我正在尝试使用 uni 连接到 oracle 服务器。我认为它确实连接但是我无法从表中选择以检查登录凭据是否相同以便登录。我也尝试过其他方法,但这是我迄今为止最接近的方法。问题出在 oci_bin 部分,它显示错误,但我不知道有其他方法可以解决这个问题。
<?php
session_start();
if(!isset($_POST['username']) || !isset($_POST['password'])) {
header("Location: ../session.php");
}
putenv("ORACLE_SID=teaching");
if ($Connection = oci_connect("w4e09", "melih312")) {
print "Connection OK \n";}
if(isset($_SESSION['loggedin'])) header("Location: ../secret.php");
$Statement = oci_parse($Connection, 'select *
from Company
where address = :un_bv
and email = :pw_bv' );
Oci_bind_by_name($s, ":un_bv", $_POST['username']);
Oci_bind_by_name($s, ":pw_bv", $_POST['password']);
oci_execute($s);
$r = oci_fetch_array($s, OCI_ASSOC);
}
if ($r) {
$_SESSION['loggedin']=TRUE; $_SESSION['username']="admin";
}
else {
// No rows matched so login failed
login_form('Login failed. Valid usernames/passwords ' .
'are "chris/tiger" and "alison/red"');
}
header("Location: secret.php");
?>
qq_笑_17
相关分类