【www.gdgbn.com--页面特效】
代码如下session_start();
/* get post */
if (!function_exists("getpost")){function getpost(){if(count($_post)){foreach($_post as $key => $value){global ${$key};${$key}=$value;}}}}
/* get get */
if (!function_exists("getget")){function getget(){if(count($_get)){foreach($_get as $key => $value){global ${$key};$$key=($value);}}}}
/* sql escape string */
if (!function_exists("escapeit")){
function escapeit($text){
if (get_magic_quotes_gpc()) $text=strips教程lashes($text);
if (!is_numeric($text)) $text=mysql教程_real_escape_string($text);
return $text;
}}
getpost(); //获取post过来的数据
//login
$rs = $db->query("select * from `backend_user` where binary `login` = "".escapeit($login)."" and binary `password` = "".md5($password).""");
if (mysql_num_rows($rs) > 0) {
$row = $db->fetch_array($rs);
$_session["smartinfo_sysid"] = $row["user_id"];
$_session["smartinfo_syslogin"] = $row["login"];
$db->query("update `backend_user` set `last_logon` = "".date("y-m-d h:i:s")."" where `id` = "".$row["id"].""");
header("location: index2.php");
} else {
header("location: index.php?status=fail");
}
//利用到的函数
?>
html代码
control panel
--
-- 表的结构 `backend_user`
--
create table if not exists `backend_user` (
`user_id` int(11) not null auto_increment,
`group_id` int(11) not null default "0",
`login` varchar(255) not null default "",
`password` varchar(255) not null default "",
`last_logon` datetime not null default "0000-00-00 00:00:00",
primary key (`user_id`)
) engine=myisam default charset=utf8 auto_increment=2 ;
--
-- 导出表中的数据 `backend_user`
--
insert into `backend_user` (`user_id`, `group_id`, `login`, `password`, `last_logon`) values
(1, 0, "admin", "e10adc3949ba59abbe56e057f20f883e", "0000-00-00 00:00:00");