Bonjour
J'ai utilisé ce script (pris d'un site et deja utilisé par d'autres forumeurs) :
guestbook.php
writeguest.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15<form method=post action=writeguest.php onSubmit='if ( this.nom.value.length < 2 ) { return false ;}' > <table> <tr><td>Nom :</td> <td><input type=text name=nom size=25 ></td> <td rowspan=2><input type=submit value=Envoyer></td></tr> <tr><td>Mail :</td> <td><input type=text name=mail size=25 ></td></tr> <tr><td>Message:</td><td colspan=2> <textarea name=message rows=4 cols=47></textarea> </td></tr> </table> </form> <?php include("guestbook.txt"); ?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <? //Ouverture du fichier en écriture $fp = fopen("guestbook.txt","a"); //On convertit les caracteres html $nom = htmlspecialchars($_POST['nom']); $mail = htmlspecialchars($_POST['mail']); $message = stripslashes(nl2br(htmlentities($_POST['message']))); $d = date ( "d/m/Y H:i:s" ); $page = ""; $lemail = "<a href=\"mailto:$mail\">$mail</a>"; $page .= "<b>$nom</b> (".$lemail.") - $d<br>$message<br><br>\n"; //On rajoute le message fwrite($fp,"$page" ,strlen("$page")); //fermeture du fichier fclose($fp); //On affiche le message enregistré echo "Merci $nom, nous avons enregistré: <br>"; echo "email : $mail <br> message : $message"; ?> <a href="comments.php">Retour au guestbook</a>
Le script tourne niquel en local avec easy php mais quand je le met online j'ai ces messages qui s'affichent après avoir cliqué sur envoyer :
Warning: fopen(guestbook.txt): failed to open stream: Permission denied in D:\WWWRoot\deejay-pool.com\www\krafft\writeguest.php on line 3
Warning: fwrite(): supplied argument is not a valid stream resource in D:\WWWRoot\deejay-pool.com\www\krafft\writeguest.php on line 16
Warning: fclose(): supplied argument is not a valid stream resource in D:\WWWRoot\deejay-pool.com\www\krafft\writeguest.php on line 19
Merci pour votre aide,
Manu






Répondre avec citation
Partager