Above all, Encryption is the most convenient way to pass variables to the next page through URL(Php).
e.g. index.php?id=3
This URL shows the value of id, so it will be vulnerable we need to encode it for security purpose.
urlencode(string): This PHP function is Encodes a string to be used in a query part of a URL. URL encoding is used when placing text in a query string to avoid it being confused with the URL itself. It is normally used when the browser sends form data to a web server.
function base64_url_encode($input)
This function is convenient when encoding a string to be used in a query part of a URL.
Step 1 : Create function for encrypt input data.
function base64_url_encode($input)
{
return strtr(base64_encode($input), '+/=', '-_,');
}
base64_encode -Encodes data with MIME base64
urldecode(string): This PHP function decodes the query part of a URL string. URL encoding is used when placing text in a query string to avoid it being confused with the URL itself. It is normally used when the browser sends form data to a web server.
Step 2 : Create a function for decrypt input data.
function base64_url_decode($input)
{
return base64_decode(strtr($input, '-_,', '+/='));
}
base64_decode -Decodes data encoded with MIME base64.
For Customized Business Solutions at best prices, call Nevpro Business Solutions on (022) 6673 6577/78
or
Write to us at [email protected]