[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: appointment.php
<?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require '../auth/PHPMailer/src/Exception.php'; require '../auth/PHPMailer/src/PHPMailer.php'; $timezome = 'Africa/Accra'; date_default_timezone_set($timezome); include "connect.php"; include "Includes/functions/functions.php"; include "Includes/templates/header.php"; include "Includes/templates/navbar.php"; ?> <!-- Appointment Page Stylesheet --> <link rel="stylesheet" href="Design/css/appointment-page-style.css"> <!-- BOOKING APPOINTMENT SECTION --> <section class="booking_section"> <div class="container"> <?php if(isset($_GET['shopname'])){ $getshopname = mysqli_real_escape_string($new,$_GET['shopname']); } if(isset($_POST['submit_book_appointment_form']) && $_SERVER['REQUEST_METHOD'] === 'POST') { // Selected SERVICES $selected_services = $_POST['selected_services']; // Selected EMPLOYEE $selected_employee = $_POST['selected_employee']; // Selected DATE+TIME $selected_date_time = explode(' ', $_POST['desired_date_time']); $date_selected = $selected_date_time[0]; $start_time = $date_selected." ".$selected_date_time[1]; $end_time = $date_selected." ".$selected_date_time[2]; //Client Details $client_first_name = test_input($_POST['client_first_name']); $client_last_name = test_input($_POST['client_last_name']); $client_phone_number = test_input($_POST['client_phone_number']); $client_email = test_input($_POST['client_email']); $gender = test_input($_POST['gender']); $con->beginTransaction(); try { // Check If the client's email already exist in our database // $stmtCheckClient = $con->prepare("SELECT * FROM clients WHERE client_email = ?"); // $stmtCheckClient->execute(array($client_email)); // $client_result = $stmtCheckClient->fetch(); // $client_count = $stmtCheckClient->rowCount(); $check = mysqli_query($new,"SELECT * FROM clients WHERE client_email = '$client_email'"); $ch = mysqli_fetch_array($check); $eMail = $ch['client_email']; if($e === $client_email ) { $client_id = $ch["client_id"]; $status = 'online'; $active = 'No'; $created = date("Y-m-d"); $payment_mode = 'None'; $date_created = Date("Y-m-d H:i"); $discount = "0.0"; $stmt_appointment = mysqli_query($new,"insert into appointments(date_created,created,client_id,employee_id,start_time, end_time_expected,active,status,payment_mode,business_name,discount)values('$date_created','$created','$client_id','$selected_employee','$start_time','$end_time','$active','$status','$payment_mode','$getshopname','$discount')"); $last_id = mysqli_insert_id($new); $fo = 1; for ($i=0; $i < count($selected_services) ; $i++) { $item = $selected_services[$i]; $xy = "INSERT INTO services_booked (appointment_id, service_id) VALUES ('$last_id','$item')"; $x = mysqli_query($new,$xy); } echo "<div class = 'alert alert-success'>"; echo "Great! Your appointment has been created successfully."; echo "</div>"; $subject = "Appointment Booking"; $mail_body = "<head> <meta name='viewport' content='width=device-width' /> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> </head> <body style='margin:0px; background: #f8f8f8; '> <div width='100%' style='background: #f8f8f8; padding: 0px 0px; font-family:arial; line-height:28px; height:100%; width: 100%; color: #000000;'> <table class='email-header'> </table> <div style='max-width: 700px; padding:50px 0; margin: 0px auto; font-size: 14px'> <center> <td class='text-center pb-4'> </td> </center> <div style='padding: 40px; background: #fff;'> <table border='0' cellpadding='0' cellspacing='0' style='width: 100%;'> <tbody> <tr> <td style='border-bottom:1px solid #000000;'> <h1>Appointment Booking</h1> </td> </tr> <tr> <td style='padding:10px 0 30px 0;'> <p style='font-size: 20px'>Thank you for booking an appointment. We will get in intouch soon</p> </td> </tr> <tr> <br /><br /> </tr> </tbody> </table> </div> <center> <td class='text-center pt-4'> <p class='email-copyright-text'>Copyright © 2023 The Salon Friend. All rights reserved.</p> </td> </center> </div> </div> </div> </body> </html>"; $eMail1 = "benmoshe15@gmail.com"; $mail = new PHPMailer(); $mail->addAddress($eMail1); $mail->setFrom('noreply@thesalonfriend.com','Appointment Bookings'); $mail->Subject = $subject; $mail->isHTML(true); $mail->CharSet= 'UTF-8'; $mail->Body = $mail_body; $mail->send(); } else { $stmtgetCurrentClientID = $con->prepare("SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'thesjhvq_thesalonfriend' AND TABLE_NAME = 'clients'"); $stmtgetCurrentClientID->execute(); $client_id = $stmtgetCurrentClientID->fetch(); $date = date('Y-m-d'); $stmtClient = $con->prepare("insert into clients(first_name,last_name,phone_number,client_email,date,gender,business_name) values(?,?,?,?,?,?,?)"); $stmtClient->execute(array($client_first_name,$client_last_name,$client_phone_number,$client_email,$date,$gender,$getshopname)); } $stmtgetCurrentAppointmentID = $con->prepare("SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'thesjhvq_thesalonfriend' AND TABLE_NAME = 'appointments'"); $stmtgetCurrentAppointmentID->execute(); $appointment_id = $stmtgetCurrentAppointmentID->fetch(); $status = 'online'; $active = 'No'; $created = date("Y-m-d"); $payment_mode = 'None'; $stmt_appointment = $con->prepare("insert into appointments(date_created,created,client_id, employee_id, start_time, end_time_expected,active,status,payment_mode,business_name,discount) values(?,?,?,?, ?,?,?,?,?,?,?)"); $stmt_appointment->execute(array(Date("Y-m-d H:i"),$created,$client_id[0],$selected_employee,$start_time,$end_time,$active,$status,$payment_mode,$getshopname,$discount)); foreach($selected_services as $service) { $stmt = $con->prepare("insert into services_booked(appointment_id, service_id) values(?, ?)"); $stmt->execute(array($appointment_id[0],$service)); } echo "<div class = 'alert alert-success'>"; echo "Great! Your appointment has been created successfully."; echo "</div>"; $subject = "Appointment Booking"; $mail_body = "<head> <meta name='viewport' content='width=device-width' /> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> </head> <body style='margin:0px; background: #f8f8f8; '> <div width='100%' style='background: #f8f8f8; padding: 0px 0px; font-family:arial; line-height:28px; height:100%; width: 100%; color: #000000;'> <table class='email-header'> </table> <div style='max-width: 700px; padding:50px 0; margin: 0px auto; font-size: 14px'> <center> <td class='text-center pb-4'> </td> </center> <div style='padding: 40px; background: #fff;'> <table border='0' cellpadding='0' cellspacing='0' style='width: 100%;'> <tbody> <tr> <td style='border-bottom:1px solid #000000;'> <h1>Appointment Booking</h1> </td> </tr> <tr> <td style='padding:10px 0 30px 0;'> <p style='font-size: 20px'>Thank you for booking an appointment. We will get in intouch soon</p> </td> </tr> <tr> <br /><br /> </tr> </tbody> </table> </div> <center> <td class='text-center pt-4'> <p class='email-copyright-text'>Copyright © 2023 THE SALON FRIEND. All rights reserved.</p> </td> </center> </div> </div> </div> </body> </html>"; $mail = new PHPMailer(); $mail->addAddress($eMail1); $mail->setFrom('noreply@thesalonfriend.com','Appointment Bookings'); $mail->Subject = $subject; $mail->isHTML(true); $mail->CharSet= 'UTF-8'; $mail->Body = $mail_body; $mail->send(); $con->commit(); } catch(Exception $e) { $con->rollBack(); echo "<div class = 'alert alert-danger'>"; echo $e->getMessage(); echo "</div>"; } } ?> <form method="post" id="appointment_form" action="appointment.php?shopname=<?php echo $getshopname ;?>"> <div class="select_services_div tab_reservation" id="services_tab"> <div class="alert alert-danger" role="alert" style="display: none"> Please, select at least one service! </div> <div class="text_header"> <span> 1. Choice of services </span> </div> <!-- SERVICES TAB --> <div class="items_tab"> <?php $stmt = $con->prepare("Select * from services WHERE business_name = ?"); $stmt->execute(array($getshopname)); $rows = $stmt->fetchAll(); foreach($rows as $row) { echo "<div class='itemListElement'>"; echo "<div class = 'item_details'>"; echo "<div>"; echo $row['service_name']; echo "</div>"; echo "<div class = 'item_select_part'>"; echo "<span class = 'service_duration_field'>"; echo $row['service_duration']." min"; echo "</span>"; echo "<div class = 'service_price_field'>"; echo "<span style = 'font-weight: bold;'>"; echo $row['service_price']." ¢"; echo "</span>"; echo "</div>"; ?> <div class="select_item_bttn"> <div class="btn-group-toggle" data-toggle="buttons"> <label class="service_label item_label btn btn-secondary"> <input type="checkbox" name="selected_services[]" value="<?php echo $row['service_id'] ?>" autocomplete="off">Select </label> </div> </div> <?php echo "</div>"; echo "</div>"; echo "</div>"; } ?> </div> </div> <!-- SELECT EMPLOYEE --> <div class="select_employee_div tab_reservation" id="employees_tab"> <!-- ALERT MESSAGE --> <div class="alert alert-danger" role="alert" style="display: none"> Please, select your Staff! </div> <div class="text_header"> <span> 2. Choice of employee </span> </div> <!-- EMPLOYEES TAB --> <div class="btn-group-toggle" data-toggle="buttons"> <div class="items_tab"> <?php $stmt = $con->prepare("Select * from employees WHERE business_name = ?"); $stmt->execute(array($getshopname)); $rows = $stmt->fetchAll(); foreach($rows as $row) { echo "<div class='itemListElement'>"; echo "<div class = 'item_details'>"; echo "<div>"; echo $row['first_name']." ".$row['last_name']; echo "</div>"; echo "<div class = 'item_select_part'>"; ?> <div class="select_item_bttn"> <label class="item_label btn btn-secondary active"> <input type="radio" class="radio_employee_select" name="selected_employee" value="<?php echo $row['employee_id'] ?>">Select </label> </div> <?php echo "</div>"; echo "</div>"; echo "</div>"; } ?> </div> </div> </div> <!-- SELECT DATE TIME --> <div class="select_date_time_div tab_reservation" id="calendar_tab"> <!-- ALERT MESSAGE --> <div class="alert alert-danger" role="alert" style="display: none"> Please, select time! </div> <div class="text_header"> <span> 3. Choice of Date and Time </span> </div> <div class="calendar_tab" style="overflow-x: auto;overflow-y: visible;" id="calendar_tab_in"> <div id="calendar_loading"> <img src="Design/images/ajax_loader_gif.gif" style="display: block;margin-left: auto;margin-right: auto;"> </div> </div> </div> <!-- CLIENT DETAILS --> <div class="client_details_div tab_reservation" id="client_tab"> <div class="text_header"> <span> 4. Client Details </span> </div> <div> <div class="form-group colum-row row"> <div class="col-sm-6"> <input type="text" name="client_first_name" id="client_first_name" class="form-control" placeholder="First Name"> <span class = "invalid-feedback">This field is required</span> </div> <div class="col-sm-6"> <input type="text" name="client_last_name" id="client_last_name" class="form-control" placeholder="Last Name"> <span class = "invalid-feedback">This field is required</span> </div> <div class="col-sm-6"> <input type="email" name="client_email" id="client_email" class="form-control" placeholder="E-mail"> <span class = "invalid-feedback">Invalid E-mail</span> </div> <div class="col-sm-6"> <input type="text" name="client_phone_number" id="client_phone_number" class="form-control" placeholder="Phone number"> <span class = "invalid-feedback">Invalid phone number</span> </div> <div class="col-sm-6"> <select class="form-control" name="gender" required style="color:#000"> <label>Gender</label> <option value="">Select gender</option> <option value="male">Male</option> <option value="female">Female</option> </select> </div> </div> </div> </div> <!-- NEXT AND PREVIOUS BUTTONS --> <div style="overflow:auto;padding: 30px 0px;"> <div style="float:right;"> <input type="hidden" name="submit_book_appointment_form"> <button type="button" id="prevBtn" class="next_prev_buttons" style="background-color: #bbbbbb;" onclick="nextPrev(-1)">Previous</button> <button type="button" id="nextBtn" class="next_prev_buttons" onclick="nextPrev(1)">Next</button> </div> </div> <!-- Circles which indicates the steps of the form: --> <div style="text-align:center;margin-top:40px;"> <span class="step"></span> <span class="step"></span> <span class="step"></span> <span class="step"></span> </div> </form> </div> </section> <!-- FOOTER BOTTOM --> <?php include "Includes/templates/footer.php"; ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 60.01 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002