move the upload and update code at lines 323 - 362
<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if(isset($_POST["DownloadFileButton"]) || isset($_POST["DownloadFileButton_x"])){
WA_DFP_DownloadFile("WA_DownloadResult1", "../Forum-SharedFiles/", "".$row_Post['ShareFile'] ."", "[FileName]", false, false, false, "", "", "", "");
}
?>
<?php require_once("webassist/email/mail_php.php"); ?>
<?php require_once("webassist/email/mailformatting_php.php"); ?>
<?php
// WA DataAssist Insert
if (isset($_POST["CommentButton"]) || isset($_POST["CommentButton_x"])) // Trigger
{
$WA_connection = $Connection;
$WA_table = "siteezy_comments";
$WA_sessionName = "LatestComment";
$WA_redirectURL = "Post.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = true;
$WA_fieldNamesStr = "MessageID|UserEmail|UserName|Comment";
$WA_fieldValuesStr = "".$row_Post['MessageID'] ."" . $WA_AB_Split . "".$row_User['UserEmail'] ."" . $WA_AB_Split . "".$row_User['UserFirstName'] ." ".$row_User['UserLastName'] ."" . $WA_AB_Split . "".((isset($_POST["Comment"]))?$_POST["Comment"]:"") ."";
$WA_columnTypesStr = "none,none,NULL|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_Connection;
mysql_select_db($WA_connectionDB, $WA_connection);
@session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id($WA_connection);
if ($WA_redirectURL != "") {
$WA_redirectURL = str_replace("[Insert_ID]",$_SESSION[$WA_sessionName],$WA_redirectURL);
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
to 219 so it is before the recordset code.