I got some problem with login system using PHP and SQL 2000 server.
The session registered on login php cannot be read by authenticated pages like index.php...
i use code like this :
login php :
session_start();
include_once "inc/config.php";
$username = $REQUEST["username"];
$password = crypt($REQUEST["password"]);
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=database; User ID=dbuid; Password=dbpwd");
$rs = $conn->Execute("SELECT * FROM administrator");
if ($rs->fields["username"]==$username || $rs->fields["password"]==$password){
while (!$rs->EOF){
$adminid = $rs->fields["id"];
session_start();
session_register ("id");
$session_adminid=$id;
$_SESSION["id"];
header("location: index.php");
}
else {
// login form
}
and the code of index.php :
session_start();
if (!isset($_SESSION["id"])){
header("location: login.php");
}
else {
ob_start();
//index_page_content
}
can someone help me??