Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function randucode($txt) {
- $x=56780; $out="";
- for($i=0;$i<strlen($txt);$i++) {
- $x=((($x*65539)+0) ^ 0x7FFFFFFF) & 0xFFFFFFFF;
- $r=($x ^ ($x >> 16))& 0x3F;
- $s=ord($txt[$i]);
- if($s>=46 && $s<=127) {
- $s=($s ^ $r);
- if($s<46 or $s>=127) $s=($s ^ $r);
- }
- $out.=chr($s);
- }
- return $out;
- }
- function encode($txt) {
- return str_replace(array("?","&","/","="),array("(",")","*",","),randucode($txt));
- }
- function decode($txt) {
- return randucode(str_replace(array("(",")","*",","),array("?","&","/","="),$txt));
- }
- $c=encode('/?id=12&link=http://example.com/?id=123&p=param');
- var_dump(encode("/?id=12&link=http://example.com/?id=123&p=param"));
- var_dump(decode(encode("/?id=12&link=http://example.com/?id=123&p=param")));
Advertisement