<?php
/*
* 控制面板首页
* @author: moufer<moufer@163.com>
* @package: modoer
* @version: 1.0.0
* @copyright: www.modoer.com
* @Date: 2007-10-12 v1.0.0
*/
(!defined('IN_ADMIN') || !defined('IN_MUDDER')) && exit('Access Denied');

$installfiles = array('./install.php', './install');
foreach($installfiles as $val) {
    if(file_exists($val)) {
        $install_exists = TRUE;
    }
}

$server['time'] = date('Y-m-d H:i:s', $timestamp);
$server['upfile'] = (ini_get('file_uploads')) ? '允许 ' . ini_get('upload_max_filesize') : '关闭';
$server['register_globals'] = (ini_get('register_globals')) ? '允许' : '关闭';
$server['safe_mode'] = (ini_get('safe_mode')) ? '允许' : '关闭';
$server['software'] = $_SERVER['SERVER_SOFTWARE'];
$s = function_exists('gd_info') ? gd_info() : '<span class="font_1"><strong>Not Support</strong></span>';
$server['gd'] = is_array($s) ? ($s['GD Version']) : $s;
if (function_exists('memory_get_usage')) {
$server['memory'] = round(memory_get_usage()/1024,2); //KB
}

$query = $db->query("SELECT a.adminid,a.ip,a.dateline,b.adminname FROM {$dbpre}adminsessions a LEFT JOIN {$dbpre}admin b ON(a.adminid=b.id)");
while($session = $db->fetch_array($query)) {
    $session['dateline'] = date('Y-m-d H:i:s', $session['dateline']);
    $adminsessions[] = $session;
}

$r = $db->get_one("SELECT COUNT(*) AS c FROM {$dbpre}members");
$system['members'] = $r['c'];
$r = $db->get_one("SELECT COUNT(*) AS c FROM {$dbpre}shops");
$system['shops'] = $r['c'];
$r = $db->get_one("SELECT COUNT(*) AS c FROM {$dbpre}shops WHERE adduid > 0");
$system['shops_mbpost'] = $r['c'];
$r = $db->get_one("SELECT COUNT(*) AS c FROM {$dbpre}reviews");
$system['reviews'] = $r['c'];
$r = $db->get_one("SELECT COUNT(*) AS c FROM {$dbpre}responds");
$system['respond'] = $r['c'];
$r = $db->get_one("SELECT COUNT(*) AS c FROM {$dbpre}pmsgs");
$system['pmsgs'] = $r['c'];
$r = $db->get_one("SELECT COUNT(*) AS c FROM {$dbpre}favorites");
$system['favorites'] = $r['c'];

include cptpl('home');
?>