1
PHP로 작성된 로그인 시스템이 있고 내 서버 (xampp를 사용하여)에서 제대로 작동하고 있습니다. 파일을 웹 서버에 업로드했습니다. 자격 증명을 준 다음 로그인하고 있다고 가정 해 봅시다. 세션을 생성하고 home.php라는 다른 페이지로 리디렉션해야합니다. 이것은 로컬 서버에서는 정상적으로 작동하지만 웹 서버에서는 정상적으로 작동하지 않습니다. 세션을 생성하지 않습니다.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();
}
}
}
?>
문제가 될 수 :
이는 login.php의 코드인가? 조언을 부탁드립니다.
미리 감사드립니다.
PHP 로그를 확인하십시오. 거기에 뭐가 있는지 알려주세요. –
그리고 home.php로 리디렉션 했습니까? 생산적인 서버에서. – invisal
생산 서버에서 쿠키를 설정할 수 있습니까? – Abrixas2