| 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/hkosl.com/kelvin/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");
$contactid = check_input($_POST["contactid"]);
/*
$contacttitleen = htmlspecialchars($_POST["contacttitleen"],ENT_QUOTES);
$contacttitletc = htmlspecialchars($_POST["contacttitletc"],ENT_QUOTES);
*/
$contactdescsc = preg_replace("/'/","\'",$_POST["contactdescsc"]);
$contactdesctc = preg_replace("/'/","\'",$_POST["contactdesctc"]);
$nowdate = date("Y-m-d H:i:s");
$sql2 = "SELECT * FROM contactus WHERE contactid='$contactid' ";
$result2=mysql_query($sql2);
$row2 = mysql_fetch_array($result2,MYSQL_ASSOC);
if ($_FILES['contactimg']['name'] <> '' or $_POST['delimage'] > 0 ) {
unlink("../images/".$row2{'contactimg'});
$sql = "update contactus set contactimg=''";
$sql .= "where contactid=". $contactid ." ";
mysql_query($sql);
}
$filelimit = 2 * 1048576; //Filelimit in 2MB
if ($_FILES['contactimg']['name'] <> '')
{
if ($_FILES['contactimg']['size'] < $filelimit ){
if (($_FILES["contactimg"]["type"] == "image/gif") || ($_FILES["contactimg"]["type"] == "image/GIF") || ($_FILES["contactimg"]["type"] == "image/jpg") || ($_FILES["contactimg"]["type"] == "image/JPG") || ($_FILES["contactimg"]["type"] == "image/jpeg") || ($_FILES["contactimg"]["type"] == "image/JPEG") || ($_FILES["contactimg"]["type"] == "image/pjpeg") || ($_FILES["contactimg"]["type"] == "image/PJEG") || ($_FILES["contactimg"]["type"] == "image/png") || ($_FILES["contactimg"]["type"] == "image/x-png") || ($_FILES["contactimg"]["type"] == "image/PNG") || ($_FILES["contactimg"]["type"] == "image/X-PNG"))
{
$filename=$_FILES['contactimg']['name'];
preg_match("/\.([^\.]+)$/", $filename, $file_ext);
copy ($_FILES['contactimg']['tmp_name'], "../images/contact_".$contactid.".".$file_ext[1])
or die ("Could not copy the file: Product Photo(thumb)");
$imagethumb = "../images/contact_".$contactid.".".$file_ext[1];
//createthumb($imagethumb, $imagethumb, 220, 454);
$contactimg = "contact_".$contactid.".".$file_ext[1];
$contactimg = htmlspecialchars($contactimg,ENT_QUOTES);
}
}
else
{
// upload error
?>
<script language="javascript">
alert("Files must be JPEG, GIF, or PNG and under 2MB in size");
history.back();
</script>
<?php
exit;
}
}
else
{
$contactimg ="";
}
// Modify
//$sql = "update contactus set contacttitleen='$contacttitleen', contacttitletc='$contacttitletc', contactdescsc='$contactdescsc', contactdesctc='$contactdesctc', modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' ";
$sql = "update contactus set contactdescsc='$contactdescsc', contactdesctc='$contactdesctc', lastupdate='$nowdate', lastupby='".$_SESSION['cmsloginid']."' ";
if ($contactimg <> '' or $_POST['delimagesc'] > 0 )
$sql .= ", contactimg='$contactimg'";
$sql .= " where contactid=". $contactid ." ";
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");
?>