| 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");
$contactusid = $_POST["contactusid"];
$contactusdistricten = htmlspecialchars($_POST["contactusdistricten"],ENT_QUOTES);
$contactusdistricttc = htmlspecialchars($_POST["contactusdistricttc"],ENT_QUOTES);
$contactusdistrictsc = htmlspecialchars($_POST["contactusdistrictsc"],ENT_QUOTES);
$contactuscontenten = preg_replace("/'/","\'",$_POST["contactuscontenten"]);
$contactuscontenttc = preg_replace("/'/","\'",$_POST["contactuscontenttc"]);
$contactuscontentsc = preg_replace("/'/","\'",$_POST["contactuscontentsc"]);
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
//Delete execiting file
$result = mysql_query("SELECT * FROM contactus WHERE contactusid=".$contactusid." ");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
if($row['contactusimage'] <> ''){
unlink("../images/".$row['contactusimage']);
}
// Upload File
if ($_FILES['contactusimage']['name'] <> '')
{
if (($_FILES["contactusimage"]["type"] == "image/bmp") || ($_FILES["contactusimage"]["type"] == "image/BMP") || ($_FILES["contactusimage"]["type"] == "image/gif") || ($_FILES["contactusimage"]["type"] == "image/GIF") || ($_FILES["contactusimage"]["type"] == "image/jpg") || ($_FILES["contactusimage"]["type"] == "image/JPG") || ($_FILES["contactusimage"]["type"] == "image/jpeg") || ($_FILES["contactusimage"]["type"] == "image/JPEG") || ($_FILES["contactusimage"]["type"] == "image/pjpeg") || ($_FILES["contactusimage"]["type"] == "image/PJEG") || ($_FILES["contactusimage"]["type"] == "image/png") || ($_FILES["contactusimage"]["type"] == "image/x-png") || ($_FILES["contactusimage"]["type"] == "image/PNG") || ($_FILES["contactusimage"]["type"] == "image/X-PNG"))
{
move_uploaded_file ($_FILES['contactusimage']['tmp_name'], "../images/contactus_".$contactusid."_".$_FILES['contactusimage']['name'])
or die ("Could not copy the file: contactusimage");
$contactusimageimg = "../images/contactus_".$contactusid."_".$_FILES['contactusimage']['name'];
createthumb($contactusimageimg, $contactusimageimg, 336, 190);
$contactusimage = "contactus_".$contactusid."_".$_FILES['contactusimage']['name'];
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be JPEG, GIF, or PNG");
history.back();
</script>
<?php
exit;
}
}
else
{
$contactusimage = "";
}
// Modify
$sql = "update contactus set contactusdistricten='$contactusdistricten', contactusdistricttc='$contactusdistricttc', contactusdistrictsc='$contactusdistrictsc', contactuscontenten='$contactuscontenten', contactuscontenttc='$contactuscontenttc', contactuscontentsc='$contactuscontentsc', modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' ";
if ($contactusimage <> '')
$sql .= ", contactusimage='$contactusimage' ";
$sql .= " where contactusid=". $contactusid ." ";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Modify Contact Us Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
header("Location: contactus_index.php?msg=Modify Successful");
?>