| 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");
$menuid=check_input($_REQUEST["menuid"]);
$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");
//print_r($_POST);
$sql = "select max(contentid) as maxid ";
$sql .= "from mate_tech_content ";
$result=mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$contentid = $row{maxid}+1;
// Upload File
$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"))
{
move_uploaded_file ($_FILES['contentimgtc']['tmp_name'], "../images/mate_tech_contentid_tc_".$contentid.$_FILES['contentimgen']['name'])
or die ("Could not copy the file");
$contentimgtcimg = "../images/mate_tech_contentid_tc_".$contentid.$_FILES['contentimgen']['name'];
//createthumb($contentimgtcimg, $contentimgtcimg, 980, 310);
$contentimgtc = "mate_tech_contentid_tc_".$contentid.$_FILES['contentimgen']['name'];
}
}
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 = "";
}
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"))
{
move_uploaded_file ($_FILES['contentimgen']['tmp_name'], "../images/mate_tech_contentid_en_".$contentid.$_FILES['contentimgen']['name'])
or die ("Could not copy the file");
$contentimgenimg = "../images/mate_tech_content/mate_tech_contentid_en_".$contentid.$_FILES['contentimgen']['name'];
//createthumb($contentimgenimg, $contentimgenimg, 980, 310);
$contentimgen = "mate_tech_contentid_en_".$contentid.$_FILES['contentimgen']['name'];
}
}
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 = "";
}
// Sort
//if ($sort == '' || $sort == '0') {
$sql2 = "select max(sort) as maxid from mate_tech_content where belongpage='$belongpage'";
$result2=mysql_query($sql2);
$row2 = mysql_fetch_array($result2,MYSQL_ASSOC);
$sort = $row2{maxid}+1;
//}
/*if( mysql_num_rows(mysql_query("SELECT contentid FROM content WHERE sort=$sort ")) > 0){
mysql_query("UPDATE content SET sort= sort+1 WHERE sort >=$sort ");
}*/
$sql = "insert into mate_tech_content (contentimgtc, contentimgen, belongpage, belongcatid, contentid, contentdesctc, contentdescen,sort, status, createdate, createby, lastupdate, lastupby) values ('$contentimgen', '$contentimgtc', '$belongpage','$belongcatid', '$contentid', '$contentdesctc', '$contentdescen', '$sort', '1', '$nowdate', '".$_SESSION['cmsloginid']."', '$nowdate', '".$_SESSION['cmsloginid']."')";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Add Material or Technology Content Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
header("Location: mate_tech_content_index.php?menuid=$menuid&msg=Add Successful");
?>