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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
<?php
//connection au serveur
$BDD = mysql_connect(""""""); // Connexion à la base de données.
mysql_select_db("db657178822"); // Sélection de la base de données utilisée.
?>
<?php
$dossier = 'images/';
$fichier = basename($_FILES['image_localisation']['name']);
$taille_maxi = 1000000;
$taille = filesize($_FILES['image_localisation']['tmp_name']);
$extensions = array('.png', '.gif', '.jpg', '.jpeg');
$extension = strrchr($_FILES['image_localisation']['name'], '.');
//Début des vérifications de sécurité...
if(!in_array($extension, $extensions)) //Si l'extension n'est pas dans le tableau
{
$erreur = 'Vous devez uploader un fichier de type png, gif, jpg, jpeg, txt ou doc...';
}
if($taille>$taille_maxi)
{
$erreur = 'Le fichier est trop gros...';
}
if(!isset($erreur)) //S'il n'y a pas d'erreur, on upload
{
//On formate le nom du fichier ici...
$fichier = strtr($fichier,
'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ',
'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
$fichier = preg_replace('/([^.a-z0-9]+)/i', '-', $fichier);
if(move_uploaded_file($_FILES['image_localisation']['tmp_name'], $dossier . $fichier)) //Si la fonction renvoie TRUE, c'est que ça a fonctionné...
{
echo 'Upload effectué avec succès !';
}
else //Sinon (la fonction renvoie FALSE).
{
echo 'Echec de l\'upload !';
}
if (isset($_FILES['image_localisation']) && is_array($_FILES['image_localisation'])){
foreach($_FILES['image_localisation'] as $index=>$valeur){
$valeur = trim($valeur);
if (!empty($valeur)) {
$sql5 =" UPDATE modele SET image_localisation = '".$valeur."' WHERE id_modele = '".$id_modele."'";
mysql_query($sql5) or die(mysql_error());
}
}
}
}
else
{
echo $erreur;
}
?>
<?php
$illustration_1 = $_FILES['illustration_1']['name'];
$nom_fichier = $_FILES['illustration_1']['tmp_name'];
$nom_destination = 'images/'.$illustration_1;
move_uploaded_file($nom_fichier, $nom_destination);
$illustration_2 = $_FILES['illustration_2']['name'];
$nom_fichier = $_FILES['illustration_2']['tmp_name'];
$nom_destination = 'images/'.$illustration_2;
move_uploaded_file($nom_fichier, $nom_destination);
$illustration_3 = $_FILES['illustration_3']['name'];
$nom_fichier = $_FILES['illustration_3']['tmp_name'];
$nom_destination = 'images/'.$illustration_3;
move_uploaded_file($nom_fichier, $nom_destination);
$illustration_4 = $_FILES['illustration_4']['name'];
$nom_fichier = $_FILES['illustration_4']['tmp_name'];
$nom_destination = 'images/'.$illustration_4;
move_uploaded_file($nom_fichier, $nom_destination);
//récupération des valeurs des champs:
//marque:
$marque = $_POST["marque"] ;
$marque = addslashes( $marque ) ;
//id modele:
$id_modele = $_POST["id_modele"] ;
$id_modele = addslashes( $id_modele ) ;
//modele:
$modele = $_POST["modele"] ;
$modele = addslashes( $modele ) ;
//categorie:
$numero_fiche = $_POST["numero_fiche"] ;
$numero_fiche = addslashes( $numero_fiche ) ;
//millesime:
$millesime = $_POST["millesime"] ;
$millesime = addslashes( $millesime ) ;
//creation:
$crea = $_POST["crea"] ;
$crea = addslashes( $crea ) ;
//mise à jour:
$maj = $_POST["maj"] ;
$maj = addslashes( $maj ) ;
//indice:
$indice = $_POST["indice"] ;
$indice = addslashes( $indice ) ;
//indice:
$support = $_POST["support"] ;
$support = addslashes( $support ) ;
//percage:
$percage = $_POST["percage"] ;
$percage = addslashes( $percage ) ;
//decoupe:
$decoupe = $_POST["decoupe"] ;
$decoupe = addslashes( $decoupe ) ;
//autre:
$autre = $_POST["autre"] ;
$autre = addslashes( $autre ) ;
//autre:
$operation_text_autre = $_POST["operation_text_autre"] ;
$operation_text_autre = addslashes( $operation_text_autre ) ;
//localisation:
$localisation = $_POST["localisation"] ;
$localisation = addslashes( $localisation ) ;
//localisation_text_autre:
$localisation_text_autre = $_POST["localisation_text_autre"] ;
$localisation_text_autre = addslashes( $localisation_text_autre ) ;
//gamme:
$gamme = $_POST["gamme"] ;
$gamme = addslashes( $gamme ) ;
//titre_illustration_1:
$titre_illustration_1 = $_POST["titre_illustration_1"] ;
$titre_illustration_1 = addslashes( $titre_illustration_1 ) ;
//titre_illustration_2:
$titre_illustration_2 = $_POST["titre_illustration_2"] ;
$titre_illustration_2 = addslashes( $titre_illustration_2 ) ;
//titre_illustration_3:
$titre_illustration_3 = $_POST["titre_illustration_3"] ;
$titre_illustration_3 = addslashes( $titre_illustration_3 ) ;
//titre_illustration_4:
$titre_illustration_4 = $_POST["titre_illustration_4"] ;
$titre_illustration_4 = addslashes( $titre_illustration_4 ) ;
//création de la requête SQL:
$sql = "UPDATE modele
SET marque = '".$marque."',
modele = '".$modele."',
numero_fiche = '".$numero_fiche."',
millesime = '".$millesime."',
crea = '".$crea."',
maj = '".$maj."',
indice = '".$indice."',
support = '".$support."',
percage = '".$percage."',
decoupe_plastique = '".$decoupe."',
operation_autre = '".$autre."',
operation_text_autre = '".$operation_text_autre."',
localisation = '".$localisation."',
localisation_text_autre = '".$localisation_text_autre."',
gamme = '".$gamme."',
titre_illustration_1 = '".$titre_illustration_1."',
titre_illustration_2 = '".$titre_illustration_2."',
titre_illustration_3 = '".$titre_illustration_3."',
titre_illustration_4 = '".$titre_illustration_4."',
illustration_1 = '".$illustration_1."',
illustration_2 = '".$illustration_2."',
illustration_3 = '".$illustration_3."',
illustration_4 = '".$illustration_4."'
WHERE id_modele = ".$id_modele ;
//exécution de la requête SQL:
$requete = mysql_query($sql, $BDD) or die( mysql_error() ) ;
//affichage des résultats, pour savoir si la modification a marchée:
if($requete)
{
echo("<h3>Votre fiche ".$marque." ".$modele." ".$millesime." a bien été modifié</h3> ") ;
}
else
{
echo("La modification à échouée") ;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<body>
</body>
</html> |
Partager