Hej,
Uzywam obecnie tych funkcji, aby zakodowac link, a dokladniej zmienne przez get
<?php
function rot13($source) {
$from = "abcdefghijklmnopqrstuvwxyz";
$to = "nopqrstuvwxyzabcdefghijklm";
$source = strtr($source, $from, $to);
return $source;
}
function Encrypt($source,$key,$pub_key) {
$cr = '';
$index = 0;
$char = '';
$key_char = '';
$enc_string = '';
$encode = '';
$first = '';
$second = '';
$let1 = '';
$let2 = '';
$encrypted = '';
$escapes = '';
$source = rot13($source);
$cr = '·¨ ';
while ($index < strlen($source)) { $char = substr($source,$index,1
); $key_char = substr($key,$index,1
); $enc_string .= chr(ord($char) ^ ord($key_char));
$index++;
}
for ($i=0; $i<=255; $i++) {
$escapes[chr
($i)] = sprintf("%2x", $i); }
$index=0;
while ($index < strlen($enc_string)) { $char = substr($enc_string,$index,1
); $encode = $escapes[$char];
$second = substr($encode,1
,1
); $encrypted .= $let1.$let2;
$index++;
}
return $encrypted;
}
function Decrypt($encrypted, $key, $pub_key) {
$cr = '';
$index = 0;
$char = '';
$key_char = '';
$dec_string = '';
$decode = '';
$decode2 = '';
$decrypted = '';
while ( strlen($key) < strlen($encrypted) ) { $key .= $key; }
while ($index < strlen($encrypted)) {
$index++;
$index++;
$dec_string .= chr
(hexdec($decode.$decode2)); }
$index=0;
while( $index < strlen($dec_string) ) { $char = substr($dec_string,$index,1
); $key_char = substr($key,$index,1
);
$decrypted .= chr(ord($char) ^ ord($key_char));
$index++;
}
$cr = '·¨ ';
return rot13( $decrypted );
}
?>
Wszystko ladnie dziala, poza tym ze linki sa za dlugie. wiekszosc ma dlugosc ponad 500 znakow

!
Czy zna ktos inny sposob na kodowanie linkow, aby byly nieczytelne, a krotkie ?
Pozdrawiam i dzieki
Ten post edytował dsk 24.05.2006, 16:38:18