Pure PHP Upload Add-On Pack Support Product Page
This topic was archived
delete file before update... many tryouts...
Reported 04 Apr 2007 19:26:52
1
has this problem
04 Apr 2007 19:26:52 Patrick Van Hautem posted:
Sorry fellows,I've had a good go at it and not much success....
Maybe you can find a solution with the info I have here:
I'm running on a php mysql server
using DMX 7,0,1
using pure php upload 2,1,3
addon 1,0,6
I've looked throughout the forum and tryout various solution that were put forward... tried a few little tricks also but to no avail.
I seem to have an issue with the delete file before update.
I get : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
The problem seems to be coming from the $HTTP_POST_VARS as I've echoed it and nothing appears..... food for thought.
The litttle blighter seems to capture my imagination and irritate my skin.
Anyway,
Here's the beginning of my "edit data" page
...hope you can enlighten us all a little .
<?php require_once('../../../Connections/mic_data.php'); ?><?php
session_start();
$MM_authorizedUsers = "2,1";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == ""
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../error/access_denied2.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?"
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php require_once('../../../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../../../ScriptLibrary/incResize.php'); ?>
<?php require_once('../../../ScriptLibrary/incPUAddOn.php'); ?>
<?php ?>
<?php ?>
<?php ?>
<?php ?>
<?php
// Pure PHP Upload 2.1.3
if (isset($HTTP_GET_VARS['GP_upload'])) {
$ppu = new pureFileUpload();
$ppu->path = "../../../mic_int/php_dynamic/teampictures";
$ppu->extensions = "";
$ppu->formName = "form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "over";
$ppu->requireUpload = "false";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->checkVersion("2.1.3"
$ppu->doUpload();
}
$GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true";
} else {
$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
}
} else {
$GP_uploadAction .= "?"."GP_upload=true";
}
// Delete Before Update Addon 1.0.6
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1"
mysql_select_db($database_mic_data, $mic_data);
$dbu_result = mysql_query("SELECT * FROM members WHERE thiskey=".$HTTP_POST_VARS['thiskey'] , $mic_data) or die(mysql_error());
$dbu = new deleteFileBeforeUpdate($ppu);
$dbu->pathThumb = "";
$dbu->naming = "suffix";
$dbu->suffix = "_small";
$dbu->checkVersion("1.0.6"
while ($dbu->sqldata = mysql_fetch_array($dbu_result)) {
$dbu->deleteFile();
}
}
echo "SELECT * FROM members WHERE thiskey=".$HTTP_POST_VARS[$colname_Rs2]."<br/>";
// Smart Image Processor 1.0.6
if (isset($HTTP_GET_VARS['GP_upload'])) {
$sip = new resizeUploadedFiles($ppu);
$sip->component = "ImageMagick";
$sip->resizeImages = "true";
$sip->aspectImages = "true";
$sip->maxWidth = "70";
$sip->maxHeight = "70";
$sip->quality = "80";
$sip->makeThumb = "false";
$sip->pathThumb = "";
$sip->aspectThumb = "true";
$sip->naming = "suffix";
$sip->suffix = "_small";
$sip->maxWidthThumb = "";
$sip->maxHeightThumb = "";
$sip->qualityThumb = "70";
$sip->checkVersion("1.0.6"
$sip->doResize();
}
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != ""
break;
case "long":
case "int":
$theValue = ($theValue != ""
break;
case "double":
$theValue = ($theValue != ""
break;
case "date":
$theValue = ($theValue != ""
break;
case "defined":
$theValue = ($theValue != ""
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_update"])) && ($_POST["MM_update"] == "form1"
$updateSQL = sprintf("UPDATE members SET whome_txt=%s, whatme_txt=%s, order_txt=%s, whatdo_txt=%s, whereami_txt=%s, whatsmyemail_txt=%s, whatsmymobile_txt=%s, findoutmore_txt=%s, whatsmymobile2_txt=%s, landphone_txt=%s, landphone2_txt=%s, fax_txt=%s, whatsmyemail2_txt=%s, whatsmyemail3_txt=%s, homeaddress=%s, homepage_txt=%s, ichat_txt=%s, msn_txt=%s, skype_txt=%s, photo1_txt=IFNULL(%s,photo1_txt), photo2_txt=IFNULL(%s,photo2_txt), photo3_txt=IFNULL(%s,photo3_txt), photo4_txt=IFNULL(%s,photo4_txt), photo5_txt=IFNULL(%s,photo5_txt), photo6_txt=IFNULL(%s,photo6_txt), photo7_txt=IFNULL(%s,photo7_txt), photo8_txt=IFNULL(%s,photo8_txt), photo9_txt=IFNULL(%s,photo9_txt), photo10_txt=IFNULL(%s,photo10_txt), photo11_txt=IFNULL(%s,photo11_txt), photo12_txt=IFNULL(%s,photo12_txt) WHERE thiskey=%s",
GetSQLValueString($_POST['name_txt'], "text"
GetSQLValueString($_POST['whatme_txt'], "text"
GetSQLValueString($_POST['order_txt'], "text"
GetSQLValueString($_POST['whatdo_txt'], "text"
GetSQLValueString($_POST['whereami_txt'], "text"
GetSQLValueString($_POST['whatsmyemail_txt'], "text"
GetSQLValueString($_POST['whatsmymobile_txt'], "text"
GetSQLValueString($_POST['findoutmore_txt'], "text"
GetSQLValueString($_POST['whatsmymobile2_txt'], "text"
GetSQLValueString($_POST['landphone_txt'], "text"
GetSQLValueString($_POST['landphone2_txt'], "text"
GetSQLValueString($_POST['fax_txt'], "text"
GetSQLValueString($_POST['whatsmyemail2_txt'], "text"
GetSQLValueString($_POST['whatsmyemail3_txt'], "text"
GetSQLValueString($_POST['homeaddress'], "text"
GetSQLValueString($_POST['homepage_txt'], "text"
GetSQLValueString($_POST['ichat_txt'], "text"
GetSQLValueString($_POST['msn_txt'], "text"
GetSQLValueString($_POST['skype_txt'], "text"
GetSQLValueString($_POST['photo1_txt'], "text"
GetSQLValueString($_POST['photo2_txt'], "text"
GetSQLValueString($_POST['photo3_txt'], "text"
GetSQLValueString($_POST['photo4_txt'], "text"
GetSQLValueString($_POST['photo5_txt'], "text"
GetSQLValueString($_POST['photo6_txt'], "text"
GetSQLValueString($_POST['photo7_txt'], "text"
GetSQLValueString($_POST['photo8_txt'], "text"
GetSQLValueString($_POST['photo9_txt'], "text"
GetSQLValueString($_POST['photo10_txt'], "text"
GetSQLValueString($_POST['photo11_txt'], "text"
GetSQLValueString($_POST['photo12_txt'], "text"
GetSQLValueString($_POST['Key'], "int"
mysql_select_db($database_mic_data, $mic_data);
$Result1 = mysql_query($updateSQL, $mic_data) or die(mysql_error());
$updateGoTo = "../updates/updated.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_Rs2 = "1";
if (isset($_GET['recordID3'])) {
$colname_Rs2 = (get_magic_quotes_gpc()) ? $_GET['recordID3'] : addslashes($_GET['recordID3']);
}
mysql_select_db($database_mic_data, $mic_data);
$query_Rs2 = sprintf("SELECT * FROM members WHERE thiskey = %s", $colname_Rs2);
$Rs2 = mysql_query($query_Rs2, $mic_data) or die(mysql_error());
$row_Rs2 = mysql_fetch_assoc($Rs2);
$totalRows_Rs2 = mysql_num_rows($Rs2);
?>
cheers
Replies
Replied 05 Apr 2007 10:33:23
05 Apr 2007 10:33:23 Georgi Kralev replied:
Hi Patrick,
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>The problem seems to be coming from the $HTTP_POST_VARS as I've echoed it and nothing appears..... food for thought.
The litttle blighter seems to capture my imagination and irritate my skin.<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I have not checked your code. But If you believe that the problem comes from $HTTP_POST_VARS note that from PHP 4.2 long predefined array variables (as $HTTP_*_VARS) usually are disabled. (There is a line in php.ini register_long_arrays = Off).
The problem could be fixed either by changing the line in php.ini. Or (if you do not have access to php.ini) by adding the following lines before your php code:
<?php
if( !isset( $HTTP_SERVER_VARS ) )
{
$HTTP_SERVER_VARS = $_SERVER;
}
if( !isset( $HTTP_GET_VARS ) )
{
$HTTP_GET_VARS = $_GET;
}
if( !isset( $HTTP_POST_VARS ) )
{
$HTTP_POST_VARS = $_POST;
}
if( !isset( $HTTP_POST_FILES ) )
{
$HTTP_POST_FILES = $_FILES;
}
?>
This code will initialize $HTTP_POST_VARS.
Regards,
Georgi Kralev
----------------------------------
Support - www.DMXzone.com
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>The problem seems to be coming from the $HTTP_POST_VARS as I've echoed it and nothing appears..... food for thought.
The litttle blighter seems to capture my imagination and irritate my skin.<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I have not checked your code. But If you believe that the problem comes from $HTTP_POST_VARS note that from PHP 4.2 long predefined array variables (as $HTTP_*_VARS) usually are disabled. (There is a line in php.ini register_long_arrays = Off).
The problem could be fixed either by changing the line in php.ini. Or (if you do not have access to php.ini) by adding the following lines before your php code:
<?php
if( !isset( $HTTP_SERVER_VARS ) )
{
$HTTP_SERVER_VARS = $_SERVER;
}
if( !isset( $HTTP_GET_VARS ) )
{
$HTTP_GET_VARS = $_GET;
}
if( !isset( $HTTP_POST_VARS ) )
{
$HTTP_POST_VARS = $_POST;
}
if( !isset( $HTTP_POST_FILES ) )
{
$HTTP_POST_FILES = $_FILES;
}
?>
This code will initialize $HTTP_POST_VARS.
Regards,
Georgi Kralev
----------------------------------
Support - www.DMXzone.com
Replied 12 Jul 2008 23:24:38
12 Jul 2008 23:24:38 Michael Stewart replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Sorry fellows,
I've had a good go at it and not much success....
Maybe you can find a solution with the info I have here:
I'm running on a php mysql server
using DMX 7,0,1
using pure php upload 2,1,3
addon 1,0,6
I've looked throughout the forum and tryout various solution that were put forward... tried a few little tricks also but to no avail.
I seem to have an issue with the delete file before update.
I get : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
The problem seems to be coming from the $HTTP_POST_VARS as I've echoed it and nothing appears..... food for thought.
The litttle blighter seems to capture my imagination and irritate my skin.
Anyway,
Here's the beginning of my "edit data" page
...hope you can enlighten us all a little .
<?php require_once('../../../Connections/mic_data.php'); ?><?php
session_start();
$MM_authorizedUsers = "2,1";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == ""
&& false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../error/access_denied2.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?"
) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php require_once('../../../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../../../ScriptLibrary/incResize.php'); ?>
<?php require_once('../../../ScriptLibrary/incPUAddOn.php'); ?>
<?php ?>
<?php ?>
<?php ?>
<?php ?>
<?php
// Pure PHP Upload 2.1.3
if (isset($HTTP_GET_VARS['GP_upload'])) {
$ppu = new pureFileUpload();
$ppu->path = "../../../mic_int/php_dynamic/teampictures";
$ppu->extensions = "";
$ppu->formName = "form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "over";
$ppu->requireUpload = "false";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->checkVersion("2.1.3"
;
$ppu->doUpload();
}
$GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true";
} else {
$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
}
} else {
$GP_uploadAction .= "?"."GP_upload=true";
}
// Delete Before Update Addon 1.0.6
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1"
) {
mysql_select_db($database_mic_data, $mic_data);
$dbu_result = mysql_query("SELECT * FROM members WHERE thiskey=".$HTTP_POST_VARS['thiskey'] , $mic_data) or die(mysql_error());
$dbu = new deleteFileBeforeUpdate($ppu);
$dbu->pathThumb = "";
$dbu->naming = "suffix";
$dbu->suffix = "_small";
$dbu->checkVersion("1.0.6"
;
while ($dbu->sqldata = mysql_fetch_array($dbu_result)) {
$dbu->deleteFile();
}
}
echo "SELECT * FROM members WHERE thiskey=".$HTTP_POST_VARS[$colname_Rs2]."<br/>";
// Smart Image Processor 1.0.6
if (isset($HTTP_GET_VARS['GP_upload'])) {
$sip = new resizeUploadedFiles($ppu);
$sip->component = "ImageMagick";
$sip->resizeImages = "true";
$sip->aspectImages = "true";
$sip->maxWidth = "70";
$sip->maxHeight = "70";
$sip->quality = "80";
$sip->makeThumb = "false";
$sip->pathThumb = "";
$sip->aspectThumb = "true";
$sip->naming = "suffix";
$sip->suffix = "_small";
$sip->maxWidthThumb = "";
$sip->maxHeightThumb = "";
$sip->qualityThumb = "70";
$sip->checkVersion("1.0.6"
;
$sip->doResize();
}
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_update"])) && ($_POST["MM_update"] == "form1"
) {
$updateSQL = sprintf("UPDATE members SET whome_txt=%s, whatme_txt=%s, order_txt=%s, whatdo_txt=%s, whereami_txt=%s, whatsmyemail_txt=%s, whatsmymobile_txt=%s, findoutmore_txt=%s, whatsmymobile2_txt=%s, landphone_txt=%s, landphone2_txt=%s, fax_txt=%s, whatsmyemail2_txt=%s, whatsmyemail3_txt=%s, homeaddress=%s, homepage_txt=%s, ichat_txt=%s, msn_txt=%s, skype_txt=%s, photo1_txt=IFNULL(%s,photo1_txt), photo2_txt=IFNULL(%s,photo2_txt), photo3_txt=IFNULL(%s,photo3_txt), photo4_txt=IFNULL(%s,photo4_txt), photo5_txt=IFNULL(%s,photo5_txt), photo6_txt=IFNULL(%s,photo6_txt), photo7_txt=IFNULL(%s,photo7_txt), photo8_txt=IFNULL(%s,photo8_txt), photo9_txt=IFNULL(%s,photo9_txt), photo10_txt=IFNULL(%s,photo10_txt), photo11_txt=IFNULL(%s,photo11_txt), photo12_txt=IFNULL(%s,photo12_txt) WHERE thiskey=%s",
GetSQLValueString($_POST['name_txt'], "text"
,
GetSQLValueString($_POST['whatme_txt'], "text"
,
GetSQLValueString($_POST['order_txt'], "text"
,
GetSQLValueString($_POST['whatdo_txt'], "text"
,
GetSQLValueString($_POST['whereami_txt'], "text"
,
GetSQLValueString($_POST['whatsmyemail_txt'], "text"
,
GetSQLValueString($_POST['whatsmymobile_txt'], "text"
,
GetSQLValueString($_POST['findoutmore_txt'], "text"
,
GetSQLValueString($_POST['whatsmymobile2_txt'], "text"
,
GetSQLValueString($_POST['landphone_txt'], "text"
,
GetSQLValueString($_POST['landphone2_txt'], "text"
,
GetSQLValueString($_POST['fax_txt'], "text"
,
GetSQLValueString($_POST['whatsmyemail2_txt'], "text"
,
GetSQLValueString($_POST['whatsmyemail3_txt'], "text"
,
GetSQLValueString($_POST['homeaddress'], "text"
,
GetSQLValueString($_POST['homepage_txt'], "text"
,
GetSQLValueString($_POST['ichat_txt'], "text"
,
GetSQLValueString($_POST['msn_txt'], "text"
,
GetSQLValueString($_POST['skype_txt'], "text"
,
GetSQLValueString($_POST['photo1_txt'], "text"
,
GetSQLValueString($_POST['photo2_txt'], "text"
,
GetSQLValueString($_POST['photo3_txt'], "text"
,
GetSQLValueString($_POST['photo4_txt'], "text"
,
GetSQLValueString($_POST['photo5_txt'], "text"
,
GetSQLValueString($_POST['photo6_txt'], "text"
,
GetSQLValueString($_POST['photo7_txt'], "text"
,
GetSQLValueString($_POST['photo8_txt'], "text"
,
GetSQLValueString($_POST['photo9_txt'], "text"
,
GetSQLValueString($_POST['photo10_txt'], "text"
,
GetSQLValueString($_POST['photo11_txt'], "text"
,
GetSQLValueString($_POST['photo12_txt'], "text"
,
GetSQLValueString($_POST['Key'], "int"
);
mysql_select_db($database_mic_data, $mic_data);
$Result1 = mysql_query($updateSQL, $mic_data) or die(mysql_error());
$updateGoTo = "../updates/updated.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_Rs2 = "1";
if (isset($_GET['recordID3'])) {
$colname_Rs2 = (get_magic_quotes_gpc()) ? $_GET['recordID3'] : addslashes($_GET['recordID3']);
}
mysql_select_db($database_mic_data, $mic_data);
$query_Rs2 = sprintf("SELECT * FROM members WHERE thiskey = %s", $colname_Rs2);
$Rs2 = mysql_query($query_Rs2, $mic_data) or die(mysql_error());
$row_Rs2 = mysql_fetch_assoc($Rs2);
$totalRows_Rs2 = mysql_num_rows($Rs2);
?>
cheers
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Did this work for you? I either have another syntax problem or am doing something really stupid because I am having the same problems. I still get:
Undefined variable: HTTP_SERVER_VARS
Thanks,
Michael
www.boomlogic.com
Sorry fellows,
I've had a good go at it and not much success....
Maybe you can find a solution with the info I have here:
I'm running on a php mysql server
using DMX 7,0,1
using pure php upload 2,1,3
addon 1,0,6
I've looked throughout the forum and tryout various solution that were put forward... tried a few little tricks also but to no avail.
I seem to have an issue with the delete file before update.
I get : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
The problem seems to be coming from the $HTTP_POST_VARS as I've echoed it and nothing appears..... food for thought.
The litttle blighter seems to capture my imagination and irritate my skin.
Anyway,
Here's the beginning of my "edit data" page
...hope you can enlighten us all a little .
<?php require_once('../../../Connections/mic_data.php'); ?><?php
session_start();
$MM_authorizedUsers = "2,1";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == ""
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../error/access_denied2.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?"
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php require_once('../../../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../../../ScriptLibrary/incResize.php'); ?>
<?php require_once('../../../ScriptLibrary/incPUAddOn.php'); ?>
<?php ?>
<?php ?>
<?php ?>
<?php ?>
<?php
// Pure PHP Upload 2.1.3
if (isset($HTTP_GET_VARS['GP_upload'])) {
$ppu = new pureFileUpload();
$ppu->path = "../../../mic_int/php_dynamic/teampictures";
$ppu->extensions = "";
$ppu->formName = "form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "over";
$ppu->requireUpload = "false";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->checkVersion("2.1.3"
$ppu->doUpload();
}
$GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true";
} else {
$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
}
} else {
$GP_uploadAction .= "?"."GP_upload=true";
}
// Delete Before Update Addon 1.0.6
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1"
mysql_select_db($database_mic_data, $mic_data);
$dbu_result = mysql_query("SELECT * FROM members WHERE thiskey=".$HTTP_POST_VARS['thiskey'] , $mic_data) or die(mysql_error());
$dbu = new deleteFileBeforeUpdate($ppu);
$dbu->pathThumb = "";
$dbu->naming = "suffix";
$dbu->suffix = "_small";
$dbu->checkVersion("1.0.6"
while ($dbu->sqldata = mysql_fetch_array($dbu_result)) {
$dbu->deleteFile();
}
}
echo "SELECT * FROM members WHERE thiskey=".$HTTP_POST_VARS[$colname_Rs2]."<br/>";
// Smart Image Processor 1.0.6
if (isset($HTTP_GET_VARS['GP_upload'])) {
$sip = new resizeUploadedFiles($ppu);
$sip->component = "ImageMagick";
$sip->resizeImages = "true";
$sip->aspectImages = "true";
$sip->maxWidth = "70";
$sip->maxHeight = "70";
$sip->quality = "80";
$sip->makeThumb = "false";
$sip->pathThumb = "";
$sip->aspectThumb = "true";
$sip->naming = "suffix";
$sip->suffix = "_small";
$sip->maxWidthThumb = "";
$sip->maxHeightThumb = "";
$sip->qualityThumb = "70";
$sip->checkVersion("1.0.6"
$sip->doResize();
}
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != ""
break;
case "long":
case "int":
$theValue = ($theValue != ""
break;
case "double":
$theValue = ($theValue != ""
break;
case "date":
$theValue = ($theValue != ""
break;
case "defined":
$theValue = ($theValue != ""
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_update"])) && ($_POST["MM_update"] == "form1"
$updateSQL = sprintf("UPDATE members SET whome_txt=%s, whatme_txt=%s, order_txt=%s, whatdo_txt=%s, whereami_txt=%s, whatsmyemail_txt=%s, whatsmymobile_txt=%s, findoutmore_txt=%s, whatsmymobile2_txt=%s, landphone_txt=%s, landphone2_txt=%s, fax_txt=%s, whatsmyemail2_txt=%s, whatsmyemail3_txt=%s, homeaddress=%s, homepage_txt=%s, ichat_txt=%s, msn_txt=%s, skype_txt=%s, photo1_txt=IFNULL(%s,photo1_txt), photo2_txt=IFNULL(%s,photo2_txt), photo3_txt=IFNULL(%s,photo3_txt), photo4_txt=IFNULL(%s,photo4_txt), photo5_txt=IFNULL(%s,photo5_txt), photo6_txt=IFNULL(%s,photo6_txt), photo7_txt=IFNULL(%s,photo7_txt), photo8_txt=IFNULL(%s,photo8_txt), photo9_txt=IFNULL(%s,photo9_txt), photo10_txt=IFNULL(%s,photo10_txt), photo11_txt=IFNULL(%s,photo11_txt), photo12_txt=IFNULL(%s,photo12_txt) WHERE thiskey=%s",
GetSQLValueString($_POST['name_txt'], "text"
GetSQLValueString($_POST['whatme_txt'], "text"
GetSQLValueString($_POST['order_txt'], "text"
GetSQLValueString($_POST['whatdo_txt'], "text"
GetSQLValueString($_POST['whereami_txt'], "text"
GetSQLValueString($_POST['whatsmyemail_txt'], "text"
GetSQLValueString($_POST['whatsmymobile_txt'], "text"
GetSQLValueString($_POST['findoutmore_txt'], "text"
GetSQLValueString($_POST['whatsmymobile2_txt'], "text"
GetSQLValueString($_POST['landphone_txt'], "text"
GetSQLValueString($_POST['landphone2_txt'], "text"
GetSQLValueString($_POST['fax_txt'], "text"
GetSQLValueString($_POST['whatsmyemail2_txt'], "text"
GetSQLValueString($_POST['whatsmyemail3_txt'], "text"
GetSQLValueString($_POST['homeaddress'], "text"
GetSQLValueString($_POST['homepage_txt'], "text"
GetSQLValueString($_POST['ichat_txt'], "text"
GetSQLValueString($_POST['msn_txt'], "text"
GetSQLValueString($_POST['skype_txt'], "text"
GetSQLValueString($_POST['photo1_txt'], "text"
GetSQLValueString($_POST['photo2_txt'], "text"
GetSQLValueString($_POST['photo3_txt'], "text"
GetSQLValueString($_POST['photo4_txt'], "text"
GetSQLValueString($_POST['photo5_txt'], "text"
GetSQLValueString($_POST['photo6_txt'], "text"
GetSQLValueString($_POST['photo7_txt'], "text"
GetSQLValueString($_POST['photo8_txt'], "text"
GetSQLValueString($_POST['photo9_txt'], "text"
GetSQLValueString($_POST['photo10_txt'], "text"
GetSQLValueString($_POST['photo11_txt'], "text"
GetSQLValueString($_POST['photo12_txt'], "text"
GetSQLValueString($_POST['Key'], "int"
mysql_select_db($database_mic_data, $mic_data);
$Result1 = mysql_query($updateSQL, $mic_data) or die(mysql_error());
$updateGoTo = "../updates/updated.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_Rs2 = "1";
if (isset($_GET['recordID3'])) {
$colname_Rs2 = (get_magic_quotes_gpc()) ? $_GET['recordID3'] : addslashes($_GET['recordID3']);
}
mysql_select_db($database_mic_data, $mic_data);
$query_Rs2 = sprintf("SELECT * FROM members WHERE thiskey = %s", $colname_Rs2);
$Rs2 = mysql_query($query_Rs2, $mic_data) or die(mysql_error());
$row_Rs2 = mysql_fetch_assoc($Rs2);
$totalRows_Rs2 = mysql_num_rows($Rs2);
?>
cheers
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Did this work for you? I either have another syntax problem or am doing something really stupid because I am having the same problems. I still get:
Undefined variable: HTTP_SERVER_VARS
Thanks,
Michael
www.boomlogic.com
Replied 11 Nov 2008 12:41:09
11 Nov 2008 12:41:09 George Petrov replied:
This is all fixed in the latest version of the extensions.
Greetings,
George
--------------------------------------------------
George Petrov - Founder of the Dynamic Zones
DMXzone.com, FWzone.net, FLzone.net, CFzone.net,
DNzone.com, FlashFiles.nl
--------------------------------------------------
Greetings,
George
--------------------------------------------------
George Petrov - Founder of the Dynamic Zones
DMXzone.com, FWzone.net, FLzone.net, CFzone.net,
DNzone.com, FlashFiles.nl
--------------------------------------------------
