/********************************/
/ Collect site statistics /
/********************************/
$sql = 'select count(*) from ! where active = ? and regdate > ? and status in ( ?, ?) ';
$weekcnt = $db->getOne( $sql, array( USER_TABLE, '1', strtotime("-7 day"), 'active', get_lang('status_enum','active') ) );
$t->assign( 'weekcnt', $weekcnt );
$sql = 'select sum(if(gender=\'M\',1,0)) as Dominants, sum(if(gender=\'F\',1,0)) as female subs, sum(if(gender=\'C\',1,0)) as couples, sum(if(gender=\'S\',1,0)) as male subs, sum(if(gender=\'D\',1,0))as Dominatrixs, sum(if(gender=\'V\',1,0))as male slaves, sum(if(gender=\'Y\',1,0))as female slaves, sum(if(gender=\'X\',1,0))as TS TV TG, sum(if(gender=\'U\',1,0))as Not Into BDSM, sum(if(gender=\'L\',1,0))as other from ! where active = ? and status in (?, ?)';
$row = $db->getRow( $sql, array( USER_TABLE, '1', 'active', get_lang('status_enum','active') ) );
$t->assign( 'Dominants', $row['Dominants'] );
$t->assign( 'female subs', $row['female subs'] );
$t->assign( 'couples', $row['couples'] );
$t->assign( 'male subs', $row['male subs'] );
$t->assign( 'Dominatrixs', $row['Dominatrixs'] );
$t->assign( 'male slaves', $row['male slaves'] );
$t->assign( 'female slaves', $row['female slaves'] );
$t->assign( 'TS TV TG', $row['TS TV TG'] );
$t->assign( 'Not Into BDSM', $row['Not Into BDSM'] );
$t->assign( 'Other', $row['Other'] );
$sql = 'select count(*) from ! where ins_time > ? ';
$weeksnaps = $db->getOne( $sql, array( USER_SNAP_TABLE, strtotime("-7 day") ) );
$t->assign( 'weeksnaps', $weeksnaps );