Pino
Feb 20th, 2005, 01:27 PM
Ok i've got a big deadline to meet and i didnt wnat to run into problems like this :(
Ok all my code has been fine so far for my UserCP they log in and i assign a string to a session variable name 'myid' then each page checks the string corrosponds to what it should be, eg here is my log in script
Session_Start();
if ($username==$dbuser and $mpassword==$dbpassword)
{
$_SESSION['myid'] = "ymn2prymn2pr";
header('Location: /admin.html');
exit();
}
else
{
session_destroy();
unset($_SESSION);
header('Location: /badpw.html');
exit();
}
I've missed off the db connection bit and removed the url but it all works fine because it goes to the admin page.
in the admin page there is this code
session_start();
if ($_SESSION['myid'] != "ymn2prymn2pr")
{
session_destroy();
unset($_SESSION);
header('Location: /hckattempt.html');
exit();
}
as you see it checks to make sure the varible should be the string. now then the thing is when i try and echo the session variable 'myid' its empty.
Is this a server error? Or is my login code incorrect?
Pino
Ok all my code has been fine so far for my UserCP they log in and i assign a string to a session variable name 'myid' then each page checks the string corrosponds to what it should be, eg here is my log in script
Session_Start();
if ($username==$dbuser and $mpassword==$dbpassword)
{
$_SESSION['myid'] = "ymn2prymn2pr";
header('Location: /admin.html');
exit();
}
else
{
session_destroy();
unset($_SESSION);
header('Location: /badpw.html');
exit();
}
I've missed off the db connection bit and removed the url but it all works fine because it goes to the admin page.
in the admin page there is this code
session_start();
if ($_SESSION['myid'] != "ymn2prymn2pr")
{
session_destroy();
unset($_SESSION);
header('Location: /hckattempt.html');
exit();
}
as you see it checks to make sure the varible should be the string. now then the thing is when i try and echo the session variable 'myid' its empty.
Is this a server error? Or is my login code incorrect?
Pino