<?php
session_start();
include("include/config.php");
include("include/function.php");
if($_REQUEST['UID']=="")$err="{$language[541]}";
if($err=="")
{
if($_REQUEST['type']!="private") $_REQUEST['type']="public";
$uuu = $_REQUEST['UID'];
$ttt = $_REQUEST['type'];
if($page=="")
$page = 1;
$sql = "SELECT count(*) as total from media WHERE media_type = 'video' and active = '+' AND UID=$uuu and type='$ttt' limit $config[total_per_ini]";
$ars = $conn->Execute($sql);
if($ars->fields['total']<=$config['total_per_ini'])$total = $ars->fields['total'];
else $total = $config[total_per_ini];
$tpage = ceil($total/$config['items_per_page']);
if($tpage==0) $spage=$tpage+1;
else $spage = $tpage;
$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]";
$rs=$conn->execute($sql);
if($rs->recordcount()>0)$vdo = $rs->getrows();
$start_num=$startfrom+1;
$end_num=$startfrom+$rs->recordcount();
$page_link="";
for($k=1;$k<=$tpage;$k++) {if ($k==$page)$page_link.="<a style='text-decoration:none' href='uvideos.php?UID=$_REQUEST[UID]&page=$k&type=$_REQUEST[type]'>[<b>$k</b>]</a> "; else $page_link.="<a style='text-decoration:none'href='uvideos.php?UID=$_REQUEST[UID]&page=$k&type=$_REQUEST[type]'>$k</a> ";}
}
STemplate::assign('err',$err);
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);
$kwords=my_tags($_REQUEST['UID']);
STemplate::assign('vtags',$kwords);
STemplate::assign('head_bottom',"viewuserlinks.tpl");
STemplate::display('head1.tpl');
STemplate::display('err_msg.tpl');
STemplate::display('uvideos.tpl');
STemplate::display('footer.tpl');
?>