signin.php is used to register the variable username and status.php is to display infromation after login. Now my problem is that the status.php can display information after login ((isset($SESSION["customer_name"])) is true) but sometimes it cannot display information suddenly ((isset($SESSION["customer_name"])) become false suddenly). I don't know why. And also I cannot predict when it will do so.
//signin.php
<?
session_start();
include_once("dadmin/thisDbInc.php");
function authenticate($name, $pw) {
$db_conn =& myConnectDb();
if (!$db_conn->Open()) {
die ($db_conn->GetError());
}
$rs =& DlRecordset::NewRecordset($db_conn);
$rs->Open("select customer_id, customer_pw, rate_class, one_bet_limit, one_day_limit from Customers where del<>1 and name='".$name."'");
$ReturnFlag = FALSE;
if ($rs->GetRowCount()>0) {
$rs->MoveFirst();
if ($rs->Value("customer_pw")==$pw) {
$_SESSION["customer_name"] = $name;
$_SESSION["customer_pw"] = $pw;
$_SESSION["customer_id"] = $rs->Value("customer_id");
$_SESSION["rate_class"] = $rs->Value("rate_class");
$_SESSION["b_limit"] = round($rs->Value("one_bet_limit"));
$_SESSION["d_limit"] = round($rs->Value("one_day_limit"));
$ReturnFlag = TRUE;
}
$rs->Close();
}
$db_conn->Close();
return $ReturnFlag;
}
if (isset($HTTP_POST_VARS)) {
if (authenticate($HTTP_POST_VARS["user"], $HTTP_POST_VARS["password"])) {
echo "<script language='javascript'>parent.location.replace('aftersignin.php')</script>";
//echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=index.php\">";
} else {
echo "<script language='javascript'>parent.location.reload()</script>";
//echo "<META HTTP-EQUIV=\"refresh\" content=\"0\">";
}
}
?>
/////////////////////////////////////////////////////////////////////////////
status.php
<? session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<!-- Mirrored from www.china-jr.com/ball/single.asp by HTTrack Website Copier/3.x [XR&CO'2002], Sat, 26 Apr 2003 07:23:44 GMT -->
<HEAD><TITLE>?§â?</TITLE>
<META http-equiv=Content-Type content="text/html; charset=big5"><LINK
href="css.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY bgcolor="#CCFF99">
<center>
<table width="95%" border="0">
<tr align="center">
<td width="33%" height="22" align="left" bgcolor="#CCFF99"> <font color="#009900" size="3"><strong>¤Uª`ª¬ªp</strong></font><strong><font size="3">
</font></strong><font size="3"> </font></td>
</tr>
</table>
</p>
<?
function getRate($team, $water, $rate) {
if ($team==1) {
return nvl($rate,0);
} else {
return nvl(($water - $rate),0);
}
}
if (isset($_SESSION["customer_name"])) {
// do things if user have logged in.
include_once("dadmin/thisDbInc.php");
include_once("common/inc1.php");
include_once("dadmin/inc3.php");
else {
// do things if user have not logged in.
}