Jump to content

how to ENCRYPT and DECRYPT a string


nesargha

Recommended Posts

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


Link to comment
Share on other sites

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 md5



example.
[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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.