コード落書き

  • タグ:
  • タグはありません
$logid = isset($_REQUEST['logid']) ? intval($_REQUEST['logid']) : 0;

if ($logid > 0) {
	$sql = "SELECT `arg` FROM `log` WHERE `logid` = {$logid}";
	$sth = $db->query($sql);
	if ($sth->rowCount() > 0) {
		$data = $sth->fetchColumn();
		if (!empty($data)) {
			$json = var_export(json_decode($data,TRUE),TRUE);
			include_once('lib/class.geshi.php');
			$geshi = new GeSHi($json, "php");
			$json = $geshi->parseCode();
			die(json_encode(array("res"=>"OK","msg"=>"","data"=>$json)));
		} else {
			die(json_encode(array("res"=>"KO","msg"=>"Empty data")));
		}
	} else {
		die(json_encode(array("res"=>"KO","msg"=>"Data not exists")));	
	}
	
	
} else {
	die(json_encode(array("res"=>"KO","msg"=>"Invalid log ID")));
}