-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
84 lines (68 loc) · 2.21 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!-- import the page header -->
<?php include('src/header.php') ?>
<main id="swup" class="transition-fade main-login">
<form>
<div class="uname-password">
<img class="login-image" src="src/img/logoKormaTron.png" alt="logo">
<br>
<div class='login-div'>
<label class="login-label"><b>Username</b></label>
<input class="login-input" id="username" type="text" placeholder="Enter Username" name="username" required>
<label class="login-label"><b>Password</b></label>
<input class="login-input" id="password" type="password" placeholder="Enter Password" name="password" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');" required>
</div>
<a id="login-btn" class="login-button" type="submit">Login</a>
<!--choose language -->
<div class="login-div">
<label id="english" class="language-check">🇬🇧
<input name="lang" type="radio" checked="checked" value="en">
<span class="checkmark"></span>
</label>
<label id="dutch" class="language-check">🇳🇱
<input name="lang" type="radio" value="nl">
<span class="checkmark"></span>
</label>
</div>
</div>
</form>
</main>
<script>
$(document).ready(function() {
$("#login-btn").click(function(e) {
e.preventDefault();
doLogin();
});
function doLogin() {
var username = $("#username").val();
var password = $("#password").val();
$.ajax({
type: "POST",
url: "src/db/login_code.php",
data: ({
"username": username,
"password": password,
"lang": $("input[name='lang']:checked").val()
}),
success: function(response) {
if (response.includes(true)) {
location.href = "src/mainmenu.php";
} else {
iziToast.error({
title: 'Error',
message: 'Login failed',
});
}
}
});
}
});
</script>
<style>
body {
background: rgb(3, 119, 187);
background: linear-gradient(90deg, rgba(3, 119, 187, 1) 0%, rgba(47, 50, 65, 1) 50%, rgba(3, 119, 187, 1) 100%);
}
html {
height: 100%;
}
</style>