%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_6031bb72/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_6031bb72/appointment_enquiry.php
<?php
include "config.php";
$query_website=mysqli_query($conn,"SELECT * FROM `system_settings` WHERE `id`=1");
$rows_website=mysqli_fetch_array($query_website);
$isArabic = isset($_COOKIE['ar']);

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
header('Content-Type: application/json');

$response = [];

if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $fname              = mysqli_real_escape_string($conn, $_POST['fname']);
    $lname              = mysqli_real_escape_string($conn, $_POST['lname']);
    $name               = $fname.' '.$lname;
    $email              = mysqli_real_escape_string($conn, $_POST['email']);
    $phone              = mysqli_real_escape_string($conn, $_POST['phone']);
    $book_time          = mysqli_real_escape_string($conn, $_POST['date']);
    $service_name       = mysqli_real_escape_string($conn, $_POST['services']);
    $receive_date       = date('Y-m-d H:i:s');

    if(empty($name) || empty($email) || empty($phone) || empty($book_time) || empty($service_name)){
        $response['status'] = "error";
        $response['message'] = $isArabic ? 'جميع الحقول مطلوبة.' : 'All fields are required.';
        echo json_encode($response);
        exit;
    }

    $email_config=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM email_setting WHERE id=1"));
    
      $host=$email_config['host'];
      $port=$email_config['port'];
      $username=$email_config['email'];
      $password=$email_config['password'];
      if(isset($_COOKIE['ar'])) {
        $website_name = $rows_website['website_name_ar'];
      } else {
        $website_name = $rows_website['website_name'];
      }

    //   template heading 


    $name_h          = $isArabic ? 'اسم' : 'Name';
    $country_h       = $isArabic ? 'دولة' : 'Country';
    $email_h         = $isArabic ? 'معرف البريد الإلكتروني' : 'Email ID';
    $phone_h         = $isArabic ? 'هاتف' : 'Phone';
    $appointment_h   = $isArabic ? 'تاريخ ووقت الموعد' : 'Appointment Date & Time';
    $service_name_h  = $isArabic ? 'اسم الخدمة' : 'Service Name';
    $receive_date_h  = $isArabic ? 'تاريخ الاستلام' : 'Receive Date';
    $subject         = $isArabic ? 'استفسار عن موعد' : 'Appointment enquiry';
    $altbody         = $isArabic ? 'تم إرسال استفسارك بنجاح' : 'Your enquiry sent successfully';
    $successmessage  = $isArabic ? 'تم إرسال طلب تحديد الموعد بنجاح!' : 'Appointment enquiry send successfully!';
    $errormessage1   = $isArabic ? '❌ خطأ في البريد الإلكتروني:' : '❌ Mail Error:';
    $errormessage2   = $isArabic ? 'حدث خطأ في قاعدة البيانات. يرجى المحاولة مرة أخرى.' : 'Database error. Please try again.';
    $errormessage3   = $isArabic ? 'طلب غير صالح.' : 'Invalid request.';
    
    $email_temp = '
    <table style="border: solid 2px #DDEEEE; border-collapse: collapse; border-spacing: 0; font: normal 14px Roboto, sans-serif;">
    <thead>
    <tr>
    <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B; padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">
    '.$name_h.'
    </th>
    <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B; padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">
    '.$email_h.'
    </th>
    <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B; padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">
    '.$phone_h.'
    </th>
    <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B; padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">
    '.$appointment_h.'
    </th>
    <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B; padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">
    '.$service_name_h.'
    </th>
    <th style="background-color:#DDEFEF; border:solid 1px #DDEEEE; color: #336B6B; padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">
    '.$receive_date_h.'
    </th>
    </tr>
    </thead>
    <tbody>
    <tr>    
    <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">' . $name . '</td>

    <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">' . $email . '</td>

    <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">' . $phone . '</td>

    <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">' . $book_time . '</td>

    <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">' . $service_name . '</td>
    
    <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">' . $receive_date . '</td>
    </tr>
    </tbody>
    </table>';
   

$mail = new PHPMailer(true);

    try {
    
        $mail->isSMTP();
        // $mail->SMTPDebug = 2;
        $mail->Host       = $host;
        $mail->SMTPAuth   = true;
        $mail->Username   = $username;   
        $mail->Password   = $password;
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
        $mail->Port       = $port;
        $mail->CharSet    = 'UTF-8';
    
        $mail->setFrom($username, $website_name);     
        $mail->addAddress($username); 
        $mail->addAddress($email); 
        $mail->addAddress('info@alshifamedicaltour.com');
    
        $mail->isHTML(true);
        $mail->Subject = $subject;
        $mail->Body    = $email_temp;
        $mail->AltBody = $altbody;
    
        $mail->send();
    
    } catch (Exception $e) {
        $response['status']  = "error";
        $response['message'] = $errormessage1 . " " . $mail->ErrorInfo;
        echo json_encode($response);
        exit;
    }

    $insert = mysqli_query($conn, "INSERT INTO `enquiry_tbl` (name, email, phone, book_time, service_name, enquiry_type, receive_date) VALUES ('$name', '$email', '$phone', '$book_time', '$service_name','3', '$receive_date')");

    if ($insert) {
        $response['status'] = "success";
        $response['message'] = $successmessage;
    } else {
        $response['status'] = "error";
        $response['message'] = $errormessage2;
    }

} else {
    $response['status'] = "error";
    $response['message'] = $errormessage3;
}

echo json_encode($response);
exit;
?>

VaKeR 2022