<?php
include('config.php');
include('database.php');
$method = mysql_real_escape_string(strip_tags(trim($_GET['method'])));
if ($method == 'contact') {
	$name    = htmlspecialchars($_POST['name'],ENT_QUOTES);
	$email   = htmlspecialchars($_POST['email'],ENT_QUOTES);
	$title   = htmlspecialchars($_POST['title'],ENT_QUOTES);
	$message = htmlspecialchars($_POST['message'],ENT_QUOTES);
	if (!empty($name) OR !empty($email) OR !empty($title) OR !empty($message)) {
	$time = time();
	$add = mysql_query("INSERT INTO messages (message_sender_name,message_sender_email,message_title,message_content,message_datetime) VALUES ('$name','$email','$title','$message','$time')");
		if ($add) {
			echo 1;
		} else {
			echo 0;
		}
	}
}
?>