Check out my twitter script by CMXads
Sell your soul Believeth in me an hath everlasting life | Evil gear Christmas is almost here | Viking gear Gear Gifts and Apparel | Goth and Gore Gifts Shop right now or else! |
here are some of the best and useful php scripts and snippets to help in your projects. Php displayed below. Use the search for specific script lookups. Click the category links to view scripts in Javascript and cgi. To add your own script click the link and add your useful script example.
string encoding/decoding functions using SHA1 key run your data base
strings thru these to encode and decode your data.
encode decode encrypt decrypt
encode-decode-string date added Jan 2013
These are basic string encoding/decoding functions for use in text dat
abases.
They offer limited security to protect sensitive data from b
eing viewed.
Usage: string is your data to filter, key is your passPh
rase
<?php encode($string,$key); ?> to encode.
<?php decode($strin
g,$key); ?> to decode.
Code:
<?php
$key = "jhkgghHLKGFKUHtydrdsetgo
ojhgrdstr";
function encode($string,$key) {
$key = sha1($key);
$strLen = strlen($string);
$keyLen = strlen($key);
$j =
0;
for ($i = 0; $i < $strLen; $i++) {
$ordStr = ord(subs
tr($string,$i,1));
if ($j == $keyLen) { $j = 0; }
$o
rdKey = ord(substr($key,$j,1));
$j++;
$hash .= strre
v(base_convert(dechex($ordStr + $ordKey),16,36));
}
return $
hash;
}
function decode($string,$key) {
$key = sha1($key);
$strLen = strlen($string);
$keyLen = strlen($key);
$j = 0
;
for ($i = 0; $i < $strLen; $i+=2) {
$ordStr = hexdec(b
ase_convert(strrev(substr($string,$i,2)),36,16));
if ($j == $
keyLen) { $j = 0; }
$ordKey = ord(substr($key,$j,1));
$j++;
$hash .= chr($ordStr - $ordKey);
}
return $
hash;
}
?>
Example #1: first part data to encode, second part you
r key.
Encode:
<?php echo encode("Please Encode Me!","This is a key"
); ?>
Result:
p3e4e4241674d2r4m4i5o464a4f2p3k5c2
Decode: firs
t part your encrypted data, second part your key phrase.
<?php echo d
ecode("p3e4e4241674d2r4m4i5o464a4f2p3k5c2","This is a key"); ?>
Res
ult:
Please Encode Me!