0
有時會話不起作用,我只需要一些建議和幫助。會話控制
登錄代碼:
<?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.");
}
在everypage:
ob_start();
session_start();
我在做什麼錯誤,有時系統有故障?建議是受歡迎的我的英語不是那麼完美,所以如果你指向一個方向我清楚你的意思,所以我明白了。