lundi 10 septembre 2018

Sending URL with unique parameters for each user

I have a users DB and I want to send an email for the users which will contain some unique parameters.

I have the user id, email, name and 2 fields in store these unique parameters in the DB.

I'm thinking of using both id and email to create the two parameters to be unique, Like using a hash/encryption/shuffle.

Like md5(I know it's not secured, But that's not for a password), uniquid, ..etc.

$uniquId = uniquid( $id );
$uniquEmail = md5( $email );

$URL = 'www.example.com/page.php?u='.$uniquId.'&e='.$uniquEmail;

In page.php:

$id = $_GET['u'];
$email = $_GET['e'];

//Check if these values exist in the DB, If exists show the page, Else redirect the user

But what if that random string contains &Ugeb=kijd, Then the URL would look something like : www.example.com/page.php?u=26737&e=IKd752&uTehD=Hye3, Then the $_GET['e'] would be IKd752 only right?

If so, What are the best ways to create the 2 unique parameters?




Aucun commentaire:

Enregistrer un commentaire