Jump to content

PHP Login Script Hanging-Not Working in IE


pasturepool

Recommended Posts

Hello,

 

I've run into some trouble with my PHP Login Script.  Users have no problems logging in using Firefox (mac/pc), Safari (mac/pc), but the login hangs using IE 6.0 SP2 for PC and I can't figure out why!!!

 

Here is the login script and a test login to try.

username: devadmin

password: devadmin

 

Sample Script I'm using that works (seemingly) on every browser except IE.

 

<?php require_once('../Connections/connections.php'); ?>

<?php

 

$MM_Username=$_POST['userid'];

$mypassword=$_POST['password'];

 

 

$MM_Username = stripslashes($MM_Username);

$mypassword = stripslashes($mypassword);

$MM_Username = mysql_real_escape_string($MM_Username);

$mypassword = mysql_real_escape_string($mypassword);

 

mysql_select_db($database_PastureTrack, $PastureTrack);

$sql="SELECT * FROM users WHERE userid='$MM_Username' and password='$mypassword'";

$result=mysql_query($sql);

 

 

$count=mysql_num_rows($result);

 

if($count=="1"){

session_register("MM_Username");

session_register("mypassword");

header("location:success.php");

}

else {

//echo "Wrong Username or Password";

header("location:fail.php");

 

}

 

 

?>

 

When forms work differently in different browsers it is usually because the HTML of the form is invalid in that browser. You need to post your form. Also, define: "login hangs". What exactly do you see in front of you?

 

I'll assume you read this in the php manual under the header() function -

 

Note: HTTP/1.1 requires an absolute URI as argument to » Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself:

Thanks for the response.  I'm still having issues.  The input is as expected.  I even tried hard coding in the userid/password to rule out any form posting issues and IE still hangs..meaning...it doesn't what I call "process".  It would have helped if I included the URL

 

http://www.pasturepool.com

userid: devadmin

password: devadmin

 

Try this in any browser except IE and it works, try it in IE and it doesn't.  I also updated the header and it still works in other browsers except IE.

 

 

 

 

<?php require_once('../Connections/PastureTrack.php'); ?>

<?php

 

//error_reporting(E_ALL);

 

$host  = $_SERVER['HTTP_HOST'];

$uri  = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');

$extra = 'success.php';

$extra1 = 'failed.php';

 

 

mysql_select_db($database_PastureTrack, $PastureTrack);

 

// Define $MM_Username and $mypassword

$MM_Username='[email protected]';

$mypassword='surfnut';

 

// To protect MySQL injection (more detail about MySQL injection)

$MM_Username = stripslashes($MM_Username);

$mypassword = stripslashes($mypassword);

$MM_Username = mysql_real_escape_string($MM_Username);

$mypassword = mysql_real_escape_string($mypassword);

 

$sql="SELECT * FROM users WHERE userid='$MM_Username' and password='$mypassword'";

$result=mysql_query($sql);

 

// Mysql_num_row is counting table row

$count=mysql_num_rows($result);

 

if($count=="1"){

// Register $MM_Username, $mypassword and redirect to file "login_success.php"

session_register("MM_Username");

session_register("mypassword");

header("Location: http://$host$uri/$extra");

//header("location:success.php");

}

else {

header("Location: http://$host$uri/$extra1");

//header("location:failed.php");

 

}

 

?>

 

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.