Hi all,
Maybe someone out there can enlighten me, because i'm obviously too stupid to realise
what I messed up here...
I need to setup a site with user authentification through sessions.
Since I don't want to use cookies I used the script for storing session stuff in a mysql database from ying zhangs article.
The setup:
A frameset with 3 frames (top, navigation and main).
I have a simple user login page (pure html form, username + pass) which calls the login.php script.
This checks if the form has been filled out at all, checks user and pass against the database and if everything is correct, calls
the admin.php page the registered user is allowed to see.
login.php contains the code to initiate the session.
Basically it works, i.e. the session key and variables are written to the database ok.
My Problem is that I can't pass the session to the admin.php page and to my navigation frame.
login.php looks like this:
include("../modules/session_mysql.inc.php");
session_start();
/DB connector/
include("../modules/connect.inc.php");
{
...
some formchecking code here
...
}
else
{
if($user&&$pass)
{
{... some userchecking code ... }
/*Sessionvars*/
$check1=$auth_user->USER;
$time=strftime("%H:%M:%S %d.%m.%Y");
$ip=$REMOTE_ADDR;
/*Pass OK?*/
if($auth_user->PASS==$pass)
{
/*some more Logfiles*/
include ("../modules/logging.inc.php");
/*cryt sessionvars*/
$mysession=crypt($check1.$time.$ip);
session_register($mysession);
/*Und ab geht die Luzie*/
/*admin or not?*/
if ($check1=="00000001")
{
echo " <script language='javascript'>
parent.frames[1].location.href='../templates/adm_navi.html?".session_id()."';
parent.frames[2].location.href='admin.php?".session_id()."';
</script>";
}
else
{
echo " <script language='javascript'>
document.location='user.php?".session_id()."';
</script>";
}
}
/*User and/or Pass wrong:*/
else
{
echo "<script language='javascript'>
document.location='wrong.php';
</script>";
}
}
}
What did I do wrong?
Yes, I read the fm (quite a few times), I checked through the articles and postings on this here fine site, but I couldn't find any solution to this.
To be honest, I really don't quite understand how to handle all this session stuff - I am a rookie after all ๐
pleeeeze help anyone....?
thx in advancce
marc