-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass1.php
More file actions
36 lines (30 loc) · 847 Bytes
/
class1.php
File metadata and controls
36 lines (30 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
header("Content-Type: text/html;charset=utf-8");
$servername = "localhost";
$username = "root";
$password = "syspwd";
$dbname = "myDB";
$conn = new mysqli($servername,$username,$password,$dbname);
if (mysqli_connect_error()) {
die("数据库连接失败: " . mysqli_connect_error());
} // connect
$sql = "select name,password from register";
$result = $conn->query($sql);
$gname = null;
$gpassword = null;
$gname = $_POST["name"];
$gpassword = $_POST["password"];
$mark = FALSE;
while($row = $result->fetch_assoc()) {
if($gname == $row['name'] && $gpassword == $row['password']){
echo "Right"."<br/>";
$mark = TRUE;
break;
}
}
if(!$mark){
echo "Wrong"."<br/>";
}
echo "<a href = 'class1.html'><button>Homepage</button></a>";
$conn->close();
?>