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
{
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
{