<?php if (isset($_GET[task]) && "logout" == $_GET[task]) { if (!isset($_SESSION)) { session_start(); } session_destroy(); echo "<script>location.href='admin.php';</script>"; exit; } else { require_once "action/smarty_inc.php"; if (isset($_GET[error]) && !empty($_GET[error])) { if (md5("ERROR") == $_GET[error]) { $smarty->assign("err_code", "1"); $smarty->assign("err_info", "非法提交!"); } else { if (md5("RANDOM") == $_GET[error]) { require_once "action/SysCrypt.class.php"; $sc = new SysCrypt(''); $smarty->assign("username", $sc->php_decrypt($_GET[u])); $smarty->assign("err_code", "2"); $smarty->assign("err_info", "验证码错误!"); } else { $smarty->assign("err_code", "3"); $smarty->assign("err_info", "用户名或密码错误!"); } } } $smarty->display("admin.html"); }
$tmp = ''; for ($i = 0; $i < strlen($txt); $i++) { $md5 = $txt[$i]; $tmp .= $txt[++$i] ^ $md5; } return $tmp; } private function __key($txt, $encrypt_key) { $encrypt_key = md5($encrypt_key); $ctr = 0; $tmp = ''; for ($i = 0; $i < strlen($txt); $i++) { $ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr; $tmp .= $txt[$i] ^ $encrypt_key[$ctr++]; } return $tmp; } public function __destruct() { $this->crypt_key = null; } } $sc = new SysCrypt('phpwms'); $text = '110'; print $sc->php_encrypt($text); print '<br>'; print $sc->php_decrypt($sc->php_encrypt($text)); ?>