Server : LiteSpeed System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64 User : u615232177 ( 615232177) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/u615232177/domains/poiseseat.com/public_html/admin0557/ |
<?php use PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;use PHPMailer\PHPMailer\SMTP; session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("headerstrict.php"); ?>
<?php
if (isset($_GET['u'])){
$appointment_id = mysqli_real_escape_string($con,$_GET['u']);
$stmt = $con -> prepare('SELECT * FROM appointments WHERE appointment_id=?');
$stmt -> bind_param('s',$appointment_id);
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($id,$appointment_id,$date_made,$check_in,$check_out,$check_in_nice,$first_name,$last_name,$email,$phone,$approved,$hair_id,$title,$price,$duration);
$numrows = $stmt -> num_rows();
if($numrows > 0){
while ($stmt -> fetch()) {
//convert date to Y-mm-dd
//$check_in_nice = $check_in;
$DateTime = new DateTime($check_in);
//$check_in_nice = $DateTime->format('D,dS M, Y g:ia');
/*
$stmt_room = $con -> prepare('SELECT title FROM hair_styles WHERE hair_id = ?');
$stmt_room -> bind_param('i',$hair_id);
$stmt_room -> execute();
$stmt_room -> store_result();
$stmt_room -> bind_result($title);
$numrows_room = $stmt_room -> num_rows();
if($numrows_room > 0){
while ($stmt_room -> fetch()) {}
}*/
}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
if($approved == "Yes"){$c = "forestgreen";$status="Approved";}
if($approved == "No"){$c = "crimson";$status="Rejected";}
if($approved == "Pending"){$c = "royalblue";$status="Pending";}
?>
<title><?php echo $company_name; ?> <?php echo "$first_name $last_name"; ?></title>
<?php
if (isset($_POST["delete"])) {
$stmt = $con -> prepare('DELETE FROM appointments WHERE appointment_id = ?');
$stmt -> bind_param('s', $appointment_id);
$stmt -> execute();
$msg = '';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
require 'PHPMailer/src/Exception.php';
$mail = new PHPMailer();
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "localhost"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password
$subject1 = "$first_name your appointment has been cancelled"; // form field
$message="";
$email_topic="$first_name your appointment has been cancelled";
$button_link="$link";
$button_text="Go to Site";
$motto="Let's Glam you up!";
include("email_header.php");
$message .= "
Dear $first_name,<br/><br/>
Thank you for making a appointment with us. Unfortunately we had to cancel your appointment due to reasons beyond our control. We truly regret any inconveniences caused. We shall be in touch about a possible resheduling of your hair appointment. Thank your for choosing $company_name
<br/><br/>
The $company_name Team.<br/>
$email_logo
";
include("email_footer.php");
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from add
$mail->AddAddress("$email", "$email");//Send the message to yourself, or whoever should receive contact for submissions
$mail->AddReplyTo("$company_email", "$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject1";
$mail->MsgHTML("<html><body>$message<br></body></html>");
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
$msg = "Email not sent, please try again Mailer Error: ".$mail->ErrorInfo;
}
else {
//echo "Thanks for getting in touch, we will get back to ASAP";
$msg = "<span style='color:steelblue;'>$first_name thank you for your reservation, we will get contact you shortly.</span>";
}
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Appointment successfully deleted.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=appointments.php&m=$message\">";
}
$yes="Yes";
if (isset($_POST["approve"])) {
//first check if the room is still available
//check database and get dates from this room that have been approved.
/*
$yes = "Yes";
$stmt_reser = $con -> prepare('SELECT check_in,check_out FROM appointments WHERE approved = ?');
$stmt_reser -> bind_param('s',$yes);
$stmt_reser -> execute();
$stmt_reser -> store_result();
$stmt_reser -> bind_result($check_in_db,$check_out_db);
$numrows_reser = $stmt_reser -> num_rows();
if($numrows_reser > 0){
while ($stmt_reser -> fetch()) {
//get array of dates from db
$period_db = new DatePeriod(
new DateTime("$check_in_db"),
new DateInterval('P1D'),
//new DateTime("$check_out_db")
);
//its actually an object, so create a new array from period_db
foreach ($period_db as $key_db => $value_db) {
array_push($arr_db,$value_db->format('Y-m-d'));
}
//check to see if there are any dates in common
$clashing_dates = array_intersect($arr_chosen,$arr_db);
if(count($clashing_dates) > 0){
foreach ($clashing_dates as $key_db1 => $value_db1) {
array_push($unavailable_dates,$value_db1);
}
$unavailable_dates_string = implode(" ",$unavailable_dates);
$_SESSION["action"] = "true";
$message="$unavailable_dates_string already booked.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=failure.php?u=index.php&m=$message\">";
exit();
}
}
}
*/
$msg = '';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
require 'PHPMailer/src/Exception.php';
$mail = new PHPMailer();
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "localhost"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password
$subject1 = "$first_name your appointment has been confirmed"; // form field
$message="";
$email_topic="$first_name your appointment has been confirmed";
$button_link="$link";
$button_text="Go to Site";
$motto="Let's Glam you up!";
include("email_header.php");
$message .= "
Dear $first_name,<br/><br/>
Thank you for making a appointment with us. Your Reservation ID is <b>$appointment_id</b>.Your payment has been verified and your booking has been successfully completed. We are looking forward to seeing you on $check_in_nice!
<br/><br/>
The $company_name Team.<br/>
$email_logo
";
include("email_footer.php");
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from add
$mail->AddAddress("$email", "$email");//Send the message to yourself, or whoever should receive contact for submissions
$mail->AddReplyTo("$company_email", "$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject1";
$mail->MsgHTML("<html><body>$message<br></body></html>");
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
$msg = "Email not sent, please try again Mailer Error: ".$mail->ErrorInfo;
}
else {
//echo "Thanks for getting in touch, we will get back to ASAP";
$msg = "<span style='color:steelblue;'>$first_name thank you for your reservation, we will get contact you shortly.</span>";
}
$stmt = $con -> prepare('UPDATE appointments SET approved = ? WHERE appointment_id = ?');
$stmt -> bind_param('ss', $yes,$appointment_id);
$stmt -> execute();
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Reservation successfully approved.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=appointment_details.php?u=$appointment_id&m=$message\">";
}
$no="No";
if (isset($_POST["unapprove"])) {
$msg = '';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
require 'PHPMailer/src/Exception.php';
$mail = new PHPMailer();
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "localhost"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password
$subject1 = "$first_name your appointment has been cancelled"; // form field
$message="";
$email_topic="$first_name your appointment has been cancelled";
$button_link="$link";
$button_text="Go to Site";
$motto="Let's Glam you up!";
include("email_header.php");
$message .= "
Dear $first_name,<br/><br/>
Thank you for making a appointment with us. Unfortunately we had to cancel your appointment due to reasons beyond our control. We truly regret any inconveniences caused. We shall be in touch about a possible resheduling of your hair appointment. Thank your for choosing $company_name
<br/><br/>
The $company_name Team.<br/>
$email_logo
";
include("email_footer.php");
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from add
$mail->AddAddress("$email", "$email");//Send the message to yourself, or whoever should receive contact for submissions
$mail->AddReplyTo("$company_email", "$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject1";
$mail->MsgHTML("<html><body>$message<br></body></html>");
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
$msg = "Email not sent, please try again Mailer Error: ".$mail->ErrorInfo;
}
else {
//echo "Thanks for getting in touch, we will get back to ASAP";
$msg = "<span style='color:steelblue;'>$first_name thank you for your reservation, we will get contact you shortly.</span>";
}
$stmt = $con -> prepare('UPDATE appointments SET approved = ? WHERE appointment_id = ?');
$stmt -> bind_param('ss', $no,$appointment_id);
$stmt -> execute();
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Reservation successfully unapproved.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=appointment_details.php?u=$appointment_id&m=$message\">";
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container"> </div>
</section>
<!-- End Breadcrumbs -->
<!-- ======= Contact Section ======= -->
<section id="contact" class="contact inner-page">
<div class="container" data-aos="fade-up">
<div class="section-title">
<h2><?php echo"$appointment_id ($first_name $last_name)"; ?></h2>
<p></p>
</div>
<div class="row">
<div class="col-lg-6">
<?php
echo"
Client <span style='font-weight:900;'>$first_name $last_name</span><br/>
Email <span class='number_box'>$email</span><br/>
Phone <span class='number_box'>$phone</span><br/>
Date of Appointment <b>$check_in_nice</b><br/>
Hair Style - $title<br/>
Duration - $duration<br>
Client Price - $currency$check_out <br>
Status - <span style='color:$c'>$status</span>
<br/>
Amount - $currency";echo number_format($price);
echo"<br>Appointment made on <b>$date_made</b><br/>
";
?>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?><?php echo"?u=$appointment_id"; ?>" method="post" class="php-email-form1" enctype='multipart/form-data'>
<div class='text-center'>
<?php if($approved != "Yes"){ ?>
<button type='submit' name='approve'>Approve</button>
<?php } ?>
<?php if($approved == "Yes"){ ?>
<button type='submit' name='unapprove'>Un-approve</button>
<?php } ?>
<button type='submit' style='background:red !important;' name='delete'>Delete</button>
</div>
</form>
</div>
<div class="col-lg-6">
</div>
</div><!-- end row -->
</div>
</section><!-- End Contact Section -->
<?php include("footer.php"); ?>