PHP登录界面

时间:2015-11-04 09:21:29

标签: php html oci

我正在使用PHP制作登录屏幕。我有一个HTML文件和一个PHP文件。我的HTML是

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link rel="stylesheet" type="text/css" href="Loginscreen.css" />
    <title>Inloggen</title>
</head>
<body>

<div id="login">
  <div id="triangle"></div>
  <h1>Inloggen</h1>
  <form method="get" action="Control.php">
    <input type="text" placeholder="Gebruikersnaam" name="log" required />
    <input type="password" placeholder="Wachtwoord" name ="pas" required />
    <input type="submit" value="Inloggen" />
  </form>
</div>
</body>
</html>

我的PHP代码:

<?php

$conn = oci_connect('test', 'test', 'test');
$username1 = $_GET['log'];
$password1 = $_GET['pas'];
$array = oci_parse($conn, "SELECT test_A, test_b FROM test WHERE test_A = '$username1'  AND test_b =  '$password1'");
$query = oci_execute($array);

$count = oci_fetch_row($array);

if($count > 1){
    session_start();
    $_SESSION['Login'] = "1";
    header("Location: page1.html");
}
else {
    ?>
<script>
    alert("Wrong username/password");
    location.href = "Login.php";
</script>
<?php
    session_start();
    $_SESSION['Login'] = "";
}
?>

当我提交时,页面出错:

define() expects at least 2 parameters 1 given at line 3 from the php file

如何修复此错误? 我试图在连接字符串周围设置一个定义,但后来我得到了同样的错误。

1 个答案:

答案 0 :(得分:3)

define的功能应该是:

define('YOUR_CONST','YOUR_VALUE');

参考:

http://php.net/manual/en/function.define.php