-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
139 lines (123 loc) · 4.31 KB
/
register.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
include 'conn.php';
error_reporting(0);
session_start();
if (isset($_SESSION['username'])) {
header("Location: login.php");
}
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$email = $_POST['email'];
$password =md5($_POST['password']);
$cpassword =md5($_POST['confirmpass']);
if ($password == $cpassword) {
$sql = "SELECT * FROM `admins` WHERE email='$email'";
$result = mysqli_query($con, $sql);
// echo mysqli_num_rows($result);
if (!$result->num_rows > 0) {
$sql = "INSERT INTO `admins` (`username`, `email`, `password`) VALUES ('$username', '$email', '$password')";
$result = mysqli_query($con, $sql);
if ($result) {
echo "<script>alert('Wow! User Registration Completed.')</script>";
$username = "";
$email = "";
$password= "";
$cpassword= "";
header("Location: login.php");
} else {
echo "<script>alert('Woops! Something Wrong Went.')</script>";
}
} else {
echo "<script>alert('Woops! Email Already Exists.')</script>";
}
} else {
echo "<script>alert('Password Not Matched.')</script>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AdminLTE 3 | Registration Page (v2)</title>
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
<!-- icheck bootstrap -->
<link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/adminlte.min.css">
</head>
<body class="hold-transition register-page">
<div class="register-box">
<div class="card card-outline card-primary">
<div class="card-header text-center">
<a href="index2.html" class="h1"><b>Admin</b>LTE</a>
</div>
<div class="card-body">
<p class="login-box-msg">Register a new membership</p>
<form action="" method="post">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="username" name="username" required>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-user"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="email" class="form-control" placeholder="Email" name="email" required>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-envelope"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" placeholder="Password" name="password" required>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" placeholder="Retype password" name="confirmpass" required>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<div class="icheck-primary">
<input type="checkbox" id="agreeTerms" name="terms" value="agree" required>
<label for="agreeTerms">
I agree to the <a href="#">terms</a>
</label>
</div>
</div>
<!-- /.col -->
<div class="col-4">
<button type="submit" class="btn btn-primary btn-block" name="submit">Register</button>
</div>
<!-- /.col -->
</div>
</form>
<a href="login.php" class="text-center">I already have a membership</a>
</div>
<!-- /.form-box -->
</div><!-- /.card -->
</div>
<!-- /.register-box -->
<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
</body>
</html>