/home/techb158/workloadmatch.com/workloadmatch.com/BackUp/Teacher/Inc
Edit: /home/techb158/workloadmatch.com/workloadmatch.com/BackUp/Teacher/Inc/AddCoursePreference.php (18995B)
prepare('SELECT * FROM Broker_Profile WHERE Broker_ID = ?');
$stmt->bind_param('s', $user_n);
$stmt->execute();
$result = $stmt->get_result();
//$row = $result->fetch_assoc();
$count =$result->num_rows;
if($count > 0)
{
$query = "SELECT * FROM Broker_Profile Where Broker_ID ='".$user_n."'";
$result = $mysqli->query($query);
$row = $result->fetch_assoc();
$Broker_Sender_Refer_ID = $row['Broker_Refer_ID'];
$Category_Sender_ID = $row['Category_ID'];
$Admin_ID = $row['Admin_ID'];
$Master_ID = $row['Master_ID'];
$Manager_ID = $row['Manager_ID'];
$Broker_ID = $row['Broker_ID'];
$Broker_Email = $row['Email'];
$User_Type_ID = $row['User_Type_ID'];
$Broker_Name = $row['First_Name'] .' '.$row['Last_Name'];
if($Broker_Sender_Refer_ID == $Receiver_Code)
{
header('Location: reference.php?error=You are not allowed to send Reference to your acount!');
exit();
}
///////////////////////////////////////////////////////////////////////////////////
if($Receiver_Code !="")
{
$querye = "SELECT * FROM Broker_Profile Where Broker_Refer_ID ='".$Receiver_Code."' AND Manager_ID='".$Manager_Receiver_ID."'";
$resulte = $mysqli->query($querye);
$rowe = $resulte->fetch_assoc();
$Broker_ID_Receiver = $rowe['Broker_ID'];
$Broker_Receiver_Email = $rowe['Email'];
$Broker_Receiver_Name = $rowe['First_Name'] .' '.$rowe['Last_Name'];
$Broker_Phone = $rowe['Phone'];
$Broker_SMS_Carrier = $rowe['SMS_Carrier'];
if($Broker_SMS_Carrier !="")
{
$queryee = "SELECT * FROM sms_gateways Where Gateways_ID ='".$Broker_SMS_Carrier."'";
$resultee = $mysqli->query($queryee);
$roweee = $resultee->fetch_assoc();
$Broker_SMS_Carrier = $Broker_Phone .''. $roweee['Gateway'];
}
$queryes = "SELECT * FROM manager_profile Where Manager_ID='".$Manager_Receiver_ID."'";
$resultes = $mysqli->query($queryes);
$rowes = $resultes->fetch_assoc();
$Manager_Receiver_Email = $rowes['Email'];
}else{
$querye = "SELECT * FROM manager_profile Where Manager_ID='".$Manager_Receiver_ID."'";
$resulte = $mysqli->query($querye);
$rowe = $resulte->fetch_assoc();
$Broker_ID_Receiver =0;
$Broker_Receiver_Email = $rowe['Email'];
$Manager_SMS_Carrier = $rowe['SMS_Carrier'];
$Manager_Phone =$rowe['Phone'];
$Broker_Receiver_Name = $rowe['First_Name'] .' '.$rowe['Last_Name'];
if($Manager_SMS_Carrier !="")
{
$querye = "SELECT * FROM sms_gateways Where Gateways_ID ='".$Manager_SMS_Carrier."'";
$resulte = $mysqli->query($querye);
$rowe = $resulte->fetch_assoc();
$Manager_SMS_Carrier = $Manager_Phone.''.$rowe['Gateway'];
}
}
$query = "SELECT * FROM Sub_Categories Where Sub_Category_ID ='".$Transaction_Type_ID."'";
$resultw = $mysqli->query($query);
$roww = $resultw->fetch_assoc();
$Sub_Category_Type = $roww['Sub_Category_Type'];
$datetime =date("Y/m/d") . ' ' . date('H:i:s') ;
$Best_Time_Call = date("Y-m-d", strtotime($Best_Time_Call));
//header('Location: reference.php?error='.$Client_ID.'-'. $Category_Sender_ID.'-'. $Category_Receiver_ID.'-'. $Admin_ID.'-'. $Master_ID.'-'. $Manager_ID.'-'.$Manager_Receiver_ID.'-'. $Broker_ID.'-'. $Broker_ID_Receiver.'-'. $User_Type_ID.'-'. $Transaction_Type_ID.'-'. $Sub_Category_Type.'-'. $Transaction_Amount.'-'. $Note.'-'. $datetime.'-'. $Best_Time_Call);
//exit;
do {
$number_id = mt_rand(10000,999999);
$prep_stmt = "SELECT Reference_ID FROM Reference_File WHERE Reference_ID=? LIMIT 1";
$stmt = $mysqli->prepare($prep_stmt);
if ($stmt){
$stmt->bind_param('s', $number_id);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows == 1) {
$count =$stmt->num_rows;
}else{
$count =0;
}
}
} while ($count > 0);
//1-2-2-1-1-2-11-2--3-5-Buy-1500000-Test-2020/06/24 03:32:43-2020-06-30
//1-2-2-1-1-2-11-2-11-3-5-Buy-1500000-Test-2020/06/24 03:47:47-2020-06-27
$query = "SELECT * FROM Client_Profile Where Client_ID ='".$Client_ID."' AND Email ='".$Email."' AND Deleted_Status ='0'";
$result = $mysqli->query($query);
$Managers = $result->fetch_assoc();
$Client_ID = $Managers['Client_ID'];
if ($Client_ID > 0) {
if ($insert_stmt = $mysqli->prepare("INSERT INTO Reference_File (Reference_ID,Client_ID, Category_Sender_ID, Category_Receiver_ID, Admin_ID, Master_ID, Manager_Sender_ID, Manager_Receiver_ID,Broker_Sender_ID, Broker_Receiver_ID, User_Type_ID, Transaction_Type_ID, Transaction_Type, Transaction_Amount, Note, Reg_Date, Best_time_contact) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
$insert_stmt->bind_param('sssssssssssssssss',$number_id, $Client_ID, $Category_Sender_ID, $Category_Receiver_ID, $Admin_ID, $Master_ID, $Manager_ID,$Manager_Receiver_ID, $Broker_ID, $Broker_ID_Receiver, $User_Type_ID, $Transaction_Type_ID, $Sub_Category_Type, $Transaction_Amount, $Note, $datetime, $Best_Time_Call);
// Execute the prepared query.
if (! $insert_stmt->execute()) {
//header('Location: reference.php?error='.$insert_stmt->error);
header('Location: reference.php?error=Registration failure to send Reference!');
exit();
}else{
//header('Location: reference.php?error=The Reference has been sent!');
//exit();
$Re_ID= mysqli_insert_id($mysqli);
// if ($insert_stmt = $mysqli->prepare("INSERT INTO Reference_File_Follow_UP (Reference_ID, Client_ID, Category_ID, Admin_ID, Master_ID, Manager_Sender_ID, Manager_Receiver_ID, Broker_Sender_ID, Broker_Receiver_ID, User_Type_ID, Transaction_Type_ID, Transaction_Type, Transaction_Amount, Note, Reg_Date, Best_time_contact) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
if ($insert_stmt = $mysqli->prepare("INSERT INTO Reference_File_Follow_UP (Re_ID, Reference_ID, Client_ID, Category_Sender_ID, Category_Receiver_ID, Admin_ID, Master_ID, Manager_Sender_ID, Manager_Receiver_ID,Broker_Sender_ID, Broker_Receiver_ID, User_Type_ID, Transaction_Type_ID, Transaction_Type, Transaction_Amount, Note, Reg_Date, Best_time_contact) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
$insert_stmt->bind_param('ssssssssssssssssss', $Re_ID, $number_id, $Client_ID, $Category_Sender_ID, $Category_Receiver_ID, $Admin_ID, $Master_ID, $Manager_ID,$Manager_Receiver_ID, $Broker_ID, $Broker_ID_Receiver, $User_Type_ID, $Transaction_Type_ID, $Sub_Category_Type, $Transaction_Amount, $Note, $datetime, $Best_Time_Call);
// Execute the prepared query.
if (! $insert_stmt->execute()) {
//header('Location: reference.php?error='.$insert_stmt->error);
header('Location: reference.php?error=Registration failure to send Reference!'.$Reference_ID);
exit();
}else
{
$subject = "New Reference";
$uri = 'https://'. $_SERVER['HTTP_HOST'] ;
$message = '
ImmoValet: New Reference
Dear "'.$Broker_Receiver_Name.'",
You have received a new reference, please go to Account Login to view it.
"'."Thank you for choosing ImmoValet.".'"
';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
//$headers .= 'From: '.$Broker_Name.'<'.$Broker_Email.'>' . "\r\n";
$headers .= 'From: '.$Broker_Name.'
' . "\r\n";
$headers .= 'CC: '.$Broker_Name.'<'.$Manager_Receiver_Email.'>' . "\r\n";
$headers .= 'Bcc: support' . "\r\n";
$mail= mail($Broker_Receiver_Email,$subject,$message,$headers);
//$headers[] = 'MIME-Version: 1.0';
//$headers[] = 'Content-type: text/html; charset=iso-8859-1';
//
//// Additional headers
//$headers[] = 'To: MyRateBid '.$email_to.'>';
//$headers[] = 'From: '.$Broker_Name.'<'.$Broker_Email.'>';
//$headers[] = 'CC: '.$Broker_Name.'<'.$Manager_Receiver_Email.'>';
//$headers[] = 'Bcc: support';
//
//// Mail it
//$mail =mail($Broker_Receiver_Email,$subject,$message, implode("\r\n", $headers));
if($mail)
{
$messages = 'You have received a new reference, please visit your profile to view it.';
if($Broker_SMS_Carrier !="")
{
mail($Broker_SMS_Carrier, $subject, "$messages", "From: $Broker_Name <$Broker_Email>\r\n");
}
if($Manager_SMS_Carrier !="")
{
mail($Manager_SMS_Carrier, $subject, "$messages", "From: $Broker_Name <$Broker_Email>\r\n");
}
}
header('Location: reference.php?error=The Reference has been sent!');
exit();
}
}
}
}
//header('Location: reference.php?error=Client Name is already exist.');
//exit();
//foreach ($_POST['Transaction_Type'] as $Transaction_Type)
//{
// $Transaction_Type= $Transaction_Type;
//}
}else
{
do {
$numberid = mt_rand(10000,999999);
$prep_stmt = "SELECT Reference_ID FROM Reference_File WHERE Reference_ID=? LIMIT 1";
$stmt = $mysqli->prepare($prep_stmt);
if ($stmt){
$stmt->bind_param('s', $number_id);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows == 1) {
$count =$stmt->num_rows;
}else{
$count =0;
}
}
} while ($count > 0);
do {
$number_id = mt_rand(10000,999999);
$prep_stmt = "SELECT AP.Admin_ID, MP.Master_ID, MGP.Manager_ID,BP.Broker_ID,CP.Client_ID FROM admin_profile AP JOIN master_profile MP JOIN manager_profile MGP JOIN Broker_Profile BP JOIN Client_Profile CP WHERE AP.Admin_ID=? OR MP.Master_ID=? OR MGP.Manager_ID=? OR BP.Broker_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();
}else{
$count =0;
}
}
} while ($count > 0);
$datetime =date("Y/m/d") . ' ' . date('H:i:s') ;
if ($insert_stmt = $mysqli->prepare("INSERT INTO Client_Profile (Client_ID, Category_ID, Admin_ID, Master_ID, Manager_ID, Broker_ID, User_Type_ID, Titel, First_Name, Last_Name, User_Name, Email, Home_Phone, Cell_Phone, Address, Reg_Date, Login_Date, Logout_Date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
//header('Location: addclient.php?error=file name already exists'.$user_n.'');
$insert_stmt->bind_param('ssssssssssssssssss',$number_id, $Category_Receiver_ID, $Admin_ID, $Master_ID, $Manager_ID, $Broker_ID, $User_Type_ID, $Titel, $First_Name, $Last_Name, $Client_Name, $Email, $Home_Phone, $Cell_Phone, $Address, $datetime, $datetime, $datetime);
// Execute the prepared query.
if (! $insert_stmt->execute()) {
//header('Location: reference.php?error='.$insert_stmt->error);
//header('Location: reference.php?error=Client name already exists!');
header('Location: reference.php?error=Registration failure to add new cleint!');
//header('Location: addassist.php?error='.$Managers_ID.'');
exit();
}else
{
$Cli_ID = mysqli_insert_id($mysqli);
//if ($insert_stmt = $mysqli->prepare("INSERT INTO Reference_File (Reference_ID, Client_ID, Category_ID, Admin_ID, Master_ID, Manager_ID, Broker_Sender_ID, Broker_Receiver_ID, User_Type_ID, Transaction_Type_ID, Transaction_Type, Transaction_Amount, Note, Reg_Date, Best_time_contact) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
//$insert_stmt->bind_param('sssssssssssssss',$numberid,$Cli_ID, $Category_ID, $Admin_ID, $Master_ID, $Manager_ID, $Broker_ID, $Broker_ID_Receiver, $User_Type_ID, $Transaction_Type_ID, $Sub_Category_Type, $Transaction_Amount, $Note, $datetime, $Best_Time_Call);
if ($insert_stmt = $mysqli->prepare("INSERT INTO Reference_File (Reference_ID,Client_ID, Category_Sender_ID, Category_Receiver_ID, Admin_ID, Master_ID, Manager_Sender_ID, Manager_Receiver_ID,Broker_Sender_ID, Broker_Receiver_ID, User_Type_ID, Transaction_Type_ID, Transaction_Type, Transaction_Amount, Note, Reg_Date, Best_time_contact) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
$insert_stmt->bind_param('sssssssssssssssss',$numberid, $number_id, $Category_Sender_ID, $Category_Receiver_ID, $Admin_ID, $Master_ID, $Manager_ID,$Manager_Receiver_ID, $Broker_ID, $Broker_ID_Receiver, $User_Type_ID, $Transaction_Type_ID, $Sub_Category_Type, $Transaction_Amount, $Note, $datetime, $Best_Time_Call);
// Execute the prepared query.
if (! $insert_stmt->execute()) {
//header('Location: addclient.php?error='.$mysqli->error);
header('Location: addclient.php?error=Registration failure to send Reference!');
exit();
}else
{
$Reference_ID= mysqli_insert_id($mysqli);
//if ($insert_stmt = $mysqli->prepare("INSERT INTO Reference_File_Follow_UP (Reference_ID, Client_ID, Category_ID, Admin_ID, Master_ID, Manager_ID, Broker_Sender_ID, Broker_Receiver_ID, User_Type_ID, Transaction_Type_ID, Transaction_Type, Transaction_Amount, Note, Reg_Date, Best_time_contact) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
//$insert_stmt->bind_param('sssssssssssssss',$Reference_ID, $Cli_ID, $Category_ID, $Admin_ID, $Master_ID, $Manager_ID, $Broker_ID, $Broker_Receiver_ID, $User_Type_ID, $Transaction_Type_ID, $Sub_Category_Type, $Transaction_Amount, $Note, $datetime, $Best_Time_Call);
if ($insert_stmt = $mysqli->prepare("INSERT INTO Reference_File_Follow_UP (Re_ID, Reference_ID,Client_ID, Category_Sender_ID, Category_Receiver_ID, Admin_ID, Master_ID, Manager_Sender_ID, Manager_Receiver_ID,Broker_Sender_ID, Broker_Receiver_ID, User_Type_ID, Transaction_Type_ID, Transaction_Type, Transaction_Amount, Note, Reg_Date, Best_time_contact) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
$insert_stmt->bind_param('ssssssssssssssssss',$Reference_ID, $numberid, $number_id, $Category_Sender_ID, $Category_Receiver_ID, $Admin_ID, $Master_ID, $Manager_ID,$Manager_Receiver_ID, $Broker_ID, $Broker_ID_Receiver, $User_Type_ID, $Transaction_Type_ID, $Sub_Category_Type, $Transaction_Amount, $Note, $datetime, $Best_Time_Call);
// Execute the prepared query.
if (! $insert_stmt->execute()) {
//header('Location: reference.php?error='.$mysqli->error);
header('Location: reference.php?error=Registration failure to send Reference!');
exit();
}else
{
$subject = "New Reference";
$uri = 'https://'. $_SERVER['HTTP_HOST'] ;
$message = '
ImmoValet: New Reference
Dear "'.$Broker_Receiver_Name.'",
You have received a new reference, please go to Account Login to view it.
"'."Thank you for choosing ImmoValet.".'"
';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
//$headers .= 'From: '.$Broker_Name.'<'.$Broker_Email.'>' . "\r\n";
$headers .= 'From: '.$Broker_Name.'' . "\r\n";
$headers .= 'CC: '.$Broker_Name.'<'.$Manager_Receiver_Email.'>' . "\r\n";
$headers .= 'Bcc: support' . "\r\n";
if(mail($Broker_Receiver_Email,$subject,$message,$headers)){
$messages = 'You have received a new reference, please visit your profile o view it.';
if($Broker_SMS_Carrier !="")
{
mail($Broker_SMS_Carrier, $subject, "$messages", "From: $Broker_Name <$Broker_Email>\r\n");
}
if($Manager_SMS_Carrier !="")
{
mail($Manager_SMS_Carrier, $subject, "$messages", "From: $Broker_Name <$Broker_Email>\r\n");
}
}
//header('Location: reference.php?error=New cleint successfully registered and the Reference has been sent!');
//exit();
header('Location: reference.php?error=The Reference has been sent!');
exit();
}
}
//header('Location: reference.php?error=New cleint successfully registered and the Reference has been sent!');
//exit();
}
}else{
//header('Location: reference.php?error='.$Cli_ID.'-'.$numberid.'-'. $Cli_ID.'-'. $Category_ID.'-'. $Admin_ID.'-'. $Master_ID.'-'. $Manager_ID.'-'. $Broker_ID.'-'. $Broker_Receiver_ID.'-'. $User_Type_ID.'-'. $Transaction_Type_ID.'-'. $Sub_Category_Type.'-'. $Transaction_Amount.'-'. $Note.'-'. $datetime.'-'. $Best_Time_Call);
//header('Location: reference.php?error='.$insert_stmt->error);
//header('Location: reference.php?error=Registration failure to send Reference!');
exit();
}
}
}else{
//header('Location: addclient.php?error='.$mysqli->error);
header('Location: addclient.php?error=Registration failure,A user with this user name already exists.');
}
}
}
}else{
header('Location: reference.php?error=Registration failure please insert all informaion!');
exit();
}
}