| Server IP : 27.254.96.235 / Your IP : 216.73.216.44 Web Server : Apache/2 System : Linux cs95 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64 User : piboonsa ( 1055) PHP Version : 8.0.30 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/piboonsa/domains/piboonsawasdee.ac.th/public_html/backend/ |
Upload File : |
<?php
include("passlog.inc.php");
include("lib/config.php");
$id = $_POST['id'];
$status = $_POST['status'];
$topic = htmlspecialchars($_POST['topic'], ENT_QUOTES);
$link = $_POST['link'];
$img = $_FILES['img']['name'];
if(empty($topic) || empty($status) || empty($link)){
$msg = ERR_REQ_INFO;
echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=add_vdo.php?id='.$id.'&Page='.$_POST['Page'].'&msg='.$msg.'">';
exit;
}
if($id){
//Image
if($img){
$query = $db->query("SELECT img FROM vdo WHERE id = '$id'");
$rs = $db->getresult($query);
if($rs['img']){
unlink(IMG_VDO.$rs['img']);
}
$newimg = date("dmYHis").$img;
copy($_FILES['img']['tmp_name'], IMG_VDO.$newimg);
$size = GetimageSize($_FILES['img']['tmp_name']);
if($size[0] > IMG_W || $size[1] > IMG_H){
resize(IMG_VDO.$newimg, IMG_W, IMG_H);
}
}
$sql = "UPDATE vdo SET topic = '$topic', ";
if($img){
$sql .= "img = '$newimg', ";
}
$sql .= "link = '$link', status = '$status', updated_date = now(), updated_by = '".$_SESSION['acc_username']."' WHERE id = '$id'";
$db->query($sql);
}else{
// Image
if($img){
$newimg = date("dmYHis").$img;
move_uploaded_file($_FILES['img']['tmp_name'], IMG_VDO.$newimg);
$size = GetimageSize($_FILES['img']['tmp_name']);
if($size[0] > IMG_W || $size[1] > IMG_H){
resize(IMG_VDO.$newimg, IMG_W, IMG_H);
}
}
$db->query("INSERT INTO vdo SET topic = '$topic', img = '$newimg', link = '$link', status = '$status', entered_date = now(), updated_by = '".$_SESSION['acc_username']."' ");
}
echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=vdo.php?Page='.$_POST['Page'].'">';
?>