Script passer de free à OVH
Bonjour,
J'ai commencer à develloper des pages sous free. Depuis nous avons un hébergeur (OVH). Le problème c'est que depuis que j'ai transfé mes 2 pages de free à OVH l'ajout à ma base de donné ne marche plus, alors qu'avant le site fonctionnait...
Vous auriez une idée ???
ci-joint les deux pages
recettes.php
Code:
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
| <?
mysql_connect("mysql5-9", "****", "****") or
die ("Impossible de se connecter: ".mysql_error());
mysql_select_db ("cuisineccorenne");
$query = mysql_query("SELECT * FROM categorie_recette ORDER BY intitule");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title></title>
</head>
<body>
<?
if ($_GET['message']==1) {
echo "Merci, votre recette à bien été enregistré dans la base<br />
<br />
<br />
";
}
?>
<form method="post" action="traitement-ajout-recette.php" ENCTYPE="multipart/form-data">
<table width="100%" border="0">
<tr>
<td width="49%"><div align="right">nom: </div></td>
<td width="2%"> </td>
<td width="49%"><input type="text" name="nom"/></td>
</tr>
<tr>
<td><div align="right">nombre ingrédient:</div></td>
<td> </td>
<td><input type="text" name="nombre_ingredient"/></td>
</tr>
<tr>
<td><div align="right">ingrédient: </div></td>
<td> </td>
<td><textarea name="ingredient" cols="80" rows="5"></textarea></td>
</tr>
<tr>
<td><div align="right">nombre étape: </div></td>
<td> </td>
<td><input type="text" name="nombre_etape"/></td>
</tr>
<tr>
<td><div align="right">étape:</div></td>
<td> </td>
<td><textarea name="etape" cols="80" rows="5"></textarea></td>
</tr>
<tr>
<td><div align="right">difficultés:</div></td>
<td> </td>
<td><input type="text" name="difficultes"/></td>
</tr>
<tr>
<td><div align="right">prix: </div></td>
<td> </td>
<td><input type="text" name="prix"/></td>
</tr>
<tr>
<td><div align="right">nombre personne: </div></td>
<td> </td>
<td><input type="text" name="nombre_personne"/></td>
</tr>
<tr>
<td>
<div align="right">degré épice: </div></td>
<td> </td>
<td><input type="text" name="degre_epice"/></td>
</tr>
<tr>
<td><div align="right">image:</div></td>
<td> </td>
<td><input type="hidden" name="posted" value="1" />
<input name="fichier" type="file" />
</td>
</tr>
<tr>
<td><div align="right">publier:</div></td>
<td> </td>
<td><input type="checkbox" name="publier"/></td>
</tr>
<tr>
<td><div align="right">type de plat: </div></td>
<td> </td>
<td><input type="text" name="type_de_plat"/></td>
</tr>
<tr>
<td><div align="right">catégorie</div></td>
<td> </td>
<td><select name="categorie"><?
while($row = mysql_fetch_array($query))
{
$idcat=$row['id_categorie'];
$intitule=$row['intitule'];
echo "<option value=\"$idcat\">$intitule</option>";
}
?></select></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Envoyer" /></td>
<td> </td>
</tr>
</table>
</form>
</body>
</html> |
traitement-ajout-recette.php
Code:
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
| <? //----------------------------
// DEFINITION DES VARIABLES
//----------------------------
$target = '../www/imagesRecettes/ '; // Repertoire cible
$extension = 'jpg'; // Extension du fichier sans le .
$max_size = 1000000; // Taille max en octets du fichier
$width_max = 10240; // Largeur max de l'image en pixels
$height_max = 10240; // Hauteur max de l'image en pixels
//---------------------------------------------
// DEFINITION DES VARIABLES LIEES AU FICHIER
//---------------------------------------------
$nom_file = $_FILES['fichier']['name'];
$taille = $_FILES['fichier']['size'];
$tmp = $_FILES['fichier']['tmp_name'];
//----------------------
// SCRIPT D'UPLOAD
//----------------------
if(!empty($_POST['posted'])) {
// On vérifie si le champ est rempli
if(!empty($_FILES['fichier']['name'])) {
// On vérifie l'extension du fichier
if(substr($nom_file, -3) == $extension) {
// On récupère les dimensions du fichier
$infos_img = getimagesize($_FILES['fichier']['tmp_name']);
// On vérifie les dimensions et taille de l'image
if(($infos_img[0] <= $width_max) && ($infos_img[1] <= $height_max) && ($_FILES['fichier']['size'] <= $max_size)) {
// Si c'est OK, on teste l'upload
if(move_uploaded_file($_FILES['fichier']['tmp_name'],$target.$_FILES['fichier']['name'])) {
// Si upload OK alors on affiche le message de réussite
} else {
// Sinon on affiche une erreur système
}
} else {
// Sinon on affiche une erreur pour les dimensions et taille de l'image
}
} else {
// Sinon on affiche une erreur pour l'extension
}
} else {
// Sinon on affiche une erreur pour le champ vide
}
}
$nom=$_POST["nom"];
$nombre_ingredient=$_POST["nombre_ingredient"];
$ingredient=$_POST["ingredient"];
$nombre_etape=$_POST["nombre_etape"];
$etape=$_POST["etape"];
$difficultes=$_POST["difficultes"];
$prix=$_POST["prix"];
$nombre_personne=$_POST["nombre_personne"];
$degre_epice=$_POST["degre_epice"];
$image=$_FILES['fichier']['name'];
$publier=$_POST["publier"];
$type_de_plat=$_POST["type_de_plat"];
$categorie=$_POST["categorie"];
mysql_connect("mysql5-9", "*****", "******") or
die ("Impossible de se connecter: ".mysql_error());
mysql_select_db ("cuisineccorenne");
$requete="INSERT INTO recette values ('','$nom','$nombre_ingredient','$ingredient','$nombre_etape','$etape','$difficultes','$prix','$nombre_personne','$degre_epice','$image','$publier','$type_de_plat','$categorie')";
mysql_query ($requete);
header("Location:http://www.cuisinecorenne.fr/recettes.php?message=1");
?> |