Jump to content

This redirect dosn't work on IE or Opera but works fine on FF, Chrome, Safari


Recommended Posts

I have tried everything I can think of and have had no success with the solutions I have found on forums so far. my problem is that the code below works just fine on FireFox, Chrome and Safari but stops dead on Internet Explorer and Opera...

 

###################################################

this is the "myconfig.php"

###################################################

<?php

session_start();

mysql_connect("localhost", "mydata", "my_pass") or die();

mysql_select_db("my_database") or die();

function logged_in()

{

if (isset($_SESSION['username']) || isset($_COOKIE['username']))

{

  $logged_in = TRUE;

  return $logged_in;

}

}

?>

 

 

###############################################

this is the login/redirect page  (input passed from separate login form)

###################################################

 

<?php

include "myconfig.php";

if ($_POST['login'])

 

{

//get the data

$username = stripslashes($_POST['username']);

$password = stripslashes($_POST['password']);

$rememberme = $_POST['rememberme'];

 

  if ($username && $password)

{

$login = mysql_query("SELECT * FROM mytable WHERE email = '$username'");

    while ($row = mysql_fetch_assoc($login))

      {

$db_pass = $row['password'];

 

        if ($pass == $db_pass)

  $loginok = TRUE;

        else

          $loginok = FALSE;

if ($loginok == TRUE)

 

{

if ($remember_me == "on")

setcookie ( $_COOKIE['username'], $username, time()+7200);

else if ($remember_me == "")

$_SESSION['username']=$username;

header("Location: ../admin.php");

exit();

          }

 

  else

die("error msg");

            }

          }

  else

      die ("error msg");

      }

?>

 

any help would be greatly appreciated by my three remaining hairs

 

Thanks in advance

"pass" in the post is a typo...

 

You should be coping/pasting your actual code so that you don't waste everyone's time.

 

Post the form that is submitting the data to that code. You are likely using an image as a submit button and the browsers where your code does function are actually not following the HTML specification in sending the $_POST['login'] value.

Yup! I had an image as a button in the form... all is well now thanks. Bye the way I did copy and paste, the error was due to some changes I had made just before the post and... what can I say? I missed it... anyway thanks again.

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.