Location: PHPKode > scripts > Create Your Own Directory > cms/admin/addrating.php
<?php
include "../auth/config.php";
$rateval = $_POST['rating'];
$url = $_POST['url'];
$ipadd = $_POST['ip'];
$dat = date('y-m-d');
$rid=$_POST['rid'];
//echo "Rating : $rateval,$url,$ipadd";
$link = mysql_connect($hostname, $username,$password);
if($link)
{	
	$dbcon = mysql_select_db($dbname,$link);
}
$res  = mysql_query("select url from rating where ip='$ipadd' && url='$url'");
$dd = mysql_fetch_array($res,MYSQL_BOTH);
$val = $dd[0];
echo "<table align=center width=60% cellspacing=0 cellpadding=0 class=rst><tr><td>";
if(!$val)
{
	echo"You rating has been accepted and added into the database.<br>Thanks for participating.";
	$result = mysql_query("insert into rating values(NULL,'$ipadd','$url','$dat','$rateval',$rid)",$link);
}
else
{
	echo "Your Rating for this page is already present in the database. Thanks for your effort.";
}
echo "<br><br><a class=rst1 href=\"$url\">Go Back</a></td></tr></table>";


/*if($result)
	echo "Insered";
else
	echo "not added";*/

?>
Return current item: Create Your Own Directory