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/sabrinaluxebraidedwigs.com/public_html/ |
<?php use PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;use PHPMailer\PHPMailer\SMTP; session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("header.php");
?>
<?php
if (isset($_GET['u'])){
$hair_id = mysqli_real_escape_string($con,$_GET['u']);
$stmt = $con -> prepare('SELECT * FROM hair_styles WHERE hair_id=?');
$stmt -> bind_param('s',$hair_id);
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($id,$hair_id,$title,$description,$duration,$price,$picture,$display);
$numrows = $stmt -> num_rows();
if($numrows > 0){
while ($stmt -> 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();}
$msg="";
if (isset($_POST['save'])){
$appointment_id = substr(md5(rand()), 0, 8);
$date_made = date("D,dS M, Y g:ia");
$check_in_raw = mysqli_real_escape_string($con,$_POST['check_in']);
$first_name = mysqli_real_escape_string($con,$_POST['first_name']);
$last_name = mysqli_real_escape_string($con,$_POST['last_name']);
$email = mysqli_real_escape_string($con,$_POST['email']);
$phone = mysqli_real_escape_string($con,$_POST['phone']);
$your_price = mysqli_real_escape_string($con,$_POST['your_price']);
$DateTime = new DateTime($check_in_raw);
$check_in = $DateTime->format('Y-m-d');
$check_in_nice = $DateTime->format('D,dS M, Y g:ia');
$check_out = "";
$time = "";//mysqli_real_escape_string($con,$_POST['time']);
$approved = "Pending";
$db_id=0;
//check if wrong date is manually entered
$stmt_reser = $con -> prepare('SELECT check_in FROM appointments WHERE check_in = ?');
$stmt_reser -> bind_param('s',$check_in);
$stmt_reser -> execute();
$stmt_reser -> store_result();
$stmt_reser -> bind_result($c_in);
$numrows_reser = $stmt_reser -> num_rows();
if($numrows_reser > 0){
$_SESSION["action"] = "true";
$message="The date chosen is unavailable.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=failure.php?u=hair_style_details.php?u=$hair_id&m=$message\">";
exit();
}
$stmt_a = $con -> prepare('INSERT INTO appointments VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
$stmt_a -> bind_param('issssssssssssss', $db_id,$appointment_id,$date_made,$check_in,$your_price,$check_in_nice,$first_name,$last_name,$email,$phone,$approved,$hair_id,$title,$price,$duration);
$stmt_a -> execute();
$subject="Reservation from $first_name $last_name";
$message1="
Reservation ID - $appointment_id<br/>
First Name - $first_name<br/>
Last Name - $last_name<br/>
Email - $email<br/>
Phone - $phone<br/>
Hair Style - $title<br/>
Client Price - $your_price<br>
Appointment Date - $check_in_nice $time<br/>
<br/>
Reservation made on $date_made
";
$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
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from address
$mail->AddReplyTo("$email","$email"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject";
$mail->MsgHTML("<html><body>$message1</body></html>");
$mail->AddAddress("$company_email", "Reservations");//Send the message to yourself, or whoever should receive contact for submissions
//$mail->AddAttachment(""); // attachment
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
$msg = "<div class='alert alert-danger'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Something went wrong, please try again</b>
</div>";
}
else {
$msg = "<div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Email Sent</b>
</div>";
}
//email an autoresponse to the person too
$mail->clearAddresses();
$mail->clearReplyTos();
$subject1 = "$first_name thank you for your reservation"; // form field
$message="";
$email_topic="$first_name thanks for your reservation";
$button_link="$link";
$button_text="Go to Site";
$motto="Lets Glam you Up";
include("email_header.php");
$message .= "
Dear $first_name,<br/><br/>
Thank you for making a reservation with our Salon. Your Reservation ID is <b>$appointment_id</b>.Your request is in progress and is being worked on by our service team. We are prioritizing your request and will notify you via email or phone if your reservation is successful.
<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;
$message = $msg;
$_SESSION["action"] = "true";
echo "<meta http-equiv=\"refresh\" content=\"0; url=failure.php?u=index.php&m=$message\">";
exit();
}
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 confirm your booking shortly.</span>";
$_SESSION["action"] = "true";
$message="$first_name thank you for your reservation, we will confirm your booking shortly";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=index.php&m=$message\">";
exit();
}
}
?>
<title><?php echo $company_name; ?> - <?php echo $title; ?></title>
<!-- Title Page -->
<section class="bg-title-page p-t-40 p-b-50 flex-col-c-m" style="background-image: url(images/banner-min.jpg);">
<h2 class="l-text2 t-center">
<div class='space_top'></div>
<?php echo $title; ?>
</h2>
</section>
<br/>
<section class="bgwhite p-t-66 p-b-60">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="block1 hov-img-zoom pos-relative m-b-30"data-aos='zoom-in' data-aos-delay='100'>
<img src="img/hair_styles/<?php echo $picture; ?>" alt="" style='width:100%;border-radius:5px;'>
</div>
<h3><?php echo $title; ?></h3>
<p class="f-para">
<?php echo $description; ?>
</p>
</div>
<div class="col-md-6">
<form class="leave-comment" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>?u=<?php echo $hair_id; ?>" method='post'>
<h2>Fill your desired time for the appointment below:</h2>
<h4 class="">
<?php echo"<br/>$msg";?>
</h4>
<div class="bo4 of-hidden size15 m-b-20">
<input class="sizefull s-text7 p-l-22 p-r-22" type="text" name="first_name" placeholder="First Name"required>
</div>
<div class="bo4 of-hidden size15 m-b-20">
<input class="sizefull s-text7 p-l-22 p-r-22" type="text" name="last_name" placeholder="Last Name"required>
</div>
<div class="bo4 of-hidden size15 m-b-20">
<input class="sizefull s-text7 p-l-22 p-r-22" type="text" name="phone" placeholder="Phone" required>
</div>
<div class="bo4 of-hidden size15 m-b-20">
<input class="sizefull s-text7 p-l-22 p-r-22" type="email" name="email" placeholder="Email Address"required>
</div>
<div class="bo4 of-hidden size15 m-b-20">
<input class="sizefull s-text7 p-l-22 p-r-22" type="number" name="your_price" placeholder="Your Price" required>
</div>
Time and Date
<div class="bo4 of-hidden size15 m-b-20">
<input class="sizefull s-text7 p-l-22 p-r-22" type="datetime-local" name="check_in" required>
</div>
<div class="w-size25">
<!-- Button -->
<button name='save' type='submit' class="flex-c-m size2 bg1 bo-rad-23 hov1 m-text3 trans-0-4">
Submit
</button>
</div>
</form>
</div>
</div>
</div>
</section>
<?php include("footer.php"); ?>