but my host uses 4.2.2, sessions are not saveing any value in them at all.
e.g. $_SESSION["username"] is empty! by the way, the login form is working fine, it passes the values with out a problem.
here is the login page code:
Code: Select all
<?php
session_start();
include("admin/inc/db.inc.php");
if(IsSet($_POSTї'log']))
{
$username = $_POSTї'user'];
$password = md5($_POSTї'password']);
//set up the query
$query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$ll = date("j/m/Y");
//run the query and get the number of affected rows
$result = mysql_query($query) or die('error making query');
$affected_rows = mysql_num_rows($result);
$array = mysql_fetch_array($result);
//if there's exactly one result, the user is validated. Otherwise, he's invalid
if($affected_rows == 1)
{
$_SESSIONї'username'] = $username;
$email = $arrayїemail];
$lastl = $arrayїlast_login];
$_SESSIONї'email'] = $email;
$_SESSIONї'lastl'] = $lastl;
$lastlogin = mysql_query("update users set last_login='$ll' where username = '$username' limit 1");
header("Location: main.php");
}
else
{
session_destroy();
print ("Your Username or password is not correct, please login agian...");
}
}
?>and here is the code i use to check if a session is active or not:
Code: Select all
<?php
session_start();
include("admin/inc/type.inc.php");
$username = $_SESSIONї"username"];
$email = $_SESSIONї"email"];
$lastl = $_SESSIONї"lastl"];
if(empty($username))
{
die
('An error has ocurred. It may be that you have not logged in, or that your session has expired.
Please try <a href="login.php">logging in</a> again...');
}
?>so $username is empty
what can i do to fix this?
is there anything else i can use for this task?
thanks alot for your help.