| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)standraise.com/admin/ |
Upload File : |
<?php require("configure.php"); ?>
<?
$productcatid = $_POST["productcatid"];
$productimageid = $_POST["productimageid"];
//$productnamesc = $_POST["productnamesc"];
$productnamesc = htmlspecialchars($_POST["productnamesc"],ENT_QUOTES);
//$productmodel = $_POST["productmodel"];
$productmodel = htmlspecialchars($_POST["productmodel"],ENT_QUOTES);
//$productdescsc = $_POST["productdescsc"];
$productdescsc = preg_replace("/'/","\'",$_POST["productdescsc"]);
$sortbyimage = $_POST["sortbyimage"];
if ($_FILES['image']['name'] <> '')
{
move_uploaded_file ($_FILES['image']['tmp_name'], "product/".$productimageid.$_FILES['image']['name'])
or die ("Could not copy, File Size Max.2M and change the filename to all english.");
$image = $productimageid.$_FILES['image']['name'];
$images = "product/".$productimageid.$_FILES['image']['name'];
$smallproduct = "smallproduct/".$productimageid.$_FILES['image']['name'];
$slideshow = "slideshow/".$productimageid.$_FILES['image']['name'];
createthumb($images, $images, 600, 600);
createthumb($images, $smallproduct, 200, 200);
createthumb($images, $slideshow, 200, 200);
}
else
{
$image = "";
}
function createthumb($name,$filename,$new_w,$new_h)
{
$system=explode('.',$name);
if (preg_match('/jpg|jpeg|JPG|JPEG/',$system[1])){
$src_img=imagecreatefromjpeg($name);
}
if (preg_match('/png/',$system[1])){
$src_img=imagecreatefrompng($name);
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
if (preg_match("/png/",$system[1]))
{
imagepng($dst_img,$filename);
} else {
imagejpeg($dst_img,$filename);
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
$sql = "update productimage set productimageid='$productimageid', productnamesc='$productnamesc', productmodel='$productmodel', productdescsc='$productdescsc', sortbyimage='$sortbyimage' ";
if ($image <> '')
$sql .= ", image='$image' ";
$sql .= " where productimageid=". $productimageid ." ";
//echo $sql;
mysql_query($sql);
mysql_close($dbh);
header("Location: productcatindexsc.php?pid=$productcatid&msg=Modify Successful");
?>