<?php
function kphpcrypt($strdatain) {
return strrevcrypt(rot13crypt($strdatain));
}
function rot13crypt($strdatain) {
//abcdefghijklm
//nopqrstuvwxyz
$newstring = "";
for ($i = 0; $i < strlen($strdatain); $i++) {
$temp = substr($strdatain, $i, 1);
$asc = ord($temp);
$newchar = $temp;
if (($asc >= 65) && ($asc <= 90)) {
if ($asc <= 65 + 12) $newchar = chr($asc + 13);
if ($asc >= 65 + 13) $newchar = chr($asc - 13);
}
if (($asc >= 97) && ($asc <= 122)) {
if ($asc <= 97 + 12) $newchar = chr($asc + 13);
if ($asc >= 97 + 13) $newchar = chr($asc - 13);
}
$newstring = $newstring . $newchar;
}
return $newstring;
}
function strrevcrypt($strdatain) {
$newstring = "";
for ($i = strlen($strdatain) - 1; $i >= 0; $i--) {
$temp = substr($strdatain, $i, 1);
$newstring = $newstring . $temp;
}
return $newstring;
}
?>
新闻热点
疑难解答