| 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");
$material_logolinken = check_input($_POST["material_logolinken"]);
$material_logolinktc = check_input($_POST["material_logolinktc"]);
$nowdate = date("Y-m-d H:i:s");
$sql = "select max(material_logoid) as maxid ";
$sql .= "from material_logo ";
$result=mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$material_logoid = $row{maxid}+1;
$sql = "select max(sort) as maxid ";
$sql .= "from material_logo ";
$result=mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$sort = $row{maxid}+1;
// copy image
$filelimit = 2 * 1048576; //Filelimit in 2MB
//material_logoimgtc
if ($_FILES['material_logoimgtc']['name'] <> '')
{
if ($_FILES['material_logoimgtc']['size'] < $filelimit ){
if (($_FILES['material_logoimgtc']["type"] == "image/gif") || ($_FILES['material_logoimgtc']["type"] == "image/GIF") || ($_FILES['material_logoimgtc']["type"] == "image/jpg") || ($_FILES['material_logoimgtc']["type"] == "image/JPG") || ($_FILES['material_logoimgtc']["type"] == "image/jpeg") || ($_FILES['material_logoimgtc']["type"] == "image/JPEG") || ($_FILES['material_logoimgtc']["type"] == "image/pjpeg") || ($_FILES['material_logoimgtc']["type"] == "image/PJEG") || ($_FILES['material_logoimgtc']["type"] == "image/png") || ($_FILES['material_logoimgtc']["type"] == "image/x-png") || ($_FILES['material_logoimgtc']["type"] == "image/PNG") || ($_FILES['material_logoimgtc']["type"] == "image/X-PNG"))
{
$filename=$_FILES['material_logoimgtc']['name'];
preg_match("/\.([^\.]+)$/", $filename, $file_ext);
copy ($_FILES['material_logoimgtc']['tmp_name'], "../images/material_logo/material_logo_tc_".$material_logoid.".".$file_ext[1])
or die ("Could not copy the file: Project Photo(large)");
$imagelarge = "../images/material_logo/material_logo_tc_".$material_logoid.".".$file_ext[1];
//createthumb($imagelarge, $imagelarge, 600, 600);
$material_logoimgtc = "material_logo_tc_".$material_logoid.".".$file_ext[1];
$material_logoimgtc = check_input($material_logoimgtc);
}
}
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
{
$material_logoimgtc = "";
}
//material_logoimgen
if ($_FILES['material_logoimgen']['name'] <> '')
{
if ($_FILES['material_logoimgen']['size'] < $filelimit ){
if (($_FILES['material_logoimgen']["type"] == "image/gif") || ($_FILES['material_logoimgen']["type"] == "image/GIF") || ($_FILES['material_logoimgen']["type"] == "image/jpg") || ($_FILES['material_logoimgen']["type"] == "image/JPG") || ($_FILES['material_logoimgen']["type"] == "image/jpeg") || ($_FILES['material_logoimgen']["type"] == "image/JPEG") || ($_FILES['material_logoimgen']["type"] == "image/pjpeg") || ($_FILES['material_logoimgen']["type"] == "image/PJEG") || ($_FILES['material_logoimgen']["type"] == "image/png") || ($_FILES['material_logoimgen']["type"] == "image/x-png") || ($_FILES['material_logoimgen']["type"] == "image/PNG") || ($_FILES['material_logoimgen']["type"] == "image/X-PNG"))
{
$filename=$_FILES['material_logoimgen']['name'];
preg_match("/\.([^\.]+)$/", $filename, $file_ext);
copy ($_FILES['material_logoimgen']['tmp_name'], "../images/material_logo/material_logo_en_".$material_logoid.".".$file_ext[1])
or die ("Could not copy the file: Project Photo(large)");
$imagelarge = "../images/material_logo/material_logo_en_".$material_logoid.".".$file_ext[1];
//createthumb($imagelarge, $imagelarge, 600, 600);
$material_logoimgen = "material_logo_en_".$material_logoid.".".$file_ext[1];
$material_logoimgen = check_input($material_logoimgen);
}
}
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
{
$material_logoimgen = "";
}
$sql2 = "insert into material_logo (material_logoid, sort, material_logolinken, material_logolinktc, status, createdate, lastupdate, createby, lastupby,material_logoimgtc,material_logoimgen) values ('$material_logoid', '$sort','$material_logolinken', '$material_logolinktc', '1', '$nowdate', '$nowdate', '".$_SESSION['cmsloginid']."', '".$_SESSION['cmsloginid']."', '$material_logoimgtc', '$material_logoimgen')";
mysql_query($sql2);
if( mysql_errno() > 0 ){
echo 'Add Material Logo Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
//}
//}
mysql_close($dbh);
header("Location: material_logo_index.php?msg=Add Successful");
?>