%PDF-1.5 % ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY
| Server IP : 122.155.17.190 / Your IP : 216.73.216.89 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();
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>150) or ($height>100))
{
// สร้างภาพ 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 ="$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">
<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 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 type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color:#ffffff;
font-family: 'Kanit', sans-serif;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
</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">
<style type="text/css">
<!--
.style2 {font-family: 'Kanit', sans-serif}
-->
</style>
</head>
<body background="" style="background-repeat:no-repeat; background-position:top" font-family: 'Kanit', sans-serif;>
<!-- content -->
<div align="center">
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th align="center" valign="top" scope="col"><table width="1000" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><div align="center" class="image-box">
<table width="100%" 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>
<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 valign="top" scope="col"></th>
</tr>
<tr>
<td height="5" valign="top"> </td>
</tr>
<tr>
<td valign="top"><div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height="5" valign="top"> <a name="toppage"></a></td>
</tr>
<tr>
<td><div align="right"><a href="../admin/main.php" class="style2">หน้า Admin </a>| <a href="../admin/signout.php" class="style2">ออกจากระบบ </a></div></td>
</tr>
<tr>
<td>
<table width="100%" border="1" cellspacing="0" cellpadding="0" align="center" class="magnifyarea">
<tr bgcolor="#0869ad">
<td colspan="4" align="center" bgcolor="#0099FF"><font color="#FFFFFF"><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">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right" width="35%">ชื่ออัลบั้ม : </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">รายละเอียด : </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 : </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" >ภาพกิจกรรมใช้ในหน้ารวมอัลบั้ม : <br>(กว้าง 150 px ,สูง 100 px) : </td>
<td valign="center" colspan="3">
<?
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\"> ";
}
?>
<br><input type="file" name="file1"id="file1" size="30" onchange="loadPicture('photoImage1',this);">
<input name="view1" id="view1" type="button" style="height:20px;" onclick="javascript:void(photoImage1.src = 'images/noimage.gif',document.form1.photo1.value='NO_picture')" value="Clear"> </td>
</tr>
<tr>
<td align="right">วันที่ประกาศ : </td>
<td><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;' 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"> <font color="red"> yyyy-mm-dd (ค.ศ.)</font> </td>
</tr>
<tr>
<td align="right">Order : </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"> </td>
</tr>
<tr>
<td colspan="2" align="center">
<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"> </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"> <a name="top_page"></a> </td>
<td width="5%" align="center"> </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%"> <a href="add_albums.php?sd=3&sh_order=<?=$sh_order;?>#top_page" target="_parent">ชื่ออัลบั้ม</a> </td>
<td width="20%" align="center">ภาพ </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" >
<?
$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 = "#ffffff";
if(($item %2)==0){
$bcolor = "#e5e5e5";
}
$code_1 = $c_alb_title;
?>
<tr> <td height="10" colspan="9"></td></tr>
<tr bgcolor="<?=$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%">
<?= $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>
<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#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> </td>
</tr>
</table> </td>
</tr>
<tr><td> </td></tr>
</table>
</div></td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
</table> </th>
</tr>
</table></th>
</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>