You are here: php session in ie « PHP « IT news, forums, messages
php session in ie

Posted by sunaram patir on 11/11/05 13:20

Hi, i am having problem with internet explorer. i am working on a
project on building a website where i need to keep track of the users
i.e. i use a login system in there in short. with the following code i
check whether the user is logged in or not.
<?php
session_start();

$_SESSION['myurl']=$_SERVER['PHP_SELF'];
if(!isset($_SESSION['student_username']) &&
!isset($_SESSION['student_password']))
header("Location: login.php");
?>

if the user is not logged in, it redirects to the login page login.php
as is shown in the above code. now the user is allowed to log in
through the following code:


<?php
session_cache_limiter('private_no_expire');
session_set_cookie_params(0,"/","schools.zenrays.com");
session_start();



if(isset($_POST['submit'])){
include("../database.inc");
$login=trim($_POST['login']);
$pass=trim($_POST['pass']);
$Effectivelogin=strtoupper($login);
$auth=false;
$connection=mysql_connect($host,$user,$password);
mysql_select_db($database,$connection);
$query="SELECT password FROM students WHERE userID='$Effectivelogin'";
$result=mysql_query($query);
if(mysql_num_rows($result)){
while($row=mysql_fetch_array($result))
{

if($row[0]!=$pass)
echo ("Wrong Username/Password!");
else
$auth=true;
}
}


if($auth){
$_SESSION["student_username"]=$Effectivelogin;
$_SESSION["student_password"]=$pass;
if(isset($_SESSION['myurl']))
header("Location: http://schools.zenrays.com".$_SESSION['myurl']);
else
header("Location: http://schools.zenrays.com/students");

}


}
?>
<html>
<head>
<title>User Authentication</title>
</head>
<body>
<form method="post">
LoginID:
<input type="text" name="login"><br>
Password:
<input type="password" name="pass"><br>
<input type="submit" name="submit" value="Login">
</form>


</body>


</html>

then the user is redirected back to the page he visited. it workd fine
in firefox and msn explorer. in internet explorer, when i visit to a
link in any page it asks for the login details again. could anyone
please help me out?!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация