Forum Moderators: coopster

Message Too Old, No Replies

Login script works in Firefox but not IE.

         

bboy121

11:55 pm on Mar 17, 2010 (gmt 0)

10+ Year Member



Anyone know why this code is working in Firefox but not IE? Also, I'm using PayPal subscriptions management, and PayPal automatically uses the crypt() function to encrypt the password it sends to my database, which is why I'm also using the crypt() function to compare the stored database password with the password the user enters on the login page.
<?php
//Start session
session_start();

//Include database connection details
require_once('config.php');

//Array to store validation errors
$errmsg_arr = array();

//Validation error flag
$errflag = false;

//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$login = clean($_POST['login']);
$password = clean($_POST['password']);

//Input Validations
if($login == '') {
$errmsg_arr[] = 'Login ID missing';
$errflag = true;
}
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}

//If there are input validations, redirect back to the login form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: login.php");
exit();
}
$SQL = "SELECT password, subscr_id FROM paypal_subscription_info WHERE username = '" . $_POST['login'] . "'";

$result = mysql_query($SQL);

while($row = mysql_fetch_array($result))
$encrypted_password = $row['password'];

//Check whether the query was successful or not
if($result) {

if(crypt($_POST['password'], substr($encrypted_password, 0, 2)) == $encrypted_password) {

//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = 'subscr_id';
session_write_close();
header("location:index.php");
exit();
}
else{

//Login failed
header("location: login-failed.php");
exit();
}}else{

die("Query failed");
}
?>

eelixduppy

2:09 am on Mar 18, 2010 (gmt 0)



There is no difference in the way PHP is parsed depending on the browser as the browser doesn't handle the code directly, just its output. Have you checked your error logs to see what's going on behind the scenes? What doesn't work exactly?