Tuesday, December 28, 2010

PHP Url Parameter Encryption - using base64_encode

Encodes the given data with base64.
<code>
<?php
$str = 'instructions';
echo base64_encode($str);
?>
</code>
the out put
aW5zdHJ1Y3Rpb25z
here i want to encript this url
http://mathu.co.cc/index.php?view=instruction

the coding like this
http://mathu.co.cc/index.php?view=<?php echo base64_encode('instructions'); ?>

the out put url like this
http://mathu.co.cc/index.php?view=aW5zdHJ1Y3Rpb25z

and  also you use 'base64_decode' to decrypt the url parameter
<code>
<?php
$str = 'aW5zdHJ1Y3Rpb25z';
echo base64_encode($str);
?>
</code>

1 comment: