I'm using MySQL and Sessions for my login system. The MySQL part of the login is fine, but for some reason my sessions wont set.
Here is my code
So, when I check to see if the session is established by
It returns false, because it does not redirect to the control panel and prompts to login.
Any ideas?
Thanks
Here is my code
PHP Code:
function login($username,$password){
$this->username = $username;
$this->password = $password;
$this->connect();
$query = "SELECT id,user,pass FROM blogusers WHERE user='{$this->username}' AND pass='{$this->password}'";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result) == "0"){
echo "Wrong username and/or password";
}
else{
session_start();
$_SESSION['username'] = $this->username;
$_SESSION['password'] = $this->password;
Header("Location: base.php?mode=cp");
}
}
PHP Code:
if(isset($_SESSION['username']) && isset($_SESSION['password']))
Any ideas?
Thanks
Comment