有时会议不起作用,我只需要一些建议和帮助。
登录代码:
<?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();
系统有时会出现故障,我做错了什么?欢迎提出建议,我的英语不是那么完美,所以如果你指点我一个方向,请说明你的意思,这样我就明白了。