2个页面:
conn.php<?php
$con = oci_connect("finaltest","finaltestpw","(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.19.101.72)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ENGDB01)
))
");
if (!$con)
{
die('Could not connect: ' . oci_error());
}
?>
login.php<?php
session_start();
//session_unregister('bs_Account');
//session_unregister('bs_Role'); echo 'Login...';
if ($_POST['username'] == "")
{
echo "<Script language='JavaScript'> alert('Please enter username');</Script>";
echo "<script>location.href='index.php'</script>";
exit;
}
include('conn.php');
$sql = "SELECT * FROM `user` WHERE `Account`='".strtolower($_POST['username'])."' LIMIT 1";
$result = oci_parse($con,$sql);
oci_execute($result);
if (oci_num_rows($result) == 0)
{
echo "<Script language='JavaScript'> alert('Username error!');</Script>";
echo "<script>location.href='index.php'</script>";
oci_close($con);
exit;
}
$row = oci_fetch_array($result);
if ($row['Password'] == md5($_POST['passwd']))
{
$_SESSION['bs_Account'] = $row['Account'];
$_SESSION['bs_Role'] = $row['Role'];
$_SESSION['bs_PerferListCount'] = $row['PerferListCount'];
oci_close($con);
echo "<script>location.href='switch-status.php'</script>";
}
else
{
echo "<Script language='JavaScript'> alert('Password error!');</Script>";
oci_close($con);
echo "<script>location.href='index.php'</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Login...</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<body>
</body>
</html>
现在login.php页面报错:
warning: oci_parse() : expects parameter 1 to be resource,null given in......请问怎么会找不到参数?
conn.php<?php
$con = oci_connect("finaltest","finaltestpw","(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.19.101.72)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ENGDB01)
))
");
if (!$con)
{
die('Could not connect: ' . oci_error());
}
?>
login.php<?php
session_start();
//session_unregister('bs_Account');
//session_unregister('bs_Role'); echo 'Login...';
if ($_POST['username'] == "")
{
echo "<Script language='JavaScript'> alert('Please enter username');</Script>";
echo "<script>location.href='index.php'</script>";
exit;
}
include('conn.php');
$sql = "SELECT * FROM `user` WHERE `Account`='".strtolower($_POST['username'])."' LIMIT 1";
$result = oci_parse($con,$sql);
oci_execute($result);
if (oci_num_rows($result) == 0)
{
echo "<Script language='JavaScript'> alert('Username error!');</Script>";
echo "<script>location.href='index.php'</script>";
oci_close($con);
exit;
}
$row = oci_fetch_array($result);
if ($row['Password'] == md5($_POST['passwd']))
{
$_SESSION['bs_Account'] = $row['Account'];
$_SESSION['bs_Role'] = $row['Role'];
$_SESSION['bs_PerferListCount'] = $row['PerferListCount'];
oci_close($con);
echo "<script>location.href='switch-status.php'</script>";
}
else
{
echo "<Script language='JavaScript'> alert('Password error!');</Script>";
oci_close($con);
echo "<script>location.href='index.php'</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Login...</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<body>
</body>
</html>
现在login.php页面报错:
warning: oci_parse() : expects parameter 1 to be resource,null given in......请问怎么会找不到参数?
连接参数不需要写那么多吧!