encrypting "register.php?username=jz&email=jz@hotmail.com"
I have a url address on my website:
register.php?usernam开发者_运维问答e=jz&email=jz@hotmail.com
the code used to create this url address is currently:
echo '<p class="c7">Click here to <a href="register.php?username='.$username.'&email='.$email.'">back</a> and try again.<br><img src="resources/img/spacer.gif" alt="" width="1" height="15"></p>';
I am currently using GET on register.php to retrieve the values
I was wondering if anyone could show me any encrypting/decrypting methods to mask this data passed from page to page to the user to prevent any tampering from the user.
For example what could I replace the username/email variables with in the URL for example
register.php?u=jz&e=jz@hotmail.com
or this
register.php?token=khkhkhg33424g
token being the username/email value merged and encrypted but of course on register.php the information can be descrambled and split back into the two variables of username and email to be echoed on the form
These are just a few ideas that I'm hoping to develop.
Use sessions.
<?php
session_start();
$_SESSION['username'] = $username;
$_SESSION['email'] = $email;
var_dump($_SESSION);
Only people with access to your server can modify this data.
Store those variables in $_SESSION and check their values from there instead of looking for them in $_GET.
精彩评论