Se connecter avec
S'enregistrer | Connectez-vous

script de petites annonces

Dernière réponse : dans Programmation

  1. <html><head>
  2. <META NAME="DESCRIPTION" CONTENT="Le portail du développement PHP des jeunes Webmasters">
  3. <META NAME="KEYWORDS" CONTENT="script, php, code, html, balises, programmation, javascript, web, webmaster, ressources, webmestre, jeune, débuter, commencer, langage">
  4. <META NAME="REPLY-TO" CONTENT="eroan@free.fr">
  5. <META NAME="AUTHOR" CONTENT="Eroan Boyer">
  6. <META HTTP-EQUIV="imagetoolbar" CONTENT="no">
  7. <META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="fr">
  8. <META HTTP-EQUIV="VW96.OBJECT TYPE" CONTENT="Archive">
  9. <META NAME="ROBOTS" CONTENT="index,follow">
  10. <META NAME="REVISIT-AFTER" CONTENT="15 days">
  11. <META NAME="ROBOTS" CONTENT="ALL">
  12. <link rel="stylesheet" type="text/css" href="style-annonces.css">
  13. <TITLE>Jeunes Webmasters :: Petites annonces ::</TITLE>
  14. </head><body>
  15.  
  16. <p align="center">Voici le formulaire pour <b><i>passer une annonce</i></b>
  17. <hr width="500" size="1"></p><br>
  18.  
  19. <div align="center"><center><table border="0" width="500" cellspacing="0" cellpadding="0"><tr><td width="100%">
  20.  
  21. <?
  22. if (isset($submit) AND ($ttr <> "Titre de votre annonce") AND ($modpats <> "Attention, Mot de passe!") AND ($obj <> "Décrivez ici ce que vous souhaitez vendre, avec un maximum d'informations : Etat, couleur, marque, prix...") AND ($inf <> "Donnez ici vos coordonnées : téléphone, email, adresse!") AND ($ttr <> "") AND ($modpats <> "") AND ($obj <> "") AND ($inf <> ""))
  23. {
  24. $fp = fopen("annonces.txt","a");
  25. $ttr = trim($ttr);
  26. $ttr = strtoupper($ttr);
  27. $ttr = str_replace("\'", "'", $ttr);
  28. $ttr = str_replace('\"', '"', $ttr);
  29. $ttr = str_replace(" ,", ", ", $ttr);
  30. $ttr = str_replace(" , ", ", ", $ttr);
  31. $ttr = str_replace(" .", ". ", $ttr);
  32. $ttr = str_replace(" . ", ". ", $ttr);
  33. $ttr = str_replace("|", "I", $ttr);
  34. $ttr = str_replace("£", "L", $ttr);
  35. $obj = trim($obj);
  36. $obj = strtolower($obj);
  37. $obj = Ucwords($obj);
  38. $obj = str_replace("\'", "'", $obj);
  39. $obj = str_replace('\"', '"', $obj);
  40. $obj = str_replace(" ,", ", ", $obj);
  41. $obj = str_replace(" , ", ", ", $obj);
  42. $obj = str_replace(" .", ". ", $obj);
  43. $obj = str_replace(" . ", ". ", $obj);
  44. $obj = str_replace("|", "I", $obj);
  45. $obj = str_replace("£", "L", $obj);
  46. $obj = str_replace(CHR(10), "", $obj);
  47. $inf = trim($inf);
  48. $inf = strtolower($inf);
  49. $inf = Ucwords($inf);
  50. $inf = str_replace(CHR(10), " ", $inf);
  51. $inf = str_replace("\'", "'", $inf);
  52. $inf = str_replace('\"', '"', $inf);
  53. $inf = str_replace(" ,", ", ", $inf);
  54. $inf = str_replace(" , ", ", ", $inf);
  55. $inf = str_replace(" .", ". ", $inf);
  56. $inf = str_replace(" . ", ". ", $inf);
  57. $inf = str_replace("|", "I", $inf);
  58. $inf = str_replace("£", "L", $inf);
  59.  
  60. $ttr = htmlentities($ttr);
  61. $modpats = htmlentities($modpats);
  62. $inf = htmlentities($inf);
  63. $obj = htmlentities($obj);
  64.  
  65. $inf = str_replace("[mail]", "<a href=\"mailto:", $inf);
  66. $inf = str_replace("[/mail]", "\">[Contacter]</a>", $inf);
  67.  
  68. $modpats = trim($modpats);
  69. $modpats = str_replace("\'", "'", $modpats);
  70. $modpats = str_replace('\"', '"', $modpats);
  71. $modpats = str_replace("|", "I", $modpats);
  72. $modpats = str_replace("£", "L", $modpats);
  73.  
  74. fputs($fp, "$ttr|$obj|$inf|$modpats £");
  75. fclose($fp);
  76.  
  77. $ttr = strtolower($ttr);
  78. $ttr = Ucwords($ttr);
  79.  
  80. echo("<p align=\"justify\">Votre annonce \"<b>$ttr</b>\" a bien été prise en compte! Vous pouvez vérifier en cliquant <a href=\"annonces.php\">sur ce lien</a>. Rappelez vous une fois votre annonce dépassée de contacter le webmaster pour lui demander de la retirer, en lui rappelant votre mot de passe (<b>$modpats</b>)!<br><br>Merci de votre confiance et à bientôt sur le site...</p>");
  81. }
  82. else
  83. {
  84. if (isset($submit))
  85. {
  86. echo("<script language=\"javascript\">alert('Vous devez renseigner tous les champs!');</script>");
  87. }
  88. ?>
  89.  
  90. <div align="center"><form name="form" method="POST" action="annonces-inscription.php"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  91. <tr><td width="50%"><p align="right"><input maxlength="50" type="text" name="ttr" size="32" value="Titre de votre annonce"></p>
  92. </td><td width="50%"><p align="left"><input maxlength="50" type="text" name="modpats" size="32" value="Attention, Mot de passe!">
  93. </td></tr><tr><td width="100%" colspan="2">
  94. <p align="center"><textarea rows="8" name="obj" cols="66">Décrivez ici ce que vous souhaitez vendre, avec un maximum d'informations : Etat, couleur, marque, prix...</textarea></td>
  95. </tr><tr><td width="100%" colspan="2"><p align="center"><textarea rows="5" name="inf" cols="66">Donnez ici vos coordonnées : téléphone, email, adresse!</textarea></td>
  96. </tr><tr><td width="100%" colspan="2">
  97. <p align="center"><INPUT TYPE="submit" value="Soumettre" name="submit"></td></tr></table></form></center>
  98.  
  99. <?
  100. }
  101. ?>
  102.  
  103. <br><br><center>Script développé par <a href="<a href="http://www.jeunes-webmasters.com" target="_blank">http://www.jeunes-webmasters.com</a>" target="_blank">Jeunes Webmasters</a> (Scripts PHP)<br>Powered by J-Web Annonces v1.0</center>
  104.  
  105. </td></tr></table></center></div>
  106.  
  107. </body>
  108. </html>

je ne c pas pour quoi les annonce ne sont pas enregistrer dans je fichier annonce.txt
mem si je l'ai mis en chmod777
aidez moi svp

Autres pages sur : script petites annonces

Lassé par la pub ? Créez un compte

Refet ton code en le disposant de la sorte :
  1. <balise1>
  2. <balise2>
  3. <balise3>
  4. blablabla
  5. <balise3>
  6. <balise2>
  7. <balise1>


Je peux t'assurer que ton code sera beaucoup plus propre et cela te permettera de réduire tes erreurs de code de 50% au moins.

De plus, quand je vois un code comme le tiens, je ne prend même pas la peine de l'étudier ou plutôt de le déchiffrer.

Edit ton post avec ton nouveau code.

/* // J ai testé ça et c'est bon il ya une erreur dans le if je pense que que le bon if est : */
////////////////////////////

if (isset($_POST['submit']) )
AND ($_POST['ttr'] <> "Titre de votre annonce" ) AND ($_POST['modpats'] <> "Attention, Mot de passe!" ) AND ($_POST['obj'] <> "Décrivez ici ce que vous souhaitez vendre, avec un maximum d'informations : Etat, couleur, marque, prix..." ) AND ($_POST['inf'] <> "Donnez ici vos coordonnées : téléphone, email, adresse!" ) AND ($_POST['ttr'] <> "" ) AND ($_POST['modpats'] <> "" ) AND ($_POST['obj'] <> "" ) AND ($_POST['inf'] <> "" ))

///////////////////////// sinon ça c'est bon


<html><head>
<META NAME="DESCRIPTION" CONTENT="Le portail du développement PHP des jeunes Webmasters">
<META NAME="KEYWORDS" CONTENT="script, php, code, html, balises, programmation, javascript, web, webmaster, ressources, webmestre, jeune, débuter, commencer, langage">
<META NAME="REPLY-TO" CONTENT="eroan@free.fr">
<META NAME="AUTHOR" CONTENT="Eroan Boyer">
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="fr">
<META HTTP-EQUIV="VW96.OBJECT TYPE" CONTENT="Archive">
<META NAME="ROBOTS" CONTENT="index,follow">
<META NAME="REVISIT-AFTER" CONTENT="15 days">
<META NAME="ROBOTS" CONTENT="ALL">
<link rel="stylesheet" type="text/css" href="style-annonces.css">
<TITLE>Jeunes Webmasters :: Petites annonces ::</TITLE>
</head><body>

<p align="center">Voici le formulaire pour <b><i>passer une annonce</i></b>
<hr width="500" size="1"></p><br>

<div align="center"><center><table border="0" width="500" cellspacing="0" cellpadding="0"><tr><td width="100%">

<?php
if (isset($_POST['submit']) )
{
//if (isset($submit) AND ($_POST['ttr'] <> "Titre de votre annonce" ) AND ($_POST['modpats'] <> "Attention, Mot de passe!" ) AND ($_POST['obj'] <> "Décrivez ici ce que vous souhaitez vendre, avec un maximum d'informations : Etat, couleur, marque, prix..." ) AND ($_POST['inf'] <> "Donnez ici vos coordonnées : téléphone, email, adresse!" ) AND ($_POST['ttr'] <> "" ) AND ($_POST['modpats'] <> "" ) AND ($_POST['obj'] <> "" ) AND ($_POST['inf'] <> "" ))
//{
$fp = fopen("annonces.txt","a");
$ttr = $_POST['ttr'];
$ttr = trim($ttr);
$ttr = strtoupper($ttr);
$ttr = str_replace("\'", "'", $ttr);
$ttr = str_replace('\"', '"', $ttr);
$ttr = str_replace(" ,", ", ", $ttr);
$ttr = str_replace(" , ", ", ", $ttr);
$ttr = str_replace(" .", ". ", $ttr);
$ttr = str_replace(" . ", ". ", $ttr);
$ttr = str_replace("|", "I", $ttr);
$ttr = str_replace("£", "L", $ttr);
$obj = $_POST['obj'];
$obj = trim($obj);
$obj = strtolower($obj);
$obj = Ucwords($obj);
$obj = str_replace("\'", "'", $obj);
$obj = str_replace('\"', '"', $obj);
$obj = str_replace(" ,", ", ", $obj);
$obj = str_replace(" , ", ", ", $obj);
$obj = str_replace(" .", ". ", $obj);
$obj = str_replace(" . ", ". ", $obj);
$obj = str_replace("|", "I", $obj);
$obj = str_replace("£", "L", $obj);
$obj = str_replace(CHR(10), "", $obj);
$inf = $_POST['inf'];
$inf = trim($inf);
$inf = strtolower($inf);
$inf = Ucwords($inf);
$inf = str_replace(CHR(10), " ", $inf);
$inf = str_replace("\'", "'", $inf);
$inf = str_replace('\"', '"', $inf);
$inf = str_replace(" ,", ", ", $inf);
$inf = str_replace(" , ", ", ", $inf);
$inf = str_replace(" .", ". ", $inf);
$inf = str_replace(" . ", ". ", $inf);
$inf = str_replace("|", "I", $inf);
$inf = str_replace("£", "L", $inf);

$ttr = htmlentities($ttr);
$modpats = $_POST['modpats'];
$modpats = htmlentities($modpats);
$inf = htmlentities($inf);
$obj = htmlentities($obj);

$inf = str_replace("[mail]", "<a href=\"mailto:", $inf);
$inf = str_replace("[/mail]", "\">[Contacter]</a>", $inf);
$modpats = trim($modpats);
$modpats = str_replace("\'", "'", $modpats);
$modpats = str_replace('\"', '"', $modpats);
$modpats = str_replace("|", "I", $modpats);
$modpats = str_replace("£", "L", $modpats);
fputs($fp, "$ttr|$obj|$inf|$modpats £" );
fclose($fp);
$ttr = strtolower($ttr);
$ttr = Ucwords($ttr);

echo("<p align=\"justify\">Votre annonce \"<b>$ttr</b>\" a bien été prise en compte! Vous pouvez vérifier en cliquant <a href=\"annonces.php\">sur ce lien</a>. Rappelez vous une fois votre annonce dépassée de contacter le webmaster pour lui demander de la retirer, en lui rappelant votre mot de passe (<b>$modpats</b> )!<br><br>Merci de votre confiance et à bientôt sur le site...</p>" );
}
else
{
if (isset($submit))
{
echo("<script language=\"javascript\">alert('Vous devez renseigner tous les champs!');</script>" );
}
?>

<div align="center"><form name="form" method="POST" action="index1.php"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><td width="50%"><p align="right"><input maxlength="50" type="text" name="ttr" size="32" value="Titre de votre annonce"></p>
</td><td width="50%"><p align="left"><input maxlength="50" type="text" name="modpats" size="32" value="Attention, Mot de passe!">
</td></tr><tr><td width="100%" colspan="2">
<p align="center"><textarea rows="8" name="obj" cols="66">Décrivez ici ce que vous souhaitez vendre, avec un maximum d'informations : Etat, couleur, marque, prix...</textarea></td>
</tr><tr><td width="100%" colspan="2"><p align="center"><textarea rows="5" name="inf" cols="66">Donnez ici vos coordonnées : téléphone, email, adresse!</textarea></td>
</tr><tr><td width="100%" colspan="2">
<p align="center"><INPUT TYPE="submit" value="Soumettre" name="submit"></td></tr></table></form></center>
<?php
}
?>

<br><br><center>Script développé par <a href="http://www.jeunes-webmasters.com" target="_blank">Jeunes Webmasters</a> (Scripts PHP)<br>Powered by J-Web Annonces v1.0</center>

</td></tr></table></center></div>

</body>
</html>
Lassé par la pub ? Créez un compte
Tom's guide dans le monde