Jump to content

[SOLVED] Validate Email using generated password or validation link?


limitphp

Recommended Posts

Doesn't really matter either way so long as the link couldn't be guessed.

Would something like md5(uniqid(rand(),true).$salt) be ok to use?

 

I understand how to send a link to their email address with a unqiueID as a querystring, but I'm not sure how to implement it from there.

 

Would I create a page, like validateUser.php and on that page accept querystrings with these uniqueIDs, and match them up with a userID in a table?

 

 

 

 

Link to comment
Share on other sites

You could just use a guid, php 5+ has a built in function

 

function guid(){
    if(function_exists('com_create_guid')) return substr(com_create_guid(), 1, 36);
    else {
        $uid = strtoupper(md5(uniqid(rand(), true)));
        $h = '-';
        $uuid = substr($uid, 0, .$h.substr($uid, 8, 4).$h.substr($uid,12, 4).$h.substr($uid,16, 4).$h.substr($uid,20,12);
        return $uuid;
    }
}

Link to comment
Share on other sites

Uniqid;

 

Gets a prefixed unique identifier based on the current time in microseconds

 

GUID;

 

A GUID is generated in the same way as DCE UUID's, except that the Microsoft convention is to enclose a GUID in curly braces.

 

Basically UNIQID can be used to build a GUID in older versions of PHP

Link to comment
Share on other sites

Uniqid;

 

Gets a prefixed unique identifier based on the current time in microseconds

 

GUID;

 

A GUID is generated in the same way as DCE UUID's, except that the Microsoft convention is to enclose a GUID in curly braces.

 

Basically UNIQID can be used to build a GUID in older versions of PHP

 

When I send the link with the unqiueID, do i need to put the link in curly braces?

ex) validate.php?verify={sdhjkjh345kjh45kjh6jha90}

 

 

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.