我看到相關的主題,但想知道是否有人可以請幫助我。這裏是錯誤持續存在的代碼的開始。我只是維護我的組織的網站,並沒有編寫任何代碼。希望有人可以請幫助建議修復以下代碼片段:致命錯誤:調用未定義的函數session_register()
session_name('melroseSoccerAdmin');
session_start();
session_register('current_user_id');
session_register('current_user_firstName');
session_register('current_user_lasstName');
session_register('current_user_username');
session_register('current_user_isAdmin');
session_register('current_user_team_id');
session_register('perpetuate');
/* If session not yet validated or session time expired, check credentials */
if (!$_SESSION['perpetuate'] || $_SESSION['perpetuate'] < time()) {
$dbh = mysql_connect($leagueHost, $leagueUser, $leaguePass) or die ('cannot connect');
$authSQL = "SELECT users.user_firstName, users.user_lastName, users.user_isAdmin, users.user_id, users.team_id, leagues.league_id ";
$authSQL .= "FROM users ";
$authSQL .= "LEFT JOIN teams ON users.team_id = teams.team_id ";
$authSQL .= "LEFT JOIN leagues ON teams.league_id = leagues.league_id ";
$authSQL .= "WHERE user_username = '" . addslashes($username) . "' AND user_password = PASSWORD('" . addslashes($password) . "')";
$result = mysql_db_query($leagueDB, $authSQL, $dbh) or die ('bad login query');
header("HTTP/1.0 401 Unauthorized");
while (list($firstName, $lastName, $isAdmin, $id, $team_id, $league_id) = mysql_fetch_row($result)) {
$perpetuate = time() + $sessionLength;
$_SESSION['perpetuate'] = $perpetuate;
$current_user_id = $id;
$_SESSION['current_user_id'] = $current_user_id;
$current_user_name = $username;
$_SESSION['current_user_username'] = $current_user_username;
$current_user_firstName = $firstName;
$_SESSION['current_user_firstName'] = $current_user_firstName;
$current_user_lastName = $lastName;
$_SESSION['current_user_lastName'] = $current_user_lastName;
$current_user_isAdmin = $isAdmin;
$_SESSION['current_user_isAdmin'] = $current_user_isAdmin;
$current_user_team_id = $team_id;
$_SESSION['current_user_team_id'] = $current_user_team_id;
你能(或點我的人誰可以)與代碼幫助嗎?我不是Web開發人員,也不確定在這裏需要更新什麼語法。如果有幫助,我可以發送完整的checklogin.php。 – user7886937