Page 1 of 1

Validation using a random number problem

Posted: Wed Nov 29, 2006 10:05 am
by bobby9101
Hi.
I am building a simple payment script.
The user goes to a form (say form.php) he enters the data in the form, and then submits it.
He is then sent to: payment.php, which has a paypal payment button. (the return URL is set to domain.com/form.php?randnumber=99 (where 99 is a random number generated in form.php)
after completing payment, the visitor is sent to: domain.com/form.php?randnumber=99 (where 99 is a random number generated in form.php)
The only problem si that when he returns, the rand number gets re randomized. Any way around this?

Posted: Wed Nov 29, 2006 10:25 am
by hawleyjr
Use sessions to store the random value.

Out of curiosity, why exactly are you doing this?

Posted: Wed Nov 29, 2006 10:31 am
by bobby9101
Lemme explain a little better. (bear with me I am just starting PHP)

I had:
A visitor visits a form, submits the form and then goes to paypal. After paypal he gets redirected back to a thank you page and the data from cookies is entered into a database.
Well the user (if smart) would just submit the form and manually type in the thank you page.

So I decided to make the user come back to the same page except with a random number appended to the URL, so that he couldn't bypass the paypal part.
If there is a better way, let me know.