[更新:已解决:谢谢大家。请参阅此处的代码:http://pastebin.com/1fJmXeG2] 我非常感谢我能在这个问题上获得的任何帮助。我们的网站上有一个登录页面,它运行在使用 Apache 1 和 PHP 4 的旧 Linux 服务器上。我们想将其移动到新的 Windows 2008 服务器(64 位)......所以我安装了 Apache 2.25 和 PHP 5.4新服务器。我还启用了 OCI8 连接到 Oracle 11g 数据库。我将登录页面的文件移到了新服务器上,但它们不起作用。发生的情况是页面不运行脚本,它只是转发到 index.php,而不是重定向到具有适当响应的 index php。当然,我在 PHP 脚本中更新了一些已弃用的语言,但它仍然不起作用。我是一个完整的新手,所以我不确定这是脚本的问题还是 PHP 设置的问题。我知道我可以连接到数据库,因为我这样做了一个测试页面。如果可以的话,请帮助我......我真的很绝望。以下是我的授权页面的代码:
<?php session_start();
// Begin or continue session by registering variables
$_SESSION['USER_ID'] = 'USER_ID';
$_SESSION['PASSWORD'] = 'PASSWORD';
$_SESSION['FIRST'] = 'FIRST';
$_SESSION['LAST'] = 'LAST';
$_SESSION['ACCESS_KEY'] = 'ACCESS_KEY';
$_SESSION['conn'] = 'conn';
$_SESSION['BEENHERE'] = 'BEENHERE';
$_SESSION['CUSTOMER_NAME'] = 'CUSTOMER_NAME';
$_SESSION['WAREHOUSING'] = 'WAREHOUSING';
$_SESSION['TRANSPORTATION'] = 'TRANSPORTATION';
$_SESSION['MYACCOUNT'] = 'MYACCOUNT';
// Set Environment Variables
$SYS_DBUSER = "*****";
$SYS_DBPASSWORD = "*****";
$SYS_DB = "*****";
// Begin Authorization Routine
if ( (!isset($USER_ID)) && (!isset($PASSWORD)) )
{
echo '<html>';
echo '<head>';
echo '<title> Customer Access - Login</title>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
echo '</head>';
echo '<body bgcolor="#FFFFFF" text="#000000">';
echo '<div align="center">';
echo '<p><img src="../images/logocir3.gif" width="120" height="123"> </p>';
echo '<p><b><font size="5" color="#0000FF" face="Arial, Helvetica, sans-serif">The ';
echo 'The Company</font></b></p>';
echo '<p><font size="4" color="#0000FF" face="Arial, Helvetica, sans-serif"><b><i>Customer Access</i></b></font></p>';
echo '<form name="form1" method="post" action="index.php">';
echo '<p> <font size="3" face="Arial, Helvetica, sans-serif">Username:</font> ';
echo '<input type="text" name="USER_ID" maxlength="15">';
echo '</p>';
echo '<p><font size="3" face="Arial, Helvetica, sans-serif">Password: </font> ';
echo '<input type="PASSWORD" name="PASSWORD" maxlength="15">';
echo '</p>';
echo '<p><input type="submit" name="Submit" value="Login"></p>';
echo '</form>';
echo '<p> </p>';
echo '</div>';
echo '</body>';
echo '</html>';
exit;
}
elseif ( ($BEENHERE == 1) && (isset($FIRST)) && (isset($PASSWORD)) && (isset($ACCESS_KEY)) && (isset($USER_ID)) && (isset($LAST)) && (isset($conn)) && (isset($CUSTOMER_NAME)) )
{
return (TRUE);
}
else
{
// Connect to database
unset($conn);
$conn = oci_connect($SYS_DBUSER,$SYS_DBPASSWORD,$SYS_DB);
// Generate sql statement
$loginsql = oci_parse($conn,"SELECT FIRST_NAME,LAST_NAME,CUSTOMER_NAME,ACCESS_KEY,TRANSPORTATION,WAREHOUSING,MYACCOUNT FROM WEB_USERS WHERE USER_ID = SUBSTR(UPPER('$USER_ID'),1,15) AND PASSWORD = SUBSTR(UPPER('$PASSWORD'),1,30) AND ENABLED = 'Y'");
// Execute statement
oci_execute($loginsql,OCI_NO_AUTO_COMMIT);
// Retrieve number of rows for authentication
$nrows = oci_fetch_all($loginsql,$results);
// Database Authenticate
if ( $nrows != 1 )
{
// Display if login fails
unset($USER_ID);
unset($PASSWORD);
unset($FIRST);
unset($LAST);
unset($ACCESS_KEY);
unset($conn);
unset($BEENHERE);
unset($CUSTOMER_NAME);
unset($WAREHOUSING);
unset($TRANSPORTATION);
unset($MYACCOUNT);
echo "<H1>Login Failure - Please Check Your Password AND/OR Username</H1><BR>";
echo "<A HREF=\"$PHP_SELF\"><H3>Try Again</H3></A>";
// Close used resources
oci_free_statement($loginsql);
oci_close($conn);
exit;
}
else
{
// Assign login information to global variables
unset($FIRST);
unset($LAST);
unset($ACCESS_KEY);
unset($BEENHERE);
unset($CUSTOMER_NAME);
unset($WAREHOUSING);
unset($TRANSPORTATION);
unset($MYACCOUNT);
$FIRST = $results['FIRST_NAME'][0];
$LAST = $results['LAST_NAME'][0];
$CUSTOMER_NAME = $results['CUSTOMER_NAME'][0];
$ACCESS_KEY = $results['ACCESS_KEY'][0];
$TRANSPORTATION = $results['TRANSPORTATION'][0];
$WAREHOUSING = $results['WAREHOUSING'][0];
$MYACCOUNT = $results['MYACCOUNT'][0];
$BEENHERE = 1;
// Close used resources
oci_free_statement($loginsql);
oci_close($conn);
}
}
?>
这是我在 png 文件中的 php 设置:http: //i.imgur.com/7c8BzZG.png ?1