-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsign_up.php
66 lines (64 loc) · 2.72 KB
/
sign_up.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
<?php
writeHeader("");
?>
<div class="container">
<div class="col s12 l8 offset-l2 z-depth-3" style="margin-top: 20px; padding: 0 50px 20px;">
<h2 class="title">Sign Up</h2>
<div class="row">
<div class="input-field col s12">
<input type="text" name="username" id="username" required>
<label for="username">Username</label>
</div>
<div class="input-field col s12 m6">
<input type="text" name="first_name" id="first_name" required>
<label for="first_name">First Name</label>
</div>
<div class="input-field col s12 m6">
<input type="text" name="last_name" id="last_name" required>
<label for="last_name">Last Name</label>
</div>
<div class="input-field col s12">
<input type="email" name="email" id="email" required>
<label for="email">Email</label>
</div>
<div class="input-field col s12 m6">
<input type="password" name="password" id="password" required>
<label for="password">Password</label>
</div>
<div class="input-field col s12 m6">
<input type="password" name="confirm" id="confirm" required>
<label for="confirm">Confirm Password</label>
</div>
</div>
<div class="center-align">
<a onclick="signUp()" class="waves-effect waves-light btn-large blue lighten-1">Sign Up</a>
</div>
<p>Already have an account? <a href="./index.php?action=show_log_in">Log In</a></p>
</div>
</div>
<script>
function signUp() {
username = $("#username").val();
first_name = $("#first_name").val();
last_name = $("#last_name").val();
email = $("#email").val();
password = $("#password").val();
confrm = $("#confirm").val();
$.ajax({
type: "POST",
dataType: "json",
url: "./index.php",
data: "action=sign_up&username=" + username + "&first_name=" + first_name + "&last_name=" + last_name + "&email=" + email + "&password=" + password + "&confirm=" + confrm,
complete: function(data) {
var json = JSON.parse(JSON.stringify(data));
var message = json["responseJSON"]["message"];
M.toast({html: message});
if (!json["responseJSON"]["error"]) {
setTimeout(2000);
location.href = "activate";
}
}
});
}
</script>
<?php writeFooter() ?>