Hello:
I'm ready to throw something out a window.
I have a login script which starts a session. I am able to login successfully. To see if the session is working, someone suggested I open another browser window and try to access a page in the secure area. I was told if I couldn't open the page, then the sessions were working. Well, I did that and I am able to view the page which tells me, I guess, that sessions aren't working.
I have done a lot of reading on sessions and everyone has their own programming method of doing it. I think with all the reading I'm spinning my wheels in circles and I'm not sure where things are broken.
First, can someone help me troubleshoot my sessions issue? Secondly, if someone can provide me with a really in depth tutorial that brings you from beginning to end in working with sessions, it would be greatly appreciated?
For now, I've posted my login script since this is where the session variables are set. I will paste more code as it is needed.
To try out for yourself, go to this URL:
http://www.bridgemilltennis.com/testing.htm.
Username: bill
Password: plane
Thank you so very much in advance. I'm losing my mind here.
Here's the code:
<php>
<?php
session_start();
include "conn.inc.php";
switch($_REQUEST['req'])
{
case "validate":
$validate = mysql_query("SELECT * FROM member WHERE
username = '{$POST['username']}' AND password = md5('{$POST['password']}')") or
die (mysql_error());
if (mysql_num_rows($validate) == 1)
{
while($row = mysql_fetch_assoc($validate))
{
$SESSION['login'] = true;
$SESSION['memberid'] = $row['memberid'];
$SESSION['first_name'] = $row['first_name'];
$SESSION['last_name'] = $row['last_name'];
$SESSION['email'] = $row['email'];
$SESSION['phone1'] = $row['phone1'];
$SESSION['phone2'] = $row['phone2'];
$SESSION['username'] = $row['username'];
$_SESSION['password'] = $row['password'];
$login_time = mysql_query("UPDATE member SET last_login=now() where memberid='{$row['memberid']}'");
}
header("Location: http://www.bridgemilltennis.com/members/secure/member-area-main.htm");
}
else
{
header("Location: http://www.bridgemilltennis.com/members/secure/login_form.php");
exit;
}
break;
}
?>
/php
Thank you so very much in advance