-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
69 lines (64 loc) · 2.32 KB
/
login.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
59
60
61
62
63
64
65
66
67
68
69
<?php
SESSION_START();
INCLUDE_ONCE 'php/sql_cls.php';
$error = FALSE;
IF( ARRAY_KEY_EXISTS('User', $_SESSION) ){
UNSET($_SESSION["User"]);
HEADER( "location: index.php" );
}ELSE IF( ARRAY_KEY_EXISTS( "userName", $_POST ) && ARRAY_KEY_EXISTS( "password" , $_POST )){
$sql_Check = new sql_cls;
$check = $sql_Check->loginCheck($_POST["userName"] , $_POST["password"]);
IF($check["Access"]){
$_SESSION["User"] = $check["Info"];
HEADER( "location: index.php" );
}ELSE{
$error = TRUE;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/gameStyle.css" media="screen" />
<title>gameInterface</title>
</head>
<body>
<div class='pageHeader'>
Game Library
</div>
<div id='navBar'>
<div id='btnContainer'>
<div class='menuBtn'><a href='insertGame.php' class='menuSel'>Add Game</a></div>
<div class='menuBtn'><a href='showGames.php' class='menuSel'>Show Games</a></div>
<div class='menuBtn'><a href='returnGame.php' class='menuSel'>Search Games</a></div>
<div class='menuBtn'><a href='' class='menuSel'>Edit Game</a></div>
<!--<div class='menuBtn'>Add Game Cover</div>-->
</div>
</div>
<div id="login_Container">
<h3>Log In</h3>
<form method="post" action="login.php">
<p>
<label for='userName'>User Name or Email</label><input type='text' value='<?php IF(array_key_exists('userName', $_POST)) ECHO $_POST["userName"]; ELSE ECHO "";?>' name='userName' id='userName'/><br/>
<?php
if(array_key_exists('userName', $_POST) && $_POST["userName"] == "")
ECHO "<span class='error'>User Name or Email is Required</span>";
?>
</p>
<p>
<label for='password'>Password</label><input type='password' value='<?php IF(array_key_exists('password', $_POST)) ECHO $_POST["password"]; ELSE ECHO "";?>' name='password' id='password'/><br />
<?php
if(array_key_exists("password", $_POST) && $_POST['password'] == "")
ECHO "<span class='error'>Password is Required</span>";
?>
</p>
<input type='submit' name='login' class='largeSubmit' value='Log In'/>
<?php
IF($error)
ECHO "<span class='error'><br/><br/>ERROR LOGGING <br/> Please make sure that email/UserName and Password is correct </span>";
?>
</form>
</div>
</body>
</html>