require_once("conn.php");
if(isset($_POST[s1]))
{
require_once("access.php");
$q1 = "insert into domain_vote set
domainid = '$_POST[DomainID]',
vote = '$_POST[rate]',
voterid = '$_SESSION[MemberID]' ";
mysql_query($q1) or die(mysql_error());
}
require_once("templates/header.php");
//get the domain information
$q1 = "select * from domain_domains, domain_categories where domain_domains.domainid = '$_GET[id]' and domain_domains.categoryid = domain_categories.categoryid ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
//get the rating
$q2 = "select sum(vote)/count(voterid) as AvaragePrice, count(voterid) as other from domain_vote where domainid = '$_GET[id]' ";
$r2 = mysql_query($q2) or die(mysql_error());
$a2 = mysql_fetch_array($r2);
$Price = number_format($a2[AvaragePrice], 2, ".", "");
$votes = $a2[other];
$DomainName = $a1[domainname];
$DomainID = $a1[domainid];
$DomainCategory = $a1[categoryname];
$DomainDescription = nl2br($a1[DomainDesc]);
$CategoryLink = "$a1[categoryname]";
if($a1[offers] == 'y')
{
$contact = "Click here to make an offer!";
}
//create the select menu
$qs = "select * from domain_prices order by PriceValue";
$rs = mysql_query($qs) or die(mysql_error());
$SelectMenu = "";
//check the votes
$qr = "select count(*) from domain_vote where voterid = '$_SESSION[MemberID]' and domainid = '$a1[domainid]' ";
$rr = mysql_query($qr) or die(mysql_error());
$ar = mysql_fetch_array($rr);
$q10 = "select * from domain_domains where memberid = '$_SESSION[MemberID]' and domainid = '$a1[domainid]' ";
$r10 = mysql_query($q10) or die(mysql_error());
$a10 = mysql_num_rows($r10);
if($ar[0] == '0' && $a10 == '0')
{
$Form1 = file("templates/RateForm.php");
$RateForm = implode(" ", $Form1);
$RateForm = str_replace("Select_Menu", $SelectMenu, $RateForm);
$RateForm = str_replace("Domain_Name", $a1[domainname], $RateForm);
$RateForm = str_replace("Domain_ID", $a1[domainid], $RateForm);
}
require_once("templates/InfoTemplate.php");
require_once("templates/footer.php");
?>