Location: PHPKode > projects > Oriblog > oriblog/postcomment.php

// NOTE: This page should *not* be wrapped in html. Leave it as it is, 
// with the exception of changing the email address here:

// specify an email address to send comments to (this should be your 
// address)

// include our db settings
include "db.inc";
// strip html and php tags from the name supplied
// if a name isn't given, make the name "Anonymous"
if ($name=="") {
// strip tags from the comment itself
// replace newlines with html linebreaks for the database
$commentmysql=str_replace("\n", "<br />", $comment);
// strip backslashes (used for escaping characters) from the comment so 
// it can be use in the rss feed.
// if the comment has no parent it must be a toplevel comment, so make 
// its parent "0"
if ($parent == "") {
mysql_query("INSERT INTO comments (poster, comment, entry, parent) VALUES ('$name', '$commentmysql', $entry, $parent)");

// specify the message that will appear in the email
$message="Comment from $name.\n\n$comments\n\n";
// actually send the email (this will only work on unix systems with 
// an MTA installed, AFAICT)
mail($to,"Comment From $name",$comment,"From: $to\n");
// redirect the user back to the main blog page
header('Location: index.php');
Return current item: Oriblog