1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| if ($envoye)
{
$date_debut = date ("d/m/Y");
$joursem = array('dim', 'lun', 'mar', 'mer', 'jeu', 'ven', 'sam');
list($jour_debut, $mois_debut, $annee_debut) = explode('/', $date_debut);
$timestamp = mktime (0, 0, 0, $mois_debut, $jour_debut, $annee_debut);
$joursem[date("w",$timestamp)];
if ($joursem <= 7);
{
if ($nom AND $description AND $categorie AND $jour_debut AND $mois_debut AND $an_debut AND $hour_deb AND $minute_deb)
{
$date_debut=array("$an_debut","$mois_debut","$jour_debut");
$date_debut=implode("-",$date_debut);
$heure_deb=array("$hour_deb","$minute_deb","00");
$heure_deb=implode(":",$heure_deb);
$rdv_debut=array("$date_debut","heure_deb");
$rdv_debut=implode(" ",$rdv_debut);
if ($jour_fin AND $mois_fin AND $an_fin AND $hour_fin AND $minute_fin)
{
$date_fin=array("$an_fin","$mois_fin","$jour_fin");
$date_fin=implode("-",$date_fin);
$heure_fin=array("$hour_fin","$minute_fin","00");
$heure_fin=implode(":",$heure_fin);
$rdv_fin=array("$date_fin","heure_fin");
$rdv_fin=implode(" ",$rdv_fin);
}
else
{
$rdv_fin=$rdv_debut;
}
if ($url == "http://")
{
$url="";
}
if (!$lien AND $url)
{
$lien=$url;
}
//SI MAGIC QUOTE EST DESACTIVE
if (!get_magic_quotes_gpc())
{
$nom=addslashes($nom);
$description=addslashes($description);
$contact=addslashes($contact);
$adresse=addslashes($adresse);
$lien=addslashes($lien);
}
//SUPPRESION DES TAGS HTML NON AUTORISES
$nom=strip_tags($nom,$tags);
$description=strip_tags($description,$tags);
$contact=strip_tags($contact,$tags);
$adresse=strip_tags($adresse,$tags);
//AJOUT DES SAUTS DE LIGNE
$description=nl2br($description);
$query="INSERT INTO $table_agenda (date_debut,date_fin,heure_deb,heure_fin,rdv_debut,rdv_fin,nom,description,categorie,contact,adresse,email,telephone,fax,lien,url,user,actif) VALUES ('$date_debut','$date_fin','$heure_deb','$heure_fin','$rdv_debut','$rdv_fin','$nom','$description','$categorie','$contact','$adresse','$email','$telephone','$fax','$lien','$url','$_SESSION[the_user]','$actif')";
$result=mysql_query($query);
$nom = stripslashes($nom);
echo "<p>L'événement <b>$nom</b> a été ajouté.</p>";
}
else
{
echo "<p><font color=\"red\">Erreur : merci de compléter tous les champs obligatoires.</font></p>";
$erreur="1";
}
}
else
{
echo "<p><font color=\"red\">Erreur : impossible de fixer un rendez-vous un dimanche.</font></p>";
}
} |
Partager