nesargha Posted September 8, 2006 Share Posted September 8, 2006 hi,i want to know how can i ENCRYPT and DECRYPT a string, using php functions. i am using PHP ver 5.0, I want to encrypt the string which i will be passing between the web pages, below i have writien small code of that, which i want to achive.----------------------------------file1.php<?php$str ="xyz";$var = (encrypt the string $str and assign to $var)print "<a href='file2.php?enc=".$var." '> click here</a>";?>file2.php<?php$tmp = $_GET['enc'];$var = (decrypt $tmp and assign to $var)print "the string is $var";?>----------------------------------i know i can use Mcrypt Encryption Functions but i am not able to use this since i have to host web pages on the hosting server and my hosting server does not allow to install these functions so i have to find an alernate metod to do this.thanks in advance.nesargha Quote Link to comment Share on other sites More sharing options...
extrovertive Posted September 8, 2006 Share Posted September 8, 2006 base64_encode and base64_decode Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 8, 2006 Share Posted September 8, 2006 Please remeber that base_64 is a encode and decopde method but is also a flaw as it has been around for a long time and there are online database of encoded and decoded database to hack the code .Relly should use mycript or only use md5 for passwords or even better use salt and md5example.[code]<?php$message="hi there a i am redarrow hope your ok";$encoded=base64_encode($message);echo $encoded;echo "<br>";$decoded=base64_decode($encoded);echo $decoded;?>[/code]good luck. Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 8, 2006 Share Posted September 8, 2006 don't use it.. just use a session variable, database table or plain old flat file to store the info.If you are emailing someone a link to confirm registration or such, use the ID field from a database table. Quote Link to comment Share on other sites More sharing options...
nesargha Posted September 11, 2006 Author Share Posted September 11, 2006 hi guys,thank you for all the repy, i would help me i think- nesargha Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.