erikbeam Posted May 29, 2008 Share Posted May 29, 2008 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. Link to comment https://forums.phpfreaks.com/topic/107740-solved-php-not-working-in-firefox-ie-is-ok/ Share on other sites More sharing options...
darkfreaks Posted May 29, 2008 Share Posted May 29, 2008 try using header(); instead of a metatag for the else Link to comment https://forums.phpfreaks.com/topic/107740-solved-php-not-working-in-firefox-ie-is-ok/#findComment-552313 Share on other sites More sharing options...
next Posted May 29, 2008 Share Posted May 29, 2008 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. Link to comment https://forums.phpfreaks.com/topic/107740-solved-php-not-working-in-firefox-ie-is-ok/#findComment-552318 Share on other sites More sharing options...
Gighalen Posted May 29, 2008 Share Posted May 29, 2008 Your refresh method shouldn't matter given you have a good charset, what 'next' already posted is the only thing I can see wrong with it that could create a potential issue. Link to comment https://forums.phpfreaks.com/topic/107740-solved-php-not-working-in-firefox-ie-is-ok/#findComment-552321 Share on other sites More sharing options...
erikbeam Posted May 29, 2008 Author Share Posted May 29, 2008 Wow, I hate syntax problems. Especially when it's almost midnight. Thank you second, and third, and forth sets of eyes. Working like a charm now. I hate feeling stupid, but it sure feels good when these problems go away. Link to comment https://forums.phpfreaks.com/topic/107740-solved-php-not-working-in-firefox-ie-is-ok/#findComment-552322 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.