-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcreate_user.php
More file actions
executable file
·28 lines (28 loc) · 973 Bytes
/
create_user.php
File metadata and controls
executable file
·28 lines (28 loc) · 973 Bytes
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
<?php
//Create User
include_once('config.php');
if(isset($_POST['Submit']))
{
$name = mysql_real_escape_string($_POST['name']);
$username = mysql_real_escape_string($_POST['username']);
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
$password = md5($password);
$department = mysql_real_escape_string($_POST['department']);
$CheckUserSQL = mysql_num_rows(mysql_query("SELECT * FROM admin_user WHERE username='$username'"));
if($CheckUserSQL > 0)
header('Location: add_user.php?error=Username Exists');
else
{
$CreateUser = mysql_query("INSERT into admin_user (username,email,name,password,department,role) values ('$username','$email','$name','$password','$department','admin')");
if($CreateUser)
header ('Location: add_user.php?success=1');
else
header("Location: add_user.php?error=Contact Admin");
}
}
else
{
header ('Location: add_user.php');
}
?>