PHP脚本无法在服务器上运行

时间:2017-11-17 07:09:28

标签: php mysqli

正在使用PHP中的一个简单登录脚本,该脚本似乎可以在PHP version: 7.1.7上运行的本地计算机上查找,但完全无法使用{{1}在我的服务器上运行/返回任何内容},这是代码:

PHP 5.2.0

可能是什么问题?我使用public function login($username, $password){ $response['error'] = true; $response['message'] = 'Incorrect credentials'; $user = array(); $stmt = $this->conn->prepare("SELECT * FROM user_tb WHERE username = ?"); $stmt->bind_param("s", $username); if ($stmt->execute()) { $user = $stmt->get_result()->fetch_assoc(); $stmt->close(); $salt = $user['salt']; $encrypted_password = $user['password']; $hash = $this->checkhashSSHA($salt, $password); if ($encrypted_password == $hash) { $user['id'] = $user["id"]; $user['fname'] = $user["fname"]; $user['lname'] = $user["lname"]; $user['phone'] = $user["phone"]; $user['city'] = $user["city"]; $user['country'] = $user["country"]; $response['user'] = $user; $response['error'] = false; $response['message'] = 'Welcome back.'; } } return $response; } public function hashSSHA($password) { $salt = sha1(rand()); $salt = substr($salt, 0, 20); $encrypted = base64_encode(sha1($password . $salt, true) . $salt); $hash = array("salt" => $salt, "encrypted" => $encrypted); return $hash; } public function checkhashSSHA($salt, $password) { $hash = base64_encode(sha1($password . $salt, true) . $salt); return $hash; } 不支持的方法吗?如果是这样,为什么它甚至不提供错误/警告?有人帮助我,没有想法。

0 个答案:

没有答案