<?php 

$dir = '../../';

require_once $dir.'includes/main.php';

$section = clean($_POST['section']);
$offset = (int)$_POST['offset'];

switch($section){

   case 'active':
      $sql = "SELECT * FROM users ORDER BY last_seen DESC ";
      break;

  case 'purchased':
      $sql = "SELECT * FROM users WHERE orders > 0 ORDER BY orders DESC ";
      break;

  case 'points':
      $sql = "SELECT * FROM users ORDER BY points DESC ";
      break;

  case 'visits':
      $sql = "SELECT * FROM users ORDER BY visits DESC ";
      break;

  default:
      $sql = "SELECT * FROM users ORDER BY last_seen DESC ";
      break;

}

$sql .= "LIMIT $offset, {$per['listings']}";

fetch_elements($sql, 'admin/elements/users/main.php', 'x'); ?>