wifidog的认证php源码,编写自己的WifiDog认证服务器

次我使用的是php来编写auth_server服务器,因为这样比较简单。

1.首先是login.php

include './tool/MySQLHelper.php';

if (!empty($_GET["mac"])){

$result = selectMacByToken($_GET["mac"]);

if (!empty($result)){

header("location: http://192.168.1.1:2060/wifidog/auth?token=".$result);

}

else {

header("location: http://xxxxx/WelcomePage.php?mac=".$_GET["mac"]);

}

}

else {

header("location: http://xxxxx/WelcomePage.php?mac=".$_GET["mac"]);

}

?>

2.ping.php

echo "Pong";

?>

这里没有做额外的处理,只是简单地向wifidog回应一个Pong。

3.auth.php

// 后门

if ($_GET["token"] == "123"){

echo "Auth: 1";

return;

}

if (!empty($_GET["token"]) && isset($_GET["token"])){

//获取$result的过程//

isValidate($result);

//**后续处理**//

return;

}

else if((!empty ($_GET["mac"])) && isset($_GET["mac"])){

//**获取result*//

$result = isSubscribeByMac($_GET["mac"]);

isValidate($result);

return;

}

else

{

echo "Auth: 0";

}

// 输出是否合法.

function isValidate($result){

if ($result == 1){

echo "Auth: 1";

}

else {

echo "Auth: 0";

}

}

?>

这里根据一些参数来获取$result,从而决定是否允许认证。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值