вопрос
Здравствуйте, пишу модуль, нужно вывести список забаненных построчно, с навигацией, не могу вывести данные через while, что не так?
// Выполняем нужный нам запрос в БД.
$row = $db->super_query("SELECT * FROM oh_bans WHERE id>=1 ORDER BY id DESC LIMIT 0,50");
while ($row = $db->get_row()) {
$row['server'] = strtotime($row['server']);
$row['name'] = strtotime($row['name']);
$row['ip'] = strtotime($row['ip']);
$row['date'] = strtotime($row['date']);
$row['gamename'] = strtotime($row['gamename']);
$row['admin'] = strtotime($row['admin']);
$row['reason'] = strtotime($row['reason']);
$row['expiredate'] = strtotime($row['expiredate']);
if( $row['name'] ) {
$tpl->set( '[name]', "" );
$tpl->set( '[/name]', "" );
$tpl->set( '{name}', stripslashes( $row['name'] ) );
$tpl->set_block( "'\\[not-name\\](.*?)\\[/not-name\\]'si", "" );
} else {
$tpl->set_block( "'\\[name\\](.*?)\\[/name\\]'si", "" );
$tpl->set( '{name}', "" );
$tpl->set( '[not-name]', "" );
$tpl->set( '[/not-name]', "" );
}
if( $row['ip'] ) {
$tpl->set( '[ip]', "" );
$tpl->set( '[/ip]', "" );
$tpl->set( '{ip}', stripslashes( $row['ip'] ) );
$tpl->set_block( "'\\[not-ip\\](.*?)\\[/not-ip\\]'si", "" );
} else {
$tpl->set_block( "'\\[ip\\](.*?)\\[/ip\\]'si", "" );
$tpl->set( '{ip}', "" );
$tpl->set( '[not-ip]', "" );
$tpl->set( '[/not-ip]', "" );
}
if( $row['ip_part'] ) {
$tpl->set( '[ip_part]', "" );
$tpl->set( '[/ip_part]', "" );
$tpl->set( '{ip_part}', stripslashes( $row['ip_part'] ) );
$tpl->set_block( "'\\[not-ip_part\\](.*?)\\[/not-ip_part\\]'si", "" );
} else {
$tpl->set_block( "'\\[ip_part\\](.*?)\\[/ip_part\\]'si", "" );
$tpl->set( '{ip_part}', "" );
$tpl->set( '[not-ip_part]', "" );
$tpl->set( '[/not-ip_part]', "" );
}
if( $row['country'] ) {
$tpl->set( '[country]', "" );
$tpl->set( '[/country]', "" );
$tpl->set( '{country}', stripslashes( $row['country'] ) );
$tpl->set_block( "'\\[not-country\\](.*?)\\[/not-country\\]'si", "" );
} else {
$tpl->set_block( "'\\[country\\](.*?)\\[/country\\]'si", "" );
$tpl->set( '{country}', "" );
$tpl->set( '[not-country]', "" );
$tpl->set( '[/not-country]', "" );
}
if( $row['date'] ) {
$tpl->set( '[date]', "" );
$tpl->set( '[/date]', "" );
$tpl->set( '{date}', stripslashes( $row['date'] ) );
$tpl->set_block( "'\\[not-date\\](.*?)\\[/not-date\\]'si", "" );
} else {
$tpl->set_block( "'\\[date\\](.*?)\\[/date\\]'si", "" );
$tpl->set( '{date}', "" );
$tpl->set( '[not-date]', "" );
$tpl->set( '[/not-date]', "" );
}
if( $row['gamename'] ) {
$tpl->set( '[gamename]', "" );
$tpl->set( '[/gamename]', "" );
$tpl->set( '{gamename}', stripslashes( $row['gamename'] ) );
$tpl->set_block( "'\\[not-gamename\\](.*?)\\[/not-gamename\\]'si", "" );
} else {
$tpl->set_block( "'\\[gamename\\](.*?)\\[/gamename\\]'si", "" );
$tpl->set( '{gamename}', "" );
$tpl->set( '[not-gamename]', "" );
$tpl->set( '[/not-gamename]', "" );
}
if( $row['admin'] ) {
$tpl->set( '[admin]', "" );
$tpl->set( '[/admin]', "" );
$tpl->set( '{admin}', stripslashes( $row['admin'] ) );
$tpl->set_block( "'\\[not-admin\\](.*?)\\[/not-admin\\]'si", "" );
} else {
$tpl->set_block( "'\\[admin\\](.*?)\\[/admin\\]'si", "" );
$tpl->set( '{admin}', "" );
$tpl->set( '[not-admin]', "" );
$tpl->set( '[/not-admin]', "" );
}
if( $row['reason'] ) {
$tpl->set( '[reason]', "" );
$tpl->set( '[/reason]', "" );
$tpl->set( '{reason}', stripslashes( $row['reason'] ) );
$tpl->set_block( "'\\[not-reason\\](.*?)\\[/not-reason\\]'si", "" );
} else {
$tpl->set_block( "'\\[reason\\](.*?)\\[/reason\\]'si", "" );
$tpl->set( '{reason}', "" );
$tpl->set( '[not-reason]', "" );
$tpl->set( '[/not-reason]', "" );
}
if( $row['gamecount'] ) {
$tpl->set( '[gamecount]', "" );
$tpl->set( '[/gamecount]', "" );
$tpl->set( '{gamecount}', stripslashes( $row['gamecount'] ) );
$tpl->set_block( "'\\[not-gamecount\\](.*?)\\[/not-gamecount\\]'si", "" );
} else {
$tpl->set_block( "'\\[gamecount\\](.*?)\\[/gamecount\\]'si", "" );
$tpl->set( '{gamecount}', "" );
$tpl->set( '[not-gamecount]', "" );
$tpl->set( '[/not-gamecount]', "" );
}
if( $row['expiredate'] ) {
$tpl->set( '[expiredate]', "" );
$tpl->set( '[/expiredate]', "" );
$tpl->set( '{expiredate}', stripslashes( $row['expiredate'] ) );
$tpl->set_block( "'\\[not-expiredate\\](.*?)\\[/not-expiredate\\]'si", "" );
} else {
$tpl->set_block( "'\\[expiredate\\](.*?)\\[/expiredate\\]'si", "" );
$tpl->set( '{expiredate}', "" );
$tpl->set( '[not-expiredate]', "" );
$tpl->set( '[/not-expiredate]', "" );
}
if( $row['warn'] ) {
$tpl->set( '[warn]', "" );
$tpl->set( '[/warn]', "" );
$tpl->set( '{warn}', stripslashes( $row['warn'] ) );
$tpl->set_block( "'\\[not-warn\\](.*?)\\[/not-warn\\]'si", "" );
} else {
$tpl->set_block( "'\\[warn\\](.*?)\\[/warn\\]'si", "" );
$tpl->set( '{warn}', "" );
$tpl->set( '[not-warn]', "" );
$tpl->set( '[/not-warn]', "" );
}
// Компилим шаблон
$tpl->compile('w3Module');
}
// Записываем
$w3Module = $tpl->result['w3Module'];