Problem with login script!
Posted: Sun Oct 20, 2002 1:53 pm
I have these Pages:
login.php (works fine, just HTML code)
validateuser.php (works fine I guess):
//VALIDATE USER
$user_name = $_POST['user_name'];
$password = $_POST['password'];
if (($user_name == 'shaolin') && ($password == 'shaolin')) {
$_SESSION['username'] = $user_name;
echo $_SESSION['username'];
}
else {
echo "login Failed";
}
After I log n with 'shaolin', 'shaolin' the script returns 'shaolin' which would be the Session variable so it's definately set... now the troubles start...
Now I should be logged in and when I try to access my index.php which has the first coderow like:
include 'verifyuser.php';
and... Verifyuser.php has this code:
//CHECK IF USER IS LOGGED IN
session_start();
if(empty($_SESSION['username'])) {
$VerifiedUser = "false";
echo 'Session variabel not set';
}
else {
$VerifiedUser = "true";
echo $_SESSION['username'];
}
.. it returns 'Session variable not set'.. so I wonder where my SET SESSION VARIABLE went... why does'nt my loginscript work? What can I do, please help?
thank you/
Lars Netzel
login.php (works fine, just HTML code)
validateuser.php (works fine I guess):
//VALIDATE USER
$user_name = $_POST['user_name'];
$password = $_POST['password'];
if (($user_name == 'shaolin') && ($password == 'shaolin')) {
$_SESSION['username'] = $user_name;
echo $_SESSION['username'];
}
else {
echo "login Failed";
}
After I log n with 'shaolin', 'shaolin' the script returns 'shaolin' which would be the Session variable so it's definately set... now the troubles start...
Now I should be logged in and when I try to access my index.php which has the first coderow like:
include 'verifyuser.php';
and... Verifyuser.php has this code:
//CHECK IF USER IS LOGGED IN
session_start();
if(empty($_SESSION['username'])) {
$VerifiedUser = "false";
echo 'Session variabel not set';
}
else {
$VerifiedUser = "true";
echo $_SESSION['username'];
}
.. it returns 'Session variable not set'.. so I wonder where my SET SESSION VARIABLE went... why does'nt my loginscript work? What can I do, please help?
thank you/
Lars Netzel