? GR0V Shell

GR0V shell

Linux www.koreapackagetour.com 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 x86_64

Path : /home/admin/domains/happytokorea.com/private_html/modules/gallery/
File Upload :
Current File : /home/admin/domains/happytokorea.com/private_html/modules/gallery/com_topic.php

<?
class topic extends backoff
{	
function list_sub_usertype($parent){
							$rs=$this->Query("SELECT * FROM content_cat WHERE  CatParentID='$parent'");	
							while($arr=mysql_fetch_array($rs)){
								$str.=$arr['CatID']."-";
								$str.=$this->list_sub_usertype($arr['CatID']);
								}
			return $str;
}
function get_sub_cat($parent,$selected,$option){
			global $user_login;
			$u=$user_login['ID'];
			$access=$user_login['Access'];
$rs=$this->Query("SELECT * FROM content_cat where  CatParentID='$parent'");	

			if($parent!=''){
			$option.="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			}
//$rs=$this->Query("SELECT * FROM package_cat where parent='$parent' and user_id='$u'");
while($arr=mysql_fetch_array($rs)){
	$id=$arr['CatID'];
	$name=$arr['CatName'];
	if($arr['CatID']==$selected){$s="selected";}else{$s="";}
	if($parent!=''){	
		$html.="<OPTION VALUE=\"$id\" $s>$option $name</OPTION>";
	}else{	$html.="<OPTION VALUE=\"$id\" $s>$name</OPTION>";	}

$html.=$this->get_sub_cat($arr['CatID'],$selected,$option);
}//end while
return $html;
}

function list_by_group(){
global $user_login;
$output.="
<table width=\"400\" border=0>
<tr><form method=\"GET\" action=\"$link\" name=\"form_group\">
<td width=\"100%\">
แสดงตามหมวดหมู่&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
$output.="<select name=list_group  onchange=\"document.form_group.submit()\">";
$output.="<option value=\"All\" selected> --เลือกทั้งหมด--</option>";

$result=$this->Query("SELECT * FROM content_cat   order by CatID DESC");

 $output.=$this->get_sub_cat($r,$_GET['list_group'],$option);
if($_GET){
			foreach ($_GET as $key => $value){
				if($key !="list_group"){
					$output.= "<input type='hidden' name='$key' value='$value'>\n";
				}
			}
		}
	$output.="</select>";
	$output.="</td></form></tr></table>";
return $output;
}//end function company
function Search(){
	$output.="<table width=\"350\" height=\"20\"><form method=\"GET\" action=\"$link\" name=\"search\"><tr><td width=\"100%\">
	<input type='hidden' name='option' value='search'>
		<input type='hidden' name='page' value='1'>
		<select size=\"1\" name=\"key\">";
	$keysearch=array('name_gallery'=>"ชื่อ Gallery");
	foreach($keysearch as $key=>$value){
		if($_GET['key']==$key){
			$output.="<option value=\"$key\" selected>$value</option>";
		}//end if $_GET['key']
		else{
$output.="<option value=\"$key\">$value</option>";
		}
	}

	if($_GET){
			foreach ($_GET as $key => $value){
				if($key != "key" && $key != "keyword" && $key !="search"&&$key!="page"){
					$output.= "<input type='hidden' name='$key' value='$value'>\n";
				}
			}
		}
	$output.="</select>";
	if($_GET['keyword']!=""){
	$output.="<input type='textbox' name='keyword' size=\"20\" value=".$_GET['keyword'].">";
	}else{
		$output.="<input type='textbox' name='keyword' size=\"25\">";
		}
	$output.="<input type='submit' value=\"search\" size=10>";
	$output.="</td></tr></form></table>";
return $output;
}

function listData($table,$condition,$orderby,$sort,$chksort,$header_txt,$header_td_width,$link){
global $user_login;
$this->_header_txt=$header_txt;

	foreach($header_txt as $table_colum => $header_txt_name){
		if($orderby==$header_txt_name){
		$orderby2="binary $table_colum";
		}
	}
if($chksort=='Yes'){
		if($sort=="Min2Max"){
			$sort="Max2Min"; 
			$sort2="ASC";
			$sort3=$sort;
		}else if($sort=="Max2Min"){
			$sort="Min2Max";
			$sort2="DESC";
			$sort3=$sort;
		}
}else{
		if($sort=="Min2Max"){ 
		$sort="Min2Max";
		$sort2="ASC";
		$sort3="Max2Min";
		}else if($sort=="Max2Min"){  
		$sort="Max2Min";
		$sort2="DESC";
		$sort3="Min2Max";
		}
}
// จะต้องมีการแก้ไขให้ตรงกับฐานข้อมูล *** ตัวแปร $orderby2
if($orderby2==""){
$orderby2="id_g";
}

$this->_Start = ($this->_Page * $this->_Limit) - $this->_Limit;
$sql= "SELECT * FROM $table $where ORDER BY $orderby2 $sort2 ";

$this->setQuery($sql);
$result=$this->QueryReturn();
$this->_total=$this->NumRows();
$this->_Next_Page = ceil($this->_total/$this->_Limit);
//$sql.= " LIMIT " . $this->_Start . "," .  $this->_Limit;
$this->setQuery($sql);
//echo $sql;
$result2=$this->QueryReturn();
$this->PageNavigator();
		$output.="
		<div class=\"wrapper\">
		<div class=\"content\">
    	<div class=\"title\"><img style=\"padding:10px 0 0 15px; float:left;\" src=\"images/icons/dark/docs.png\"><h5>gallery ทั้งหมด</h5></div>
        <div class=\"table\">
          <div class=\"head\"></div><form method=\"POST\" action=\"$link2\" name=\"backend_form\" >
            <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"display\" id=\"example\">
                <thead>
              ";
					foreach($header_txt as $table_colum => $header_txt_name){
						
					    $output.="<th>{$header_txt_name}</th>";
						
					$i++;
					}
					
		$output.="<th width=\"10%\">แก้ไข</th>
				  <th width=\"9%\">ลบ</th>";			
       	$output.="</tr></thead>";
		
		
$output.="<tbody>";		
$data_colum=Array();
$count=0;	
while($arr=mysql_fetch_array($result2))
{
$id=$arr['id_g'];
$j=0;

foreach($header_txt as $colum => $key){
			$data_colum[$j]=$arr[$colum];
			$j++;
}//end foreach
$link=$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
$output.="<tr class=\"gradeA\">";


for($i=0;$i<count($data_colum);$i++){
$output.="<td>";
if($i==0){
if ($_SESSION["la"] == 1){
$data=$this->getRow('gallery_phote',"WHERE id_g  ='$id' ORDER BY id_p ASC ");
}else{
$data=$this->getRow('gallery_phote_en',"WHERE id_g  ='$id' ORDER BY id_p ASC ");
}

$output.="<img src=\"images/gallery/{$data[picture]}\" width=\"150\"> </td>";
}else{
$output.="$data_colum[$i] </td>";
}
}

$link_del=$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."&ac=del_data&id=$id";
$comment="ยืนยันคำสั่งลบข้อมูล";
$alt="ลบข้อมูล";

 $output.="<td class=\"center\"><a href=\"$link&ac=edit_data&id={$id}\"  class=\"btn14 mr5\"><img src=\"images/icons/dark/pencil.png\" > แก้ไข</a></td>
           <td class=\"center\">".confirm_del($link_del,$comment,$alt)."</td>
		   </tr>";
 } //while          
			    $output.="
             </tbody>
            </table>
		 </form>
      </div>
        
    </div>
    <div class=\"fix\"></div>
</div>";



return $output;
}//end listData

function listData_idx_list($table,$condition,$orderby,$sort,$chksort,$header_txt,$header_td_width,$link){
global $user_login;
$this->_header_txt=$header_txt;

	foreach($header_txt as $table_colum => $header_txt_name){
		if($orderby==$header_txt_name){
		$orderby2="binary $table_colum";
		}
	}
if($chksort=='Yes'){
		if($sort=="Min2Max"){
			$sort="Max2Min"; 
			$sort2="ASC";
			$sort3=$sort;
		}else if($sort=="Max2Min"){
			$sort="Min2Max";
			$sort2="DESC";
			$sort3=$sort;
		}
}else{
		if($sort=="Min2Max"){ 
		$sort="Min2Max";
		$sort2="ASC";
		$sort3="Max2Min";
		}else if($sort=="Max2Min"){  
		$sort="Max2Min";
		$sort2="DESC";
		$sort3="Min2Max";
		}
}
// จะต้องมีการแก้ไขให้ตรงกับฐานข้อมูล *** ตัวแปร $orderby2
if($orderby2==""){
if ($_SESSION["la"] == 1){
$orderby2="gallery.id_g";
}else{
$orderby2="gallery_en.id_g";
}

}

$this->_Start = ($this->_Page * $this->_Limit) - $this->_Limit;
$sql= "SELECT * FROM $table ";

$this->setQuery($sql);
$result=$this->QueryReturn();
$this->_total=$this->NumRows();
$this->_Next_Page = ceil($this->_total/$this->_Limit);
$this->setQuery($sql);
$result2=$this->QueryReturn();
$this->PageNavigator();
		$output.="
		<div class=\"wrapper\">
		<div class=\"content\">
    	<div class=\"title\"><img style=\"padding:10px 0 0 15px; float:left;\" src=\"images/icons/dark/docs.png\"><h5>แสดงผลgalleryหน้าหลัก 14 อันดับ</h5></div>
        <div class=\"table\">
            <div class=\"head\"></div><form method=\"POST\" action=\"$link2\" name=\"backend_form\" >
            <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"display\" id=\"example\">
                <thead>
                    <tr><th width=\"5%\"></th>";
					foreach($header_txt as $table_colum => $header_txt_name){
					$output.="<th>{$header_txt_name}</th>";
					$i++;
					}
					
		$output.="<th width=\"22%\">จัดตำแหน่งการแสดงผลgallery</th>";			
       	$output.="</tr></thead>";
		
		
		$output.="<tbody>";		
		$data_colum=Array();
		$count=0;	

		for($kkk=1;$kkk<=14;$kkk++)
				{
				
						$j=0;
						foreach($header_txt as $colum => $key){
									$data_colum[$j]=$arr[$colum];
									$j++;
						}//end foreach
						$link=$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
						$output.="<tr class=\"gradeA\">";
						$output.="<td>&nbsp;</td>";
								if ($_SESSION["la"] == 1){
$this->setQuery("SELECT * FROM gallery INNER JOIN gallery_recommend ON (gallery.id_g = gallery_recommend.id_g) INNER JOIN gallery_phote ON (gallery.id_g = gallery_phote.id_g) WHERE (gallery_recommend.galleryRecommendRanking	 = $kkk)  order by gallery_phote.id_p ASC ");
}else{
$this->setQuery("SELECT * FROM gallery_en INNER JOIN gallery_recommend_en ON (gallery_en.id_g = gallery_recommend_en.id_g) INNER JOIN gallery_phote_en ON (gallery_en.id_g = gallery_phote_en.id_g) WHERE (gallery_recommend_en.galleryRecommendRanking	 = $kkk)  order by gallery_phote_en.id_p ASC ");
}
						
						$rsChktour_recommend= $this->QueryReturn();
						if($this->NumRows() > 0)
						{
								$arrChktour_recommend = mysql_fetch_array($rsChktour_recommend);
								for($i=0;$i<count($data_colum);$i++)
								{
									$output.="<td>";
									if($i==0)
									$output.="<img src=\"images/gallery/$arrChktour_recommend[picture]\"width=\"100\"></td>";
									else if($i==1)
									$output.="$arrChktour_recommend[name_gallery]</td>";
								}	
						}
						else
						{
								for($i=0;$i<count($data_colum);$i++)
								{
									$output.="<td>";
									if($i==0)
									$output.= "-</td>";	
									else if($i==1)
									$output.="-</td>";	
								}
						}
						
						$output.="<td class=\"center\"><a href=\"#\" onclick=\"Popup2('modules/gallery/list_index_page2.php?id=$kkk','list_index_page2',550,100)\" class=\"btn14 mr5\"><img src=\"images/icons/dark/pencil.png\"  > จัดตำแหน่งgalleryลำดับที่ $kkk</a></td></tr>";	
						$arrChktour_recommend['id_g'] = "";
				} //for
	     
			    $output.="
             </tbody>
            </table>
		 </form>
      </div>
        
    </div>
    <div class=\"fix\"></div>
</div>";



return $output;
}//end listData

function listData_idx_list2($table,$condition,$orderby,$sort,$chksort,$header_txt,$header_td_width,$link){
global $user_login;
$this->_header_txt=$header_txt;

	foreach($header_txt as $table_colum => $header_txt_name){
		if($orderby==$header_txt_name){
		$orderby2="binary $table_colum";
		}
	}
if($chksort=='Yes'){
		if($sort=="Min2Max"){
			$sort="Max2Min"; 
			$sort2="ASC";
			$sort3=$sort;
		}else if($sort=="Max2Min"){
			$sort="Min2Max";
			$sort2="DESC";
			$sort3=$sort;
		}
}else{
		if($sort=="Min2Max"){ 
		$sort="Min2Max";
		$sort2="ASC";
		$sort3="Max2Min";
		}else if($sort=="Max2Min"){  
		$sort="Max2Min";
		$sort2="DESC";
		$sort3="Min2Max";
		}
}
// จะต้องมีการแก้ไขให้ตรงกับฐานข้อมูล *** ตัวแปร $orderby2
if($orderby2==""){
if ($_SESSION["la"] == 1){
$orderby2="gallery.id_g";
}else{
$orderby2="gallery_en.id_g";
}

}

$this->_Start = ($this->_Page * $this->_Limit) - $this->_Limit;
$sql= "SELECT * FROM $table ";

$this->setQuery($sql);
$result=$this->QueryReturn();
$this->_total=$this->NumRows();
$this->_Next_Page = ceil($this->_total/$this->_Limit);
$this->setQuery($sql);
$result2=$this->QueryReturn();
$this->PageNavigator();
		$output.="
		<div class=\"wrapper\">
		<div class=\"content\">
    	<div class=\"title\"><img style=\"padding:10px 0 0 15px; float:left;\" src=\"images/icons/dark/docs.png\"><h5>ภาพประทับใจหน้าแรก</h5></div>
        <div class=\"table\">
            <div class=\"head\"></div><form method=\"POST\" action=\"$link2\" name=\"backend_form\" >
            <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"display\" id=\"example\">
                <thead>
                    <tr><th width=\"5%\"></th>";
					foreach($header_txt as $table_colum => $header_txt_name){
					$output.="<th>{$header_txt_name}</th>";
					$i++;
					}
					
		$output.="<th width=\"22%\">จัดตำแหน่งการแสดงผลgallery</th>";			
       	$output.="</tr></thead>";
		
		
		$output.="<tbody>";		
		$data_colum=Array();
		$count=0;	

		for($kkk=1;$kkk<=3;$kkk++)
				{
				
						$j=0;
						foreach($header_txt as $colum => $key){
									$data_colum[$j]=$arr[$colum];
									$j++;
						}//end foreach
						$link=$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
						$output.="<tr class=\"gradeA\">";
						$output.="<td>&nbsp;</td>";
								if ($_SESSION["la"] == 1){
$this->setQuery("SELECT * FROM gallery INNER JOIN gallery_recommend_2 ON (gallery.id_g = gallery_recommend_2.id_g) INNER JOIN gallery_phote ON (gallery.id_g = gallery_phote.id_g) WHERE (gallery_recommend_2.galleryRecommendRanking	 = $kkk)  order by gallery_phote.id_p DESC ");
}else{
$this->setQuery("SELECT * FROM gallery_en INNER JOIN gallery_recommend_2_en ON (gallery_en.id_g = gallery_recommend_2_en.id_g) INNER JOIN gallery_phote_en ON (gallery_en.id_g = gallery_phote_en.id_g) WHERE (gallery_recommend_2_en.galleryRecommendRanking	 = $kkk)  order by gallery_phote_en.id_p DESC ");
}
						
						$rsChktour_recommend= $this->QueryReturn();
						if($this->NumRows() > 0)
						{
								$arrChktour_recommend = mysql_fetch_array($rsChktour_recommend);
								for($i=0;$i<count($data_colum);$i++)
								{
									$output.="<td>";
									if($i==0)
									$output.="<img src=\"images/gallery/$arrChktour_recommend[picture]\"width=\"100\"></td>";
									else if($i==1)
									$output.="$arrChktour_recommend[name_gallery]</td>";
								}	
						}
						else
						{
								for($i=0;$i<count($data_colum);$i++)
								{
									$output.="<td>";
									if($i==0)
									$output.= "-</td>";	
									else if($i==1)
									$output.="-</td>";	
								}
						}
						
						$output.="<td class=\"center\"><a href=\"#\" onclick=\"Popup2('modules/gallery/list_index_page3.php?id=$kkk','list_index_page2',550,100)\" class=\"btn14 mr5\"><img src=\"images/icons/dark/pencil.png\"  > จัดตำแหน่งgalleryลำดับที่ $kkk</a></td></tr>";	
						$arrChktour_recommend['id_g'] = "";
				} //for
	     
			    $output.="
             </tbody>
            </table>
		 </form>
      </div>
        
    </div>
    <div class=\"fix\"></div>
</div>";



return $output;
}//end listData
}//end class BackEndData
?>

T1KUS90T
  root-grov@210.1.60.28:~$