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
| //--------------------------------------------------------------------------------------------
// Fichier previsu
//--------------------------------------------------------------------------------------------
$nom = $_SESSION['identifiant'];
$date = date('d-m-Y');
$url = basename($_SERVER['HTTP_REFERER']);
// Image Principale
if (isset($_FILES['img_principale']['name'])){
$img = $_FILES['img_principale']['name'];
}
else if (isset($_FILES['file']['name'])){ // Nouvelle Image
$img = $_FILES['file']['name'];
}
if(isset($img))
$_SESSION['imgprincipale'] = $img;
// Première Vignette
if (isset($_FILES['vignette1']['name'])){
$vignette1 = $_FILES['vignette1']['name'];
}
else if (isset($_FILES['newv1']['name'])){ // Nouvelle Vignette 1
$vignette1 = $_FILES['newv1']['name'];
}
if(isset($vignette1))
$_SESSION['vignette1'] = $vignette1;
if($url == "deposer.php"){
if($_SESSION['categorie'] == "agence"){
$req = "INSERT INTO temp(img,nom_img,titre,description,vignette1,nom_v1,vignette2,nom_v2,brouillon,auteur,client,date,produit) VALUES('$img','$img','$titre','$description','$vignette1','$vignette1','$vignette2','$vignette2','0','$nom','$client','$date','$produit')";
}
else if($url == "modifier.php"){
if($_SESSION['categorie'] == "agence"){
$req = "UPDATE temp SET img='$img', nom_img='$img', titre='$titre', description='$description', vignette1='$vignette1', nom_v1='$vignette1', vignette2='$vignette2', nom_v2='$vignette2', date='$date', produit='$produit', brouillon='0', auteur='$nom', client='$client' WHERE id!='0'";
}
.....
Affichage de l'article
......
<form name="publier" method="post">
<input type="button" name="publier" value="Publier" onclick="window.document.publier.action='scripts/post_ok.php';window.document.publier.submit();"/>
<input type="button" name="return" value="Modifier" onclick="window.document.publier.action='modifier.php';window.document.publier.submit();" />
<input type="button" name="save" value="Enregistrer en brouillon" onclick="window.document.publier.action='scripts/save.php';window.document.publier.submit();" />
</form>
//-------------------------------------------------------------------------------------------- |
Partager