Yeah, but the problem with that is that you can't get it back to normal again... But I found out a weekness about this script and I'm about to correct it... I'm just going to copy somthing from my own forum, there you can folow how it is built... here it goes:
Ok, so I've created five functions witch we are going to use today, but first I want to tell you about functions... Functions are just peases of code witch does things for us... A function might for exampel be mysql_select_db() witch we used in ouer last tutorial. And to create own functions all you have to do is write [php]function functionName($opptionalFunctionValue1,$opptionalFunctionValue2,$opptionalFunctionValueN){
};[/php]
Also inside a function there is a command named [php]return[/php]. Now basicly what that does is to return a value to wherever it is called... So when i say mysql_numrows($result) it returns the number of rows in $result...
No lets start with todays task. The encoder... The first function i had to write were realy simpel... It is named getAlfabet() and has no values to itselves... It just looks like this [php]function getAlfabet(){
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!?,.:;' ".'"';
}[/php]
Now if anyone can't understand what this does, pleas read what i wrote before the
Quote:
[php]return[/php]
, now if you can't understand it after that... Ask you mom :knob:

...
Ok, so lets get started on ouer next function...
The myEncrypt($string) function:
[php]function myEncrypt($string){
$alfa = str_split(getAlfabet());
/*Now I only got the alfabet and stored it in an array.
What str_split is that it takes every letter and puts it in an array
Lets have a look at the output of that*/
print_r($alfa)
};
/*Lets not forget to call the function... Function don't do anything until they're called*/
myEncrypt('');[/php]
Messy, huh? Well, it's supose 2 be

... But lets continue on ouer function...
Lets remove the print_r function and continue where we left:[php]function myEncrypt($string){
$alfa = str_split(getAlfabet());
/*Now I only got the alfabet and stored it in an array.
What str_split is that it takes every letter and puts it in an array
Now we want to do the same thing with what we are going to encrypt*/
$text = str_split($string);
/*Ok, so now we can start the encrypting... The encrypting mode I am going to use looks like this: '243|aoJkoKn928L?10?!!mmm'. The meaning of that is: 'P4fZ4g3ExDhHwFHGG222' whitch doesn't make any sence but I just wrote somehting...

... But first we need to find that number whitch is going to stand in front of the code (in this case 243). To do that we just use a random function... So lets get to coding*/
$add = rand(0,1000);
/*How simple was that? We just pick a number between 0 and 1000... Any1 better understand that... Now we need to start making a for loop, but first we need to find out how many rows (letters) there are in the $text varialble*/
$num = count($text);
$nom = count($alfa);
/*Now this for loop is going to be preaty advanced... So you just hang in there... I'll try to comment as much as possible*/
for ($i=0;$i<$num;$i++){
/*Now we need to check if it is equal to any of the letters in $alfa*/
for ($b=0;$b<$nom;$b++){
if ($text[$i] == $alfa[$b]){
$thisNum = $b;
$thisNum += $add;
/*Remember that $add was the number we picked*/
while ($thisNum >= 0){
$thisNum -= $nom;
/*Making number less than 0 keping it's bounds to the alfabet after the while I'm adding on the value of $nom to make shure that every number is between 0 and $nom*/
};
$thisNum += $nom;
$allNums .= "$thisNum|";
};
};
};
/*No lets have a break and echo ouer output, shal we?*/
echo($allNums);
};
myEncrypt('test');[/php]
Now, this gives us a nice little output, doesn't it? Actualy this could be the encoded stuff, but there is only one problem... It is not possible to get it back to original text so lets continue...
[php]function myEncrypt($string){
$alfa = str_split(getAlfabet());
/*Now I only got the alfabet and stored it in an array.
What str_split is that it takes every letter and puts it in an array
Now we want to do the same thing with what we are going to encrypt*/
$text = str_split($string);
/*Ok, so now we can start the encrypting... The encrypting mode I am going to use looks like this: '243|aoJkoKn928L?10?!!mmm'. The meaning of that is: 'P4fZ4g3ExDhHwFHGG222' whitch doesn't make any sence but I just wrote somehting...

... But first we need to find that number whitch is going to stand in front of the code (in this case 243). To do that we just use a random function... So lets get to coding*/
$add = rand(0,1000);
/*How simple was that? We just pick a number between 0 and 1000... Any1 better understand that... Now we need to start making a for loop, but first we need to find out how many rows (letters) there are in the $text varialble*/
$num = count($text);
$nom = count($alfa);
/*Now this for loop is going to be preaty advanced... So you just hang in there... I'll try to comment as much as possible*/
for ($i=0;$i<$num;$i++){
/*Now we need to check if it is equal to any of the letters in $alfa*/
for ($b=0;$b<$nom;$b++){
if ($text[$i] == $alfa[$b]){
$thisNum = $b;
$thisNum += $add;
/*Remember that $add was the number we picked*/
while ($thisNum >= 0){
$thisNum -= $nom;
/*Making number less than 0 keping it's bounds to the alfabet after the while I'm adding on the value of $nom to make shure that every number is between 0 and $nom*/
};
$thisNum += $nom;
$allNums .= "$thisNum|";
};
};
};
/*Putting all the numbers inside an array*/
$encr = explode('|',$allNums,-1);
$encrypted = "$add|";
foreach ($encr as $key){
$encrypted .= $alfa[$key];
};
/*And finaly returning the encrypted text!*/
return ($encrypted);
};
echo (myEncrypt('test'));[/php]
Now thats it for the encryption part, hers the code without comments: [php]function myEncrypt($string){
$alfa = str_split(getAlfabet());
$text = str_split($string);
$add = rand(0,1000);
$num = count($text);
$nom = count($alfa);
for ($i=0;$i<$num;$i++){
for ($b=0;$b<$nom;$b++){
if ($text[$i] == $alfa[$b]){
$thisNum = $b;
$thisNum += $add;
while ($thisNum >= 0){
$thisNum -= $nom;
};
$thisNum += $nom;
$allNums .= "$thisNum|";
};
};
};
$encr = explode('|',$allNums,-1);
$encrypted = "$add|";
foreach ($encr as $key){
$encrypted .= $alfa[$key];
};
return ($encrypted);
}; [/php]
Now over to the function were we want to add the password...
We now need to create a new function, but this is going to be a lot easier than the other one... You just stick in there...
[php]function passEncrypt($pass,$mess){
$password = myEncrypt($pass);
$passArr = explode('|',$password);
$passNum = $passArr[0];
$passText = $passArr[1];
$message = myEncrypt($mess);
$messArr = explode('|',$message);
$messNum = $messArr[0];
$messText = $messArr[1];
while ($messNum != $passNum){
$message = myEncrypt($mess);
$messArr = explode('|',$message);
$messNum = $messArr[0];
$messText = $messArr[1];
};
$encr = "$passNum|$passText|$messText";
return ($encr);
};[/php]
I hope I'll be able to write the dekode soon... Cheers!
Update: I've made some updates to make the script better... First of all the passEncrypt has been changed: [php]function passEncrypt($pass,$mess){
$password = myEncrypt($pass);
$passArr = explode('|',$password);
$passNum = $passArr[0];
$passText = $passArr[1];
$message = myEncrypt($mess,$passNum);
$messArr = explode('|',$message);
$messNum = $messArr[0];
$messText = $messArr[1];
while ($messNum != $passNum){
$message = myEncrypt($mess);
$messArr = explode('|',$message);
$messNum = $messArr[0];
$messText = $messArr[1];
};
$encr = "$passNum|$passText|$messText";
return ($encr);
};[/php].
Than I've changed the myEncrypt to: [php]function myEncrypt($string,$add = -1){
if ($add == -1){
$add = rand(0,1000);
};
$alfa = str_split(getAlfabet());
$text = str_split($string);
$num = count($text);
$nom = count($alfa);
for ($i=0;$i<$num;$i++){
for ($b=0;$b<$nom;$b++){
if ($text[$i] == $alfa[$b]){
$thisNum = $b;
$thisNum += $add;
while ($thisNum >= 0){
$thisNum -= $nom;
};
$thisNum += $nom;
$allNums .= "$thisNum|";
};
};
};
$encr = explode('|',$allNums,-1);
$encrypted = "$add|";
foreach ($encr as $key){
$encrypted .= $alfa[$key];
};
return ($encrypted);
}; [/php] Try figuring out the difference... It isn't that hard...
But as said... This is not yet done, and it is upgraded... This is much more secure! (But yet you can't get this back eather
Part 2: OK, here is part two of the version two of the script... The decryption...
Ok guyes... Time to start the decoding... So let just get started...[php] function myDecode($string,$add){
$alfa = str_split(getAlfabet());
/*Getting the alfabet*/
$text = str_split($string);
/*Splitting the string up to an array to get every letter by it self*/
$nom = count($alfa);
$num = count($text);
/*Counting alfa and text*/
for ($i=0;$i<$num;$i++){
for ($b=0;$b<$nom;$b++){
if ($text[$i] == $alfa[$b]){
$thisNum = $b;
/*Checking to se if the letter maches any of the letters in $alfa
and if it does giving it the value of $b witch is were we are
looking in $alfa right now*/
$thisNum -= $add;
/*Substracting the value of $add from $thisNum witch is
corresponding to witch letter it is. This is to get it
back to were it was before we encoded it*/
while ($thisNum < 0){
$thisNum += $nom;
/*Making shure that the number is between 0 and $nom*/
};
$allNums .= $alfa[$thisNum];
/*Adding the corresponding letter to $allNums*/
};
};
};
return ($allNums);
/*Returning the $allNums*/
};
/*End of function

*/[/php]
This was the myDecode... Now we only need a passDecode... That will look like this: [php] function passDecode($decoded,$pass){
$array = explode('|',$decoded);
/*Sepparating the decoded stuff into an array*/
$add = $array[0];
$encrPass = $array[1];
$encrMess = $array[2];
/*Putting all the three fields inside their own variable*/
$backPass = myDecode($encrPass,$add);
/*Decrypting the password givven in the array*/
$backMess = myDecode($encrMess,$add);
/*Decrypting the message givven in the array*/
if ($pass == $backPass){
return "$backMess";
/*if the password given in the functions parrameters
is right, return the message*/
} else {
return "Wrong Password";
/*Else return wrong password*/
};
};
/*End of function*/[/php]...
And here it is without comments:[php] function myDecode($string,$add){
$alfa = str_split(getAlfabet());
$text = str_split($string);
$nom = count($alfa);
$num = count($text);
for ($i=0;$i<$num;$i++){
for ($b=0;$b<$nom;$b++){
if ($text[$i] == $alfa[$b]){
$thisNum = $b;
$thisNum -= $add;
while ($thisNum < 0){
$thisNum += $nom;
};
$allNums .= $alfa[$thisNum];
};
};
};
return ($allNums);
};
function passDecode($decoded,$pass){
$array = explode('|',$decoded);
$add = $array[0];
$encrPass = $array[1];
$encrMess = $array[2];
$backPass = myDecode($encrPass,$add);
$backMess = myDecode($encrMess,$add);
if ($pass == $backPass){
return "$backMess";
} else {
return "Wrong Password";
};
};[/php]