note 58101 added to function.fopen

From: Date: Mon, 24 Oct 2005 12:51:21 +0000
Subject: note 58101 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-97511@lists.php.net to get a copy of this message
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> ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58101 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58101&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58101&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58101&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58101&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58101&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58101&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58101&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58101&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97511) next »