localhost and web - session problem
- From: "NurAzije" <nurazije@xxxxxxxxx>
- Date: 24 Jan 2006 03:36:13 -0800
I made a small website with user-management system, I use this code for
loig-in:
<?
session_start(); //start the session
$login=$_POST["login"]; // check an hidden input
if($login=="access")
{
$username=$_POST["username"];
$password=$_POST["password"];
include "functions.php";
include "config.php";
$q="select username,password,userid,userlevel,gender from user";
$data=connect_easy($host,$db,$user,$pass,$q);
for($i=0;$i<count($data);$i++)
{
if(($username==$data[$i][0])and($password==$data[$i][1]))
{
$_SESSION["username"]=$data[$i][0]; //add new session data
$_SESSION["passowrd"]=$data[$i][1];
$_SESSION["id"]=$data[$i][2];
$_SESSION["level"]=$data[$i][3];
$_SESSION["gender"]=$data[$i][4];
?>
<meta http-equiv="refresh" content="0;URL=home.php"> // go to home page
<?
exit();
}
}
?>
<meta http-equiv="refresh" content="0;URL=index.php"> // login failed
<?
}else{
?>
<meta http-equiv="refresh" content="0;URL=index.php"> // login failed
<?
}
?>
************
in every page of the rest of the website I use this structure :
********
<?
session_start();
if ($_SESSION["username"]) {
..
..
..
here is the page
..
..
..
}else{
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";
}
***************
On localhost it is working perfectly, but when I put it on my hosting,
the session is working for one page and then it fails as there is no
sesion data, what is the problem, any hint ??
Please!
.
- Prev by Date: Re: CRUD Frameowrk in PHP
- Next by Date: Filter Data based on Username
- Previous by thread: PHP Chat system advice
- Next by thread: Filter Data based on Username
- Index(es):
Relevant Pages
|