<?php
include ('connect.php');
include ('loginchg.php');
//在登录前,先判断是否已经选择自动登录
$query="select * from netoa.users where Urname='{$_session['Username']}' and urPassword='{$_session['Password']}'";
// oci_free_statement($stmt);
$stmt=oci_parse($conn,$query);
$result= oci_execute($stmt);
if ($ruselt)
{
//如果session会话变量名与密码匹配,则自动登录
header('Location: http://localhost/index.php');
exit;
}
?>
<html>
<html  xmlns:v>
<style>
v\:*{behavior:url(#default#VML)}
</style>
<head>
<title>用户登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
          <script language='JavaScript'>document.location.href="index.php";</script><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="10" onLoad="document.form1.user.focus();wopen()">
<table align="center" width="620" border="0" height="400" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" >
<form method="post" name="form1">
<tr>
<td width="300">
      <v:RoundRect  style="position:relative;width:300;height:400px" arcsize=0>
        <v:shadow  on="T"  type="single"  color="#b3b3b3"  offset="3px,3px"/>
        <v:TextBox  style="font-size:10.2pt;">
<table align=center width=300 height=400 cellspacing="0" cellpadding="0">
<tr>
<td align="center" height="30"></td>
</tr>
<tr>
<td align="center" width="290" height="30"> <font size="+3">系统</font> </td>
</tr>
<tr>
<td align="center" height="250"><IMG class=Ico src="logintu/logo3.gif"></td>
</tr>
<tr>
<td align="right" height="10">
<font style="font-size:9pt;">部门&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
</td>
</tr>
<tr>
<td align="right" height="10">
<font style="font-size:9pt;">Copyright &copy; 2012&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
</td>
</tr>
<tr>
<td align="center" height="10"></td>
</tr>
</table>
</td>
                </v:TextBox>
        </v:RoundRect>
<td width="20">&nbsp;</td>
<td width="300">
      <v:RoundRect  style="position:relative;width:300;height:400px" arcsize=0>
        <v:shadow  on="T"  type="single"  color="#b3b3b3"  offset="3px,3px"/>
<v:TextBox  style="font-size:10.2pt;">
<table align=center width=300 height=400 border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" width=130 height="10"></td><td></td>
</tr>
<tr>
<td align="center" colspan="2" height="80"> <font size="+5">NetOA</font> </td>
</tr>
<tr>
<td align="right" height="5">单位:</td><td align="left">部门名</td>
</tr>
<head>
<title>记录用户名和密码到Cookie中</title>
</head>
<tr>
<td align="right" height="5">用户:</td><td align="left"><input name="user" size="8" value="" onKeyPress="next12_enter(event,pass)"></td>
</tr>
<tr>
<td align="right" height="5">密码:</td><td align="left"><input name="pass" size="8" type="password" value="" onKeyPress="enter12(event)"></td>
</tr>
 </td>
<tr>
 <td align="right" height="5"><input name="Keepinfo" type="checkbox" value="Keepinfo"></input>保存登录信息</td>
</tr>
//<td align="right" height="5"><IMG style="CURSOR: hand" src="logintu/nna_1_12.gif"
  //                             height=22 width=54 onclick="urlogin()"  ></td>
<td align="center" colspan="2" height="50"></td>
</table>
</td>
                </v:TextBox>
        </v:RoundRect>
</tr>
</form>
</table>
</body>
</html>

解决方案 »

  1.   

    <?php
    include ('connect.php');
    include ('loginchg.php');
    //在登录前,先判断是否已经选择自动登录
    $query="select * from netoa.users where Urname='{$_session['Username']}' and urPassword='{$_session['Password']}'";
    // oci_free_statement($stmt);
    $stmt=oci_parse($conn,$query);
    $result= oci_execute($stmt);
    if ($ruselt)
    {
    //如果session会话变量名与密码匹配,则自动登录
    header('Location: http://localhost/index.php');
    exit;
    }
    这段是我加上去的,16行之后是另外同事写的,本来可以登录,要我加上自动登录部分,我加上后界面都不显示了,刚接触php,很多还不懂,请多多指教,谢谢。
    调试了,就是到if里面出不来,我看不出原因。
    判断没有找到用户,不是要跳出来,执行下面语句吗?
      

  2.   

    打开php错误提示看看
    php.ini 中 display_errors=On 然后重启apache再试试
      

  3.   

    display_errors=On 已经是这样的,之前设置过了,谢谢啊
      

  4.   

    $result= oci_execute($stmt);
    if ($ruselt)两个地方的变量名不一致,根本就不应该进到if里面去的,因为这个$ruselt没有被定义啊
      

  5.   

    $result= oci_execute($stmt);
    后只要不出现语法错,无论是否查询到结果。$result 都不会为假bool oci_execute ( resource stmt [, int mode] )
    oci_execute() 执行一条之前被解析过的语句(见 oci_parse())。可选参数 mode 允许定义执行模式(默认是 OCI_COMMIT_ON_SUCCESS)。如果不需要将语句自动提交,则需要把 mode 设为 OCI_DEFAULT。 用 OCI_DEFAULT 模式时,将建立一个事务。事务会在关闭连接或脚本结束时(看哪个先)自动回卷。需要明确调用 oci_commit() 来提交事务,或者 oci_rollback() 中止事务。 如果成功则返回 TRUE,失败则返回 FALSE。