<?php
session_start();
include("cnx.php");
$post = array(
"text",
"author",
"link");
foreach($post as $p){
$field[$p] = mysql_real_escape_string($_POST[$p]);
$_SESSION[$p] = $_POST[$p];
}
if($_POST["calc"] != $_SESSION['total']){
include("head.php");
echo("If you are not a robot, please <a href='send.php'>try again</a>.");
include("foot.php");
die();
}
$sql = "INSERT INTO iyell (author,ip,date,text,link)
VALUES(\"". $field["author"] ."\",\"". $_SERVER["REMOTE_ADDR"]."\",". time() .",\"". $field["text"] ."\",\"". $field["link"] ."\");";
$req = mysql_query($sql);
if(mysql_error() != ""){
include("head.php");
echo("Error. Please <a href='send.php'>try again</a>. <" . "!" . "-- " . mysql_error() ."-->");
include("foot.php");
die();
}
foreach($post as $p){
unset($_SESSION[$p]);
}
header("Location: /");