-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_user.php
More file actions
52 lines (45 loc) · 1.46 KB
/
Copy pathcreate_user.php
File metadata and controls
52 lines (45 loc) · 1.46 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
<?
session_start();
require './connect.php';
if (isset($_POST['submitLoginDetails'])) {
if ($_POST['loginId'] != NULL) {
$user_Id = $_POST['loginId'];
} else {
echo "User ID Not Entered";
exit;
}
if ($_POST['selectUser'] != '-select-') {
$user = $_POST['selectUser'];
} else {
echo "User Not Select";
exit;
}
if ($_POST['userLoginName'] != NULL) {
$user_Login_Name = $_POST['userLoginName'];
} else {
echo "User Name Not entered";
exit;
}
if ($_POST['userLoginPassword'] != NULL) {
$user_Login_Password = $_POST['userLoginPassword'];
} else {
echo "User Login Password Not Entered";
exit;
}
$sqlInsertUser = "INSERT INTO `user_login_credentials`(`login_id`, `employees_id`, `user_name`, `user_password`) VALUES ('$user_Id','$user','$user_Login_Name','$user_Login_Password')";
$sqlLoginFlag = "UPDATE `employees_details` SET `emp_login_flag` = '0' WHERE `employees_details`.`emp_id` = '$user';";
if ($connect->query($sqlLoginFlag)) {
if ($connect->query($sqlInsertUser)) {
$_SESSION["addUser"] = 'yes';
header("Location: ../../../inventory/home_users.php");
} else {
$_SESSION["addUser"] = 'no';
header("Location: ../../../inventory/home_users.php");
}
} else {
$_SESSION["LoginFlag"] = 'no';
}
} else {
echo 'You did not click the button';
}
?>