}
 if (isset($p_picture) && isset($p_picture['name']) && $p_picture['name'] != '') {
     list($postedon_year, $postedon_month, $postedon_day) = explode('-', $today);
     $picture_path = "{$upload_path}/{$postedon_year}/{$postedon_month}/{$postedon_day}/picture";
     $thumb_path = "{$upload_path}/{$postedon_year}/{$postedon_month}/{$postedon_day}/thumb";
     include "./admin/include/picture-upload.php";
 } else {
     $p_picture = '';
 }
 if ($p_terms < 1) {
     $success = false;
     array_push($errors, "You should agree with the Terms and Conditions.");
 }
 if ($success) {
     $ipaddr = $_SERVER['REMOTE_ADDR'];
     if (UserBanned::exists(0, array(), "(email='{$p_email}' OR ipaddr='{$ipaddr}')")) {
         $last = 666666;
     } else {
         $postedon = date("Y-m-d H:i:s", time());
         $expiry = date("Y-m-d", time() + $p_expiry * 24 * 60 * 60);
         $code = md5(uniqid(rand(), true));
         if (User::is_logged_in()) {
             $p_name = User::get_name();
             $p_email = User::get_email();
         }
         $last = Ad::create(array('user_id' => User::get_id(), 'name' => $p_name, 'email' => $p_email, 'telephone' => $p_telephone, 'title' => $p_title, 'description' => $p_description, 'picture' => $p_picture, 'category' => $p_category, 'price' => $p_price, 'city' => $p_city, 'region' => $p_region, 'expiry' => $expiry, 'webpage' => $p_webpage, 'code' => $code, 'ipaddr' => $ipaddr, 'postedon' => $postedon, 'lastmodified' => $postedon));
         if (User::is_logged_in()) {
             Ad::activate($last);
         } else {
             if (!($user_exists = User::exists(0, array('email' => $p_email)))) {
                 $p_em = explode('@', $p_email);
    exit;
}
if (isset($_GET['d'])) {
    $d = (int) $_GET['d'];
    if ($d > 1) {
        UserBanned::delete($d);
    }
}
$tct = UserBanned::count();
//total count
$rpp = 10;
//row per page
$pager_options = array('mode' => 'Sliding', 'perPage' => $rpp, 'delta' => 2, 'totalItems' => $tct, 'excludeVars' => array('o', 'r', 'd', 't', 'e'));
$pager = @Pager::factory($pager_options);
list($from, $to) = $pager->getOffsetByPageId();
$users = UserBanned::get_all(array(), 'id>1', $from - 1 . ", {$rpp}");
include "page-header.php";
?>

<div id="wrapper">
	
	<?php 
include "page-left.php";
?>

	<div id="content">

		<?php 
if ($tct > $rpp) {
    echo $pager->links . '<br /><br />';
}
<?php

/**
 * Classified-ads-script
 * 
 * @copyright  Copyright (c) Szilard Szabo
 * @license    GPL v3
 * @package    Frontend
 */
include "./admin/include/common.php";
if (!User::is_logged_in() || User::get_id() != 1) {
    header('Location: index.php');
    exit;
}
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$exists = User::exists(0, array('id' => $id));
if ($exists) {
    $user = User::get_one($id);
    UserBanned::create($user, $id);
    Ad::delete(0, array('user_id' => $id));
    User::delete($id);
}
include "./templates/user-ban.php";