Electronics - Kamala Harris - to-reuse.com - Debt Consolidation - Web Hosting

PDA

View Full Version : can't login using IE6


asmon
Jul 19th 2008, 5:19 am
Since i can't really express myself in English, i'll just say i have the same issue this guy has
http://www.webmasterworld.com/php/3304214.htm

"
I have a php application which allows members to log in and their information is saved and retrieved from a MySQL database.

People cannot log in using Internet Explorer 6.0, but have no problem logging in with Firefox and Internet Explorer 7.0.

This is the only cookie I use on the site. Does anyone else know of this problem with php Cookies and IE 6? "

here's the page where i check if log in is ok


<?php
include("cgi-bin/db_config.php");
$conn = mysql_connect ($db_host, $db_user, $db_password);
$db_select = mysql_select_db("$db_name",$conn);
if (!$db_select){
die ("Could not select the database: <br />". mysql_error());
}

//if the login form is submitted
if (isset($_POST['submit'])) {

// makes sure they filled it in
if(!$_POST['username'] | !$_POST['pass']) {
die('You did not fill in a required field.');
}
// checks it against the database

if (!get_magic_quotes_gpc()) {
$_POST['email'] = addslashes($_POST['email']);
}
$check = mysql_query("SELECT * FROM player_table WHERE username = '".$_POST['username']."'")or die(mysql_error());

//Gives error if user dosen't exist
$check2 = mysql_num_rows($check);
if ($check2 == 0) {
die('That user does not exist in our database.
<a href=register.php>Click Here to Register</a>');
}
while($info = mysql_fetch_array( $check ))
{
$_POST['pass'] = stripslashes($_POST['pass']);
$info['password'] = stripslashes($info['password']);


//gives error if the password is wrong
if ($_POST['pass'] != $info['password']) {
die('Incorrect password, please try again.');
}

else
{
if (isset($_POST['remember']))

{

// if login is ok then we add a cookie
$_POST['username'] = stripslashes($_POST['username']);
$hour = time() + 3600;
setcookie(loguser, $_POST['username'], $hour);
setcookie(logpass, $_POST['pass'], $hour);
$date = DATE('Y-m-d');
$update = "UPDATE users SET last_date='$date' WHERE username='$_POST[username]'";

mysql_query($update, $conn);
//then redirect them to the members area
session_start();
$_SESSION['username']=$_POST['username'];
$_SESSION['pass']=$_POST['pass'];
header("Location: index.php");
}
else
{


session_start();
$_SESSION['username']=$_POST['username'];
$_SESSION['pass']=$_POST['pass'];
header("Location: index.php");




}}}
}
else
{
echo("error 101");
}

?>



and that's the code i put in other pages to check if i'm logged


if(isset($_COOKIE['loguser']))
{
$username = $_COOKIE['loguser'];
$pass = $_COOKIE['logpass'];
}
else if(isset($_SESSION['username']))
{
$username = $_SESSION['username'];
$pass= $_SESSION['pass'];
//checks if something was selected
}
if (isset($username))
{
$check = mysql_query("SELECT * FROM $playerstable WHERE username = '$username'")or die(mysql_error());
if($info = mysql_fetch_array( $check ))
{ $passs= $info['password'];

//if the cookie has the wrong password
if ($pass != $passs)
{die(mysql_error());
}


//otherwise they are shown the logged area
else
{

Talker
Jul 19th 2008, 5:48 am
I had the same issue once and i disabled the cookies!!
Lolz, i know that's not what you should do. i just didnt have to look into all this.

Please let me know if you find a solution to this.

ceweqsakti
Jul 19th 2008, 5:53 am
Why dont u use firefox or opera? But your problem same with me. Go to ie option,privacy,add site n enter that site after that allow
Try it

asmon
Jul 19th 2008, 5:59 am
i have both firefox and ie7, the problem is not me being unable to login
but other people who enter the website with IE6 and unable to log in.

ceweqsakti
Jul 19th 2008, 6:01 am
Ah the problems are from peoples who want to login.hahaha say to them to use ie7 or ff 2 higher

asmon
Jul 19th 2008, 6:03 am
lol, but there must be something i can do to fix the problem, no? :|

ceweqsakti
Jul 19th 2008, 6:07 am
If you can login.so there isnt problem right?
No need to change

asmon
Jul 19th 2008, 6:08 am
almost half of the web users still use IE6, that's a huge problem..

Talker
Jul 19th 2008, 6:50 am
He means the cookies dont save in IE6... am i right?

asmon
Jul 19th 2008, 8:53 am
yep, even tho some ie6 users can

chanakya
Jul 19th 2008, 9:08 am
Use sessions instead of cookie , or check if users are using ie6 and use session for ie6 users

php-lover
Jul 19th 2008, 12:24 pm
$hour = time() + 3600;
setcookie(loguser, $_POST['username'], $hour);
setcookie(logpass, $_POST['pass'], $hour);

Make sure you set your cookies properly. It seems you forgot to quotes around your loguser and logpass.


$hour = time() + 3600;
setcookie('loguser', $_POST['username'], $hour);
setcookie('logpass', $_POST['pass'], $hour);

Talker
Jul 22nd 2008, 5:54 am
$hour = time() + 3600;
setcookie(loguser, $_POST['username'], $hour);
setcookie(logpass, $_POST['pass'], $hour);Make sure you set your cookies properly. It seems you forgot to quotes around your loguser and logpass.


$hour = time() + 3600;
setcookie('loguser', $_POST['username'], $hour);
setcookie('logpass', $_POST['pass'], $hour);



Good Catch.. did you manage to get it fixed using the updated code by php=lover?