| 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/hkosl.com/kelvin/webadmin/ |
Upload File : |
<?php
include 'config.php';
// Check if the user is logged in
if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1'))
{
header("Location: login.php");
exit;
}
require("configure.php");
require("function_resizethumb.php");
;
$contentid = check_input($_REQUEST["contentid"]);
$contentdesctc = preg_replace("/'/","\'",$_POST["contentdesctc"]);
$contentdescen = preg_replace("/'/","\'",$_POST["contentdescen"]);
$belongpage = check_input($_REQUEST["menuid"]);
$belongcatid = check_input($_REQUEST["belongcatid"]);
//$sort = '1';
$nowdate = date("Y-m-d H:i:s");
//Delete execiting Image file
$sql2 = "SELECT * FROM mate_tech_content WHERE contentid='$contentid' ";
$result2=mysql_query($sql2);
$row2 = mysql_fetch_array($result2,MYSQL_ASSOC);
if ($_FILES['contentimgtc']['name'] <> '' or $_POST['delimagetc'] > 0 ) {
unlink("../images/".$row{'contentimgtc'});
$sql = "update mate_tech_content set contentimgtc=''";
$sql .= " where contentid=". $contentid ." ";
mysql_query($sql);
}
if ($_FILES['contentimgen']['name'] <> '' or $_POST['delimageen'] > 0 ) {
unlink("../images/".$row{'contentimgen'});
$sql = "update mate_tech_content set contentimgen=''";
$sql .= " where contentid=". $contentid ." ";
mysql_query($sql);
}
$filelimit = 2 * 1048576; //Filelimit in 2MB
if ($_FILES['contentimgen']['name'] <> '')
{
if ($_FILES['contentimgen']['size'] < $filelimit ){
if (($_FILES["contentimgen"]["type"] == "image/gif") || ($_FILES["contentimgen"]["type"] == "image/GIF") || ($_FILES["contentimgen"]["type"] == "image/jpg") || ($_FILES["contentimgen"]["type"] == "image/JPG") || ($_FILES["contentimgen"]["type"] == "image/jpeg") || ($_FILES["contentimgen"]["type"] == "image/JPEG") || ($_FILES["contentimgen"]["type"] == "image/pjpeg") || ($_FILES["contentimgen"]["type"] == "image/PJEG") || ($_FILES["contentimgen"]["type"] == "image/png") || ($_FILES["contentimgen"]["type"] == "image/x-png") || ($_FILES["contentimgen"]["type"] == "image/PNG") || ($_FILES["contentimgen"]["type"] == "image/X-PNG"))
{
$filename=$_FILES['contentimgen']['name'];
preg_match("/\.([^\.]+)$/", $filename, $file_ext);
copy ($_FILES['contentimgen']['tmp_name'], "../images/mate_tech_content_en_".$contentid.".".$file_ext[1])
or die ("Could not copy the file: Product Photo(thumb)");
$imagethumb = "../images/mate_tech_content_en_".$contentid.".".$file_ext[1];
//createthumb($imagethumb, $imagethumb, 200, 200);
$contentimgen = "mate_tech_content_en_".$contentid.".".$file_ext[1];
$contentimgen = htmlspecialchars($contentimgen,ENT_QUOTES);
}
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be JPEG, GIF, or PNG and under 2MB in size");
history.back();
</script>
<?php
exit;
}
}
else
{
$contentimgen ="";
}
$filelimit = 2 * 1048576; //Filelimit in 2MB
if ($_FILES['contentimgtc']['name'] <> '')
{
if ($_FILES['contentimgtc']['size'] < $filelimit ){
if (($_FILES['contentimgtc']["type"] == "image/gif") || ($_FILES['contentimgtc']["type"] == "image/GIF") || ($_FILES['contentimgtc']["type"] == "image/jpg") || ($_FILES['contentimgtc']["type"] == "image/JPG") || ($_FILES['contentimgtc']["type"] == "image/jpeg") || ($_FILES['contentimgtc']["type"] == "image/JPEG") || ($_FILES['contentimgtc']["type"] == "image/pjpeg") || ($_FILES['contentimgtc']["type"] == "image/PJEG") || ($_FILES['contentimgtc']["type"] == "image/png") || ($_FILES['contentimgtc']["type"] == "image/x-png") || ($_FILES['contentimgtc']["type"] == "image/PNG") || ($_FILES['contentimgtc']["type"] == "image/X-PNG"))
{
$filename=$_FILES['contentimgtc']['name'];
preg_match("/\.([^\.]+)$/", $filename, $file_ext);
copy ($_FILES['contentimgtc']['tmp_name'], "../images/mate_tech_content_tc_".$contentid.".".$file_ext[1])
or die ("Could not copy the file: Product Photo(thumb)");
$imagethumb = "../images/mate_tech_content_tc_".$contentid.".".$file_ext[1];
//createthumb($imagethumb, $imagethumb, 200, 200);
$contentimgtc = "mate_tech_content_tc_".$contentid.".".$file_ext[1];
$contentimgtc = htmlspecialchars($contentimgtc,ENT_QUOTES);
}
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be JPEG, GIF, or PNG and under 2MB in size");
history.back();
</script>
<?php
exit;
}
}
else
{
$contentimgtc ="";
}
// Modify
$sql = "update mate_tech_content set belongpage='$belongpage', belongcatid='$belongcatid',contentdesctc='$contentdesctc', contentdescen='$contentdescen', lastupdate='$nowdate', lastupby='".$_SESSION['cmsloginid']."' ";
if ($contentimgen <> '' or $_POST['delimageen'] > 0 )
$sql .= ", contentimgen='$contentimgen'";
if ($contentimgtc <> '' or $_POST['delimagetc'] > 0 )
$sql .= ", contentimgtc='$contentimgtc'";
$sql .= " where contentid='$contentid'";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Modify Content Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
$menuid = $belongpage;
header("Location: mate_tech_content_index.php?menuid=$menuid&msg=Modify Successful");
?>