-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbejelentkezes.php
53 lines (42 loc) · 1.51 KB
/
bejelentkezes.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
<div class="login-body">
<div class = "login-frame">
<div class = "login-top "><p><h1>Bejelentkezés</h1></p></div>
<div ><p><input class = "login-input" type="email" placeholder="Email cím" id="email"></p></div>
<div ><p><input class = "login-input-2" type="text" placeholder="Jelszó" id="password"></p></div>
<div ><p><button type="submit" id="button" class = "login-button">Belépés</button></p></div>
</div>
</div>
</body>
</html>
<script>
function isEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
$('#button').click(function() {
if (isEmail($('#email').val())){
$.ajax({
url: "ajaxrequest.php",
method: "POST",
data: {
requestType: "logIn",
emailAddress: $('#email').val(),
password: $('#password').val()
},
dataType: "json",
success:function(data){
if(data.success){
window.location.href = "index.php";
}else{
console.log(data.message);
}
},
error:function(error){
console.log(error.responseText);
}
});
} else {
alert("Helytelen email");
}
});
</script>