yogibook-aury/public/bookandgo.php
2024-09-18 16:47:42 +02:00

107 lines
5.6 KiB
PHP

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
?>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once('include/headscript.php');
if (isset($_GET['idorder'])) { $idorder = $_GET['idorder']; }
if (isset($_GET['idnewbooking'])) { $idnewbooking = $_GET['idnewbooking']; }
if (isset($_GET['iduser'])) { $iduser = $_GET['iduser']; }
if (isset($_GET['idservicenew'])) { $idservicenew = $_GET['idservicenew']; }
// Effettua la cancellazione del record nella tabella bookingclass
// Sostituisci questi passaggi con il codice reale per connettersi al database e eseguire la query di cancellazione
// Recupera i valori di bookingstart e idserviceschedule dalla tabella bookingclass
$conn = new mysqli($servername, $username, $password, $dbname);
$sqlnewbook = "SELECT dateschedule FROM serviceschedule WHERE idserviceschedule = $idnewbooking";
$resultnew = $conn->query($sqlnewbook);
// Estrai il risultato e memorizzalo in $newtime
$rownew = $resultnew->fetch_assoc();
$newtime = $rownew["dateschedule"];
// Effettua l'inserimento del nuovo record nella tabella bookingclass
$insertQuery = "INSERT INTO bookingclass (idserviceschedule, iduser, prevbookingstart, idprevserviceschedule, idservice, idorder, bookingstart, status)
VALUES ($idnewbooking, $iduser, '0', '0', $idservicenew, $idorder, '$newtime', 'pending')";
$conn->query($insertQuery);
// Chiudi la connessione al database
$conn->close();
$newtimeformat = date("d-m-Y H:i", strtotime($newtime));
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
//mail to client
$messageedit=" <p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong><span style='line-height: 34.2px; font-size: 18px;'> Ciao $firstname , </span></strong></span></p>
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Hai inviato una richiesta di riprogrammazione della tua lezione </span></p>
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ecco il dettaglio della riprogrammazione $newtimeformat</span></p>
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>La tua richiesta è in fase di accettazione! Verrai avvisata se la riprogrammazione è stata accettata</span></p>
<br>
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per vedere e gestire le tue lezioni clicca qui: https://yogibook.yogasoul.it </span></p>
<br>
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per il primo accesso devi per prima cosa resettare la password cliccando di seguito</span></p>
<br>
<a href='https://yogibook.yogasoul.it/public/password/reset' target='_blank' class='v-button v-font-size' style='box-sizing: border-box;display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px;-webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;font-size: 14px;'>
<span style='display:block;padding:10px 20px;line-height:120%;'><span style='line-height: 16.8px;'>Reset Password</span></span>
</a>
<br>
<br>
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ci vediamo sul tappetino!</span></p>
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Il Team Yogasoul</span></p>";
$buttonedit="<a href='https://yogibook.yogasoul.it/' target='_blank' class='v-button v-font-size' style='box-sizing: border-box;display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px;-webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;font-size: 14px;'>
<span style='display:block;padding:10px 20px;line-height:120%;'><span style='line-height: 16.8px;'>YogiBook - YogaSoul</span></span>
</a>";
$mail = new PHPMailer(true);
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'premium60.web-hosting.com'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'info@yogasoul.it'; // SMTP username
$mail->Password = '!Testolina88'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->Port = '587';
include('mail/emailtemplate2.php');
// Email body content
//$trfnmbmail=$appformn.'r'.$revnumb;
$htmlContent = $mailmessage1;
$mail->From = 'info@yogasoul.it';
$mail->FromName = 'YogiBook [YogaSoul]';
$mail->addAddress($emailuser); // Add a recipient
$mail->Subject = "Proposta di riprogrammazione!";
$mail->Body = $htmlContent;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
//mail sent
// Esegui il reindirizzamento
header("Location: userpanel.php?reprogram=Y");
exit();
?>