-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
60 lines (47 loc) · 1.4 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
59
60
<?php
ob_start();
session_start();
?>
<!doctype html>
<html lang="en">
<?php require_once 'head.php';?>
<body>
<script src="js/scripts.js"></script>
<h1>Kingdom Death Monsters</h1>
<dd> <h3>the nightmare horror board game</h3></dd>
<?php
require_once 'database.php';
$con=mysqli_connect($db_host, $db_username, $db_password,$db_name);
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if ((empty($_GET['username'])) || (empty($_GET['password']))){
?>
<form id='login' action='index.php' method='get' accept-charset='UTF-8'>
Login<br>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<label for='username' >UserName:</label>
<input type='text' name='username' id='username' maxlength="50" />
<label for='password' >Password:</label>
<input type='password' name='password' id='password' maxlength="50" />
<input type='submit' name='Submit' value='Submit' />
</form>
<?php
}else{
$username = $_GET['username'];
$password = $_GET['password'];
$login = mysqli_fetch_assoc(mysqli_query($con, "SELECT * FROM login WHERE username = '$username' AND password = '$password'"));
if(!$login)
{
// Fetch one and one row
echo "ERROR! T'as mal entré tes affaires!";
}else{
$_SESSION['name'] = $login['name'];
header('Location:NewLoad.php');}
mysqli_close($con);
}
?>
</body>
</html>