-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathregistration.php
94 lines (89 loc) · 2.52 KB
/
registration.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
include_once 'include/class.user.php';
$user = new User();
// Checking for user logged in or not
/*if (!$user->get_session())
{
header("location:index.php");
}*/
if (isset($_POST['submit'])){
extract($_POST);
$register = $user->reg_user($fullname, $uname, $upass, $uemail);
if ($register) {
// Registration Success
echo "<div style='text-align:center'>Registration successful <a href='login.php'>Click here</a> to login</div>";
} else {
// Registration Failed
echo "<div style='text-align:center'>Registration failed. Email or Username already exits please try again.</div>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Register</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
</head>
<body>
<div id="container" class="container">
<h1>Registration Here</h1>
<form action="" method="post" name="reg">
<table class="table">
<tr>
<th>Full Name:</th>
<td>
<input type="text" name="fullname" required>
</td>
</tr>
<tr>
<th>User Name:</th>
<td>
<input type="text" name="uname" required>
</td>
</tr>
<tr>
<th>Email:</th>
<td>
<input type="email" name="uemail" required>
</td>
</tr>
<tr>
<th>Password:</th>
<td>
<input type="password" name="upass" required>
</td>
</tr>
<tr>
<td> </td>
<td>
<input class="btn" type="submit" name="submit" value="Register" onclick="return(submitreg());">
</td>
</tr>
<tr>
<td> </td>
<td><a href="login.php">Already registered? Click Here!</a></td>
</tr>
</table>
</form>
</div>
<script>
function submitreg() {
var form = document.reg;
if (form.name.value == "") {
alert("Enter name.");
return false;
} else if (form.uname.value == "") {
alert("Enter username.");
return false;
} else if (form.upass.value == "") {
alert("Enter password.");
return false;
} else if (form.uemail.value == "") {
alert("Enter email.");
return false;
}
}
</script>
</body>
</html>