/
index.php
executable file
·58 lines (57 loc) · 1.92 KB
/
index.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
56
57
58
<?php
require_once dirname(__FILE__) . "/library/DB.php";
require_once dirname(__FILE__) . "/config/config.php";
session_start();
$db = new DB();
$db->db_connect();
if(isset($_SESSION["user"])) {
header("Location: list.php");
}
if(isset($_POST["eid"])) {
$sql = "SELECT * FROM user WHERE (user_eid = '" . $db->db_escape_string($_POST["eid"]) . "' OR LOWER(user_nick_name) = LOWER('" . $db->db_escape_string($_POST["eid"]) . "')) AND active = 1";
$rs = $db->db_query($sql);
$user = $db->fetch_array($rs);
if(!$user){
$errors = "EID not exist";
}else {
$_SESSION["user"] = $user;
header("Location: list.php");
};
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="/bower_components/Materialize/dist/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Let browser know website is optimized for mobile-->
</head>
<body>
<div class="container">
<h1>Thanks Card</h1>
<p>Please enter your EID</p>
<?php if(isset($errors)) {
echo "
<div class='card-panel red darken-1'>{$errors}</div>
";
}?>
<form name="thanks" action="index.php" method="post">
<p><input type="text" name="eid" placeholder="Your name"></p>
<p>
<button class="btn waves-effect waves-light" type="submit" name="action">Login
<i class="material-icons right">send</i>
</button>
</p>
</form>
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="/bower_components/jquery/dist/jquery.min.js"></script>
<script>
$("input[name='eid']").focus();
</script>
<!-- Compiled and minified JavaScript -->
<script src="/bower_components/Materialize/dist/js/materialize.min.js"></script>
</body>
</html>