Jump to content

[SOLVED] How do I .........


marukochan

Recommended Posts

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

 

 

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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'].

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.