Jump to content

ie6 and lower loads blank page after login


thebigtuna

Recommended Posts

My problem: I've got a script the logs the user, then redirects them a different page. Everything works fine in Firefox and ie7. But anything ie6 or lower, after they click login, it just loads a blank page. Upon refreshing, it loads the page just like its supposed to. I read a little bit about problems with sessions and ie6, but didn't find any real solutions. I know ie is worthless, but is there any real fix for this?

 

The login page:

<?php

session_start();

$errorMessage = '';
if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) {
   
mysql_connect("localhost", "user", "pass") or die(mysql_error());
   mysql_select_db(db) or die(mysql_error());

   $userId = $_POST['txtUserId'];
   $password = $_POST['txtPassword'];

   // check if the user id and password combination exist in database
   $sql = "SELECT username
           FROM test
           WHERE username = '$userId'
                 AND password = '$password'";

   $result = mysql_query($sql)
             or die('Query failed. ' . mysql_error());

   if (mysql_num_rows($result) == 1) {
      // the user id and password match,
      // set the session
      $_SESSION['db_is_logged_in'] = true;
//stores the username
$_SESSION['userid'] = $_POST['txtUserId'];
header('Location: main.php');

      // after login we move to the main page
   
      exit;
   } else {
      $errorMessage = 'Sorry, wrong user id / password';
   }
  mysql_close(); 
  }
?>

 

 

The page login goes to after user logs in:

<?php

session_start();

// is user logged in or not??
if (!isset($_SESSION['db_is_logged_in'])
    || $_SESSION['db_is_logged_in'] !== true) {

    // not logged in, move to login page
    header('Location: login.php');
    exit;
}

      $userid = $_SESSION['userid'];

mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db(db) or die(mysql_error());

$result = mysql_query("SELECT *
           FROM test
           WHERE username = '$userid'");


while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$yourArray[] = $row;
}

foreach($yourArray as $rowNum => $row) {

}

if ($_POST['logoutb'] == "Logout"){
header('Location: logout.php');
}

if ($_POST['updateb'] == "Update")
  {

      
        $email=$_POST['email'];
        $name=$_POST['name'];
        $zip=$_POST['zip'];
        $city=$_POST['city'];
        $state=$_POST['state'];
        $country=$_POST['country'];
        $adress=$_POST['adress'];
        $phone=$_POST['phone'];

        //update user information
        $query="UPDATE test 
        SET email='$email', name='$name', zip='$zip', city='$city', 
        state='$state', country='$country', adress='$adress', phone='$phone' 
        WHERE username='$userid'";
        mysql_query($query) or die(mysql_error());
      header('Location: main.php'); //refresh page
}

mysql_close();

?>

 

Link to comment
Share on other sites

I dont see how this could be a php issue. PHP happens on the server, long before your browser recieves the output. Be aware though that it is recomended to use a full url with the Location header. Maybe this causes issues for IE?

Link to comment
Share on other sites

I changed the header location to have the full url, but no luck.

 

If its not a problem with php, and I cant use php to fix it, I don't know what to do. I'm going to keep looking for a way to fix it.

 

Oh how I wish everyone just used firefox and made my life easy.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.