<?php
error_reporting(0);
include("../../config/ht.php");
session_start();
if($_POST){
$postname=ubo(iconv("UTF-8","GB2312",$_POST["name"]));
$postpass=ubo(md5(iconv("UTF-8","GB2312",$_POST["pass"])));
$type="WHERE name='$postname'";
$admin=queryall(admin,$type);  
if($admin[pass]==$postpass and $admin[name]==$postname){
$_SESSION['adminname']=$postname;
$ip=getIP();
$cs=file_get_contents("http://whois.pconline.com.cn/ip.jsp?ip=".$ip);  
$ipcs=$ip.$cs;
$sql = "SELECT ip FROM adminip WHERE  ip='$ipcs'";
$query = mysql_query($sql);
$admins=mysql_fetch_array($query);
if (!$admins) {
mysql_query("insert into adminip set name='$postname',shijian='$shijian',ip='$ipcs'"); 
}else{
$query = "UPDATE adminip SET shijian='$shijian'  WHERE name='$postname' and ip='$ipcs'";
$resul = mysql_query($query);
}
$home="/hthome$dshz";
$errstr = array ('status'=>"true",'url'=>$home);   
echo json_encode($errstr);
}else{
$err=iconv("GB2312","UTF-8","用户名或者密码错误");
$errstr = array ('status'=>"false",'msg'=>$err);   
echo json_encode($errstr);
}
}else{
$code=$_SERVER["REQUEST_URI"];
$html ='<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">';
$html.='<html><head>';
$html.='<meta charset="gb2312">';
$html.='<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />';
$html.='<title>404 Not Found</title>';
$html.='</head><body>';
$html.='<h1>Not Found</h1>';
$html.='<p>The requested URL '.$code.' was not found on this server.</p>';
$html.='</body>';
$html.='</html>';
echo $html;
exit;
}
?>
