<?php
/**************************************************************************************************
|
| iDocScript - Document Sharing Script
| http://www.idocscript.com
| webmaster@idocscript.com
|
|**************************************************************************************************
|
| By using this software you agree that you have read and acknowledged our End-User License 
| Agreement available at http://www.idocscript.com/eula.html and to be bound by it.
|
| Copyright (c) 2011 iDocScript.com. All rights reserved.
|**************************************************************************************************/

include("../include/config.php");
include_once("../include/functions/import.php");
verify_login_admin();

function insert_get_total_v1($var)
{
        global $conn;
        $query="SELECT count(*) as total FROM docs WHERE active='0'";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

function insert_get_total_v2($var)
{
        global $conn;
        $query="SELECT count(*) as total FROM docs_reports";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

function insert_get_total_v3($var)
{
        global $conn;
        $query="SELECT count(*) as total FROM docs WHERE featured='1'";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

function insert_get_total_v4($var)
{
        global $conn;
		$week = time() - (7 * 24 * 60 * 60);
        $query="SELECT count(*) as total FROM docs WHERE time_added>='$week'";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

function insert_get_total_v5($var)
{
        global $conn;
        $query="SELECT count(*) as total FROM docs";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

function insert_get_total_com($var)
{
        global $conn;
        $query="SELECT count(*) as total FROM $var[table]";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

function insert_get_total_m1($var)
{
        global $conn;
		$query="SELECT count(*) as total FROM members WHERE status='0'";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

function insert_get_total_m2($var)
{
        global $conn;
        $query="SELECT count(*) as total FROM members WHERE featured='1'";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

function insert_get_total_m3($var)
{
        global $conn;
        $query="SELECT count(*) as total FROM members";
        $executequery=$conn->execute($query);
        $t = $executequery->fields[total];
		echo $t+0;
}

$query2 = "select username,email from members order by USERID desc limit 5";
$executequery2 = $conn->Execute($query2);	
$results = $executequery2->getrows();
STemplate::assign('results',$results);

$mainmenu = "1";
Stemplate::assign('mainmenu',$mainmenu);
Stemplate::assign('error',$error);
STemplate::display("administrator/global_header.tpl");
STemplate::display("administrator/home.tpl");
STemplate::display("administrator/global_footer.tpl");
?>