1
我測試了我的網站,它有一個用php編寫的登錄系統,它在本地服務器(即時使用xampp)中正常工作。我已經將文件上傳到網絡服務器。 說我已經給了憑據,然後我登錄。它應該做的是創建會話,並將我重定向到另一個名爲home.php的頁面。這在本地服務器上工作正常,但不在Web服務器中。它不會按照它的設想創建會話。PHP系統在服務器中不生成Cookie
這是在login.php中的代碼:
<?php
require 'core/init.php';
$general->logged_in_protect();
if (empty($_POST) === false) {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
if (empty($username) === true || empty($password) === true) {
$errors[] = 'Sorry, but we need your username and password.';
} else if ($users->user_exists($username) === false) {
$errors[] = 'Sorry that username doesn\'t exists.';
} else if ($users->email_confirmed($username) === false) {
$errors[] = 'Sorry, but you need to activate your account.
Please check your email.';
} else {
if (strlen($password) > 18) {
$errors[] = 'The password should be less than 18 characters, without spacing.';
}
$login = $users->login($username, $password);
if ($login === false) {
$errors[] = 'Sorry, that username/password is invalid';
}else {
session_regenerate_id(true);// destroying the old session id and creating a new one
$_SESSION['id'] = $login;
header('Location: home.php');
exit();
}
}
}
?>
這裏可能是這個問題?請指教,
在此先感謝!
檢查您的PHP日誌。讓我們知道是否有任何內容。 –
並做了重定向到home.php?在生產性服務器。 – invisal
Cookie是否允許由生產性服務器設置? – Abrixas2