| 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;
}
?>
<?php require("configure.php");
require("function_resizethumb.php");
$slidesort = check_input($_POST["slidesort"]);
//$slideimgalten = check_input($_POST["slideimgalten"]);
//$slideimgalttc = check_input($_POST["slideimgalttc"]);
$slidelinksc = check_input($_POST["slidelinksc"]);
$slidelinktc = check_input($_POST["slidelinktc"]);
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
$slidetype = check_input($_POST["slidetype"]);
if(empty($slidetype)){
echo "<script language='javascript'>
alert('You must choose one type of the slide show image!');
history.back();
</script>";
exit;
}
$sql = "select max(slideid) as maxid ";
$sql .= "from slideshow ";
$result=mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$slideid = $row{maxid}+1;
// Upload File
$filelimit = 2 * 1048576; //Filelimit in 2MB
if ($_FILES['slideimgsc']['name'] <> '')
{
if ($_FILES['slideimgsc']['size'] < $filelimit ){
if (($_FILES["slideimgsc"]["type"] == "image/gif") || ($_FILES["slideimgsc"]["type"] == "image/GIF") || ($_FILES["slideimgsc"]["type"] == "image/jpg") || ($_FILES["slideimgsc"]["type"] == "image/JPG") || ($_FILES["slideimgsc"]["type"] == "image/jpeg") || ($_FILES["slideimgsc"]["type"] == "image/JPEG") || ($_FILES["slideimgsc"]["type"] == "image/pjpeg") || ($_FILES["slideimgsc"]["type"] == "image/PJEG") || ($_FILES["slideimgsc"]["type"] == "image/png") || ($_FILES["slideimgsc"]["type"] == "image/x-png") || ($_FILES["slideimgsc"]["type"] == "image/PNG") || ($_FILES["slideimgsc"]["type"] == "image/X-PNG"))
{
move_uploaded_file ($_FILES['slideimgsc']['tmp_name'], "../images/slideshow/id_".$slideid."_sc_".$_FILES['slideimgsc']['name'])
or die ("Could not copy the file");
$slideimgscimg = "../images/slideshow/id_".$slideid."_sc_".$_FILES['slideimgsc']['name'];
createthumb($slideimgscimg, $slideimgscimg, 980, 310);
$slideimgsc = "id_".$slideid."_sc_".$_FILES['slideimgsc']['name'];
}
}
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
{
$slideimgsc = "";
}
if ($_FILES['slideimgtc']['name'] <> '')
{
if ($_FILES['slideimgtc']['size'] < $filelimit ){
if (($_FILES["slideimgtc"]["type"] == "image/gif") || ($_FILES["slideimgtc"]["type"] == "image/GIF") || ($_FILES["slideimgtc"]["type"] == "image/jpg") || ($_FILES["slideimgtc"]["type"] == "image/JPG") || ($_FILES["slideimgtc"]["type"] == "image/jpeg") || ($_FILES["slideimgtc"]["type"] == "image/JPEG") || ($_FILES["slideimgtc"]["type"] == "image/pjpeg") || ($_FILES["slideimgtc"]["type"] == "image/PJEG") || ($_FILES["slideimgtc"]["type"] == "image/png") || ($_FILES["slideimgtc"]["type"] == "image/x-png") || ($_FILES["slideimgtc"]["type"] == "image/PNG") || ($_FILES["slideimgtc"]["type"] == "image/X-PNG"))
{
move_uploaded_file ($_FILES['slideimgtc']['tmp_name'], "../images/slideshow/id_".$slideid."_tc_".$_FILES['slideimgtc']['name'])
or die ("Could not copy the file");
$slideimgtcimg = "../images/slideshow/id_".$slideid."_tc_".$_FILES['slideimgtc']['name'];
createthumb($slideimgtcimg, $slideimgtcimg, 980, 310);
$slideimgtc = "id_".$slideid."_tc_".$_FILES['slideimgtc']['name'];
}
}
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
{
$slideimgtc = "";
}
// Sort
//if ($slidesort == '' || $slidesort == '0') {
$sql = "select max(slidesort) as maxid ";
$sql .= "from slideshow where slidetype='$slidetype'";
$result=mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$slidesort = $row{maxid}+1;
//}
/*
if( mysql_num_rows(mysql_query("SELECT slideid FROM slideshow WHERE slidesort=$slidesort ")) > 0){
mysql_query("UPDATE slideshow SET slidesort= slidesort+1 WHERE slidesort >=$slidesort ");
}
*/
$sql = "insert into slideshow (slidetype,slideid, slidelinksc, slidelinktc, slideimgsc, slideimgtc, slidesort, slidestatus, createdate, createby, lastupdate, lastupby) values ('$slidetype','$slideid', '$slidelinksc', '$slidelinktc', '$slideimgsc', '$slideimgtc', '$slidesort', '1', '$nowdate','".$_SESSION['cmsloginid']."', '$nowdate', '".$_SESSION['cmsloginid']."')";
mysql_query($sql);
if( mysql_errno() > 0 ){
echo 'Add Home Slide Show Error:<br />'. mysql_error() .'<br />SQL: '. $sql;
exit;
}
mysql_close($dbh);
header("Location: slideshow_index.php?msg=Add Successful");
?>