amol0010
01-11-2008, 10:58 AM
Hi,
I am working on my website, where a few pages for the member's area are protected by user login via sessions.
i.e.if the user tries to access a particular member's page without logging in, the user should be forwarded to the login page where the user has to enter the username/password. This members2.php. The form on members2.php has a form which sends the username/password to a login check script login-exec.php
This is working fine, however, once after being forwarded to the logging in page, and after entering the right credentials, the user is forwarded to only a page called membersloggedin.php.
What I want to be able to do is make login-exec.php remember which page the user earlier clicked to forward him/her to the page that he clicked once the authentication is verified.
How can this be done ?
//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result)>0) {
//Login Successful
session_regenerate_id();
$member=mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID']=$member['uname'];
$_SESSION['SESS_MEMNO']=$member['umembno'];
$_SESSION['SESS_MEMPASS']=$member['upass'];
$_SESSION['SESS_ULOGIN']=$member['ulogin'];
$_SESSION['SESS_UDUPER']=$member['uduper'];
session_write_close();
header("location: membersloggedin.php");
exit();
}else {
//Login failed
header("location: members2.php");
How the can the header be changed on this page to remember the page the user clicked on the member's area and take him/her to the page that he/she clicked and not to membersloggedin.php everytime after a successful login.
Any suggestions would be helpful.
Thanks..
I am working on my website, where a few pages for the member's area are protected by user login via sessions.
i.e.if the user tries to access a particular member's page without logging in, the user should be forwarded to the login page where the user has to enter the username/password. This members2.php. The form on members2.php has a form which sends the username/password to a login check script login-exec.php
This is working fine, however, once after being forwarded to the logging in page, and after entering the right credentials, the user is forwarded to only a page called membersloggedin.php.
What I want to be able to do is make login-exec.php remember which page the user earlier clicked to forward him/her to the page that he clicked once the authentication is verified.
How can this be done ?
//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result)>0) {
//Login Successful
session_regenerate_id();
$member=mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID']=$member['uname'];
$_SESSION['SESS_MEMNO']=$member['umembno'];
$_SESSION['SESS_MEMPASS']=$member['upass'];
$_SESSION['SESS_ULOGIN']=$member['ulogin'];
$_SESSION['SESS_UDUPER']=$member['uduper'];
session_write_close();
header("location: membersloggedin.php");
exit();
}else {
//Login failed
header("location: members2.php");
How the can the header be changed on this page to remember the page the user clicked on the member's area and take him/her to the page that he/she clicked and not to membersloggedin.php everytime after a successful login.
Any suggestions would be helpful.
Thanks..