Location: PHPKode > scripts > Create Your Own Directory > cms/functions/detailcnt.php
<html>
<?php

  include "../header.php";
?>
<?php 
	$id1=$_GET['id'];
    $ref=$_SERVER[HTTP_REFERER];

?>
<?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);
    while($row1 = @mysql_fetch_array($res,MYSQL_ASSOC))
    {
      $cvid=$row1['cvid'];
    }
 if(!($domain))
    {
    $str1="insert into referral values('',1,sysdate(),'$username','$rip',$id1)";
    $result1 = mysql_query($str1);

    }
  if(!($cvid))
  {
    $str1="insert into views values('',sysdate(),'$username','$rip',$id1,'$url')";
    $result1 = mysql_query($str1);
    $str2="update cnt set view=view+1 where cntid=$id1";
    $result2 = mysql_query($str2);
   
  }
  $str="select cntid,contents,rateval,UserId,tid,rid,dat,coalesce(ratcnt,0) as ratcnt, 
  adddate,upddate,rateval from cnt left join (SELECT rid, sum(rateval) as rateval,dat,count(rateval) as ratcnt  from rating group by rid) A ON (cnt.cntid = A.rid)  left join (select crid,sum(referral)  as
  referral from referral 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=$id1 and status like 'REV' ";
  //echo"$str";
  $arr=array();
  $result = mysql_query($str);
  while($row = @mysql_fetch_array($result,MYSQL_ASSOC)){
	$cntid=$row['cntid'];
	$contents=$row['contents'];
	$tid=$row['tid'];
	$usrid=$row['UserId'];
	$ratid=$row['rid'];
	$rateval=$row['rateval'];
	$ratcnt=$row['ratcnt'];
	$adddate=$row['adddate'];
	$upddate=$row['upddate'];
	$rating=$row['rateval'];
	$view=$row['view'];
	$username=$row['UserName'];

$arr=split('####',$contents);
$i=0;
$st="select fname,contentpg from cntfields where catid=$tid";
$res=mysql_query($st);
while($rr= @mysql_fetch_array($res,MYSQL_ASSOC))
{
  $fname[$i]=$rr['fname'];
  $i++;
}
	echo"<title>$arr[0]</title>";
	echo"<table border=0  valign=top  width=85% cellpadding=0 cellspacing=0 align=center 
	style='border: 0px solid grey; background-color: #ffffff;'>
	  <tr>";

if($typ[18]=="updated"){
	    		echo"<td  background=".$home."includes/print.php?cnt=".$id[18]." width=".$uwidth[18]." height=".$uheight[18]." >$arr[0]</td>";
		}else{
	   		echo"<td background=".$home."image/img18.gif  width=".$width[18]." height=".$height[18]." >$arr[0]</td>";
      	}


		echo"	</tr>
	<tr><td >
		<table width=100% class=heading1 align=right border=0>
		<tr>
			<td valign=top align=left width=85%></td> 
			<td width=100 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"."functions/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"."functions/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 height=20><td colspan=3></td></tr>
	<tr></td></tr>
		<table border=0  valign=top  width=85% cellpadding=0 cellspacing=0 align=center >";
      	for($k=1;$k<count($fname);$k++)
		{
			echo"<tr><td>$fname[$k] </td><td>$arr[$k]  </td></tr>";
		}
      echo"</td></tr>
	<tr class=heading1 bgcolor=#dedede><td colspan=3><strong>Rating Details</strong></td></tr><tr><td colspan=3 >
		<table class=heading1 width=100% border=0 >
		<tr><td width=40%>
			<table class=heading1 border=0 bgcolor=#dedede width=250>
			<tr><td colspan=3 align=center> RATING DETAILS</tr></td><tr><td>";
            $sst="select title,cntid,tid,name from cnt,users where cnt.usrid=users.UserId and users.UserId=$usrid and cnt.cntid != $cntid and cnt.status like 'REV' limit 0,30";					
            $result3 = mysql_query($sst);
		$str1="select rateval as rating1,count(rateval) as ratingno,sum(rateval) as ratesum,(select count(rateval) from rating where rid=$cntid) as ratsum from rating where rid=$cntid group by rateval";
		$result1 = mysql_query($str1);
		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'];
			$ratesum=$row1['ratesum'];
		}
		$k=0;
		$avg=@(round(($rating/$ratcnt),2));
           		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 class=cathead 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 &nbsp;&nbsp;&nbsp;:&nbsp;<strong>$avg</strong> (out of 5)</div>
			<div>No of Rating &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<strong>$ratcnt</strong>  Votes </div>
				<div><table align=left class=heading1 width=200><tr><td>";
				
			
			$hm = "/home/freephpc/public_html/demo/cms/admin";
			$hm2 = "http://freephpcms.com/demo/cms/admin";
			include "$hm/addcode.php";
				echo "</div></td></tr></table></td></tr>
			<tr><td height=5></td></tr> ";
			
				echo"</table>";
	}
  ?>
  <?php
  include '../footer.php';
  ?>


Return current item: Create Your Own Directory