-
Notifications
You must be signed in to change notification settings - Fork 1
/
account_add_action.php
122 lines (105 loc) · 5.34 KB
/
account_add_action.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
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
<?php
include("db.php");
if(isset($_POST['Submit']))
{
if ($_POST['account_add_gender'] == 'Male')
{
$account_add_img = "img/emp_profile/maletmp.png";
}
else
{
$account_add_img = "img/emp_profile/femaletmp.png";
}
$account_add_accLevel = $_POST['account_add_Level'];
$account_add_username = $_POST['account_add_username'];
$account_add_name = $_POST['account_add_name'];
$account_add_password = $_POST['account_add_password'];
$account_add_repassword = $_POST['account_add_repassword'];
$account_add_email = $_POST['account_add_email'];
$account_add_address = $_POST['account_add_address'];
$account_add_age = $_POST['account_add_age'];
$account_add_gender = $_POST['account_add_gender'];
$account_add_mobile = $_POST['account_add_mobile'];
$account_add_position = $_POST['account_add_position'];
$chkPost = mysql_real_escape_string($_POST['account_add_username']);
$chkRes = mysql_query("SELECT username FROM emp_accounts_record WHERE username = '$chkPost'");
$chkUser = mysql_fetch_array($chkRes);
if (empty($account_add_img) ||empty($account_add_name)||empty($account_add_password)||empty($account_add_repassword)||empty($account_add_email)||empty($account_add_mobile)||empty($account_add_position)||empty($account_add_age)||empty($account_add_gender)||empty($account_add_username))
{
if (empty($account_add_img)) {
echo "<script>alert('Pleaes Choose Some Image!');
window.location='account.php';
</script>";
}
if (empty($account_add_name)) {
echo "<script>alert('Name is Empty!');
window.location='account.php';
</script>";
}
if (empty($account_add_username)) {
echo "<script>alert('Username is Empty!');
window.location='account.php';
</script>";
}
if (empty($account_add_password)) {
echo "<script>alert('Password is Empty!');
window.location='account.php';
</script>";
}
if (empty($account_add_repassword)) {
echo "<script>alert('Repassword is Empty!');
window.location='account.php';
</script>";
}
if (empty($account_add_email)) {
echo "<script>alert('Email is Empty!');
window.location='account.php';
</script>";
}
if (empty($account_add_mobile)) {
echo "<script>alert('Mobile Number is Empty!');
window.location='account.php';
</script>";
}
if (empty($account_add_age)) {
echo "<script>alert('Mobile Number is Empty!');
window.location='account.php';
</script>";
}
if (empty($account_add_gender)) {
echo "<script>alert('Mobile Number is Empty!');
window.location='account.php';
</script>";
}
if (empty($account_add_position)) {
echo "<script>alert('Position is Empty!');
window.location='account.php';
</script>";
}
}
else if ($account_add_username != $chkUser['username'])
{
if ($account_add_password == $account_add_repassword)
{
$sql = "INSERT INTO emp_accounts_record (accLevel, username, password, fullName, Age, Gender, Address, Email, Pos, Mobile, image) ";
$sql.= "VALUES ('$account_add_accLevel','$account_add_username','$account_add_password','$account_add_name','$account_add_age','$account_add_gender','$account_add_address','$account_add_email','$account_add_position','$account_add_mobile','$account_add_img')";
$result = mysqli_query($con,$sql);
echo "<script>alert('Register Successfully!');
window.location='account.php';
</script>";
}
else
{
echo "<script>alert('Password not match!');
window.location='account.php';
</script>";
}
}
else// if user exits
{
echo "<script>alert('This Username Already Taken!');
window.location='account.php';
</script>";
}
}
?>