| 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_logoid = check_input($_POST["material_logoid"]);
$material_logolinken = check_input($_POST["material_logolinken"]);
$material_logolinktc = check_input($_POST["material_logolinktc"]);
//$levelnum = $_POST["levelnum"];
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
$sql = "SELECT * FROM material_logo WHERE material_logoid='$material_logoid'";
$result=mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
if ($_FILES['material_logoimgtc']['name'] <> '' or $_POST['delimagetc'] > 0 ) {
unlink("../images/material_logo/".$row{'material_logoimgtc'});
$sql = "update material_logo set material_logoimgtc='' ";
$sql .= " where material_logoid='$material_logoid'";
mysql_query($sql);
}
if ($_FILES['material_logoimgen']['name'] <> '' or $_POST['delimagesc'] > 0 ) {
unlink("../images/material_logo/".$row{'material_logoimgen'});
$sql = "update material_logo set material_logoimgen='' ";
$sql .= " where material_logoid='$material_logoid'";
mysql_query($sql);
}
// 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 = "";
}
$sql = "update material_logo set material_logolinktc='$material_logolinktc', material_logolinken='$material_logolinken',
lastupdate='$nowdate', lastupby='".$_SESSION['cmsloginid']."' ";
if ($material_logoimgtc <> '' or $_POST['delimagetc'] > 0 )
$sql .= ", material_logoimgtc='$material_logoimgtc' ";
if ($material_logoimgen <> '' or $_POST['delimagesc'] > 0 )
$sql .= ", material_logoimgen='$material_logoimgen' ";
$sql .= " where material_logoid='$material_logoid'";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Modify Material Logo Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
header("Location: material_logo_index.php?msg=Update Successful");
?>