<?php
error_reporting(0); 
include("../../config/wap.php");
session_start();
if(ubo($_POST)){
$name=ubo(iconv("UTF-8","GB2312",$_POST["name"]));
$passto=ubo(iconv("UTF-8","GB2312",$_POST["pass"]));
$pass=md5($passto);
$type="WHERE name='$name'";
$row=queryall(user,$type);  
if($row){
if($row[pass]==$pass and $row[name]==$name){
if ($row['zt'] == "true") {
$sql = "SELECT name FROM userip WHERE  name='$name'";
$query = mysql_query($sql);
$admins=mysql_fetch_array($query);
if (!$admins) {
mysql_query("insert into userip set name='$name',bcsj='$shijian',bcip='$ip',scip='$ip',scsj='$shijian'"); 
}else{
$query = "UPDATE userip SET bcsj='$shijian',bcip='$ip'  WHERE name='$name'";
$resul = mysql_query($query);
}
$type="WHERE ip='$ip'";
$userrz=queryall(userrz,$type); 
if($userrz){
}else{
$type="(`id`, `name`, `ip`, `sj`) VALUES (null, '$name', '$ip', '$shijian')";
dbinsert(userrz,$type);
}
$_SESSION['username']=$name;
$errstr = array ('status'=>"true",'url'=>"/mmain".$dshz);   
echo json_encode($errstr);
}else{
$user=iconv("GB2312","UTF-8","SORRY！您的ID已经被锁定，请联系管理激活");
$errstr = array ('status'=>"false",'msg'=>$user);  
}
}else{
$err=iconv("GB2312","UTF-8","代理账号或者代理密码错误");
$errtip = array ('status'=>"false",'msg'=>$err);   
echo json_encode($errtip);
}
}else{
$err=iconv("GB2312","UTF-8","代理账号不存在");
$errtip = array ('status'=>"false",'msg'=>$err);   
echo json_encode($errtip);
}
}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;
}
?>
