Hide $_GET variables using encryption
Hello friends, I am writing this blog which will let you know how to hide variables using encryption. I have created activation url, though which users will activate their account by clicking on it. So, I want to create secure url. To create a secure url I have used base64_encode
encryption.
base64_encode — Encodes data with MIME base64
Please have a look on the following lines of code:
$invited_email= 'amukmca@gmail.com'
// $userinvite_id ==> this id was generated by table
$password ='helloworld'
$activation_url=Router::url('/user_invites/activate?invitestatus=true&invite_id='.$userinvite_id.'&passkey='.base64_encode($password).'&invitedmail='.base64_encode($invited_email), true );
base64_decode — Decodes data encoded with MIME base64
On the activate function I am retrieving the information in the following way using base64_decode:
$invite_id=isset($_GET['invite_id'])?$_GET['invite_id']:'';
$status=isset($_GET['invitestatus'])?$_GET['invitestatus']:false;
$password= isset($_GET['passkey'])? base64_decode($_GET['passkey']):'';
$email= isset($_GET['invitedmail'])? base64_decode($_GET['invitedmail']):'';
Hope this helps!
Thanks for reading the blog.
0 Comment(s)