Location: PHPKode > projects > OpenHuman > openhuman/sendmessage_com1.php
<?php

session_start();
require_once("inc.php");
require_once("db.php");

if(!isset($_SESSION['address']))
	die("You should be signed in to continue... Click to <a href=\"signin.php\">sign in</a>");
	

if(!isset($_POST['to'])||!isset($_POST['message'])||empty($_POST['to'])||empty($_POST['message'])) {
	die("Please fill in the form correctly and try again.");
}

if($_POST['captcha']!=$_SESSION['captcha_phrase'])
	die("Captcha Verification Failed");


$sql = "INSERT INTO communities VALUES (NULL, '".mysql_real_escape_string($_POST['to'])."', '".mysql_real_escape_string($_SESSION['address'])."', '".mysql_real_escape_string($_POST['message'])."', NOW());";
$res = $db->query($sql);
if(PEAR::isError($res))
	die("Error!");
	

$tpl->clear_cache("static.tpl","community|".urlencode($_POST['to']));


die("Message sent! Go back to <a href=\"community.php?s=".urlencode($_POST['to'])."\">the page</a>");



?>
Return current item: OpenHuman