我繼承了一個小型辦公室池站點。最近我的主機升級了我的服務器,PHP腳本停止工作。我現在能夠解決一些錯誤並抑制一些其他錯誤,但$ user_id在登錄後不會保留。登錄後,我可以看到「玩家」鏈接。選擇其中一個鏈接會顯示該頁面,但無法訪問用戶。任何新的頁面請求行爲,如果沒有登錄。我敢肯定,代碼是非常古老的。我只需要恢復並跑完賽季。我不知道如何做到這一點。希望可以閱讀。
<?
session_start();
include "functions.php";
include "uiFunctions.php";
// session_register("user_id");
$_session['userid']= $user_id;
// session_register("groupID");
$_session['groupID']= "groupID";
// log in/out sequence
if ($logout) $user_id = 0;
if ($login_step)
{
$check = dbFetch("SELECT id FROM users WHERE user='".$userName."' AND
pass=PASSWORD('".$userPass."') AND ((activated>0 AND
banned=0) OR is_admin=1)");
if ($check[0])
{
$user_id = $check[0];
$page = "";
dbQuery("UPDATE users SET last_login=NOW() WHERE
id='".$user_id."'");
}
}
$user_info = dbFetch("SELECT full_name, is_admin FROM users WHERE
id='".$user_id."'");
$user_name = $user_info[0];
$user_admin = $user_info[1];
$page_path = $_SERVER['PHP_SELF'];
// -----------------------------------------------------------------
$m_curSystemTimeStamp = dbFetch("SELECT DATE_ADD(NOW(), INTERVAL 1 HOUR)");
$m_curSystemTimeStamp = dbFetch("SELECT
DATE_FORMAT('".$m_curSystemTimeStamp[0]."', '%Y-%m-%d'), ".
"DATE_FORMAT('".$m_curSystemTimeStamp[0]."', '%H:%i:%s')");
$m_CURDATE = $m_curSystemTimeStamp[0];
$m_CURTIME = $m_curSystemTimeStamp[1];
?><html>
<head>
<title>Pick'em</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel='stylesheet' href='base.css' type='text/css'>
</head>
<script language=javaScript>
<!--
function finishedLoading()
{
<? if (!empty($user_admin)) echo "return;"; ?>
for(x=0;x<document.all.length;x++)
{
me = document.all[x];
tg=me.tagName;
if (tg=='DIV' || tg=='IMG' || tg=='TD' || tg=='SPAN' || tg=='B' ||
tg=='BODY' || tg=='FONT' || tg=='NOBR')
{
me.unselectable='on';
me.style.cursor='default';
}
}
}
-->
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
style="background: #3A4774 url(img/page_bg.gif) repeat-x"
onLoad="finishedLoading()">
<table align=center border=0 cellspacing=0 cellpadding=0>
<tr><td rowspan=3 width =1><img src="img/spacer.gif" height=123 width=1>
</td>
<td height=1><img src="img/spacer.gif" width =770 height=1></td>
</tr>
<tr><td class="logo_text" height=55>Pick'em</td></tr>
<tr><td class="logo_text" height=48><img src="img/spacer.gif" width =770
height=1></td></tr>
<tr><td colspan=2>
<table border=0 cellspacing=0 cellpadding=0>
<tr><td valign=top width=140><img src='img/spacer.gif' width=140 height=1>
</td>
<td valign=top width=640><img src='img/spacer.gif' width=460 height=1>
</td>
</tr><tr><td valign=top>
<?
// ---------------------------------------------------------------------
// the left panels
uiStartPannel("Site map", 135);
uiLink("Home" , $page_path);
uiLink("Race results", $page_path."?page=race_rez");
uiLink("Standings" , $page_path."?page=standings");
uiLink("Rules" , $page_path."?page=rules");
uiEndPannel();
uiPannelDelimiter();
uiStartPannel("Players area", 135);
if (empty($user_id))
{
// uiLink("Log in here" , $page_path."?page=closed");
uiLink("Log in here" , $page_path."?page=login");
uiLink("Register now" , $page_path."?page=new_user");
// uiLink("Register now" , $page_path."?page=closed");
} else {
if (empty($user_admin))
{
uiLink("Make your picks", $page_path."?page=make_picks");
uiLink("Everyone's pick", $page_path."?page=everyone_pick");
uiLink("Player info..." , $page_path."?page=view_player");
uiLink("Driver info..." , $page_path."?page=view_driver");
} else {
uiLink("Everyone's pick" , $page_path."?
page=everyone_pick");
uiLink("Edit players" , $page_path."?page=adm_users");
uiLink("Edit player picks", $page_path."?page=adm_picks");
uiLink("Edit races" , $page_path."?page=adm_races");
uiLink("Edit race results", $page_path."?page=adm_results");
uiLink("Edit drivers" , $page_path."?page=adm_drivers");
}
uiLink("Prize Table", $page_path."?page=prizes");
uiLink("Change password", $page_path."?page=change_pw");
uiLink("Log out" , $page_path."?logout=1");
}
uiEndPannel();
$serverDate = dbFetch("SELECT DATE_FORMAT('".$m_CURDATE."', '%D %b
%Y')");
echo "<div class=pannel_text><br>Server time: <br>".
"<div align=left>".substr($m_CURTIME, 0, 5)." ".$serverDate[0]."
</div></div><br><br><br>\n";
// ------------------------------------------------------------
echo "</td><td valign=top align=center>";
// the middle area
if (empty($page)) $page = "home";
include $page.".php";
?></td></tr>
<tr><td colspan=2><? PushCopyrightNote(); ?></td></tr>
</table>
</td></tr></table>
</body></html>
是對會話區分大小寫的全局變量?應該用大寫「$ _SESSION」? – Meffen
$ _SESSION沒有解決問題 – 1XLTomcat