Page 1 of 1

help on sessions

Posted: Mon Mar 15, 2004 9:58 am
by dakkonz
hey guys this is my code for logging oin to a session

Code: Select all

$query = "SELECT useracc, userid FROM user WHERE userid='$u' AND password=PASSWORD('$p')";		
		$result = @mysql_query ($query);
		$row = mysql_fetch_array ($result, MYSQL_NUM); 
		
		if ($row) { // A match was made.
				
				// Start the session, register the values & redirect.
                session_name('userlogin');
				session_start();
				$_SESSIONї'userid'] = $rowї1];
				$_SESSIONї'useracc'] = $rowї0];

				
                header ("Location:  http://" . $_SERVERї'HTTP_HOST'] . dirname($_SERVERї'PHP_SELF']) . "/writerindex.php");
				exit();
	
		} else { // No match was made.
			echo '<p><font color="red" size="+1">The username and password entered do not match those on file.</font></p>'; 
		&#125;
But i have a problem is that my fren cannot seem to login in IE6 but managed to log in using Mozilla..... Can anyone tell me what is wrong?? I read about session_set_cookie_params() saying somthing like if the server time and the user time is different the session will not be able to work.. then how do i correct this???

here is the code i put at the top of my secured page

Code: Select all

session_name('userlogin');
session_set_cookie_params(900);
session_start();

if(!isset($_SESSION&#1111;'userid']))
  &#123;
    header ("Location:  http://" . $_SERVER&#1111;'HTTP_HOST'] . dirname($_SERVER&#1111;'PHP_SELF']) . "/unauthorized.html");
	exit();
  &#125;