Redirecting to appropriate page
Posted: Mon Sep 24, 2007 2:42 am
hello,
In a shopping cart page, if the user has not logged in, he will be sent to login page, if he enters username and password correctly, he should be redirected to the page where he was. I tried using sessions.
This is the code i tried,
login page,
$query_member_details=mysql_query("SELECT * FROM members WHERE member_username='$member_username' AND member_password='$member_password' AND confirm_flag='YES' AND member_flag=1");
once he is directed to shop.php he should not see again buy now, since he allready has clicked. i.e once he is authenticated, the details should be entered into database and redirected to index.php (where all products are listed). I hope i am explaining properly
Thanks
In a shopping cart page, if the user has not logged in, he will be sent to login page, if he enters username and password correctly, he should be redirected to the page where he was. I tried using sessions.
This is the code i tried,
login page,
$query_member_details=mysql_query("SELECT * FROM members WHERE member_username='$member_username' AND member_password='$member_password' AND confirm_flag='YES' AND member_flag=1");
Code: Select all
if(mysql_num_rows($query_member_details) > 0)
{
$fetch_member_details=mysql_fetch_array($query_member_details);
$member_id=$fetch_member_details['member_id'];
session_start();
$_SESSION['member_id']=$member_id;
if(isset($_SESSION['shop']))// this i am setting it in shop.php before sending to login page.
header("Location:".SITE_URL."/shop.php");
else
header("Location:".SITE_URL);
}Thanks