-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsertadmin.php
27 lines (26 loc) · 959 Bytes
/
insertadmin.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
<?php
include_once 'connection.php';
$username = $_POST["username"];
$email = $_POST["email"];
$password = $_POST["password"];
$connpassword = $_POST["conpassword"];
$mobile = $_POST["mobile"];
$fullname = $_POST["fullname"];
$qury = "select * from admin where username='$username'";
$result = mysqli_query($conn, $qury);
if (mysqli_num_rows($result) > 0) {
header("Location:add_admin.php?er=0");
} else {
if ($password == $connpassword) {
$qury = "INSERT INTO `admin`(`username`, `email`, `password`, `mobile`, `fullname`) VALUES ('$username','$email','$password','$mobile','$fullname')";
if (mysqli_query($conn, $qury)) {
echo "Insert Success";
header("Location:add_admin.php?er=1");
} else {
echo "Insert Failed";
header("Location:add_admin.php?er=2");
}
} else {
header("location:add_admin.php?msg=Password and confirm password could not match");
}
}