-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistration.php
More file actions
112 lines (82 loc) · 3.63 KB
/
Copy pathregistration.php
File metadata and controls
112 lines (82 loc) · 3.63 KB
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
<?php include "includes/db.php"; ?>
<?php include "includes/header.php"; ?>
<!-- Navigation -->
<?php include "includes/navigation.php"; ?>
<?php
if (isset($_POST['register'])) {
//echo "registered";
$username = $_POST['username'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$phone_no = $_POST['phone_no'];
$password = $_POST['password'];
$image = $_FILES['image']['name'];
$tmp_image = $_FILES['image']['tmp_name'];
move_uploaded_file($tmp_image, "images/$image");
if ($image == "") {
$image = "user_default.jpg";
}
if ($username=="" || $firstname=="" || $lastname=="" || $email=="" || $phone_no=="" || $image=="" || $password=="") {
# code...
echo "**ALL FIELDS MANDATORY";
}
elseif (strlen($phone_no)!=10) {
# code...
echo "**PhoneNo Must Contain Of 10 bits";
}
else {
$query = "INSERT INTO users(username, user_password, user_firstname, user_lastname, user_email, user_phoneno, user_role, user_image) VALUES('$username', '$password', '$firstname', '$lastname', '$email', '$phone_no', 'subscriber', '$image') ";
$register_user = mysqli_query($connection, $query);
if(!$register_user) {
die("Query Failed" . mysqli_error($connection));
}
header("Location: index.php");
}
}
?>
<!-- Page Content -->
<!-- <div class="container jumbotron" style="width: 45%; border-radius: 15px"> -->
<div class="container">
<div class="row">
<div class="col-lg-6">
<img src="images/bus_regis.png" style="margin-top: 30%;">
</div>
<div class="col-lg-6">
<h2 style="margin-left: 40%;">Registration</h2>
<form action="" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="email">Username:</label>
<input type="text" class="form-control" id="email" placeholder="Enter Username" name="username">
</div>
<div class="form-group">
<label for="email">Firstname:</label>
<input type="text" class="form-control" id="email" placeholder="Enter Firstname" name="firstname">
</div>
<div class="form-group">
<label for="email">Lastname:</label>
<input type="text" class="form-control" id="email" placeholder="Enter Lastname" name="lastname">
</div>
<div class="form-group">
<label for="bus-image">UserImage</label>
<input type="file" name="image" >
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
</div>
<div class="form-group">
<label for="pwd">Phone No:</label>
<input type="text" class="form-control" id="pwd" placeholder="Enter password" name="phone_no">
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" placeholder="Enter password" name="password">
</div>
<button type="submit" class="btn btn-primary" name="register" style="margin-left: 45%; margin-top: 20px;">Register</button>
</form>
</div>
</div>
</div>
<hr>
<?php include "includes/footer.php"; ?>