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
|
<?php
include("../config/connect.php");
ini_set('mysql.trace_mode', true);
$structure= htmlentities(addslashes($_POST['structure']));
$titre= htmlentities(addslashes($_POST['titre']));
$actu= htmlentities(addslashes($_POST['texte']));
$date= htmlentities(addslashes(date("d/m/Y")));
$rename= htmlentities(addslashes($_FILES["image"]["name"])); //Nom de l'image
$chemin = "../photos/".$rename;
move_uploaded_file($_FILES["image"]["tmp_name"],$chemin);
if ($rename!=""){
mysql_query("INSERT INTO actualite(id, structure, titreactu, texteactu, imageactu, dateactu) VALUES ('','$structure','$titre', '$actu','$rename','$date')");
echo("
<script language=\"javascript1.2\">
alert(\"L'actualité a été enregistrer!....\")
location.href=\"liste-actualite.php\";
</script>
");
}
else {
mysql_query("INSERT INTO actualite(id, structure, titreactu, texteactu, imageactu, dateactu) VALUES ('','$structure','$titre', '$actu','logo.png','$date')");
echo("
<script language=\"javascript1.2\">
alert(\"L'actualité a été enregistrer avec image par défaut!....\")
location.href=\"liste-actualite.php\";
</script>
");
}
mysql_close($config);
?> |
Partager