connect('mysql', 'localhost', 'messiba', 'HyJZWTEiVOLL0mw', 'messiba_mariage_eden_haniel');
$token = $_GET["token"] ?? '';
$card_name = '';
// mode readonly
$files = [];
$files[] = 'cover';
// token ?
$info_json = json_encode([]);
if(!empty($token))
{
$token_found = $DB->query("SELECT *, (select name from app_event where id = app_event_id) as event_name FROM app_event_invitation WHERE deleted = 'no' and `token` = '$token'")->fetch();
if(!$token_found)
{
die("
Erreur : merci de prendre le lien de votre faire-part
");
}
$card_name = $token_found['custom_sentence'];
$info = json_decode($token_found['params_json'], true);
$info_json = json_encode($info);
// mairie
if($info["Mairie"]['adulte'] || $info["Mairie"]['enfant'])
{
$files[] = 'mairie';
}
// mikve
/*if($info["Mikve"]['adulte'] || $info["Mikve"]['enfant'])
{
$files[] = 'mikve';
}*/
// houppa & réception
if($info["Houppa & Réception"]['adulte'] || $info["Houppa & Réception"]['enfant'])
{
$files[] = 'houppa-reception';
}
$files[] = 'rsvp';
// post response
if($_POST)
{
include 'inc/contact.inc.php';
}
}
else
{
die("Merci de cliquer sur le lien de votre invitation
");
}
// compilation *********************************************************************************************************
$files[] = 'end';
$contents = '';
foreach($files as $file)
{
$contents .= file_get_contents("view/{$file}.html");
}
$BASE = file_get_contents('_layout.html');
$BASE = str_replace('[contents]', $contents, $BASE);
$BASE = str_replace('{info_json}', $info_json, $BASE);
$BASE = str_replace('[card_name]', strtoupper($card_name), $BASE);
$BASE = str_replace('[TIME]', time(), $BASE);
die($BASE);