Hi there,
I have a page on my website:here
It is essentially a news submission page I put together in Dreamweaver which allows the user to attach an image for the news story. It uses the Smart Image and PHP upload extensions to do this.
The basic problem is that Smart Image processor is working great, images are being uploaded and resized, but nothing is being entered into the database, in any field. If I take the smart image stuff out the form submits the data as it should. I am using the Insert Record Behaviour in Dreamweaver.
Here is the code from the top of the page:
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $SERVER['PHP_SELF'];
if (isset($SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($editFormAction)) {
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
}
if ((isset($POST["MM_insert"])) && ($POST["MM_insert"] == "add_news")) {
$insertSQL = sprintf("INSERT INTO news (Type, Headline, Poster, Summary, Content, Image, Date, Disabled) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($POST['type'], "int"),
GetSQLValueString($POST['headline'], "text"),
GetSQLValueString($POST['poster'], "text"),
GetSQLValueString($POST['summary'], "text"),
GetSQLValueString($POST['content'], "text"),
GetSQLValueString($POST['image'], "text"),
GetSQLValueString($POST['date'], "date"),
GetSQLValueString(isset($POST['disabled']) ? "true" : "", "defined","'Y'","'N'"));
mysql_select_db($database_c13_RLI_2006c, $c13_RLI_2006c);
$Result1 = mysql_query($insertSQL, $c13_RLI_2006c) or die(mysql_error());
$insertGoTo = "news.php";
if (isset($SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
Sorry to post so much code but I'm not sure which is relevant. There is also a load of code for Smart Image and PHP upload, and I wonder if the following could conflict with the insert record code above:
$resizeGoTo = "news.php"; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$resizeGoTo .= (strpos($resizeGoTo, '?')) ? "&" : "?";
$resizeGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $resizeGoTo));
}
Can anyone shed any light on this?