| Current Path : /home/happyrenas/old/happy-r.fr/transfere_pro/administration/templates/admin2/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/old/happy-r.fr/transfere_pro/administration/templates/admin2/google_agenda.php |
<?
//https://www.sitepoint.com/community/t/ics-file-creation/3507/4
//http://www.kanzaki.com/docs/ical/dateTime.html
// For example, the following represents January 19, 1998, at 0700 UTC:
// DTSTART:19980119T070000Z
session_start();
$page="fiche";
include("config.php");
// CONNEXION
$mail = base64_decode(trim($_GET['mail']));
$password = base64_decode(trim($_GET['password']));
$id_logement = trim($_GET['id_logement']);
if ($mail && $password)
{
$num = $db->get_var("select count(id) from proprietaire where mail = '$mail' AND password = '$password'");
if ($num!=0)
{
header('Content-type: text/calendar; charset=utf-8');
$myquery="select id,statut from proprietaire where mail = '$mail' AND password = '$password'";
$marequete = $db->get_row($myquery);
$id=$marequete->id;
if ($id_logement)
{
$myquery = "SELECT * from reservation where (statut=2 || statut=3 || statut=4 || statut=8 || statut=9) AND id_logement=$id_logement AND id_proprietaire=".$id." order by id";
}
else
{
$myquery = "SELECT * from reservation where (statut=2 || statut=3 || statut=4 || statut=8 || statut=9) AND id_proprietaire=".$id." order by id";
}
$site_calls = $db->get_results($myquery);
$num = $db->num_rows;
echo "BEGIN:VCALENDAR\r\n";
echo "VERSION:2.0\r\n";
echo "PRODID:-//hacksw/handcal//NONSGML v1.0//EN\r\n";
$DTSTAMP = date("Ymd", strtotime(date("Y-m-d")))."T000000Z";
if (!empty($site_calls))
{
foreach ( $site_calls as $call )
{
if ($call->statut=='2') {$montexte="Indisponible";}
if ($call->statut=='3') {$montexte="Réservation validée";}
if ($call->statut=='4') {$montexte="Réservation payée";}
if ($call->statut=='8') {$montexte="Indisponible";}
if ($call->statut=='9') {$montexte="Indisponible";}
$myquery1 = "SELECT nom,prenom from proprietaire where id=".$call->id_proprietaire;
$marequete1 = $db->get_row($myquery1);
$myquery2 = "SELECT label from logement where id=".$call->id_logement;
$marequete2 = $db->get_row($myquery2);
$DTSTART = date("Ymd", strtotime($call->date1))."T000000Z";
$DTEND = date("Ymd", strtotime($call->date2))."T000000Z";
//echo "DTSTAMP:".$DTSTAMP."\r\n";
echo "BEGIN:VEVENT\r\n";
echo "DTSTART:".$DTSTART."\r\n";
echo "DTEND:".$DTEND."\r\n";
//echo "SUMMARY:".$marequete2->label.",".$montexte.",Mail : ".$call->mail."\r\n";
echo " .\r\n";
echo "END:VEVENT\r\n";
}
}
echo "END:VCALENDAR\r\n";
}
}
?>