Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // get the filename for the comment log
- $parts=parse_url($_SERVER['REQUEST_URI']));
- $filename=$parts['path'];
- $filename=str_replace(array("/","\","."),"-",$filename);
- $filename.=".comments";
- // save the comment?
- if($_POST['comment-now'])) {
- $comment=strip_tags(stripslashes($_POST['comment']));
- $source =strip_tags(stripslashes($_POST['source']));
- $f=fopen($filename,"at");
- if($f) {
- fwrite($f,"<div class='comment_block'>");
- fwrite($f,"<blockquote>$comment</blockquote>");
- fwrite($f,"<cite>$source</cite>");
- fwrite($f,"<p class='time'>$now</p>");
- fwrite($f,"</div>");
- fclose($f);
- }
- }
- // display the existing comments
- if(file_exists($filename)) {
- echo "<div class='comments'>";
- echo file_get_contents($filename);
- echo "</div>";
- }
- // display the comment form
- ?>
- <form action='' method='post'>
- <table>
- <tr>
- <td>Your name</td>
- <td><input type='text' name='source' /></td>
- </tr>
- <tr>
- <td>Your comment</td>
- <td><textarea name='comment'></textarea></td>
- </tr>
- <tr>
- <td>Ready?</td>
- <td><input type='submit' name='comment-now' value='Add Comment'></td>
- </tr>
- </table>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment