<?php 
/**
#	Project: PHPDISK File Storage Solution
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: adm_ajax.php 64 2016-07-30 14:01:18Z along $
#
#	Copyright (C) 2008-2016 PHPDisk Team. All Rights Reserved.
#
*/

include "includes/commons.inc.php";
phpdisk_core::admin_login();

switch($action){
	case 'get_depart_name':
		$uid = (int)gpc('uid','P','');
		if($uid){
			$depart_id = get_profile($uid,'depart_id');
			if($depart_id){
				echo @$db->result_first("select depart_name from {$tpf}departs where depart_id='$depart_id' limit 1");
			}
		}else{
			echo 'Error';
		}
		break;
	case 'ping_sv':
		$server_oid = (int)gpc('server_oid','P',0);
		if($server_oid){
			if(display_plugin('multi_server','open_multi_server_plugin',$settings['open_multi_server'],0)){
				$rs = $db->fetch_one_array("select server_host from {$tpf}servers where server_oid='$server_oid' limit 1");
				if($rs){
					$remote_server_url = $rs['server_host'];
				}
				unset($rs);
			}else{
				$remote_server_url = '';
			}
			$arr = get_web_link($remote_server_url.'robots.txt');
			if($arr[http_code]==200){
				echo 'true|'.round($arr[total_time],4).'秒';
			}else{
				echo '错误'.$arr[http_code];
			}
		}else{
			echo 'Error server!';
		}
		break;
}


?>