2 Star 0 Fork 0

Tony/WIFIADMIN

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
wifirenzheng_mx_get.php 7.56 KB
一键复制 编辑 原始数据 按行查看 历史
Tony 提交于 2014-03-21 08:53 . added web
<?php
require_once("inc/common.inc.php");
$rentype=intval($rentype);
if ($rentype==1){
$mobile=trim($mobile);
$shang=trim($shang);
$mac=trim($mac);
$Rid=intval($Rid);
$yancode=trim($yancode);
//是否为空
if($mobile=="" or $Rid==0 or $mac=="" or strlen($mac)!=12 or $shang=="" or $yancode==""){echo "0";exit();}
//验证手机号格式
if(!eregi("^[0-9]{11,11}$",$mobile)){echo "0";exit();}
// echo md5($mac."{mx}".$shang."{z}".$mobile."{w}".$Rid)."<br>".$sign;
// exit();
//验证码
if(md5($mac."{mx}".$shang."{z}".$mobile."{w}".$Rid."{w}".$yancode."{w}")!=$sign){echo "0";exit();}
$reginfo=$db->getinfo("select top 1 * from mx_view_sms_relog where mac='$mac' and rid='$Rid' and mobile='$mobile' and yancode='$yancode'");
if (!is_array($reginfo)){echo "0";exit();}
else{
$db->excu("BEGIN TRANSACTION DEPS02_DEL");
$thistime=date("Y-m-d H:i:s");
//更新mac认证
$db->excu("update mx_maclist set renzhengtype='1',isrenzheng='1',mobile='$mobile',firstrid='$Rid',firsttime='$thistime',isonline='1' where mac='$mac' and isrenzheng='0' ");
$maclist=$db->getinfo("select top 1 * from mx_shang_maclist where mac='$mac' and shanghuid='$shang'");
if (!is_array($maclist)){
$macinfo=$db->getinfo("select top 1 id from mx_maclist where mac='$mac'");
$db->excu("insert into mx_shang_maclist (macid,shanghuid,biaoshi,mac,firsttime,mobile,renzhengtype,isrenzheng,ispop,zongrenum,isonline,mactype,createdate)values('$macinfo[id]','$shang','$biaoshi','$mac','$thistime','$mobile','1','1','1','1','1','0','$thistime')");
}
else{
$db->excu("update mx_shang_maclist set biaoshi='$biaoshi',firsttime='$thistime',mobile='$mobile',renzhengtype='1',isrenzheng='1',ispop='1',zongrenum=zongrenum+1,isonline='1',mactype='0' where mac='$mac' and shanghuid='$shang'");
}
$db->excu("update mx_sms_relog set isuse='1' where id='$reginfo[id]' and isuse='0'");
$db->excu("COMMIT TRANSACTION DEPS02_DEL");
echo "1";
}
}
elseif ($rentype==2){
$shang=trim($shang);
$mac=trim($mac);
$Rid=intval($Rid);
$yancode=trim($yancode);
//是否为空
if($Rid==0 or $mac=="" or strlen($mac)!=12 or $shang=="" or $yancode==""){echo "0";exit();}
//验证码
if(md5($mac."{mx}".$shang."{z}{w}".$Rid."{w}".$yancode."{w}")!=$sign){echo "0";exit();}
$reginfo=$db->getinfo("select top 1 * from mx_view_weixin_relog where shanghuid='$shang' and yancode='$yancode'");
if (!is_array($reginfo)){echo "0";exit();}
else{
$db->excu("BEGIN TRANSACTION DEPS02_DEL");
$thistime=date("Y-m-d H:i:s");
//更新mac认证
$db->excu("update mx_maclist set renzhengtype='2',isrenzheng='1',mobile='$mobile',firstrid='$Rid',firsttime='$thistime' where mac='$mac' and isrenzheng='0' ");
$maclist=$db->getinfo("select top 1 * from mx_shang_maclist where mac='$mac' and shanghuid='$shang'");
if (!is_array($maclist)){
$macinfo=$db->getinfo("select top 1 id from mx_maclist where mac='$mac'");
$db->excu("insert into mx_shang_maclist (macid,shanghuid,biaoshi,mac,firsttime,renzhengtype,isrenzheng,ispop,zongrenum,mactype,createdate)values('$macinfo[id]','$shang','$biaoshi','$mac','$thistime','2','1','1','1','0','$thistime')");
}
else{
$db->excu("update mx_shang_maclist set biaoshi='$biaoshi',firsttime='$thistime',renzhengtype='2',isrenzheng='1',ispop='1',zongrenum=zongrenum+1,mactype='0' where mac='$mac' and shanghuid='$shang'");
}
$db->excu("update mx_weixin_relog set isuse='1' where id='$reginfo[id]' and isuse='0'");
$db->excu("COMMIT TRANSACTION DEPS02_DEL");
echo "1";
}
}
elseif ($rentype==3){
$shang=trim($shang);
$mac=trim($mac);
$Rid=intval($Rid);
$username=trim($username);
$password=trim($password);
//是否为空
if($Rid==0 or $mac=="" or strlen($mac)!=12 or $shang=="" or $username==""or $password==""){echo "0";exit();}
//验证码
if(md5($mac."{mx}".$shang."{z}{w}".$Rid."{w}".$username."{w}")!=$sign){echo "0";exit();}
$reginfo=$db->getinfo("select top 1 * from mx_shanghu_wifiuser where wfiusername='$username' and wipassword='".md5($wipassword)."' and hanghuid='$shang'");
if (!is_array($reginfo)){echo "0";exit();}
else{
$db->excu("BEGIN TRANSACTION DEPS02_DEL");
$thistime=date("Y-m-d H:i:s");
//更新mac认证
$db->excu("update mx_maclist set renzhengtype='3',isrenzheng='0',mobile='$mobile',firstrid='$Rid',firsttime='$thistime' where mac='$mac' and isrenzheng='0' ");
$maclist=$db->getinfo("select top 1 * from mx_shang_maclist where mac='$mac' and shanghuid='$shang'");
if (!is_array($maclist)){
$macinfo=$db->getinfo("select top 1 id from mx_maclist where mac='$mac'");
$db->excu("insert into mx_shang_maclist (macid,shanghuid,biaoshi,mac,firsttime,renzhengtype,isrenzheng,ispop,zongrenum,mactype,createdate)values('$macinfo[id]','$shang','$biaoshi','$mac','$thistime','3','1','1','1','0','$thistime')");
}
else{
$db->excu("update mx_shang_maclist set biaoshi='$biaoshi',firsttime='$thistime',renzhengtype='3',isrenzheng='1',ispop='1',zongrenum=zongrenum+1,mactype='0' where mac='$mac' and shanghuid='$shang'");
}
$db->excu("update mx_weixin_relog set isuse='1' where id='$reginfo[id]' and isuse='0'");
$db->excu("COMMIT TRANSACTION DEPS02_DEL");
echo "1";
}
}
elseif ($rentype==99){
$shang=trim($shang);
$mac=trim($mac);
$Rid=intval($Rid);
//是否为空
if($Rid==0 or $mac=="" or strlen($mac)!=12 or $shang==""){echo "0";exit();}
//验证码
if(md5($mac."{mx}".$shang."{z}{w}".$Rid."{w}")!=$sign){echo "0";exit();}
//获取商户
$shanginfo=$db->getinfo("select top 1 * from mx_view_shanghu where id='$shang' and isok='1' and startdate<='".date("Y-m-d 23:59:59")."' and enddate>='".date("Y-m-d 00:00:00")."'");
if (!is_array($shanginfo)){
echo "0";exit();
}
//获取设备信息
$shebei=get_shebeiinfo_online($Rid," and shanghuid='$shanginfo[id]' and startdate<='".date("Y-m-d 23:59:59")."' and enddate>='".date("Y-m-d 00:00:00")."' and iscandoing='1'");
if (!is_array($shebei)){
echo "0";exit();
}
//判断是否在白名单或者黑名单中
if(strpos("##,".$shanginfo["whitelist"].",",",$mac,")){$iswhite=1;}
if(strpos("##,".$shanginfo["blacklist"].",",",$mac,")){$isbalck=1;}
if ($isbalck==1){
echo "0";exit();
}
//判断商家mac是否存在
$shangmac=$db->getinfo("select * from mx_shang_maclist where mac='$mac' and shanghuid='$shanginfo[id]'");
if (is_array($shangmac)){
if ($shangmac["isrenzheng"]==1 or $iswhite==1){
echo "1";exit();
}else{
echo "0";exit();
}
}
}
elseif ($rentype==999){
$shang=trim($shang);
$mac=trim($mac);
$Rid=intval($Rid);
//是否为空
if($Rid==0 or $mac=="" or strlen($mac)!=12 or $shang==""){echo "0";exit();}
//验证码
if(md5($mac."{mx}".$shang."{z}{w}".$Rid."{w}")!=$sign){echo "0";exit();}
//获取商户
$shanginfo=$db->getinfo("select top 1 * from mx_view_shanghu where id='$shang' and isok='1' and startdate<='".date("Y-m-d 23:59:59")."' and enddate>='".date("Y-m-d 00:00:00")."'");
if (!is_array($shanginfo)){
echo "0";exit();
}
//获取设备信息
$shebei=get_shebeiinfo_online($Rid," and shanghuid='$shanginfo[id]' and startdate<='".date("Y-m-d 23:59:59")."' and enddate>='".date("Y-m-d 00:00:00")."' and iscandoing='1'");
if (!is_array($shebei)){
echo "0";exit();
}
//判断是否在白名单或者黑名单中
if(strpos("##,".$shanginfo["whitelist"].",",",$mac,")){$iswhite=1;}
if(strpos("##,".$shanginfo["blacklist"].",",",$mac,")){$isbalck=1;}
if ($isbalck==1){
echo "0";exit();
}
//判断商家mac是否存在
$shangmac=$db->getinfo("select * from mx_shang_maclist where mac='$mac' and shanghuid='$shanginfo[id]'");
if (is_array($shangmac)){
if ($shangmac["isrenzheng"]==1 or $iswhite==1){
$db->excu("update mx_maclist set isonline='1' where mac='$mac' ");
$db->excu("update mx_shang_maclist set ispop='1',isonline='1' where id='$shangmac[id]'");
echo "1";exit();
}else{
echo "0";exit();
}
}
}
?>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/Tony.zhang/WIFIADMIN.git
git@gitee.com:Tony.zhang/WIFIADMIN.git
Tony.zhang
WIFIADMIN
WIFIADMIN
master

搜索帮助