38 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			38 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
|  | <?php | |||
|  | @session_start(); | |||
|  | @error_reporting( 7 ); | |||
|  | @ini_set( 'display_errors', true ); | |||
|  | @ini_set( 'html_errors', false ); | |||
|  | 
 | |||
|  | define( 'DATALIFEENGINE', true ); | |||
|  | define( 'ROOT_DIR', substr( dirname(  __FILE__ ), 0, -12 ) ); | |||
|  | define( 'SYSTEM_DIR', ROOT_DIR . '/system' ); | |||
|  | 
 | |||
|  | include SYSTEM_DIR . '/data/config.php'; | |||
|  | require_once SYSTEM_DIR . '/classes/mysql.php'; | |||
|  | require_once SYSTEM_DIR . '/data/dbconfig.php'; | |||
|  | require_once SYSTEM_DIR . '/modules/functions.php'; | |||
|  | require_once SYSTEM_DIR . '/modules/sitelogin.php'; | |||
|  | 
 | |||
|  | if( ! $is_logged ) die( "error" ); | |||
|  | 
 | |||
|  | $title = $db->safesql( trim( convert_unicode( $_POST['title'], $config['charset'] ) ) ); | |||
|  | if( $title == "" ) die(); | |||
|  | $buffer = ""; | |||
|  | $id = intval( $_POST['id'] ); | |||
|  | if( $id ) $where = " AND id != '" . $id . "'"; else $where = ""; | |||
|  | $db->query( "SELECT id, title, date, alt_name, MATCH (title, short_story) AGAINST ('$title') as score FROM " . PREFIX . "_post WHERE MATCH (title, short_story) AGAINST ('$title') AND approve='1'" . $where . " ORDER BY score DESC, date DESC LIMIT 5" ); | |||
|  | while ( $related = $db->get_row() ) { | |||
|  | 	$related['date'] = strtotime( $related['date'] ); | |||
|  | 	$news_date = date( 'd-m-Y', $related['date'] ); | |||
|  | 	$full_link = $config['http_home_url'] . $related['id'] . "-" . $related['alt_name'] . ".html"; | |||
|  | 	$buffer .= "<div style=\"padding:2px;\">{$news_date} - <a href=\"".$full_link."\" target=\"_blank\">".stripslashes($related['title'])."</a></div>"; | |||
|  | } | |||
|  | 
 | |||
|  | $db->close(); | |||
|  | @header( "Content-type: text/html; charset=" . $config['charset'] ); | |||
|  | 
 | |||
|  | if( $buffer ) echo "<div style=\"width:600px; background: #ffc;border:1px solid #9E9E9E;padding: 5px;margin-top: 7px;margin-right: 10px;\">" . $buffer . "</div>"; | |||
|  | else echo "<div style=\"width:542px;background: #ffc;border:1px solid #9E9E9E;padding: 5px;margin-top: 7px;margin-right: 10px;\"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.</div>"; | |||
|  | 
 | |||
|  | ?>
 |