<html>
<?php
include "../login/A-header.php";
?>
<?php
$id1=$_GET['id'];
?>
<?php
$url = $_SERVER['SCRIPT_NAME'];
$host = $_SERVER['SERVER_NAME'];
$ser = "http://$host";
$url1 = $_SERVER['argv'];
$sss = count($url1);
$rip = $_SERVER['REMOTE_ADDR'];
if($sss >= 1)
{
$argas = $url1[0];
$url="$url?$argas";
}
$duplicate="";
$url= $ser.$url;
//echo"$url";
$qry="select * from views where vip='$rip' and vdate=sysdate() and url='$url'";
//echo"$qry";
$res=mysql_query($qry,$link);
while($row1 = @mysql_fetch_array($res,MYSQL_ASSOC)){
$cvid=$row1['cvid'];
}
if(!($cvid))
{
$str1="insert into views values('',sysdate(),'$username','$rip',$id1,'$url')";
$result1 = mysql_query($str1,$link);
$str2="update content set view=view+1 where cntid=$id1";
$result2 = mysql_query($str2,$link);
}
$str="select cntid,name,rateval,id as usrid,websitelink,dlink,platform,tid,rid,dat,description,coalesce(ratcnt,0) as ratcnt,
adddate,upddate,title,version,license,rateval from content left join (SELECT rid, sum(rateval) as rateval,dat,count(rateval) as ratcnt from rating where ( DATEDIFF(CURDATE(),dat)) < 30 group by rid) A ON (content.cntid = A.rid) left join (select crid,sum(referral) as
referral from referral where (DATEDIFF(CURDATE(), refdate) ) < 30 group by crid) C on (content.cntid=C.crid) left join (select name,id from hioxpm )D on (content.usrid=D.id)
where content.cntid=$id1";
//echo"$str";
$result = mysql_query($str,$link);
while($row = @mysql_fetch_array($result,MYSQL_ASSOC)){
$cntid=$row['cntid'];
$tid=$row['tid'];
$usrid=$row['usrid'];
$ratid=$row['rid'];
$rateval=$row['rateval'];
$ratcnt=$row['ratcnt'];
$description=$row['description'];
$platform=$row['platform'];
$adddate=$row['adddate'];
$upddate=$row['upddate'];
$title=$row['title'];
$version=$row['version'];
$license=$row['license'];
$rating=$row['rateval'];
$view=$row['view'];
$username=$row['username'];
$websitelink=$row['websitelink'];
$dlink=$row['dlink'];
echo "<table class=heading1 border=0 valign=top width=85%cellpadding=0 cellspacing=0 align=center
style='border: 0px solid grey; background-color: #ffffff;'>
<tr bgcolor=#84A258 class=cntbg>
<td class=heading1 colspan=2 >
<image src='$home"."image/page.gif'> <strong>$title</strong></image></td></tr><tr><td>
<table class=heading1 align=right border=0>
<tr><td valign=top width=82%><br><strong>Description:</strong><br>
<div align=center>$description<br></div></td>
<td align=right>
<table class=heading1 border=0><tr><td class=ww><a id=lin href='http://$dlink'>View</a></td></tr>
<tr><td class=ww><a id=lin href=$home"."refer.php?cntid=$cntid>Refer</a></td></tr>
<tr><td class=ww><a id=lin href=$home"."HRAS/users/favourite.php?cntid=$cntid&sub=yes&usrid=$usrid>Add as Favourite</a></td></tr>
<tr><td class=ww><a id=lin href=$home"."feedback.php?cntid=$cntid&sub=yes>Report Issue</a></td></tr>
<tr><td class=ww><a id=lin href=$home"."HRAS/users/edit.php?cntid=$cntid&sub=yes>Edit</a></td></tr>
</table>
</td></tr>
</table>
</td></tr>
<tr class=heading1 bgcolor=#dedede><td colspan=2><strong>Software Specification</strong></td></tr><tr><td>
<table class=heading1 width=100% border=0><tr><td width=25%> Platform</td><td>: $platform</td></tr>
<tr><td> AddDate</td><td>: $adddate</td></tr>
<tr><td> UpdatedDate</td><td>: $upddate</td></tr>
<tr><td> Version</td><td>: $version</td></tr>
<tr><td> Author</td><td>: $username</td></tr>
<tr><td> Website</td><td>: $websitelink</td></tr>
</table>
</td></tr>
<tr class=heading1 bgcolor=#dedede><td colspan=2><strong>License Information</strong></td></tr><tr><td>
<table class=heading1 width=100% border=0><tr><td width=25%> License Type</td><td>: $license</td></tr>
<tr><td> Rate</td><td>: $rateval</td></tr>
</table>
</td></tr>
<tr class=heading1 bgcolor=#dedede><td colspan=2><strong>Rating Details</strong></td></tr><tr><td>
<table class=heading1 width=100% border=0 >
<tr><td width=40%>
<table class=heading1 border=0 bgcolor=#dedede width=250>
<tr><td colspan=2 align=center> RATING DETAILS</tr></td><tr><td>";
$str1="select rateval as rating1,count(rateval) as ratingno,(select count(rateval) from rating where rid=$cntid) as ratsum from rating where rid=$cntid group by
rateval";
$result1 = mysql_query($str1,$link);
echo"<table border=0 align=center width=200 cellpadding=0 cellspacing=0 height=100px><tr>";
while($row1 = @mysql_fetch_array($result1,MYSQL_ASSOC)){
$ratingno[]=$row1['ratingno'];
$rating1[]=$row1['rating1'];
$ratsum[]=$row1['ratsum'];
}
$k=0;
$avg=@($rating/$ratcnt);
for($i=0;$i<5;$i++)
{
$j=$i+1;
$no[$i]=@(100/$ratsum[$i]);
$ht[$i]=($no[$i]*$ratingno[$i]);
$ht[$i]=round($ht[$i]);
echo "<td class=ww1>";
echo "<table align=center border=0 height=160 width=30>
<tr><td></td></tr>";
if($rating1[$k]==$j){
echo "<tr><td align=center height=20 style=\"font-size:10;\">($ht[$k])</td></tr><tr><td height=$ht[$k] px bgcolor=red></td></tr>";
$k=$k+1;
}else{
echo "<tr><td></td></tr>";
}
echo "<tr><td bgcolor=#9b9a9a align=center style=\"color:white;font-weight:bold;\" height=20px>$j</td></tr>";
echo "</table></td>";
}
echo"</tr></table></td></tr>
</table></td><td align=left valign=top width=30% valign=middle><br>
<div>Average Visitor Rating : <strong>$avg</strong> (out of 5)</div>
<div>No of Rating :<strong>$ratcnt</strong> Votes </div><br>
<div align=left><strong>Click here to get <a href=$home"."HRAS/users/getrating.php?ip=$rip&rid=$cntid>Rating code</a> to rate this content from your page</strong></div>";
echo"<tr><td height=15></td></tr>
<tr class=heading1 bgcolor=#dedede><td colspan=2><strong>Other Content added by this user</strong></td></tr><tr><td>
<table class=heading1 width=100% border=0>";
$str2="select title,cntid,tid,name from content,hioxpm where content.usrid=hioxpm.id and hioxpm.id=$usrid and content.cntid != $cntid";
$result2 = mysql_query($str2,$link);
while($row2 = @mysql_fetch_array($result2,MYSQL_ASSOC)){
$title=$row2['title'];
$title1 = str_replace(" ", "_", "$title");
$cntid=$row2['cntid'];
$tid=$row2['tid'];
echo"<tr><td><a href=\"$title1-$cntid.html \">$title </a></td><td>";
}
echo"</table></td></tr>
</table>";
}
?>
<?php
include "../login/A-footer.php";
?>