<?php 
/**
#	Project: PHPDISK File Storage Solution
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: index.php 25 2011-03-04 07:36:51Z along $
#
#	Copyright (C) 2008-2011 PHPDisk Team. All Rights Reserved.
#
*/

include "includes/commons.inc.php";

$in_front = true;

lang('index');

$title = $settings['site_title'];
include PHPDISK_ROOT."./includes/header.inc.php";

$last = $db->fetch_one_array("select userid,username from {$tpf}users order by userid desc limit 1");
$last['username_all'] = $last['username'];
$last['username'] = cutstr($last['username'],18);
$a_last_user = urr("space","username=".rawurlencode($last['username_all']));

$rs = $db->fetch_one_array("select wealth,credit,rank,exp from {$tpf}users where userid='$pd_uid' limit 1");
if($rs){
	$credit = (int)$rs['credit'];
	$wealth = (int)$rs['wealth'];
	$rank = (int)$rs['rank'];
	$exp = (int)$rs['exp'];
	$this_exp = ($rank+1)*$settings['exp_const'];
	$lv_tips = ($rank+1)*$settings['exp_const']-$exp;
	$exp_fill = @round(100*($exp/(($rank+1)*$settings['exp_const'])));
}
unset($rs);

if($pd_uid){
	$stats['total_folders'] = (int)@$db->result_first("select count(*) from {$tpf}folders where userid='$pd_uid' and in_recycle=0");
	$stats['total_share_files'] = @$db->result_first("select count(*) from {$tpf}files where userid='$pd_uid' and in_share=1 and in_recycle=0");
	$stats['total_files'] = (int)@$db->result_first("select count(*) from {$tpf}files where userid='$pd_uid' and in_recycle=0");
	$stats['file_size_total'] = get_size(@$db->result_first("select sum(file_size) from {$tpf}files where userid='$pd_uid' and in_recycle=0"));
	$stats['last_login_ip'] = @$db->result_first("select last_login_ip from {$tpf}users where userid='$pd_uid'");
}

require_once template_echo('phpdisk',$user_tpl_dir);
include PHPDISK_ROOT."./includes/footer.inc.php";

?>