| 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");
$menuid = htmlspecialchars($_POST["menuid"],ENT_QUOTES);
//$backgroundsort = htmlspecialchars($_POST["backgroundsort"],ENT_QUOTES);
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
$sql = "select max(backgroundid) as maxid ";
$sql .= "from background ";
$result=mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$backgroundid = $row{maxid}+1;
// 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 = "";
}
// Sort
if ($backgroundsort == '' || $backgroundsort == '0') {
$sql = "select max(backgroundsort) as maxid ";
$sql .= "from background ";
$sql .= "where menuid = $menuid ";
$result=mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$backgroundsort = $row{maxid}+1;
}
if( mysql_num_rows(mysql_query("SELECT backgroundid FROM background WHERE backgroundsort=$backgroundsort AND menuid = $menuid ")) > 0){
mysql_query("UPDATE background SET backgroundsort= backgroundsort+1 WHERE backgroundsort >=$backgroundsort AND menuid = $menuid ");
}
$sql = "insert into background (backgroundid, menuid, backgroundimage, backgroundsort, backgroundstatus, creationday, modifyday, cmsloginid) values ('$backgroundid', '$menuid', '$backgroundimage', '$backgroundsort', '1', '$nowdate', '$nowdate', '".$_SESSION['cmsloginid']."')";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Add background Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
header("Location: background_index.php?menuid=".$menuid."&msg=Add Successful");
?>