Php 它似乎没有收到$u的邮件
我被困在登录页面。从主页,用户将登录(表单发送到check_登录),从check_登录,用户将根据其角色定向到页面。但是,我无法通过登录页面。我的意思是,我一直从标题中获取错误消息('location:1.php?error=1') 仅供参考,我已成功连接到db。数据就在那里。但是如果我回显oci_num_行,结果是0 这是我的login.php代码Php 它似乎没有收到$u的邮件,php,oracle,oracle10g,Php,Oracle,Oracle10g,我被困在登录页面。从主页,用户将登录(表单发送到check_登录),从check_登录,用户将根据其角色定向到页面。但是,我无法通过登录页面。我的意思是,我一直从标题中获取错误消息('location:1.php?error=1') 仅供参考,我已成功连接到db。数据就在那里。但是如果我回显oci_num_行,结果是0 这是我的login.php代码 <form action="check_login.php" method="post" name="login">
<form action="check_login.php" method="post" name="login">
<div class="error"><?php include('error-handler.php'); ?></div>
<p> Matric / Staff ID :</p>
<p><input type="text" name="id" size="20" maxlength="10" onkeypress="return isNumberKey(event)" required value=""/></p>
<p>Password :</p>
<p><input type="password" name="password" id="password" size="20" maxlength="8" min="6" required value="" />
<script type="text/javascript">
//add a show password checkbox
new ShowPasswordCheckbox(document.getElementById("password"));
//test the submitted value
document.getElementById('login').onsubmit = function()
{
alert('pword = "' + this.pword.value + '"');
return false;
};
</script>
</p>
<p><input type="submit" name="submit" value="Login"/></p> </form>
矩阵/员工ID:
密码:
//添加显示密码复选框
新的ShowPasswordCheckbox(document.getElementById(“密码”);
//测试提交的值
document.getElementById('login')。onsubmit=function()
{
警报('pword=“”+this.pword.value+”);
返回false;
};
这是我的check_login.php
<?php
ob_start();
// Inialize session
session_start();
require_once('connection.php');
//if the login form is submitted
if(isset($_POST['submit']) && !empty($_POST['submit']))
{
$id = $_POST['id'];
$pass = $_POST['password'];
$stmt2= oci_parse($conn, "SELECT * FROM user1 WHERE id = '$id'")or die(oci_error());
$check2 = oci_execute($stmt2);
//Gives error if user dosen't exist
$check3 = oci_num_rows($stmt2);
if ($check3 == 0)
{
header('location: 1.php?error=1'); //the msg will be: you are not eligible user.
exit();
}
else
{
while($info2=oci_fetch_array($stmt2,OCI_ASSOC+OCI_RETURN_NULLS))
{
//gives error if the password is wrong
if ($pass != $info2['password'])
{
header('location: 1.php?error=2'); //password mismatch with id
exit();
}
else
{
// if login is ok then we add a cookie
$_SESSION['id'] = $_POST['id'];
$_SESSION['password'] = $_POST['password'];
$hour = time() + 86400;
setcookie(ID_site, $_SESSION['id'], $hour);
setcookie(Pass_site, $_SESSION['password'], $hour);
//then redirect them to the members area
if ($info2['role']=='admin')
{
header('Location: homeAdmin.php');
}
elseif ($info2['role']=='staff')
{
header('Location: homeStaff.php');
}
elseif ($info2['role']=='student')
{
header('Location: homeStudent.php');
}
else
{
header('Location: 1.php');
}
} //end else
} //end while
}//end else
}// end if submit
else
{
header('Location: 1.php');
}
?>
PHP手册“oci\u num\u行”中的
:
此函数不返回选定的行数!选择
语句此函数将返回
使用oci_fetch*()函数提取到缓冲区
“无法通过登录页面”是什么意思?代码不执行?你有错误吗?请解释实际问题。发生了什么以及应该发生什么?有任何错误消息吗?请您也共享您的表单。?在此处显示您的表单代码。您应该将数据库中的密码保存为校验和。请参见,但我如何确认Select Station有效?有代码吗?我自己没有使用过oci函数,所以不太确定。检查我提供的链接,也许评论中的一些东西可以帮助你。