Jump to content
xisto Community
electriic ink

Unexpected "$" Sign On Last Line Of File even if i change the line nos its there

Recommended Posts

I am trying to create a file which send mail after a user has filled in the appropiate fields in a form. It checks to see whether the required fields are full, writes some mail headers and sends it.

 

When I check to see if the code works, I get this error:

 

Parse error: parse error, unexpected $ in /home/cmatcme/public_html/affliates.cmat on line 203

 

The funny thing is that regardelss of how long I make the file, the file always appear on the final line, whether I leave it blank or just put ?>. I understand that these errors can sometimes be caused by other lines in the file so I post all of the code:

 

<?if(!$_REQUEST["task"] == "checkaffvalid") {$title = "Affliates :: Please Fill Out The Form";include "header.php";?><h3> Affliates </h3> If you wish to become an affliate all you have  to do is fill out this simple form. Any incorrect information given will mean that your link will be removed: <br> <br> <form action="affliates.cmat?task=checkaffvalid" method="post"><font size="2"> What's your site's name? <br> <input type="text" name="name"> <br> <br>What's the url to your site? <br><input type="text" name="url" value="http://" title="You can enter a referal link if you wish"> <br> <br>What's your email address? <br><input type="text" name="email"><br><input type="checkbox" name="nosend" value="1">   <font color="red"> I <b>do not</b> wish to be sent emails regarding my affliate status <b>except</b> for my request accepted or my request rejected email.</font> <br> <br><input type="hidden" name="ip" value="<? echo $_SERVER["REMOTE_ADDR"] ?>" readonly> At how many pages* can my link on your site be found: <br><select name="mylink"><option value="none">-----<option value="1"> One<option value="2"> Two<option value="3"> Three<option value="4"> Four<option value="5"> Five<option value="6"> Over Five<option value="all"> All</select> <br> <br>What is the url to your button? If you don't have a button, what text would you like be to display on my site as a link?<br><input type="text" name="button"> <br> <br><b>Please complete this easy English test:</b> <br> <br>All you have to is fill in the word in this boxes which makes sense: <br> <br><select name="enga"><option value="none>-----<option value="I"> I sat<option value="Me"> Me sits<option value="They"> They sats<option value="We"> We satted</select>  down on a   <select name="engb"><option value="none"> -----<option value="dog"> dog<option value="touch"> touch<option value="chair"> chair<option value="person"> person<option value="think"> think<option value="satter"> satter</select><br> <br> <br>Unlike most affliates dealers we will not force you to put our button on your site until we have checked, reviewed and put your button on our site.<br> <br><input value="Send Request" type="submit" onClick="this.value='Pending Request';" title="By clicking here you certify all the information here is correct."></font></form> <br>* A "page" is a internal webpage which must be linked from your hompage. <?include "footer.php";} else  {      $name = $_REQUEST["name"];      $url = $_REQUEST["url"];      $email = $_REQUEST["email"];      $nosend = $_REQUEST["nosend"];      $ip = $_REQUEST["ip"];      $mylink = $_REQUEST["mylink"];      $enga = $_REQUEST["enga"];      $engb = $_REQUEST["engb"]; $title = "Affliates :: Pending...."; include "header.php"; $errortxtnofill = "Please fill out these fields: <br> <br>"; if (!$_REQUEST["name"]) { $emptyfield = $emptyfield . "-- Your site's name <br>";  } if (!$_REQUEST["url"]) {  $emptyfield = $emptyfield . "-- Your site's url <br>"; } if (!$_REQUEST["email"]) {  $emptyfield = $emptyfield .  "-- Your email address so we can send you details on your affliate account status <font color=\"red\">This will only be used to send you details regarding your account, never anything else. </font> <br>"; } if (!$_REQUEST["ip"]) {?><script> window.alert("The scripts could not retrieve your ip address. \\n\\nGo back and allow them to."); window.location = "/task.cmat?task=affliates"; </script><?exit; } if ($_REQUEST["mylink"] == "none") {  $emptyfield = $emptyfield . "-- Tell me at how many pages my link can be found. <br>"; } if ($_REQUEST["enga"] == "none") {   $emptyfield = $emptyfield . "-- Please complete the first part of the English test. <br>"; } if ($_REQUEST["engb"] == "none") {   $emptyfield = $emptyfield . "-- Please complete the second part of the English test. <br>"; } if ($emptyfield) {  echo $errortxtnofill . $emptyfield; } else { $en = 0; if ($_REQUEST["enga"] == "I") {  $en = $en + 50; } if ($_REQUEST["engb"] == "chair") {  $en = $en + 50; } if ($_REQUEST["nosend"] == "1") {  $nosend = ", only send the (dis)approval email to this user."; }  echo "Request accepted... <br> <br>           Sending request... <br> <br>";  $mh = "MIME-Version: 1.0 \r\n"; $mh = $mh . "Content-type: text/html; charset=iso-8859-1 \r\n"; $mh = $mh . "To: CMATCME Site Owner <----@cmatcme.trap17.com> \r\n"; $mh = $mh . "From: Site User <" . $email . "> \r\n";  $to = "dontbothersp@mmingmyemailaddress.freeserve.co.uk"; $from = $email; $sub = "New affliate request <$url>"; $msg = "<font color='grey' size='1'> <i>$ip</i></font> <br> <br>The owner of the site $name has asked for his/her site ( $url ) to be added to your affliate section.  This is what he/she wants displayed <br> <br><a href='$url'><img src='$button'  alt='$name'></a><br> <br> He/she scored $en in the english test and will place your button on $mylink page(s) on his/her site. <br> <br> The user's email address is " . $email . $nosend;mail($to , $sub, $msg, $mh); echo "Mail Sent: <br> <br> <b>Subject:</b> $sub <br> <b>Message</b><br><br> $msg"; include "footer.php";?>

Thanks to all who attempt to help.

Share this post


Link to post
Share on other sites

I think I have found the problem, on line 154 you open an else, but never close the curly braces:

echo $errortxtnofill . $emptyfield;} else {     <--- THIS LINE$en = 0;

I am not exactly sure where the closing } should go as I haven't read your entire script, but I am sure you can fix it.

Share this post


Link to post
Share on other sites

Bingo! While fixing that error I also found that I didn't close and else right at the end of the document. Both triggered the error.Thanks for your help. It is much appreciated :D

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.