ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/vracandbio.com/ |
Upload File : |
<?php
// Chargement fichiers de configuration.
require('libs/Smarty.class.php');
// Démarrage du moteur TPL.
$smarty = new Smarty;
// Chargement des Fonctions Globals.
require('fonctions.php');
//****************************************************************************************//
//************************** Traitement Formulaire de Contact ****************************//
//****************************************************************************************//
if($_POST['email']) {
$_POST['email'] = htmlspecialchars($_POST['email']);
if (preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#i", $_POST['email']))
{ $erreur_mail="1" ; } else { $erreur_mail="100" ; }
if ( $erreur_mail < 50) {
// Vérification si l'expéditeur est présent dans la base de données Newsletter
$sql = $GLOBALS['bdd']->prepare('SELECT * FROM fe_mail_user WHERE id_cat =:id_cat AND email =:email');
$sql->execute(array('email' => $_POST['email'], 'id_cat' => '3'));
$result = $sql->fetch();
// Si non présent, à l'ajoute.
if($result['email'] !== $_POST['email'])
{
$unsubscribe_code = substr(md5(trim($_POST['name']).trim($_POST['email'])), 0, 7);
$sql = $GLOBALS['bdd']->prepare('INSERT INTO fe_mail_user (insert_date, id_user, id_cat, name, email, unsubscribe_code, time_unsubscribe, ip_unsubscribe, status) VALUES (:insert_date, :id_user, :id_cat, :name, :email, :unsubscribe_code, :time_unsubscribe, :ip_unsubscribe, :status)');
$sql->execute(array('insert_date' => time(),
'id_user' => '3',
'id_cat' => '3',
'name' => '',
'email' => strtolower($_POST['email']),
'unsubscribe_code' => $unsubscribe_code,
'time_unsubscribe' => '0',
'ip_unsubscribe' => '0',
'status' => '0'));
$reponse = "Nous vous remercions pour votre Inscription...";
$smarty->assign('reponse',$reponse);
}
else
{
$reponse = "Désolé mais vous êtes déjà inscrit !";
$smarty->assign('reponse',$reponse);
}
}
if ( $erreur_mail > 50) {
$reponse = "Désolé mais votre adresse est invalide !";
$smarty->assign('reponse',$reponse);
}
}
//*************************************** Affichage **************************************//
$smarty->display('newsletter.tpl');
?>