PHP和MYSQL用户授权用于wifi热点

时间:2021-10-25 17:19:00

I have a wifi system that I am trying to setup using PHP & My SQL auth. I have found this script https://github.com/kaptk2/portal that does all I want. But unfortunately when I try to login I keep getting an error "A valid username or password was not found."

我有一个wifi系统,我试图使用PHP和我的SQL身份验证设置。我找到了这个脚本https://github.com/kaptk2/portal,它可以满足我的所有需求。但不幸的是,当我尝试登录时,我不断收到错误“找不到有效的用户名或密码。”

I have setup all of the SQL table's correctly (From the SQL dump provided) and from what i can see in the authorisation.php file (Below) it should be working: http://pastebin.com/kHe6EH6T (Sorry cant seem to get the php to format correctly here)

我已正确设置所有SQL表(从提供的SQL转储)和我在authorisation.php文件中看到的内容(下图)它应该正常工作:http://pastebin.com/kHe6EH6T(对不起似乎让PHP在这里正确格式化)

My initial taught on what was going wrong was that the user and pass were being denied because the unix timestamp was incorrect.but then i checked the time on my system and made sure that the value was substantially increased and still the same error. The values that I am using are the following:

我最初教导的问题是用户和传递被拒绝,因为unix时间戳不正确。但是我检查了我的系统上的时间并确保该值大幅增加并且仍然是相同的错误。我使用的值如下:

  • ID: 3
  • username: test
  • password: test
  • expires: 1482135170
  • notes: null

I have checked all of the error logs (PHP, apache and Mysql) but there are no errors.

我检查了所有错误日志(PHP,apache和Mysql),但没有错误。

Is there a chance that the error could be happening with the authentication of the controller (On another server) And I cant see it in the logs ?

是否有可能通过控制器的身份验证(在另一台服务器上)发生错误而我无法在日志中看到它?

Thanks in advance for you help.

在此先感谢您的帮助。

1 个解决方案

#1


0  

change you code:

改变你的代码:

if ($_POST)
{
  $user = preg_replace("/[^a-zA-Z0-9.]/", "", $_POST['username']);
  $pass = $_POST['password'];
  if (authorizeMySQL($user, $pass))
        sendAuthorization($_SESSION['id'], '480');
  else
      echo "Cannot connect to mysql.";
}
else
      echo "A valid username or password was not found.";

and you probably will see that problem with mysql connection, check its settings in mysql/config.php and check whether the user provided is stored in guests table

你可能会看到mysql连接的问题,在mysql / config.php中检查它的设置并检查用户提供的是否存储在来宾表中

UPDATE: also note - in mysql you should have passwords stored as MD5, for for test it is 098f6bcd4621d373cade4e832627b4f6

更新:还要注意 - 在mysql中你应该将密码存储为MD5,对于测试它是098f6bcd4621d373cade4e832627b4f6

#1


0  

change you code:

改变你的代码:

if ($_POST)
{
  $user = preg_replace("/[^a-zA-Z0-9.]/", "", $_POST['username']);
  $pass = $_POST['password'];
  if (authorizeMySQL($user, $pass))
        sendAuthorization($_SESSION['id'], '480');
  else
      echo "Cannot connect to mysql.";
}
else
      echo "A valid username or password was not found.";

and you probably will see that problem with mysql connection, check its settings in mysql/config.php and check whether the user provided is stored in guests table

你可能会看到mysql连接的问题,在mysql / config.php中检查它的设置并检查用户提供的是否存储在来宾表中

UPDATE: also note - in mysql you should have passwords stored as MD5, for for test it is 098f6bcd4621d373cade4e832627b4f6

更新:还要注意 - 在mysql中你应该将密码存储为MD5,对于测试它是098f6bcd4621d373cade4e832627b4f6