<?php
 class TarUsed2DB extends ADO { var $className = 'TarUsed2'; public function __construct( $app, $dburi, $debug=false, $tmode=true, $dformat='') { $this->owner = $app; if ( !empty($dburi)) $this->dburi = $dburi; return parent::__construct( $this->dburi, $debug, $tmode, $dformat); } public function get_records($lines_per_page, $page=0, $id='', $date='', $edate='') { $ext = " sk_users.gid='".$id."'"; $need_and = true; if ( $date != '' && $date != '1970-01-01') { if ( $need_and) $ext .= ' AND '; $ext .= sprintf(SQL_TARUSED_EXT1, $date); $need_and = true; } if ( $edate != '' && $edate != '1970-01-01') { if ( $need_and) $ext .= ' AND '; $ext .= sprintf(SQL_TARUSED_EXT2, $edate); $need_and = true; } $res = $this->GetAll("SELECT count(*) FROM sk_users WHERE ".$ext); $allRecs = $this->GetAll("SELECT * FROM (SELECT sk_users.uid, sk_users.username, sk_packets.packet, sk_users.deposit, sk_users.credit, sk_users.expired, sk_users.last_connection, time_show(sk_users.total_time::int8), sk_users.total_traffic, sk_users.total_money, sk_users.blocked, sk_users.gid FROM sk_packets, sk_users WHERE sk_users.gid=sk_packets.gid AND ".$ext.") AS sk_users ORDER BY sk_users.expired"); return array($res[0][0], $allRecs); } } ?>
