<?
require 'common.inc.php';
define('ThisFile', ThisFile());
if($act=='login'){
session_start();
$rs= new admin;
if(!$username) echo message('请输入用户名',ThisFile.'.php');
if(!$userpwd) echo message('请输入密码',ThisFile.'.php');
$admin_info = $rs->login($username,$userpwd);
if ($admin_info['id']<1) echo message('密码错误',ThisFile.'.php');
if ($admin_info['id']>0){
$_SESSION['username'] = $admin_info['username'];
$_SESSION['pwd'] = $userpwd;
$add['logintime'] = time();
$add['logip'] = $_SERVER['REMOTE_ADDR'];
$do->update($add,'admin','username',$_SESSION['username']);
$do->update_one(array('admin','logn','logn+1','username',$_SESSION['username']));
msg('输入正确！成功登陆后台管理', 'index.php');
}
}
$url =  's/'.$_SERVER['PHP_SELF'];
$safe['adminpath'] = strpos($url,"/admin/") > 0 ? '1': 0;
include inTemplate(ThisFile);
?>