| 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/airchats.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;
}
?>
<?php require("configure.php");
$homeid = $_POST["homeid"];
$homeintro = preg_replace("/'/","\'",$_POST["homeintro"]);
$homedesc = preg_replace("/'/","\'",$_POST["homedesc"]);
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
// Upload File
if ($_FILES['homeimage1']['name'] <> '')
{
if (($_FILES["homeimage1"]["type"] == "image/bmp") || ($_FILES["homeimage1"]["type"] == "image/BMP") || ($_FILES["homeimage1"]["type"] == "image/gif") || ($_FILES["homeimage1"]["type"] == "image/GIF") || ($_FILES["homeimage1"]["type"] == "image/jpg") || ($_FILES["homeimage1"]["type"] == "image/JPG") || ($_FILES["homeimage1"]["type"] == "image/jpeg") || ($_FILES["homeimage1"]["type"] == "image/JPEG") || ($_FILES["homeimage1"]["type"] == "image/pjpeg") || ($_FILES["homeimage1"]["type"] == "image/PJEG") || ($_FILES["homeimage1"]["type"] == "image/png") || ($_FILES["homeimage1"]["type"] == "image/x-png") || ($_FILES["homeimage1"]["type"] == "image/PNG") || ($_FILES["homeimage1"]["type"] == "image/X-PNG"))
{
copy ($_FILES['homeimage1']['tmp_name'], "home/id_".$homeid."_A_".$_FILES['homeimage1']['name'])
or die ("Could not copy the file");
$homeimage1 = "id_".$homeid."_A_".$_FILES['homeimage1']['name'];
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be BMP, JPEG, GIF, or PNG");
history.back();
</script>
<?php
exit;
}
}
else
{
$homeimage1 = "";
}
if ($_FILES['homeimage2']['name'] <> '')
{
if (($_FILES["homeimage2"]["type"] == "image/bmp") || ($_FILES["homeimage2"]["type"] == "image/BMP") || ($_FILES["homeimage2"]["type"] == "image/gif") || ($_FILES["homeimage2"]["type"] == "image/GIF") || ($_FILES["homeimage2"]["type"] == "image/jpg") || ($_FILES["homeimage2"]["type"] == "image/JPG") || ($_FILES["homeimage2"]["type"] == "image/jpeg") || ($_FILES["homeimage2"]["type"] == "image/JPEG") || ($_FILES["homeimage2"]["type"] == "image/pjpeg") || ($_FILES["homeimage2"]["type"] == "image/PJEG") || ($_FILES["homeimage2"]["type"] == "image/png") || ($_FILES["homeimage2"]["type"] == "image/x-png") || ($_FILES["homeimage2"]["type"] == "image/PNG") || ($_FILES["homeimage2"]["type"] == "image/X-PNG"))
{
copy ($_FILES['homeimage2']['tmp_name'], "home/id_".$homeid."_B_".$_FILES['homeimage2']['name'])
or die ("Could not copy the file");
$homeimage2 = "id_".$homeid."_B_".$_FILES['homeimage2']['name'];
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be BMP, JPEG, GIF, or PNG");
history.back();
</script>
<?php
exit;
}
}
else
{
$homeimage2 = "";
}
if ($_FILES['homeimage3']['name'] <> '')
{
if (($_FILES["homeimage3"]["type"] == "image/bmp") || ($_FILES["homeimage3"]["type"] == "image/BMP") || ($_FILES["homeimage3"]["type"] == "image/gif") || ($_FILES["homeimage3"]["type"] == "image/GIF") || ($_FILES["homeimage3"]["type"] == "image/jpg") || ($_FILES["homeimage3"]["type"] == "image/JPG") || ($_FILES["homeimage3"]["type"] == "image/jpeg") || ($_FILES["homeimage3"]["type"] == "image/JPEG") || ($_FILES["homeimage3"]["type"] == "image/pjpeg") || ($_FILES["homeimage3"]["type"] == "image/PJEG") || ($_FILES["homeimage3"]["type"] == "image/png") || ($_FILES["homeimage3"]["type"] == "image/x-png") || ($_FILES["homeimage3"]["type"] == "image/PNG") || ($_FILES["homeimage3"]["type"] == "image/X-PNG"))
{
copy ($_FILES['homeimage3']['tmp_name'], "home/id_".$homeid."_C_".$_FILES['homeimage3']['name'])
or die ("Could not copy the file");
$homeimage3 = "id_".$homeid."_C_".$_FILES['homeimage3']['name'];
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be BMP, JPEG, GIF, or PNG");
history.back();
</script>
<?php
exit;
}
}
else
{
$homeimage3 = "";
}
// Modify
$sql = "update home set homeintro='$homeintro', homedesc='$homedesc', modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' ";
if ($homeimage1 <> '')
$sql .= ", homeimage1='$homeimage1' ";
if ($homeimage2 <> '')
$sql .= ", homeimage2='$homeimage2' ";
if ($homeimage3 <> '')
$sql .= ", homeimage3='$homeimage3' ";
$sql .= " where homeid=". $homeid ." ";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Modify Home Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
header("Location: home_modifyform.php?msg=Modify Successful");
?>