fpinger
Гуру форума
- Регистрация
- 11 Май 2007
- Сообщения
- 256
- Реакции
- 63
Я бы скрипт переписал так. И в указанных местах сделал бы замеры.
Код:
<?php
session_start();
include("include/config.php");
include("include/function.php");
$err = "";
if (!isset($_REQUEST['UID']) || empty($_REQUEST['UID'])) {
$err="{$language[541]}";
} else {
if($_REQUEST['type']!="private") $_REQUEST['type']="public";
if($page=="") $page = 1;
$uuu = $_REQUEST['UID'];
$ttt = $_REQUEST['type'];
$sql = "SELECT COUNT(*) AS total".
" FROM media".
" WHERE media_type = 'video'".
" AND active = '+'".
" AND UID = '{$uuu}'".
" AND type='{$ttt}'".
" LIMIT '{$config['total_per_ini']}'";
// Начало замера 1 ---------------------------------------
$ars = $conn->Execute($sql);
// Конец замера 1 ----------------------------------------
$total = $config['total_per_ini'];
if ($ars->fields['total'] <= $total) {
$total = $ars->fields['total'];
}
$tpage = ceil($total/$config['items_per_page']);
$spage = $tpage;
if(0 == $spage) {
$spage = $tpage + 1;
}
$startfrom = ($page-1) * $config['items_per_page'];
$sql="SELECT * FROM media".
" WHERE media_type = 'video'".
" AND active = '+'".
" AND UID='{$uuu}'".
" AND type='$ttt'".
" ORDER BY VID DESC".
" LIMIT '{$startfrom}', '{$config['items_per_page']}'";
// Начало замера 2 ---------------------------------------
$rs = $conn->Execute($sql);
// Конец замера 2 ----------------------------------------
if($rs->recordcount() > 0) {
$vdo = $rs->getrows();
}
$start_num = $startfrom + 1;
$end_num = $startfrom + $rs->recordcount();
$page_link = "";
for($k=1;$k <= $tpage; $k++) {
$page_link .= "<a style='text-decoration:none'".
" href='uvideos.php?UID={$_REQUEST['UID']}".
"&page={$k}&type={$_REQUEST['type']}'>";
if ($k == $page) {
$page_link .= "[<b>{$k}</b>]</a> ";
} else {
$page_link .= "{$k}</a> ";
}
}
// Начало замера 3 ---------------------------------------
$kwords = my_tags($_REQUEST['UID']);
// Конец замера 3 ----------------------------------------
}
STemplate::assign('head_bottom',"viewuserlinks.tpl");
STemplate::display('head1.tpl');
if (!empty($err)) {
STemplate::assign('err',$err);
STemplate::display('err_msg.tpl');
} else {
STemplate::assign('msg',$msg);
STemplate::assign('page',$page);
STemplate::assign('start_num',$start_num);
STemplate::assign('end_num',$end_num);
STemplate::assign('page_link',$page_link);
STemplate::assign('total',$total);
STemplate::assign('answers',$vdo);
STemplate::assign('vtags',$kwords);
// Начало замера 4 ---------------------------------------
STemplate::display('uvideos.tpl');
// Конец замера 4 ----------------------------------------
}
STemplate::display('footer.tpl');
?>