Forum Moderators: coopster
$itemsql = "INSERT INTO `items` (user_id, propertytype, age, grade, style, nofl, adres, arcd, pstcd, borough, city, country, startingprice, dateends)
VALUES('".$_SESSION['USERID']."','".addslashes($_POST['propertytype'])."','".$_POST['age']."','".addslashes($_POST['grade'])."','".addslashes( $_POST['style'])."','".$_POST['nofl']."','".addslashes($_POST['adres'])."','".$_POST['arcd']."','".$_POST['pstcd']."','".$_POST['borough']."','".$_POST['city']."',
'".$_POST['country']."','".$_POST['startingprice']."','".$concatdate."')";
mysql_query($itemsql)or die(mysql_error());
$db = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($dbdatabase, $db);
$age = strip_tags(mysql_real_escape_string($_POST['age']));
$nofl = strip_tags(mysql_real_escape_string($_POST['nofl']));
$adres = strip_tags(mysql_real_escape_string($_POST['adres']));
$arcd = strip_tags(mysql_real_escape_string($_POST['arcd']));
$pstcd = strip_tags(mysql_real_escape_string($_POST['pstcd']));
$borough = strip_tags(mysql_real_escape_string($_POST['borough']));
$city = strip_tags(mysql_real_escape_string($_POST['city']));
$country = strip_tags(mysql_real_escape_string($_POST['country']));
$startingprice = strip_tags(mysql_real_escape_string($_POST['startingprice']));
mysql_query($itemsql)or die(mysql_error());
function error_func($generic,$db_err=null) {
echo "<h1>Error</h1>";
echo "<p>$generic</p>";
// THEN log the value of $db_err here
if ($db_err) {
// open log file, store error
}
}
function pf_validate_string($value, $function, $redirect)
{
$final = NULL;
if($value!="")
{
if(!is_string($value))
{
header("Location: {$redirect}");
exit();
}
else
{
$final = $value;
}
}
else
{
if ($function=='redirect')
{
header("Location: {$redirect}");
exit();
}
}
return $final;
}
if(!isset($_POST['name']) || !isset($_POST['age']) || !isset($_POST['town']))
{
//redirect to login page as values are empty,place an exit
//after the redirect to make sure that nothing else downstream executes
exit;
}else{
//values are set, process the form!
}