mardi 28 juin 2016

header() in php not working

I have developed a php web app which makes use of header() function of php . For instance, when a user is logged in, the website should redirect to homepage. This works perfectly while testing the site on my local computer using xampp server , but when i try to access the site using its domain name, it does not redirect to homepage . This is the code I have used :

$querry = "select * from user where email= '$email' and pass= '$pass'";
    $result = mysql_query($querry);
    if(mysql_num_rows($result)!=0){
       $row = mysql_fetch_row($result);
        $_SESSION['user'] = $row[0];
        $_SESSION['email'] = $row[1];
        $_SESSION['pass'] = $row[2];
        $_SESSION['id'] = $row[3];
        $_SESSION['last_name'] = $row[4];
        $_SESSION['dp'] = $row[5];
        header("Location: index.php");
    }else
        $wrong_cred = true;

    }
}
if($wrong_cred){
    echo("<div class='pageBegin'><p><h1>Wrong User name or Password></h1></p></div>");

}




Aucun commentaire:

Enregistrer un commentaire