forked from EddwaardHaar/Group_8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kirjauduajax.html
80 lines (71 loc) · 2.47 KB
/
kirjauduajax.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="assets/style.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<header>
<a href="Home.html"><img src="assets/images/2560px-Sodexo_logo.svg.png"
width="10%";
height="auto" /></a>
<h3> <a href="index.html">Home</a>     <a href="Menu.html">Menu</a>     <a href="OpenTime.html">Open time</a>     <a href="AboutUs.html">About us</a>    <a href="forum.php">Forum</a></h3>
</header>
<kuva><img id="coffee1"src="assets/images/coffeeBeans4.jpg" alt="coffeeBeans"></kuva>
<main>
<login>
<script>
function lahetaKayttaja(lomake){
var user=new Object();
user.username=lomake.username.value;
user.password=lomake.password.value;
var jsonUser=JSON.stringify(user);
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if (this.responseText=="admin"){
window.location.assign("/tervetuloaAdmin.php");
}
else if (this.responseText=="user"){
window.location.assign("/tervetuloa.php");
}
else{
document.getElementById("result").innerHTML = "User not found";
}
}
};
xmlhttp.open("POST", "kirjauduajax.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send("user=" + jsonUser);
}
</script>
<h2>Login</h2>
<form id='userlomake'>
Username: <input type='text' name='username' value='' placeholder='Username...'><br>
Password: <input type='password' name='password' value='' placeholder='password...'><br>
<input type='button' name='ok' value='Send' onclick='lahetaKayttaja(this.form);'><br>
</form>
<p id='result'>
</p>
<p> No account? Click <a href="rekisteroidy.html">here</a></p>
</body>
</html>
</main>
<footer>
<address>
<ul class="list">
<li><b>Sodexo Oy</b></li>
<li>Vankanlähde 9</li>
<li>1313 Hämeenlinna</li>
<li>p. 010 540 7000</li>
<li>[email protected]</li>
<li>[email protected]</li>
<li><a href="kirjauduajax.html">login</a> </li>
</ul>
</address>
</footer>
</body>
</html>