
1×01 1×09 101 109 a1200 Adrive apache blog clarín comic Comics DD Dexter DNS DNS poisoning eLinks ezx facebook Gigasize Hack humor internet kaminsky kernel Knight Rider linux man in the middle Megaupload Megavideo mod_proxy Netload p2p S01E01 S01E09 script Seguridad The Mentalist ubuntu Universo unix vulnerabilidad windows WordPress xkcd Yabadaba.ru
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.

Content © El blog de J0hn. Proudly powered by WordPress. To bookmark this site, press Control+D.
"Black Hat" theme by Nicki Faulk. For best results, please view with Firefox. [ Register / Log in ]
Hell’s Gourmet PHP Comments Script Canape
Tagged as comments, Hell's Gourmet, Hell's Gourmet PHP Comments Script Canape, php, script, web
Very well, this a pretty small comments script (as its Canape part of the name makes evident) and is my first actual PHP code editing and understanding project. It came out as a funny add-on to a small static page I published just as a joke for a friend of mine, a couple of days ago. I have to admit it was funny…to code it and to use it!
You can see here the page I was talking about, if intrigued, as an example of its functionality (MeLL need some paper bags :p).
The engine:
<?phpsession_start();
if (isset($_POST['message'])) {
if (isset($_SESSION['token']) && $_POST['token'] == $_SESSION['token']) {
$message = htmlentities($_POST['message']);
$message2 = htmlentities($_POST['message2']);
$fp = fopen('messages.txt', 'a'); // This is the file where comments wil be stored. Should be writable.
fwrite($fp, "<p><strong>".date("d-m-Y H:i:s")."</strong><br /><b>$message</b><br/>$message2</p>");
fclose($fp);
}
}
$token = md5(uniqid(rand(), true));
$_SESSION['token'] = $token;
?>
We use a simple plain text file in stead of a database. Of course the file messages.txt must exist and be writeable by the webserver. This code MUST be placed above you HTML code. You can customize the way the comments will be displayed by editing the html tags that are hardcoded on the fwite function. Read more... (396 words, 0 images, estimated 1:35 mins reading time)