-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserRegistration.php
53 lines (52 loc) · 2.57 KB
/
UserRegistration.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
<?php
include('dbConnection.php');
if(isset($_REQUEST['rSignup'])){
// Checking for Empty Fields
if(($_REQUEST['rName'] == "") || ($_REQUEST['rEmail'] == "") || ($_REQUEST['rPassword'] == "")){
$regmsg = '<div class="alert alert-warning mt-2" role="alert"> All Fields are Required </div>';
} else {
$sql = "SELECT r_email FROM requesterlogin_tb WHERE r_email='".$_REQUEST['rEmail']."'";
$result = $conn->query($sql);
if($result->num_rows == 1){
$regmsg = '<div class="alert alert-warning mt-2" role="alert"> Email ID Already Registered </div>';
} else {
// Assigning User Values to Variable
$rName = $_REQUEST['rName'];
$rEmail = $_REQUEST['rEmail'];
$rPassword = $_REQUEST['rPassword'];
$sql = "INSERT INTO requesterlogin_tb(r_name, r_email, r_password) VALUES ('$rName','$rEmail', '$rPassword')";
if($conn->query($sql) == TRUE){
$regmsg = '<div class="alert alert-success mt-2" role="alert"> Account Succefully Created </div>';
} else {
$regmsg = '<div class="alert alert-danger mt-2" role="alert"> Unable to Create Account </div>';
}
}
}
}
?>
<div class="container pt-5" id="registration">
<h2 class="text-center">Create an Account</h2>
<div class="row mt-4 mb-4">
<div class="col-md-6 offset-md-3">
<form action="" class="shadow-lg p-4" method="POST">
<div class="form-group">
<i class="fas fa-user"></i><label for="name" class="pl-2 font-weight-bold">Name</label><input type="text"
class="form-control" placeholder="Name" name="rName">
</div>
<div class="form-group">
<i class="fas fa-user"></i><label for="email" class="pl-2 font-weight-bold">Email</label><input type="email"
class="form-control" placeholder="Email" name="rEmail">
<!--Add text-white below if want text color white-->
<small class="form-text">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<i class="fas fa-key"></i><label for="pass" class="pl-2 font-weight-bold">New
Password</label><input type="password" class="form-control" placeholder="Password" name="rPassword">
</div>
<button type="submit" class="btn btn-danger mt-5 btn-block shadow-sm font-weight-bold" name="rSignup">Sign Up</button>
<em style="font-size:10px;">Note - By clicking Sign Up, you agree to our <a href="#">Term & Conditions</a></em>
<?php if(isset($regmsg)) {echo $regmsg; } ?>
</form>
</div>
</div>
</div>