Forum Moderators: coopster
Are there any particular settings in firefox that need to changed/modified in order for session varialbes to work?
I recently just updated to fireforx 2.0.0.4, so could that also be part of the issue?
just a bit worried here that my php scripts are now not going to work in firefox, the way i have it is i have a file called auth.php that checks if $_SESSION['Authenticated'] is true or not, if it is then it will load the page, if not it will redirect to a login page, whats happening in firefox is even as the correct username and password are entered it is saying "this page requires login" however in IE it goes on to load the correct page.
any help?
auth.php
<?php
session_start();
if($_SESSION['Authenticated']!= true)
{
header('Location: http://example.co.uk/bin/loginform.php?e=You%20need%20to%20login%20to%20view%20this%20page');
//echo "not logged in, this page is protected";
exit();
}
?> login.php
<?php
session_start();
include '/home/www/mysite/lib/dbcon.php';
if(isset($_POST['fuser']) && $_POST['fpass'])
{
$user = mysql_real_escape_string($_POST['fuser']);
$pass = mysql_real_escape_string($_POST['fpass']);
$query = "SELECT * FROM user WHERE username='$user' AND password='$pass'";
$result = mysql_query($query) or die("Unable to verify user because : " . mysql_error());
if(mysql_num_rows($result)!= 0)
{
$_SESSION['Authenticated'] = true;
//echo "Logged in";
header('Location: http://www.example.co.uk/bin/logs.php');
}
else
{
header('Location: http://example.co.uk/bin/loginform.php?e=Invalid%20Username%20and/or%20password');
//echo "not logged in wrong username and password";
}
}
else
{
//echo "not logged in, you didnt enter a username and password";
header('Location: http://example.co.uk/bin/loginform.php?e=Please%20enter%20a%20username%20and/or%20password');
}
mysql_close($dbc);
?> This code has worked previously i took from other code i had written about 6 weeks ago and i know that it worked then so cant imagine why it wont work now.
The problem I am having is that any page with auth.php included at the top always asked me for a username and password, so the session variable Authenticated isnt being remembered accross a few pages.
any help greatly appreciated.
Thanks
ChrisW
[edited by: eelixduppy at 11:55 am (utc) on June 5, 2007]
[edit reason] delinked URLs [/edit]
Could it be my web host limiting something? I suppose that doesnt explain why IE works fine but FFox doesn't, strange this i just cant get it to work :-(