-
Notifications
You must be signed in to change notification settings - Fork 0
/
regisztracio.php
59 lines (47 loc) · 2 KB
/
regisztracio.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
<div id="registration-whole-container">
<div id="registration-container">
<div id="registration-title"><h1>Regisztráció</h1></div>
<p><input class="login-input" type="text" placeholder = "Felhasználónév" id ="text"></p>
<p><input class="login-input" type="email" placeholder = "Email cím" id = "email"></p>
<p><input class="login-input" type = "text" placeholder ="Jelszó" id = "password"></p>
<p><input class="login-input" type = "text" placeholder ="Jelszó megismétlése" id = "passwordagain"></p>
<p><button class="login-button"t ype = "submit" id = "button">Regisztrálás</button></p>
</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())){
if ($('#password').val() == $('#passwordagain').val() && $('#password').val() != ""){
$.ajax({
url: "ajaxrequest.php",
method: "POST",
data: {
requestType: "registration",
userName: $('#text').val(),
emailAddress: $('#email').val(),
password: $('#password').val()
},
dataType: "json",
success:function(data){
if (data.success){
window.location.href = "index.php";
}
},
error:function(error){
console.log(error.responseText);
}
});
} else {
alert("A két jelszó nem egyezik.");
}
} else {
alert("Helytelen email");
}
});
</script>