Location: PHPKode > scripts > Create Your Own Directory > cms/admin/addcode.php
<br>
<script language=javascript>
	var name = new Array();
	name[0]= "<?php echo($hm2);?>/images/star2.gif";
	if(document.images)
	{
		var ss = new Image();
		ss.src = name[0];		
	}			
</script>
<?php
$rateval1=0;
$start = $_GET['begin'];
$user=$_GET['user'];
$url=$_GET['ur'];
if($start == "")
	$start = 0;
if($user!="getrate")
{
$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";
}
$url= $ser.$url;
}
if(strpos($url,"?begin=")){
	$url = substr($url,0,strpos($url,"?begin="));
}else if(strpos($url,"&begin=")){
	$url = substr($url,0,strpos($url,"&begin="));
}
//include "$hm/auth/config.php";
//$link = mysql_connect($hostname, $username,$password);
//if($link)
//{
//	$dbcon = mysql_select_db($dbname,$link);
//}

//averaging rating 

$quer1 = "select sum(rateval)as rateval1 from rating where url like '$url'";
$quer = @mysql_query($quer1);
while($line1= mysql_fetch_array($quer, MYSQL_ASSOC))
{   
	$rateval1 = $line1['rateval1'];
     // $rateval = $rateval + $val;
	
}
$qur1 = "select count(*) as dd from rating where url='$url'";

$result1 = mysql_query($qur1);
if($line = @mysql_fetch_array($result1, MYSQL_ASSOC))
{
	$count = $line['dd'];
}
if($count!=0)
	$rateval =@round(($rateval1 / $count),1);
$qur = "select * from colors";
$result = mysql_query($qur);
if($line = @mysql_fetch_array($result, MYSQL_ASSOC))
{
	$border = $line['border'];
	$bmessage = $line['bmessage'];
	$bgcolor = $line['bgcolor'];
	$messagebg = $line['messagebg'];
	$message = $line['message'];
	$infobg = $line['infobg'];
	$info = $line['info'];
	$others = $line['others'];
}
if($border == "")
	$border= "green";
if($bmessage== "")
	$bmessage = "white";
if($bgcolor== "")
	$bgcolor = "#ccffcc";
if($messagebg== "")
	$messagebg = "#dddddd";
if($message == "")
	$message = "#333333";
if($infobg == "")
	$infobg = "#ddffee";
if($info == "")
	$info = "#0000dd";
if($others == "")
	$others = "#343434";

?>

<table width=220 cellpadding=0 cellspacing=0 border=0 class=tab>
<tr align=center><td class=heading1>
<form name=rate method=post action="<?php echo($hm2); ?>/addrating.php">
<b>Current Rating: </b>
	<?php
 for($i=1;$i<=5;$i++)
	{
		if($rateval>=1)
		{
			echo "<img src=\"$hm2/images/star2.gif\">";
			$rateval=$rateval-1;
		}
		else if($rateval>=0.5)
		{
			echo "<img src=\"$hm2/images/star3.gif\">";
			$rateval=$rateval-1;
		}
		else
		{
		echo "<img src=\"$hm2/images/star1.gif\">";
		}
	}	
	?>
</td></tr>
<style>
.star{cursor:pointer; }

</style>
<Script language=javascript>
function selstar(val)
{
	for(var x=1;x<=val;x++)
	{
		document['i'+x].src="<?php echo "$hm2";?>/images/star2.gif";
	}
	
}
function remstar(val)
{
	for(var x=1;x<=val;x++)
	{
		document['i'+x].src="<?php echo "$hm2";?>/images/star1.gif";
	}
}

function setrate(val)
{
	document.rate.rating.value=val;
	document.rate.submit();
}
</script>

<tr><td align=left class=heading1 >
<b>Rate this Page :</b> 
<img name=i1 class=star onmouseover="selstar(1)" onmouseout="remstar(1)" onclick="setrate(1)" src="<?php echo "$hm2";?>/images/star1.gif">
<img name=i2 class=star onmouseover="selstar(2)" onmouseout="remstar(2)" onclick="setrate(2)" src="<?php echo "$hm2";?>/images/star1.gif">
<img name=i3 class=star onmouseover="selstar(3)" onmouseout="remstar(3)" onclick="setrate(3)" src="<?php echo "$hm2";?>/images/star1.gif">
<img name=i4 class=star onmouseover="selstar(4)" onmouseout="remstar(4)" onclick="setrate(4)" src="<?php echo "$hm2";?>/images/star1.gif">
<img name=i5 class=star onmouseover="selstar(5)" onmouseout="remstar(5)" onclick="setrate(5)" src="<?php echo "$hm2";?>/images/star1.gif"><br><br>

<input type=hidden name="rating">
<input type=hidden value=<?php echo "$url"; ?> name=url>
<input type=hidden value=<?php echo "$rip"; ?> name=ip>
<input type=hidden value=<?php echo "$cntid"; ?> name=rid>

</form>
</td></tr></table>
</td></tr></table></td></tr>
	<tr width=100% bgcolor=#dedede align=left>
	<td class=heading1 colspan=3 height=20><strong>User Comments :</strong>&nbsp;
	<a onClick="return show()" href="<?php echo "$PHP_SELF"; ?>?begin=0" style="font-family:aerial;font-size:15px; color:#bb1515;text-decoration:none;">View/Add Comments</a></td></tr><tr><td height=10></td></tr></table>

<?php
echo "<table id=\"comment\" name=\"comment\" width=100% cellpadding=0 cellspacing=0 border=0 class=tab1>";
echo "<tr><td align=center style=\"background-color: $border; color: $bmessage;\"> User Comments/Feedback</td></tr>";

echo "<tr width=100%>";
echo "<td align=center style=\"background-color: $bgcolor; color: $others;\">";

echo "<br><table width=95% cellpadding=0 cellspacing=0>";

$qur1 = "select count(*) as dd from comments where url like '$url' and status like 'yes'";
$result1 = mysql_query($qur1);
if($line = @mysql_fetch_array($result1, MYSQL_ASSOC))
{
	$count = $line['dd'];
}

$qur = "select * from comments where url like '$url' and status like 'yes' order by dat desc limit $start,10";
$result = mysql_query($qur);
$sc = $start;

echo "<tr><td style=\"color:000000; font-size: 14px;\" align=center bgcolor=#ffaafa> ";
if($count == 0){	
}else{
	$pre = $start-10;
	$nex = $start+10;
	
	if($start > 9 && $count > ($start-10))
		echo "--- <a href=\"?begin=$pre&cntid=$cntid&tid=$tid&sub=yes\">Prev</a> ----";
	if($count > $nex)
		echo "---- <a href=\"?begin=$nex&cntid=$cntid&tid=$tid&sub=yes&url=$url\">Next</a> ---";
	}
echo "</td></tr>";
echo" <tr><td>
<div class=rev>";
echo"<table width=700>";
while($line = @mysql_fetch_array($result, MYSQL_ASSOC))
{
	$name = $line['name'];
	$email = $line['email'];
	$date = $line['dat'];
	$review = $line['review'];
	$email = substr($email,0,strpos($email,"@"))."........";

	$sc = $sc+1;
	echo "<tr style=\"background-color: $messagebg;\">
		<td><div style=\"font-size: 13px; color: $message; font-family: arial, verdana, san-serif; 
		padding: 5px;\">$sc) $review</div></td></tr><tr align=center><td>
		<table align=center cellpadding=0 cellspacing=0 width=100%>
		<tr style=\"font-size: 12px; color: $info; font-family: arial, verdana, san-serif; padding: 2px; 
	background-color: $infobg;\" align=center>
		<td>Name: $name</td><td>Mail: $email</td><td>Added: $date</td>
		</tr></table></div>
		</td></tr><tr><td> <br> </td></tr>";
		
}
echo"</tr></td></table></div>";

echo "<tr><td class=mess> ";
if($count == 0){
	echo "No  messages";
}else{
	$pre = $start-10;
	$nex = $start+10;
	
	if($start > 9 && $count > ($start-10))
		echo "--- <a href=\"?begin=$pre\">Prev</a> ----";
	if($count > $nex)
		echo "---- <a href=\"?begin=$nex&cntid=$cntid&tid=$tid&sub=yes\">Next</a> ---";
	}
echo "</td></tr>";
echo "</table>";

?>

<script language=javascript>
	document.onload = load();
	function  show()
	{
		var cc = document.getElementById("comment");
		cc.style.display = 'block';
		return false;
	}
	function load()
	{
		var xx=<?php if($start==""){echo "-1";}else{echo "$start";} ?>;
		var cc = document.getElementById("comment");
		if(xx==-1)
		{
			cc.style.display = 'none';
		}
		else
		{
			cc.style.display = 'block';
		}
		
	}
</script>
<br>
<font color=green>Add NEW Feebdack:</font>
<form name=xx action="<?php echo($hm2); ?>/addcomment.php" method=post style="color: <?php echo($others); ?>;">
<textarea name=com rows=4 cols=50></textarea><br>
Name : <input type=text name=nam> &nbsp; &nbsp;
Email: <input type=text name=email size=25>
<input type=hidden value="<?php echo($url) ?>" name=url>
<input type=submit value=add>
</form><br>

Return current item: Create Your Own Directory