/home/techb158/workloadmatch.com/Manager/Inc
NameSizeModeActions
LLMProviders/-0755rm
AddCourse.php25560644editdlrm
AddCourseTime.php19040644editdlrm
AddGroup - Copy.php46330644editdlrm
AddGroup.php56980644editdlrm
AddHoliday.php17720644editdlrm
AddTeacherLevel.php23070644editdlrm
AddUser.php128210644editdlrm
Add_Retake_Remediation.php13340644editdlrm
AIScheduleOptimizer.php119190644editdlrm
Assignment-1.php753800644editdlrm
Assignment-2.php753800644editdlrm
Assignment - BackUp- orgenal.php732720644editdlrm
Assignment - BackUp.php627610644editdlrm
Assignment - Copy (Last File Updated 2025-05-15).php729330644editdlrm
Assignment - Copy.php618260644editdlrm
Assignment.php743080644editdlrm
Assignment_BackUp.php790470644editdlrm
Assign_Teacher_Manual.php209570644editdlrm
Assign_Teacher_Manual_bak.php.disabled205350644editdlrm
Assign_Teacher_Manual_Force_conflict.php211060644editdlrm
Available_Teacher_Report.php23420644editdlrm
BatchScheduler.php35880644editdlrm
CombinedScheduler.php81300644editdlrm
ConflictResolver.php49200644editdlrm
error_log8690644editdlrm
Lockup_to_Assign.php63670644editdlrm
Process_Assignment - Copy.php42330644editdlrm
Process_Assignment.php58130644editdlrm
ScheduleEngine.php55960644editdlrm
ScheduleGenerator.php88110644editdlrm
Schedule_Report_by_Group.php30740644editdlrm
TeacherAssignmentEngine.php124870644editdlrm
Update_Course.php27170644editdlrm
Update_Course_Time.php19470644editdlrm
Update_Group - Copy.php34890644editdlrm
Update_Group.php96570644editdlrm
Update_Holiday.php23570644editdlrm
Update_Profile.php49230644editdlrm
Update_User.php55470644editdlrm
Edit: /home/techb158/workloadmatch.com/Manager/Inc/AddUser.php (12821B)
The email address you entered is not valid

'; set_flash_msg('The email address you entered is not valid.', 'warning'); header('Location: adduser.php'); exit(); } $Password = filter_input(INPUT_POST, 'p', FILTER_UNSAFE_RAW); if (strlen($Password) != 128) { // The hashed pwd should be 128 characters long. // If it's not, something really odd has happened //$error_msg .= '

Invalid password configuration.

'; set_flash_msg('Invalid password configuration.', 'warning'); header('Location: adduser.php'); exit(); } $Password = password_hash($Password, PASSWORD_BCRYPT); do { $number_id = mt_rand(10000,999999); $prep_stmt = "SELECT AP.Admin_ID, MP.Master_ID, MGP.Manager_ID,BP.Teacher_ID,CP.Client_ID FROM admin_profile AP JOIN master_profile MP JOIN manager_profile MGP JOIN teacher_profile BP JOIN Client_Profile CP WHERE AP.Admin_ID=? OR MP.Master_ID=? OR MGP.Manager_ID=? OR BP.Teacher_ID=? OR CP.Client_ID=? LIMIT 1"; $stmt = $mysqli->prepare($prep_stmt); if ($stmt){ $stmt->bind_param('sssss', $number_id, $number_id, $number_id, $number_id, $number_id); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows == 1) { $count =$stmt->num_rows; // A user with this email address already exists //$error_msg .= '

A user with this user name already exists.

'; //header('Location: adduser.php?error=A user with this user name already exists.'); //exit(); } } } while ($count > 0); $prep_stmt = "SELECT Admin_ID FROM admin_profile WHERE User_Name = ? LIMIT 1"; $stmt = $mysqli->prepare($prep_stmt); if ($stmt){ $stmt->bind_param('s', $User_Name); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows == 1) { // A user with this email address already exists //$error_msg .= '

A user with this user name already exists.

'; set_flash_msg('A user with this user name already exists.', 'warning'); header('Location: adduser.php'); exit(); } }else{ // $error_msg .= '

Database error

'; } $prep_stmt = "SELECT Master_ID FROM master_profile WHERE User_Name = ? LIMIT 1"; $stmt = $mysqli->prepare($prep_stmt); if ($stmt) { $stmt->bind_param('s', $User_Name); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows == 1) { // A user with this email address already exists //$error_msg .= '

A user with this user name already exists.

'; set_flash_msg('A user with this user name already exists.', 'warning'); header('Location: adduser.php'); exit(); } } else { // $error_msg .= '

Database error

'; } $prep_stmt = "SELECT Manager_ID FROM manager_profile WHERE User_Name = ? LIMIT 1"; $stmt = $mysqli->prepare($prep_stmt); if ($stmt) { $stmt->bind_param('s', $User_Name); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows == 1) { // A user with this email address already exists //$error_msg .= '

A user with this user name already exists.

'; set_flash_msg('A user with this user name already exists.', 'warning'); header('Location: adduser.php'); exit(); } } else { //$error_msg .= '

Database error

'; } $prep_stmt = "SELECT Teacher_ID FROM teacher_profile WHERE User_Name = ? LIMIT 1"; $stmt = $mysqli->prepare($prep_stmt); if ($stmt) { $stmt->bind_param('s', $User_Name); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows == 1) { // A user with this email address already exists //$error_msg .= '

A user with this user name already exists.

'; set_flash_msg('A user with this user name already exists.', 'warning'); header('Location: adduser.php'); exit(); } } else { //$error_msg .= '

Database error

'; } $user_n=$_SESSION['user_id']; if (($_SESSION['User_type'] ?? '') === 'master_profile') { $querys = "SELECT * FROM master_profile Where Master_ID='".$user_n."'"; $results = $mysqli->query($querys); $rows = $results->fetch_assoc(); $Admin_ID = $rows['Admin_ID']; $Master_ID = $rows['Master_ID']; $Manager_ID = 0; $Manager_ID_Profile = 0; $Manager_Email = $rows['Email'] ?? ''; $ManagerName = ($rows['First_Name'] ?? '') .' '. ($rows['Last_Name'] ?? ''); } else { $querys = "SELECT * FROM manager_profile Where Manager_ID='".$user_n."'"; $results = $mysqli->query($querys); $rows = $results->fetch_assoc(); $Admin_ID = $rows['Admin_ID']; $Master_ID = $rows['Master_ID']; $Manager_ID = $rows['Manager_ID']; $Manager_ID_Profile = $rows['Manager_ID']; //$User_Type_ID = $rows['User_Type_ID']; $Manager_Email = $rows['Email']; $ManagerName = $rows['First_Name'] .' '. $rows['Last_Name']; } $query = "SELECT * FROM teacher_profile Where User_Name ='".$User_Name."' AND Email ='".$Email."'"; $result = $mysqli->query($query); $Managers = $result->fetch_assoc(); $ID = $Managers['Teacher_ID']; if ($ID >= 1) { set_flash_msg('User Name is already exist.', 'warning'); header('Location: adduser.php'); exit(); }else{ //header('Location: adduser.php?error=User Name is already exist.'); //exit(); $User_Type_ID=3; $datetime =date("Y/m/d") . ' ' . date('H:i:s') ; $sql = "INSERT INTO teacher_profile ( Teacher_ID, Admin_ID, Master_ID, Manager_ID, User_Type_ID, Seniority_ID, First_Name, Last_Name, User_Name, Email, Phone, Password, User_Access, Reg_Date, Login_Date, Logout_Date, prof_lang, Note, Load_Hours ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; if ($insert_stmt = $mysqli->prepare($sql)) { $insert_stmt->bind_param( 'sssssssssssssssssss', $number_id, $Admin_ID, $Master_ID, $Manager_ID, $User_Type_ID, $Seniority_level, $First_Name, $Last_Name, $User_Name, $Email, $Phone, $Password, $User_Access, $datetime, $datetime, $datetime, $prof_lang, $Note, $Load_Hours ); if (!$insert_stmt->execute()) { set_flash_msg('❌ Insert failed! ' . $insert_stmt->error, 'warning'); header('Location: adduser.php'); exit(); } // Insert restricted groups $insertionError = ''; if (isset($_POST['Restricted_Groups']) && is_array($_POST['Restricted_Groups'])) { $restrictedGroups = $_POST['Restricted_Groups']; $Teacher_ID = $number_id; // Step 2: Insert new restricted groups foreach ($restrictedGroups as $groupID) { $insertStmt = $mysqli->prepare("INSERT INTO teacher_restricted_groups (Teacher_ID, Group_ID) VALUES (?, ?)"); $insertStmt->bind_param("ss", $Teacher_ID, $groupID); $insertStmt->execute(); $insertStmt->close(); } } // Redirect after group insert or general success set_flash_msg('New User successfully registered!', 'success'); header('Location: adduser.php'); exit(); } else { set_flash_msg('❌ Prepare failed! ' . $mysqli->error, 'warning'); header('Location: adduser.php'); exit(); } /* if ($insert_stmt = $mysqli->prepare("INSERT INTO teacher_profile (Teacher_ID, Admin_ID, Master_ID, Manager_ID, User_Type_ID, Seniority_ID, First_Name, Last_Name, User_Name, Email, Phone, Password, salt, User_Access, Reg_Date, Login_Date, Logout_Date,prof_lang,Note,Load_Hours) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { //header('Location: adduser.php?error=file name already exists'.$user_n.''); $insert_stmt->bind_param('ssssssssssssssssssss',$number_id, $Admin_ID, $Master_ID, $Manager_ID, $User_Type_ID, $Seniority_level, $First_Name, $Last_Name, $User_Name, $Email, $Phone, $Password,$random_salt,$User_Access,$datetime, $datetime, $datetime, $prof_lang,$Note,$Load_Hours); // Execute the prepared query. if (! $insert_stmt->execute()) { //header('Location: adduser.php?error='.$insert_stmt->error); header('Location: adduser.php?error=Registration failure to add new User!'.$insert_stmt->error); //header('Location: addassist.php?error='.$Password.''); exit(); }else{ header('Location: adduser.php?error=New User successfully registered!'); exit(); //header('Location: adduser.php?error='.$mysqli->error); //exit(); } }else{ //header('Location: adduser.php?error='.$mysqli->error); //exit(); } } */ //header('Location: addclient.php?error='.$mysqli->error); } }else { set_flash_msg('Registration failure please insert all informaion!', 'warning'); header('Location: adduser.php'); exit(); } } // //$Teacher_ID= mysqli_insert_id($mysqli); // $Teacher_ID= $number_id; // //if(!empty($_POST["Access_Category"])) { // // $subject = "New Teacher Added"; // $uri = 'https://'. $_SERVER['HTTP_HOST'] ; // $message = ' // // // Work Load Match: New Teacher Added // // //

Dear "'.$UserName.'",


//

Your Account Details:

//

User Name: "'.$User_Name.'"

//

Please visit our login page Account Login.


//

"'."Thank you.".'"


// // // // '; // $headers = "MIME-Version: 1.0" . "\r\n"; // $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // $headers .= 'From: '.$ManagerName.'<'.$Manager_Email.'>' . "\r\n"; // $headers .= 'CC: '.$ManagerName.'<'.$Manager_Email.'>' . "\r\n"; // //$headers .= 'Bcc: support' . "\r\n"; // // //mail($Email,$subject,$message,$headers); // if(mail($Email, $subject, $message, $headers)) { // //echo "Email sent successfully!"; // header('Location: adduser.php?error=New User successfully registered!'); // exit(); //} else { // echo "Failed to send email."; //}