Script php application stock url avec descrip

badreflow Messages postés 54 Date d'inscription   Statut Membre Dernière intervention   -  
manirac Messages postés 37 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,
s.o.s je veux ecrire un formulaire qui va créer un catalogue d'url.chaque url saisie par l'utilisateur sera accompagnée d'un bref commentaire disant quel est le service offert par le site corresepondant. url et commentaire associé seront rangés l'un apres l'autre dans le fichier data.txt.pour cela j'ai ecrit deux code le premier .html qui invite un autre .php3

mais l'aure de l'exécution de l'application biensur avec wamp ou esyphp il me donne se message d'erreur :
Parse error: syntax error, unexpected $end in C:\wamp\www\phpp\ecrire.php on line 35

code html :

<html><head><title>hhh</title>
<body>
<form action ="ecrire.php" method=post>
url :<input type=text name ="tableau[url]" size=60>
<br>
description :<textarea name ="tableau[description]" rows=5 cols=40>
</textarea>
<br>
<input type="submit" value="envoyez !">
</form>
</body>
</html>
...................................................................................................................
code php :

<?php
function ecrirefichier ($url,$description)
{ $lefichier="data.txt";
$open =fopen($lefichier,"a");
if ($open)
{fwrite($open, "$url\t$description\n");
fclose($open);
$test=true;
}else
{$test=false;
}return $test;
}?>
<html>
<head>
<title>ecriture dans un fichier </title></head>
<body>
<?php
$motif="(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
if (eregi($motif,$tableau["url"]))
{$remplacement="<a href=\"http://\\2\\3\"target=\"_new
\">\\2\\3</a>";
$tableau["url"]= eregi_replace ($motif,$remplacement,$tableau["url"]);
$appel=ecrirefichier($tableau["url"],
$tableau["description"]);
if ($appel)
{print ("gooood. <br>\n");
}
else {print ("not good.<br>\n");
}
?>
</body>
</html>

.............................................................................
merci

1 réponse

manirac Messages postés 37 Date d'inscription   Statut Membre Dernière intervention   6
 
L'accolade après le test if (eregi($motif,$tableau["url"])) n'est pas fermée !
-1