Not sure why I'm getting the Parse error: parse error, unexpected '}' message. All my { are closed. Am I missing something?
<?php
require_once ('../files/config.inc');
$did=($_GET['did']);
$dname=($_GET['dname']);
$q1=($_POST['qset1']);
$q2=($_POST['qset2']);
$q3=($_POST['qset3']);
$q4=($_POST['qset4']);
$q5=($_POST['qset5']);
$q6=($_POST['qset6']);
$q7=($_POST['qset7']);
$q8=($_POST['qset8']);
$q9=($_POST['qset9']);
$q10=($_POST['qset10']);
$q11=($_POST['qset11']);
if (isset($_POST['submit'])) {
require_once ('../mysql_connect.php');
if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{ 2,4} $",
stripslashes(trim($_POST['email'])))) {
$e = escape_data($_POST['email']);
} else {
$e = FALSE;
echo '<p><font color="red" size="+1">Please enter a valid email address</font></p>';
}
if (eregi ("^[[:alnum:]_]{ 4,20} $", stripslashes(trim($_POST['username'])))) {
$u = escape_data($_POST['username']);
} else {
$u = FALSE;
echo '<p><font color="red" size="+1">Please enter a valid username</font></p>';
}
if (eregi ("^[[:alnum:]_]{ 4,2000} $", stripslashes(trim($_POST['comments'])))) {
$cm = escape_data($_POST['comments']);
} else {
$cm = FALSE;
echo '<p><font color="red" size="+1">You have not entered any comments</font></p>';
}
if (getenv(HTTP_X_FORWARDED_FOR)) {
$ip = getenv('HTTP_X_FORWARD_FOR');
$h = gethostbyaddr($ip);
} else {
$ip = getenv('REMOTE_ADDR');
$h = gethostbyaddr($ip);
}
if ($e && $u && $cm && $ip && $h) {
$query = "SELECT username FROM tablename WHERE username='$u'";
$result = @mysql_query ($query);
if (mysql_num_rows($result) == 0) {
$query = "INSERT INTO ratings (doc_id, username, email, host, ipaddress, comments, qset1, qset2, qset3, qset4,
qset5, qset6, qset7, qset8, qset9, qset10, qset11, revdate) VALUES ('$did', '$u', '$e', '$h', '$ip',
'$cm', '$q1', '$q2', '$q3', '$q4', '$q5', '$q6', '$q7', '$q8', '$q9', '$q10', '$q11', NOW())";
$result = @mysql_query ($query);
if ($result) {
$body = "Thank you for '{ $_GET['dname']} '. ";
mail ($_POST['email'], 'Thanks',$body, 'From: [email]admin@12345.com[/email]');
echo '<p> thanks</p>';
} else {
echo '<p>Please go back and try again.</p>';
}
} else {
echo '<p><font color="red">error.</font></p>';
}
} else {
echo '<p>Please go back and try again.</p>';
}
mysql_close();
}
?>