1

我是 php 新手,并且坚持使用为 php4 编写的旧代码。一切似乎都运行良好,我什至在这里快速修复了 register_globals。问题是,我在单击任何链接后立即退出,所以我怀疑这次是会话问题。请帮我检查一下:

<?
foreach (array_merge($_GET, $_POST) as $key => $val) {
  global $$key;
  $$key = addslashes($val);
}
@session_start(); 
include("../dbinfo.php");
$expireTime = 60;
@session_set_cookie_params($expireTime);

if(isset($bye)) {
    $_SESSION['session_unregister']= 'login';
    $_SESSION['session_unregister']= 'password';
    $_SESSION['time']= time();
    include("logout.php"); 
    exit;
        } 
if(!isset($login)) { 
    include("loginform.php");
exit; }

$_SESSION['login']= 'login';
$_SESSION['password']= 'password';
mysql_connect($DBhost, $DBuser, $DBpass) or DIE("Unable to connect to database");
@mysql_select_db($DBName) or die("Unable to select database");

$myquery="select loginname,password from $table where loginname='$login' and   password='$password'";
$result = mysql_query($myquery);
$num_result = mysql_num_rows($result);

if(!$num_result) { 
    $_SESSION['session_unregister']= 'login';
    $_SESSION['session_unregister']= 'password';
    ?>
        <html>
            <head>
            <title> Access Denied </title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body bgcolor="#CCCCCC">
<h1> Access Denied </h1>
            <p>Your user ID or password is incorrect, or you are not a
        registered user on this site. To try logging in again, click
            <a href="<?=$PHP_SELF?>">here</a>.</p>
            </body>
        </html>

<? exit;
}
?>  

<

4

0 回答 0