//Check to see if the directory ztmp and that it is writeable.
if ( ! ( is_dir("ztmp") and is_writeable("ztmp") ) ) {
echo "You're supposed to create a directory at the same level as this php file and chmod 1777 ztmp.
\n" ;
exit ;
}
//Check to see if the file ztmp/posts.txt is there. If it isn't, create and emtpy file.
if ( ! is_file("ztmp/posts.txt") ) {
touch("ztmp/posts.txt") ;
}
//If the string that was passed to the php script in $a is not empty, add it to the end of the file.
if ( $a != "" ) {
$fp = fopen( "ztmp/posts.txt" , 'a' ) ;
fwrite( $fp, $a . " from $REMOTE_ADDR
\n" ) ;
fclose($fp) ;
}
//Include the file here so that it is printed out in the html.
include("ztmp/posts.txt") ;
?>
Back