<html>
<?php
include "../login/A-header.php";
include "../login/authheader.php";
if($block != true)
{
?>
<?php
$cntid=$_GET['cntid'];
$usrid=$_GET['usrid'];
$sub=$_GET['sub'];
$url=$_SERVER['REQUEST_URI'];
$urll =$url;
if($sno=="")
$sno=0;
$start = $_GET['start'];
if($start == "")
$start = 0;
if($sub=='yes')
{
$id=" ";
$qry="select * from favourite where favid=$cntid and usrid=$usrid";
//echo"$qry";
$res=mysql_query($qry);
while($row = @mysql_fetch_array($res,MYSQL_ASSOC)){
$id=$row['id'];
}
if($id==" ")
{
$query="insert into favourite values('',sysdate(),$cntid,$usrid)";
//echo"$query";
$result=mysql_query($query);
echo"<div align=center> your favourite has been added into your database <br></div>";
}else
{
echo"<div align=center> your favourite has already added into your database <br></div>";
}
}
if($sub=="list")
{
$str="select cntid,contents,UserName,UserId,tid,dat,rid,adddate,coalesce(rateval,0)as rateval,
coalesce(referral,0)as referral, coalesce(view,0) as view
from cnt left join (SELECT rid, sum(rateval) as rateval,dat from rating where ( DATEDIFF(CURDATE(),dat)) < 30 group by rid) A ON (cnt.cntid = A.rid) left join (select crid,sum(referral) as
referral,refdate from referral where (DATEDIFF(CURDATE(), refdate) ) < 30 group by crid) C on (cnt.cntid=C.crid) left join (select UserName,UserId from user )D on (cnt.usrid=D.UserId)
where cnt.cntid in (select favid from favourite where usrid=$usrid) limit $start,5 ";
//echo"$str";
$result = mysql_query($str);
$sno = $sno+$start;
while($row = @mysql_fetch_array($result,MYSQL_ASSOC))
{
$contents=$row['contents'];
$arr=split('####',$contents);
$cntid=$row['cntid'];
$tid=$row['tid'];
$usrid=$row['UserId'];
$ratid=$row['rid'];
$adddate=$row['adddate'];
$rateval=$row['rateval'];
$view=$row['view'];
$name=$row['UserName'];
$y="<table border=0 align=center width=90% cellpadding=0 cellspacing=0 align=center style='border: 1px solid lightblue; background-color: #ffffff;'>";
if($typ[18]=="updated"){
$y=$y."<tr width=100%><td width=16% align=left background=".$home."includes/print.php?cnt=".$id[18]." width=".$width[18]." height=".$height[18]." border=0 > <a href='$arr[0]-$cntid.html' class=cathead>$arr[0]</a></td><td width=16% align=right background=".$home."includes/print.php?cnt=".$id[18]." width=".$width[18]." height=".$height[18]." border=0 >Views: $view</span></td></tr>";
}else{
$y=$y."<tr ><td width=16% align=left background=".$home."image/img18.gif width=".$width[18]." height=".$height[18]." border=0 width=16%> <a href='$arr[0]-$cntid.html' class=cathead>$arr[0]</a></td><td width=16% align=right background=".$home."image/img18.gif width=".$width[18]." height=".$height[18]." border=0 width=16%>Views: $view</span></td></tr>";
}
$i=0;
$st="select fname,contentpg from cntfields where catid=$tid";
$res=mysql_query($st);
//echo"$st";
while($rr= @mysql_fetch_array($res,MYSQL_ASSOC))
{
$fname[$i]=$rr['fname'];
$contentpg[$i]=$rr['contentpg'];
$i++;
}
for($j=1;$j<count($arr);$j++)
{
if($contentpg[$j]==1)
{
$tmp=$tmp."<tr><td ><div style='padding: 5px 15px;' align=left >$fname[$j]</div></td><td colspan=2><div style='padding: 5px 15px;' align=left >$arr[$j]</div></td></tr>";
}
}
$pr=$pr.$y.$tmp."<tr bgcolor=#eeeeee><td style=\"padding: 5px 15px; \" >Date: $adddate </td><td><div align=right style=\"padding-right:20px;\"> Added by:$name</div></tr></table><br>";
$sno = $sno+1;
$y="";
$tmp="";
}
?>
<td></tr><tr><td style="font-size: 14px; padding: 10px;" valign=top align=right>
<?php
$start1=$start+5;
$start2=$start-5;
$url1=$urll."&"."start=".$start1;
$url2=$urll."&"."start=".$start2;
echo"<div align=right style='margin-right:10px;'>";
if($sno > 5)
{
if($typ[21]=="updated")
{
$str1="<a href=\"$url2\" style='text-decoration:none'><image style='border:0;' SRC=".$home."includes/print.php?cnt=".$id[21]."></a>";
}else{
$str1="<a href=\"$url2\" style='text-decoration:none'><image style='border:0;' SRC=".$home."image/img21.gif></a>";
}
echo"$str1";
}
echo" ";
if($sno == ($start+5)){
if($typ[20]=="updated")
{
$str2="<a href=\"$url1\" style='text-decoration:none'><image style='border:0;' SRC=".$home."includes/print.php?cnt=".$id[20]."></a>";
}else{
$str2="<a href=\"$url1\" style='text-decoration:none'><image style='border:0;' SRC=".$home."image/img20.gif></a>";
}
echo"$str2";
}
echo"</div><br>";
echo"$pr";
if($sno > 5)
{
echo"$str1";
}
echo" ";
if($sno == ($start+5)){
echo"$str2";
}
echo"</div>";
}
?>
<?php
include '../login/A-footer.php';
}
?>