/
home
/
techb158
/
workloadmatch.com
/
workloadmatch.com
/
BackUp
/
Manager
/
Inc
/
/home/techb158/workloadmatch.com/workloadmatch.com/BackUp/Manager/Inc
mkdir
upload
Name
Size
Mode
Actions
AddClient.php
3930
0644
edit
dl
rm
AddCourse.php
1996
0644
edit
dl
rm
AddCourseTime.php
1709
0644
edit
dl
rm
AddGroup - Copy.php
4531
0644
edit
dl
rm
AddGroup.php
4921
0644
edit
dl
rm
AddHoliday.php
1636
0644
edit
dl
rm
AddReference.php
8258
0644
edit
dl
rm
AddTeacherLevel.php
2131
0644
edit
dl
rm
AddUser.php
11841
0644
edit
dl
rm
Add_Retake_Remediation.php
1248
0644
edit
dl
rm
Assignment-1.php
73605
0644
edit
dl
rm
Assignment-2.php
73605
0644
edit
dl
rm
Assignment - BackUp- orgenal.php
71487
0644
edit
dl
rm
Assignment - BackUp.php
61314
0644
edit
dl
rm
Assignment - Copy (Last File Updated 2025-05-15).php
71164
0644
edit
dl
rm
Assignment - Copy.php
60402
0644
edit
dl
rm
Assignment.php
74235
0644
edit
dl
rm
Assignment_BackUp.php
77046
0644
edit
dl
rm
Assign_Category_To_User.php
2733
0644
edit
dl
rm
Assign_Teacher_Manual.php
20508
0644
edit
dl
rm
Assign_Teacher_Manual_Force_conflict.php
20638
0644
edit
dl
rm
Available_Teacher_Report.php
2341
0644
edit
dl
rm
error_log
869
0644
edit
dl
rm
Process_Assignment - Copy.php
4150
0644
edit
dl
rm
Process_Assignment.php
5559
0644
edit
dl
rm
Schedule_Report_by_Group.php
2997
0644
edit
dl
rm
UpdateClient.php
2513
0644
edit
dl
rm
updateuser.php
2429
0644
edit
dl
rm
Update_Course.php
2019
0644
edit
dl
rm
Update_Course_Time.php
1755
0644
edit
dl
rm
Update_Group - Copy.php
3404
0644
edit
dl
rm
Update_Group.php
8905
0644
edit
dl
rm
Update_Holiday.php
2178
0644
edit
dl
rm
Update_Profile.php
4816
0644
edit
dl
rm
Update_Reference.php
8908
0644
edit
dl
rm
Update_Reference_Follow_Up.php
3481
0644
edit
dl
rm
Update_User.php
5204
0644
edit
dl
rm
Edit:
/home/techb158/workloadmatch.com/workloadmatch.com/BackUp/Manager/Inc/AddUser.php
(11841B)
<?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['Company_Name'],$_POST['Company_Phone'],$_POST['Name_Comapny_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>'; header('Location: adduser.php?error=The email address you entered is not valid.'); exit(); } $Password = filter_input(INPUT_POST, 'p', FILTER_SANITIZE_STRING); 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>'; header('Location: adduser.php?error=Invalid password configuration.'); exit(); } $random_salt = hash('sha512', uniqid(openssl_random_pseudo_bytes(16), TRUE)); // Create salted password $Password = hash('sha512', $Password . $random_salt); 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>'; header('Location: adduser.php?error=A user with this user name already exists.'); 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>'; header('Location: adduser.php?error=A user with this user name already exists.'); 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>'; header('Location: adduser.php?error=A user with this user name already exists.'); 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>'; header('Location: adduser.php?error=A user with this user name already exists.'); exit(); } } else { //$error_msg .= '<p class="error">Database error</p>'; } $user_n=$_SESSION['user_id']; $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) { header('Location: adduser.php?error=User Name is already exist.'); 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, salt, User_Access, Reg_Date, Login_Date, Logout_Date, prof_lang, Note, Load_Hours ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; if ($insert_stmt = $mysqli->prepare($sql)) { $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 ); if (!$insert_stmt->execute()) { header('Location: adduser.php?error=❌ Insert failed! ' . $insert_stmt->error); 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 header('Location: adduser.php?error=New User successfully registered!'); exit(); } else { header('Location: adduser.php?error=❌ Prepare failed! ' . $mysqli->error); 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 { header('Location: adduser.php?error=Registration failure please insert all informaion!'); 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