错误:此网页在localhost上有一个重定向循环

时间:2015-04-11 15:47:50

标签: php redirect

当我浏览

时出现此错误

http://localhost/a/Student_Home.php

我不明白如何解决这些问题。请有人查看下面的代码,并为我提供解决方案。 这是我的脚本 student_login_handler.php

<?php
session_start();
$id = $_SESSION['user_id'];
include 'Connect.php';
$flag = "";
$learner_id = mysql_real_escape_string(htmlentities($_POST['learner_id']));
$student_password =  mysql_real_escape_string(htmlentities($_POST['student_password']));
$query = "SELECT last_login_date from student_information WHERE learner_id='$learner_id' and student_password='$student_password'";
$result = mysqli_query($link_id, $query);
if(mysqli_error() != null){
    die(mysqli_error());
}
if($date = mysqli_fetch_array($result))
{
     $lastdate = $date['last_login_date'];
     $date2 = date("d-m-Y h:i A",strtotime($lastdate));
     $_SESSION['learner_id'] = $date['learner_id'];
     $_SESSION["lastlogin"] =$date2;
     $_SESSION["type"] = "Student";
    mysqli_query("UPDATE student_information SET last_login_date=now() where learner_id='{$_SESSION['user_id']}'",$link_id);
     if(mysql_error() != null){
        die(mysql_error());
    }
         header("location:  Student_Home.php");
 die();
}
else
{
    $flag = "invalid";
    header("location:Student_login.php?flag=$flag");
    die();      
} 

&GT;

0 个答案:

没有答案