-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdmin.php
More file actions
140 lines (119 loc) · 3.38 KB
/
Admin.php
File metadata and controls
140 lines (119 loc) · 3.38 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
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
140
<?php
include('Connect.php');
if (isset($_POST['btnReg']))
{
$name=$_POST['txtAname'];
$ph=$_POST['txtAph'];
$email=$_POST['txtAemail'];
$password=$_POST['txtApsw'];
$address=$_POST['txtAaddr'];
$position=$_POST['txtAposition'];
$checkemail = "SELECT * from Admins Where AdminEmail='$email'";
$result=mysqli_query($connect,$checkemail);
$count=mysqli_num_rows($result);
if ($count>0)
{
echo "<script>window.alert('Admin Email Already Existed. Please Use Another Email')</script>";
echo "<script>window.location='Admin.php'</script>";
}
else
{
$insert="INSERT INTO Admins(AdminName, AdminPhNo, AdminEmail, AdminPassword, AdminAddress, AdminPosition)
VALUES ('$name','$ph','$email','$password','$address', '$position')";
$finalResult=mysqli_query($connect,$insert);
if ($finalResult) {
echo "<script>window.alert('Admin Register Successful!')</script>";
echo "<script>window.location='AdminLogin.php'</script>";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="Style4.css">
<title>Global Wild Swimming Camping</title>
</head>
<body>
<header>
<div class="logo">
<img src="Images/mainlogo3.jpg" alt="image" width="100px">
</div>
</header>
<div class="innerRG">
<div class="image-holder">
<img src="Images/admreg.jpg" alt="image">
</div>
<form action="Admin.php" method="POST" class="admreg">
<h3>Admin Registration Form</h3>
<div class="form-wrap">
<input type="text" name="txtAname" placeholder="Enter Admin Fullname" class="control">
</div>
<div class="form-wrap">
<input type="text" name="txtAph" placeholder="Enter Admin phone" class="control">
</div>
<div class= "form-warp">
<input type="text" name="txtAemail" placeholder="Enter Admin Email" class="control">
</div>
<div class="form-wrap">
<input type="password" name="txtApsw" placeholder="Enter Admin Password" class="control">
</div>
<div class="form-wrap">
<textarea name="txtAaddr" placeholder="Enter address"class="control"></textarea>
</div>
<div class="form-wrap">
<input type="text" name="txtAposition" placeholder="Enter Admin Position" class="control">
</div>
<input type="submit" name="btnReg" value="Register" class="btnar">
<a href="AdminLogin.php"><input type="submit" name="" value="Login" class="btnar"/>
</a>
</form>
</div>
<?php
$select = "SELECT * FROM Admins";
$query= mysqli_query($connect, $select);
$count=mysqli_num_rows($query);
if ($count==0)
{
echo "<p>No record for Admin </p>";
}
?>
<div>
<table border="1px">
<tr>
<th>ID</th>
<th>Admin Name</th>
<th>Admin Phone</th>
<th>Admin Email</th>
<th>Admin Position</th>
<th>Action</th>
</tr>
<?php
for ($i=0; $i <$count; $i++)
{
$data=mysqli_fetch_array($query);
$aid=$data['AdminID'];
$anm=$data['AdminName'];
$aph=$data['AdminPhNo'];
$aem=$data['AdminEmail'];
$apos=$data['AdminPosition'];
echo "<tr>";
echo "<td>$aid</td>";
echo "<td>$anm</td>";
echo "<td>$aph</td>";
echo "<td>$aem</td>";
echo "<td>$apos</td>";
echo "<td>
<a href='AdminUpdate.php?aID=$aid'>Update</a>|
<a href='AdminDelete.php?aID=$aid'>Delete</a>
</td>
";
echo "</tr>";
}
?>
</table>
</div>
</body>
</html>