Jump to content

[SOLVED] php not working in Firefox, IE is ok


erikbeam

Recommended Posts

I've got a login page that goes through a php page to check the database, then it either routes to the content or to .../wrong_id.php.

 

Here's the form I'm sending to login:

 

<form name="login" method="post" action="login.php">
   Username:<input name="user" type="text"  size="16"/><br>
   Password:<input name="pass" type="password"  size="16"/><br>
   <input type="submit" name="login" value="Login"/>
   <input type="reset" name="reset" value="Reset"/>
</form>

 

and the database checking .../login.php

 

<?php
$con=mysql_connect ("localhost", "user", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("dbname", $con); 



$query = sprintf("SELECT username, password, email, gallery FROM customer WHERE username='%s' AND password='%s'",
    mysql_real_escape_string($user),
    mysql_real_escape_string($pass));
$result = mysql_query($query);

while ($row = mysql_fetch_assoc($result)) {
    $dbuser = $row['username'];
    $dbpass = $row['password'];
    $dbemail = $row['email'];
    $dbgallery = $row['gallery'];
}

echo $dbuser;
echo $dbpass;

if($dbpass)
{
  	$_SESSION['sessionuser'] = $dbuser;
$_SESSION['sessiongallery'] = $dbgallery;
$_SESSION['sessionpassword'] = $dbpass;
echo "<meta http-equiv=\"refresh\" content=\"0;URL=gallery/index.php\">";
}
else
session_destroy();
echo "<meta http-equiv=\"refresh\" content=\"0;URL=wrong_id.php\">";
?>

 

I've got the echo's in there just to see if the variables are being passed.  They are.

 

On .../wrong_id.php I've got:

 

<?php
echo   	$_SESSION['sessionuser'];
echo	$_SESSION['sessiongallery'];
echo	$_SESSION['sessionpassword'];
?>

 

 

just to see if the variables are in fact being read.  They are.  This works fine in IE, but not in Firefox.  If the right user/password is entered, IE will route to the content.  Firefox routes to .../wrong_id.php no matter what.  The thing I don't get is since the variables are being passed, it means that the php is working, and since Firefox shouldn't even see the login.php site, why would it react any differently?  The only thing I can think is that the data Firefox sends to the server must be different in some way between IE and Firefox.

 

Any suggestions?  Thanks.

if($dbpass)
{
  	$_SESSION['sessionuser'] = $dbuser;
$_SESSION['sessiongallery'] = $dbgallery;
$_SESSION['sessionpassword'] = $dbpass;
echo "<meta http-equiv=\"refresh\" content=\"0;URL=gallery/index.php\">";
}
else
session_destroy();
echo "<meta http-equiv=\"refresh\" content=\"0;URL=wrong_id.php\">";

i think you need to specify block for "else", i mean:

else {
session_destroy();
echo "<meta http-equiv=\"refresh\" content=\"0;URL=wrong_id.php\">";
}

Not tested.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.