-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
63 lines (58 loc) · 2.32 KB
/
signup.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
<html dir = "rtl">
<head>
<meta charset="utf-8"/>
<title>رایانش</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
var urlParams = new URLSearchParams(window.location.search);
var userid = urlParams.get('userid');
var inviter = urlParams.get('inviter');
function ajax(destination, request, responseHandle) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
responseHandle(this.responseText);
}
};
xhttp.open("POST", destination, true);
xhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhttp.setRequestHeader('Content-Type', 'application/json');
xhttp.send(request);
}
function register()
{
var username = document.getElementbyId('btnRegister').value;
registerRequest = {userid: userid, username: username};
if(inviter != null)
registerRequest.inviter = inviter;
ajax("register.php", JSON.stringify(registerRequest), verifyRegisteration);
}
funciton verifyRegisteration(response)
{
//TODO: replace alerts with better buddies
response = JSON.parse(response);
if(response['success'])
{
alert("بزن بریم :)");
document.location = "redirect.php?userid=" + userid;
}
else
{
alert(response['errorMsg']);
}
}
</script>
</head>
<body>
<div id = "whole">
<div id = "controls">
<div>ثبت نام</div>
<input type = "text" id = "username">
<input type = "button" value = "بزن بریم!" id = "btnRegister" onclick = "register()">
<div>برای ثبت نام از نام کاربری و گذرواژه ایمیل ce.sharif.edu@ات استفاده کن.
نام کاربری اون چیزیه که قبل @ تو میل سیای میاد. </div>
</div>
<div id = "credit">Photo by Kelli Tungay on Unsplash</div>
</div>
</body>
</html>