1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
<?php
if(isset($_POST['mode']) && $_POST['mode']=="GO"){
mysql_select_db($database_classifieds, $classifieds);
$productid=@$_REQUEST['productid'];
$lid=@$_REQUEST['listingid'];
$sSQL="SELECT * FROM cartproducts WHERE id= '$productid' AND images='Y'";
$result = mysql_query($sSQL, $classifieds) or die(mysql_error());
$rs = mysql_fetch_assoc($result);
$numphotos=$rs['numimages'];
mysql_free_result($result);
$sSQL="SELECT id,component,extensions,maxWidth,maxHeight,quality,maxWidthThumb,maxHeightThumb,qualityThumb FROM image_settings WHERE id=1";
$result = mysql_query($sSQL, $classifieds) or die(mysql_error());
$rs = mysql_fetch_array($result);
$component =$rs['component'];
$extensions =$rs['extensions'];
$maxWidth =$rs['maxWidth'];
$maxHeight =$rs['maxHeight'];
$quality =$rs['quality'];
$maxWidthThumb =$rs['maxWidthThumb'];
$maxHeightThumb =$rs['maxHeightThumb'];
$qualityThumb =$rs['qualtityThumb'];
mysql_free_result($result);
// Pure PHP Upload 2.1.2
if (isset($GET['GP_upload'])) {//$HTTP_GET_VARS
$ppu = new pureFileUpload();
$ppu->path = "photos";
$ppu->extensions = $extensions;
$ppu->formName = "imageupload";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "uniq";
$ppu->requireUpload = "true";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "fileCopyProgress.php";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->checkVersion("2.1.2");
$ppu->doUpload();
}
$GP_uploadAction = $SERVER['PHP_SELF'];//$HTTP_SERVER_VARS
if (isset($SERVER['QUERY_STRING'])) {//$HTTP_SERVER_VARS
if (preg_match("GP_upload=true", $SERVER['QUERY_STRING'])) {//$HTTP_SERVER_VARS !eregi
$GP_uploadAction .= "?".$SERVER['QUERY_STRING']."&GP_upload=true";//$HTTP_SERVER_VARS
} else {
$GP_uploadAction .= "?".$SERVER['QUERY_STRING'];//$HTTP_SERVER_VARS
}
} else {
$GP_uploadAction .= "?"."GP_upload=true";
}
// Smart Image Processor 1.0.3
if (isset($GET['GP_upload'])) {//$HTTP_GET_VARS
$sip = new resizeUploadedFiles($ppu);
$sip->component = $component;
$sip->resizeImages = "true";
$sip->aspectImages = "true";
$sip->maxWidth = $maxWidth;
$sip->maxHeight = $maxHeight;
$sip->quality = $quality;
$sip->makeThumb = "true";
$sip->pathThumb = "thumbs";
$sip->aspectThumb = "true";
$sip->naming = "prefix";
$sip->suffix = "small_";
$sip->maxWidthThumb = $maxWidthThumb;
$sip->maxHeightThumb = $maxHeightThumb;
$sip->qualityThumb = $qualityThumb;
$sip->checkVersion("1.0.3");
$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;
}
if ((isset($POST["MM_insert"])) && ($POST["MM_insert"] == "imageupload")) {//$HTTP_POST_VARS
$insertSQL = sprintf("INSERT INTO prodimages (pid, title, image) VALUES (%s, %s, %s)",
GetSQLValueString($POST['listingid'], "text"),//$HTTP_POST_VARS
GetSQLValueString($POST['title'], "text"),//$HTTP_POST_VARS
GetSQLValueString($POST['imagename'], "text"));//$HTTP_POST_VARS
mysql_select_db($database_classifieds, $classifieds);
$Result1 = mysql_query($insertSQL, $classifieds) or die(mysql_error());
$insertGoTo = "updatesuccess.php?refer=adminaddimages.php?id=$_GET[id]";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
// header(sprintf("Location: %s", $insertGoTo));
}
}
}
$productid=@$_REQUEST['productid'];
$lid=@$_REQUEST['lid'];
$sSQL="SELECT * FROM cartproducts WHERE id= '$productid' AND images='Y'";
$result = mysql_query($sSQL, $classifieds) or die(mysql_error());
$rs = mysql_fetch_assoc($result);
$numphotos=$rs['numimages'];
$sSQL = "SELECT * FROM products WHERE id = '$_GET[id]'";
$result = mysql_query($sSQL, $classifieds) or die(mysql_error());
$rs = mysql_fetch_array($result);
$prod = $rs[prodID];
mysql_free_result($result);
$sSQL="SELECT * FROM prodimages WHERE pid=$lid";
$result = mysql_query($sSQL, $classifieds) or die(mysql_error());
$upphotos=mysql_num_rows($result);
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($editFormAction)) {
if (isset($SERVER['QUERY_STRING'])) {//$HTTP_SERVER_VARS
if (preg_match("GP_upload=true", $SERVER['QUERY_STRING'])) {//$HTTP_SERVER_VARS !eregi
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= '?GP_upload=true';
}
}
if ($upphotos < $numphotos) {
?> |
Partager