marukochan Posted March 15, 2007 Share Posted March 15, 2007 Can anybody give me an idea on how to do this. I have two pages; verification page (to verify the given code) & registration page. I want the registration page to be opened only after the user have verified the verification code thru verification page. I want the script of registration.php to redirect to code verification page if any user directly open registration.php without going thru verification.php. Understand what I mean. Thanks Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted March 15, 2007 Share Posted March 15, 2007 you want like a randomly generated verification code or something? Quote Link to comment Share on other sites More sharing options...
marukochan Posted March 15, 2007 Author Share Posted March 15, 2007 OK ..... the code will be given to the user via e-mail after he has requested for it. So, the user will type in the code at verification page and after the code is being verified he will be redirected to registration page. If I don't block the registration page with some kind of script, anyone without the code can go directly to registration page only by typing www......../registration.php, right? It is something like if you don't log in you cannot view the page. Only this time, I want the registration page to be redirected only thru verification page. TQ Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted March 15, 2007 Share Posted March 15, 2007 dont make them seperate pages, just put the verification at the top of reg code, and if they dont verify: die(); Quote Link to comment Share on other sites More sharing options...
Fergusfer Posted March 15, 2007 Share Posted March 15, 2007 Can anybody give me an idea on how to do this. [...] I want the script of registration.php to redirect to code verification page if any user directly open registration.php without going thru verification.php. Understand what I mean. Redirection is best accomplished with the header() function and the HTTP "Location" header. However, since you are sending this by e-mail, there's a much better way to do this. Rather than requiring them to return to your site and type in a verification code, give them a link WITH the verification code that they click on. I have used this scheme many times with hashing of the database ID of a row that contains the verification reference. Something like this: // having retrieved the ID from the database and placed it in $id define('SALT', 'some random JUNK people CANNOT GU3SS!!!!!!'); $hashedId = sha1($id . SALT); mail($recipient, 'Verification E-mail', "Click the link to verify your account:\n\nhttp://www.example.com/verify.php?h=$hashedId", 'From: info@example.com'); I think this is far more user friendly, and using a salted and hashed autogenerated ID is safe. Your verification script would retrieve the hashed ID from $_GET['h']. Quote Link to comment Share on other sites More sharing options...
marukochan Posted March 15, 2007 Author Share Posted March 15, 2007 Thanks. I've made them in the same page .......... Thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.