I'm having trouble with my code. Somehow an if-statement that checks sessions always returns true. Even at start. I can't really figure out why..
Here is my login page.
<?php
session_start();
if(isset($_SESSION['username'])) //<-----This always returns true here for a strange reason.
{
}
?>
Here is my my login controller.
if($_POST)
{
if(isset($_POST['submit']) AND $_POST['submit'] == "login")
{
$username = $_POST['username'];
$password = $_POST['password'];
try
{
include '../model/Login.php';
$login = new Login($username, $password);
if($login == TRUE)
{
session_start();
$_SESSION['username'] = $username;
header("Location:../index.php");
}
}
catch (Exception $exc)
{
echo $exc->getMessage();
}
}
}
Aucun commentaire:
Enregistrer un commentaire