Password="$432f$4340$4330$4351$433b$4354$4324$4345"
Код: Виділити все
<?php
if($PHP_SELF=='/dnevnik/include/sim_password.php')
die('<pre>'.htmlspecialchars(file_get_contents($_SERVER['DOCUMENT_ROOT'].$PHP_SELF)).'</pre>');
$data1=$_POST['data1'];
$data2=$_POST['data2'];
if($data1!='') $data2=sim_encode($data1);
elseif($data2!='') $data1=sim_decode($data2);
$article['Body'] = str_replace('name=data1 value=""','name=data1 value="'.htmlspecialchars($data1).'"',$article['Body']);
$article['Body'] = str_replace('name=data2 value=""','name=data2 value="'.htmlspecialchars($data2).'"',$article['Body']);
function sim_decode($pswd) {
$pswd=trim($pswd,"\n\r\t $");
$s = ''; $temp = 0x45;
$a=explode('$',$pswd);
foreach($a as $l) {
$x = hexdec(substr($l,2));
$s .= chr($temp^$x);
$temp = $x;
}
return $s;
}
function sim_encode($s) {
$pswd = ''; $temp = 0x45;
$a=str_split($s);
foreach($a as $l) {
$temp = $temp^ord($l);
$x = "".dechex($temp); if(strlen($x)<2) $x='0'.$x;
$pswd .= "$43".$x;
}
return $pswd;
}
?>
Источник: http://lleo.aha.ru/dnevnik/2009/09/11.html