有时会话不起作用,我只需要一些建议和帮助。
登录代码:
<?php
if (isset($_POST['submit']))
{
$query = "SELECT wachtwoord, naam, status, email FROM leden WHERE email = '$username' AND wachtwoord = '$password' LIMIT 1";
$username = mysqli_real_escape_string($connect,$username);
$result = mysqli_query($connect,$query) or die(mysql_error());
while($row = mysqli_fetch_array($result)){
$resusername = $row['naam'];
$respassword = $row['wachtwoord'];
$resemail = $row['email'];
$resstatus = $row['status'];
}
$teller = mysqli_num_rows($result);
if ($teller == 1) {
session_start();
$_SESSION['email'] = $resemail;
$_SESSION['naam'] = $resusername;
$_SESSION['status'] = $resstatus;
$_SESSION['start_time'] = time();
echo "<div class=\"confirmation-box round\">Je bent nu ingelogd je word doorgestuurd in 3 seconden.</div>";
echo "<meta http-equiv=\"refresh\" content=\"3;URL=**********/home_.php\" />";
}else{
echo "<div class=\"error-box round\">E-mail of wachtwoord komt niet overeen.</div>"; } }
?>
检查会话是否存在(打开):
if (empty($_SESSION['naam'])){
die("Log eerst in voordat u deze pagina bezoekt.");
}
在每个页面上:
ob_start();
session_start();
系统有时会出现故障我做错了什么?建议是受欢迎的,我的英语不是那么完美,所以如果你指出我的方向,请说明你的意思,所以我理解。
答案 0 :(得分:0)
Nevermind切换到cookies会话是没用的。