| 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/(Del)hsiaust.com.au/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");
$backgroundid = htmlspecialchars($_POST["backgroundid"],ENT_QUOTES);
$menuid = htmlspecialchars($_POST["menuid"],ENT_QUOTES);
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
//Delete execiting file
$result = mysql_query("SELECT * FROM background WHERE backgroundid=".$backgroundid." ");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
if($row['backgroundimage'] <> ''){
unlink("../images/background/".$row['backgroundimage']);
}
// Upload File
if ($_FILES['backgroundimage']['name'] <> '')
{
if (($_FILES["backgroundimage"]["type"] == "image/bmp") || ($_FILES["backgroundimage"]["type"] == "image/BMP") || ($_FILES["backgroundimage"]["type"] == "image/gif") || ($_FILES["backgroundimage"]["type"] == "image/GIF") || ($_FILES["backgroundimage"]["type"] == "image/jpg") || ($_FILES["backgroundimage"]["type"] == "image/JPG") || ($_FILES["backgroundimage"]["type"] == "image/jpeg") || ($_FILES["backgroundimage"]["type"] == "image/JPEG") || ($_FILES["backgroundimage"]["type"] == "image/pjpeg") || ($_FILES["backgroundimage"]["type"] == "image/PJEG") || ($_FILES["backgroundimage"]["type"] == "image/png") || ($_FILES["backgroundimage"]["type"] == "image/x-png") || ($_FILES["backgroundimage"]["type"] == "image/PNG") || ($_FILES["backgroundimage"]["type"] == "image/X-PNG"))
{
move_uploaded_file ($_FILES['backgroundimage']['tmp_name'], "../images/background/id_".$backgroundid."_".$_FILES['backgroundimage']['name'])
or die ("Could not copy the file: background");
$backgroundimageimg = "../images/background/id_".$backgroundid."_".$_FILES['backgroundimage']['name'];
createthumb($backgroundimageimg, $backgroundimageimg, 1430, 592);
$backgroundimage = "id_".$backgroundid."_".$_FILES['backgroundimage']['name'];
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be JPEG, GIF, or PNG");
history.back();
</script>
<?php
exit;
}
}
else
{
$backgroundimage = "";
}
// Modify
$sql = "update background set modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' ";
if ($backgroundimage <> '')
$sql .= ", backgroundimage='$backgroundimage' ";
$sql .= " where backgroundid=". $backgroundid ." ";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Modify background Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
header("Location: background_index.php?menuid=".$menuid."&msg=Modify Successful");
?>