/
home
/
techb158
/
workloadmatch.com
/
Manager
/
Inc
/
/home/techb158/workloadmatch.com/Manager/Inc
mkdir
upload
Name
Size
Mode
Actions
LLMProviders/
-
0755
rm
AddCourse.php
2556
0644
edit
dl
rm
AddCourseTime.php
1904
0644
edit
dl
rm
AddGroup - Copy.php
4633
0644
edit
dl
rm
AddGroup.php
5698
0644
edit
dl
rm
AddHoliday.php
1772
0644
edit
dl
rm
AddTeacherLevel.php
2307
0644
edit
dl
rm
AddUser.php
12821
0644
edit
dl
rm
Add_Retake_Remediation.php
1334
0644
edit
dl
rm
AIScheduleOptimizer.php
11919
0644
edit
dl
rm
Assignment-1.php
75380
0644
edit
dl
rm
Assignment-2.php
75380
0644
edit
dl
rm
Assignment - BackUp- orgenal.php
73272
0644
edit
dl
rm
Assignment - BackUp.php
62761
0644
edit
dl
rm
Assignment - Copy (Last File Updated 2025-05-15).php
72933
0644
edit
dl
rm
Assignment - Copy.php
61826
0644
edit
dl
rm
Assignment.php
74308
0644
edit
dl
rm
Assignment_BackUp.php
79047
0644
edit
dl
rm
Assign_Teacher_Manual.php
20957
0644
edit
dl
rm
Assign_Teacher_Manual_bak.php.disabled
20535
0644
edit
dl
rm
Assign_Teacher_Manual_Force_conflict.php
21106
0644
edit
dl
rm
Available_Teacher_Report.php
2342
0644
edit
dl
rm
BatchScheduler.php
3588
0644
edit
dl
rm
CombinedScheduler.php
8130
0644
edit
dl
rm
ConflictResolver.php
4920
0644
edit
dl
rm
error_log
869
0644
edit
dl
rm
Lockup_to_Assign.php
6367
0644
edit
dl
rm
Process_Assignment - Copy.php
4233
0644
edit
dl
rm
Process_Assignment.php
5813
0644
edit
dl
rm
ScheduleEngine.php
5596
0644
edit
dl
rm
ScheduleGenerator.php
8811
0644
edit
dl
rm
Schedule_Report_by_Group.php
3074
0644
edit
dl
rm
TeacherAssignmentEngine.php
12487
0644
edit
dl
rm
Update_Course.php
2717
0644
edit
dl
rm
Update_Course_Time.php
1947
0644
edit
dl
rm
Update_Group - Copy.php
3489
0644
edit
dl
rm
Update_Group.php
9657
0644
edit
dl
rm
Update_Holiday.php
2357
0644
edit
dl
rm
Update_Profile.php
4923
0644
edit
dl
rm
Update_User.php
5547
0644
edit
dl
rm
Edit:
/home/techb158/workloadmatch.com/Manager/Inc/AddUser.php
(12821B)
<?php include_once '../includes/db_connect.php'; include_once '../includes/psl-config.php'; sec_session_start(); $error_msg = ""; if(isset($_POST["submit"]) && $_POST["submit"]!="") { // $user_n=$_SESSION['user_id']; //header('Location: addclient.php?error=file name already exists'.$user_n.''); //exit(); if (isset ($_POST['p'],$_POST['username'],$_POST['First_Name'],$_POST['Last_Name'],$_POST['email'],$_POST['prof_lang'],$_POST['User_Access'],$_POST['Seniority_level'])) { //if (isset ($_POST['p'],$_POST['username'],$_POST['Category_ID'],$_POST['First_Name'],$_POST['Last_Name'],$_POST['email'],$_POST['Phone'],$_POST['Personnaladdressd'],$_POST['licenceNo'],$_POST['College_Name'],$_POST['College_Phone'],$_POST['Name_College_Director'],$_POST['User_Access'],$_POST['Access_Category'])) { $prof_lang = $_POST['prof_lang']; $User_Name = $_POST['username']; $Seniority_level = $_POST['Seniority_level']; $First_Name = $_POST['First_Name']; $Last_Name = $_POST['Last_Name']; $Email = $_POST['email']; $Phone = $_POST['Phone']; $Load_Hours = $_POST['Load_Hours']; $rx = "/ (1)?\D* # optional country code (\d{3})?\D* # optional area code (\d{3})\D* # first three (\d{4}) # last four (?:\D+|$) # extension delimiter or EOL (\d*) # optional extension /x"; preg_match($rx, $Phone, $matches); if(!isset($matches[0])) { $Phone= ""; }else{ $country = $matches[1]; $area = $matches[2]; $three = $matches[3]; $four = $matches[4]; $ext = $matches[5]; $Phone= $area.''.$three.''.$four; }// return false; $User_Access = $_POST['User_Access']; $Note= $_POST['Note']; //$Client_Name = $First_Name .''. $Last_Name; $UserName=$First_Name .' '.$Last_Name; $datepickerx = date("Y-m-d", strtotime($datepicker)); $Email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL); $Email = filter_var($Email, FILTER_VALIDATE_EMAIL); if (!filter_var($Email, FILTER_VALIDATE_EMAIL)) { // Not a valid email //$error_msg .= '<p class="error">The email address you entered is not valid</p>'; 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 .= '<p class="error">Invalid password configuration.</p>'; 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 .= '<p class="error">A user with this user name already exists.</p>'; //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 .= '<p class="error">A user with this user name already exists.</p>'; set_flash_msg('A user with this user name already exists.', 'warning'); header('Location: adduser.php'); exit(); } }else{ // $error_msg .= '<p class="error">Database error</p>'; } $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 .= '<p class="error">A user with this user name already exists.</p>'; set_flash_msg('A user with this user name already exists.', 'warning'); header('Location: adduser.php'); exit(); } } else { // $error_msg .= '<p class="error">Database error</p>'; } $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 .= '<p class="error">A user with this user name already exists.</p>'; set_flash_msg('A user with this user name already exists.', 'warning'); header('Location: adduser.php'); exit(); } } else { //$error_msg .= '<p class="error">Database error</p>'; } $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 .= '<p class="error">A user with this user name already exists.</p>'; set_flash_msg('A user with this user name already exists.', 'warning'); header('Location: adduser.php'); exit(); } } else { //$error_msg .= '<p class="error">Database error</p>'; } $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 = ' // <html> // <head> // <title>Work Load Match: New Teacher Added</title> // </head> // <body> // <p>Dear "'.$UserName.'",</p><br> // <p>Your Account Details:</p> // <p>User Name: "'.$User_Name.'"</p> // <p>Please visit our login page <a href="'.$uri.'/index.php">Account Login</a>.</p><br> // <p>"'."Thank you.".'"</p><br> // </body> // <footer> // <p>Support Team</p><br> // <a href="'.$uri.'/index.php" target="_blank"><img src="'.$uri.'/img/access-logo.svg" class="stone-logo" height="50" width="150"></a> // </footer> // </html> // '; // $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<info@techbala.com>' . "\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."; //}
Save
cmd:
run