-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin.php
55 lines (48 loc) · 1.56 KB
/
admin.php
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
$db_host = 'localhost';
$db_user = 'root';
$db_pass = 'helloqsctech';
$db_chosen = 'cipher';
?>
<html>
<head>
<title>求是潮技术大赛 - 管理界面</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="http://fonts.googleapis.com/css?family=Press+Start+2P|VT323" rel="stylesheet" type="text/css">
<link href="style.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<div id="content">
<h1>QSCTech</h1>
<?php
if(!isset($_POST['user'])) {
?>
<form id="pass" method="POST" action="admin.php" align="center">
<label>Username:</label><input type="text" name="user"><br>
<label>Password:</label><input type="password" name="pass"><br><br>
<input type="submit" value="Login">
</form>
<?php
} else {
$link = mysql_connect($db_host,$db_user,$db_pass) or die('Could not connect: ' . mysql_error());
mysql_select_db($db_chosen) or die('Could not select database');
mysql_query('set names utf8');
$user = $_POST['user'];
$pass = $_POST['pass'];
$result = mysql_query("SELECT * FROM `auth` WHERE `user`='$user' AND `pass`='$pass'");
if (mysql_num_rows($result) == 0) {
echo '<p style="text-align: center;">Permission denied.</p>';
} else {
$row = mysql_fetch_assoc($result);
echo '<p>';
foreach ( $row as $key=>$value ) {
echo "$key: $value<br>";
}
echo '</p>';
}
}
?>
</div>
</body>
</html>