note 58101 deleted from function.fopen by cece

From: Date: Mon, 24 Oct 2005 13:00:35 +0000
Subject: note 58101 deleted from function.fopen by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-97513@lists.php.net to get a copy of this message
Note Submitter: das_kaushik at hotmail dot com Reason: bad code ---- The following is an example of a simple blog program. Brgds, Kaushik <HTML> <BODY> <H1>Your Comments</H1> <H2>Please feel free to voice your comments here</H2> <? // This is a SIMPLE Blog program using PHP // Author: Kaushik Das // Email : Das_Kaushik@hotmail.com // Please create an empty file -> yourcomments.html // before executing this program // This file is available at http://www.das-in.org/comments/index.php if ($_POST) { //This section writes to the comments file $filecomments = fopen("yourcomments.html","a+"); if (trim($_POST['name'])=="") {$name="Unknown Poster";} else {$name=trim($_POST['name']);} if (trim($_POST['email'])=="") {$email="godknows@heaven.int";} else {$email=trim($_POST['email']);} $addString = "<HR>On " . date("l dS \of F Y h:i:s A") . " <EM>" . $name . "</EM>(<a href=\"mailto:$email\">". $email . "</a>) wrote:<BR>\n" . trim($_POST['YRCOMMENTS']) . "\n"; fwrite($filecomments, $addString); fclose($filecomments); } include("yourcomments.html"); echo "<HR>"; ?> <FORM ACTION="<?= $PHP_SELF ?>" METHOD="POST"> <FONT SIZE=0>Please note that this is an open forum. Please refrain from making any derogatory remarks. Thanks for your cooperation in maintaining the sanctity of the board.</FONT><BR> <PRE>Your Name: <INPUT TYPE="TEXT" NAME="name"></PRE> <PRE>Your email: <INPUT TYPE="TEXT" NAME="email"></PRE> <P><TEXTAREA NAME="YRCOMMENTS" ROWS="10" COLS="50" wrap="virtual"></TEXTAREA></P> <P><INPUT TYPE="SUBMIT" VALUE="POST MY COMMENT!"/></P> </FORM> </BODY> </HTML>

« previous php.notes (#97513) next »