| 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/c-c.com.hk/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_createthumb.php");
$pdid = $_POST["pdid"];
$pimgid = $_POST["pimgid"];
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
if ($_FILES['pimgfile']['name'] <> '')
{
if (($_FILES["pimgfile"]["type"] == "image/bmp") || ($_FILES["pimgfile"]["type"] == "image/BMP") || ($_FILES["pimgfile"]["type"] == "image/gif") || ($_FILES["pimgfile"]["type"] == "image/GIF") || ($_FILES["pimgfile"]["type"] == "image/jpg") || ($_FILES["pimgfile"]["type"] == "image/JPG") || ($_FILES["pimgfile"]["type"] == "image/jpeg") || ($_FILES["pimgfile"]["type"] == "image/JPEG") || ($_FILES["pimgfile"]["type"] == "image/pjpeg") || ($_FILES["pimgfile"]["type"] == "image/PJEG") || ($_FILES["pimgfile"]["type"] == "image/png") || ($_FILES["pimgfile"]["type"] == "image/x-png") || ($_FILES["pimgfile"]["type"] == "image/PNG") || ($_FILES["pimgfile"]["type"] == "image/X-PNG"))
{
$filename=$_FILES['pimgfile']['name'];
preg_match("/\.([^\.]+)$/", $filename, $file_ext);
copy ($_FILES['pimgfile']['tmp_name'], "../project/".$pdid."_id_".$pimgid.".".$file_ext[1])
or die ("Could not copy the file: Project Photo");
$image = "../project/".$pdid."_id_".$pimgid.".".$file_ext[1];
createthumb($image, $image, 800, 800);
copy ($_FILES['pimgfile']['tmp_name'], "../project/large/".$pdid."_id_".$pimgid.".".$file_ext[1])
or die ("Could not copy the file: Project Photo(large)");
$imagelarge = "../project/large/".$pdid."_id_".$pimgid.".".$file_ext[1];
createthumb($imagelarge, $imagelarge, 280, 280);
copy ($_FILES['pimgfile']['tmp_name'], "../project/thumb/".$pdid."_id_".$pimgid.".".$file_ext[1])
or die ("Could not copy the file: Project Photo(thumb)");
$imagethumb = "../project/thumb/".$pdid."_id_".$pimgid.".".$file_ext[1];
createthumb($imagethumb, $imagethumb, 140, 140);
$pimgfile = $pdid."_id_".$pimgid.".".$file_ext[1];
$pimgfile = htmlspecialchars($pimgfile,ENT_QUOTES);
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be BMP, JPEG, GIF, or PNG");
history.back();
</script>
<?php
exit;
}
}
else
{
$pimgfile = "";
}
// Modify
$sql = "update project_img set modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' ";
if ($pimgfile <> '')
$sql .= ", pimgfile='$pimgfile' ";
$sql .= " where pimgid=". $pimgid ." ";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Modify Project Detail(Images) Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
header("Location: project_image_index.php?pdid=$pdid&msg=Modify Successful");
?>