Файл: banners.php
Строк: 116
<?php
//error_reporting(2047|2048);
error_reporting(0);
include 'config.php';
class_exists('config') or die('Error load config class');
$config = new config(1, 1, 1);
$lang = $config->parse_lang() or die('Error parse lang file');
if(!$mysql = mysql_connect($config->mysql['host'], $config->mysql['user'], $config->mysql['pass'])){
$config->start('error', $lang['1014']);
if($config->vers == 'wml'){
print '<b>'.$lang['1014'].'! '.$lang['1010'].'</b><br/>';
}
else
if($config->vers == 'html'){
print '<font color="'.$config->color['error'].'">'.$lang['1014'].'! '.$lang['1010'].'</font><br/>';
}
print $lang['1015'].' MySQL: <u>'.mysql_error().'</u><br/>';
print '<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
$config->finish(true);
}
if(!mysql_select_db($config->mysql['db'], $mysql)){
$config->start('error', $lang['1014']);
if($config->vers == 'wml'){
print '<b>'.$lang['1014'].'! '.$lang['1011'].'</b><br/>';
}
else
if($config->vers == 'html'){
print '<font color="'.$config->color['error'].'">'.$lang['1014'].'! '.$lang['1011'].'</font><br/>';
}
print $lang['1015'].' MySQL: <u>'.mysql_error().'</u><br/>';
print '<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
mysql_close($mysql); $config->finish(true);
}
$config->start('banners', $lang['1007']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT COUNT(`id`) FROM `banners` WHERE `s1` > '0';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
$count = $q['0'];
if($count < 1) print '<u>'.$lang['1100'].'</u><br/><br/>';
else{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*5-5;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/5);
if($pages*5 < $count) $pages++;
$q = mysql_query("SELECT `id`, `s1`, `c1` FROM `banners` WHERE `s1` > '0' ORDER BY `c1` DESC LIMIT $limit, 5;", $mysql);
echo '<u>'.$lang['1099'].': <b>'.$count.'</b></u><br/><br/>';
$num = 1;
while($d = mysql_fetch_array($q)){
echo '<b>'.($limit+$num).'.</b>'.
' <img src="banner.php?id='.$d['id'].'" alt=""/><br/>'.
'CTR: '.round($d['c1']/$d['s1'], 3).' ('.$d['c1'].'/'.$d['s1'].')<br/><br/>';
$num++;
}
if($page > 1 || $page < $pages){
if($page > 1)
print '<a href="banners.php?l='.$config->lang.'&v='.$config->vers.'&p='.($page-1).'"><--</a> ';
if($page < $pages)
print '<a href="banners.php?l='.$config->lang.'&v='.$config->vers.'&p='.($page+1).'">--></a>';
print '<br/><br/>';
}
}
print '<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish();
?>