Jul 20, 2008

Unexpected "$" Sign On Last Line Of File - even if i change the line nos it's there

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Unexpected "$" Sign On Last Line Of File - even if i change the line nos it's there

electriic ink
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:

QUOTE(affliates.cmat)
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:

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"> &nbsp; <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> &nbsp;
down on a &nbsp; <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\\n
Go 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.

 

 

 


Reply

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

CODE

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.

Reply

electriic ink
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 smile.gif

Reply

snlildude87
Problem solved -> thread closed.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : unexpected file nos

  1. Php Configuration File - "config.php" (16)
    I did create this topic mainly because I want to know everything about that configuration file. I
    will post other replies if I want to know more depending on your experience. Is this code correct
    for that file: CODE <? $host="localhost"; $dbname="XXX";
    $dbuser="XXX"; $dbpass="XXX";
    $connection=mysql_connect($host, $dbuser, $dbpass) or
    die(mysql_error()); mysql_select_db($dbname) or
    die(mysql_error()); ?> Add your suggestions or i...
  2. Unexpected T_string In User.php [resolved] - (5)
  3. Getting List Of Directories And Files Using Php - PHP Function for Directory and File List (6)
    is there a php function that lists the content of some folder.... example: /New folder new.txt
    left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
    style='vertical-align:middle' alt='rolleyes.gif' /> ...
  4. Parse: Error Unexpected T_lnumber - php parse error when running script (4)
    Hi. I've just created a php script. The main object of the script is to delete some old files
    and replace it with a new file with some new content, effectively moving the contents from one file
    to another. These are the first 50 lines of the file: /* Calculate For The "A" Group - The
    Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) {
    $a_B++; } $new_page_contents = " " . $_POST . " " . $_POST . "
    include \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen(&...
  5. Include File.php?id=something - using the include() function (13)
    Well, I am making a full CMS system for my site, and want to make the index.php file to include the
    view.php?id=1 file. I tried with this code, but it didn't work: CODE <?php include
    'view.php?id=1' ?> This is the error I get: CODE Warning:
    main(view.php?id=1) [function.main]: failed to open stream: Invalid argument
    in C:\server\xampp\htdocs\test\index.php on line 1 Warning:
    main() [function.include]: Failed opening 'view.php?id=1' for inclusion
    (i...
  6. Script: Php Jukebox - A one file script! (4)
    This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder
    called 'songs' and put some audio files in it. Here is the whole page, I named it index.php
    and put it in a folder called 'music': CODE <!DOCTYPE HTML PUBLIC
    "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
    <title>PHP jukebox</title> </head> <body> <!-- ©2005 Craig
    lloyd. All rights reserved. Visit cragllo.com for more sc...
  7. Unexpected T_variable... - Help! (3)
    I did construct the database connection file which is called "config.php". But, I got some mistake
    that has to be solved to continue with working. This is the code itself: //Set the database
    values $confg ="alex1985_admin" //Your database username $confg ="" //Your database
    user's password $confg ="localhost" //Your host $confg ="books" //Your database name
    //Create the function to log into the DB function db_login() { global $confg; $link =
    @mysql_connect($confg , $confg , $confg ) or die("Error connecting: " . mysql...
  8. Need Some Help In File Browser - listing all sub folders and files in them. (8)
    Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
    places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
    and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
    Following code reads on the files inside the main directory, it does not read the files inside the
    sub-folders.. I appreciate any help. CODE <? $path = "./"; $dir_handle =
    @opendir($path) or die("Unable to open $path"); whil...
  9. Updating Php File Through A Web Form - (5)
    Hello, i'm not sure if this can be done with php or not but what i need is a way to make an php
    file that have an html form on it and it will take the info you put in to that form and write it to
    an existing php file, for example: if i have the file news.php and the file news_update.php. if you
    went to news_update.php you would get an form with a text area for you to write a new addition for
    the news.php file and when you hit submit it will add what you typed in the form to the file
    news.php. If this is going to be a big code or a hard one to make but some one think...
  10. File Checker-how To Check File Whith Html Through Html? - (2)
    edit:sorry for the mistake it is php not html and its with not whith my code checking script= CODE
    <?php $file = '$CHECK'; if (file_exists($file)) {
        echo "The file $filename exists"; } else {     echo "The file $filename
    does not exist"; } ?> my question is how to check the file whith html example:on a page
    a text box is provided and a button the user writes a file name (or website) the user clicks on the
    submit button then it checks and show it (with the code above) i got the code C...
  11. Php And Flash Image Gallery - Need some help in creating or editing an xml file while viewing some o (5)
    Hello there and thanks for the helping hand you are offering. PHP newbie here! /ph34r.gif"
    style="vertical-align:middle" emoid=":ph34r:" border="0" alt="ph34r.gif" /> So here is my problem:
    On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a
    folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a
    picture: CODE <pictures>     <image location="nameofpicture1.jpg"
    desc="" />     <image location="nameofpicture2.jpg" desc="" /&#...
  12. No File Extension - (3)
    On MediaWiki, the URL of the content is http://YOURWIKI.com/index.php/Blah Is it possible to
    create a page or two that doesn't have a file extension? If so, how is it done?...
  13. File Upload - File upload (1)
    I need to add a facility on my customer's website so his clients can send him jobs, typically
    5mb - 50mb. I've looked around the web and researched this, and tried a few tests (failed), but
    my brain's beginning to hurt. Could someone please tell me the best way to go about this,
    please. The site is done in Flash, but I'm sure a link to an html page would be ok if necessary....
  14. <?php ?> Unique Visitors Script - Flat file unique visitors script (no sessions) (2)
    This is really simple script. Well at least this part is, but it could be extendable. Only problem
    is that it's not really for massive websites with hundread of visitors a day, but rather for
    small ones. But it is a good script to figure out how to make a visitor counter script. Anyway
    here's the snippet. CODE <?php function getVisits($variable) {
        $visits = array();     if ($handle =
    opendir('stats/')) {     while (false !== ($file =
    readdir($handle))) {  ...
  15. [php]simple Flat File Text Manipulator - Example on how to use forms to write to files in PHP (3)
    I made a simple flat file text editor, that can show you probably how simple it is to use forms with
    php and write that data to file. This example has 2 files, submit.php, and postit.html. Submit.php
    is used to write title, and some text, and add html tags, and paragraph tags where new paragraphs
    are. Here's the file with comments. I think that HTML really doesn't need some more
    explaining. CODE Title: <br /> <input type="text"
    name="title" size="53"> <br /> Text: <br />
    <textarea nam...
  16. Edit .txt File In Ftp Via Webpage - file on external ftp (2)
    Right Im new here and stuggling with a problem im having. I've currently got a Login Script to
    login to a external ftp and it displays the folders contents, however i need it so it echos a
    specific file (coursedata.cfg) into a formarea which you can then edit the file and when u click
    save it overwrites the file with the new one. Im really quiet getting annoyed with it xD as
    everything i do ends up trying to include the file from the webserver the script is hosted on and
    not the external ftp source. thanks Full Code Bellow Simple FTP Manager body { fon...
  17. Php Help Needed Including File In A Page. - (2)
    i'm a noob in php programming, i can understand and modify php programs, but i dont know to
    write on my own. So please somebody who is well versed in php help me. My need is, I'm
    currently builiding a knowledge base website , i've my own design for the website, check here,
    http://laschatz.info/kzone/ Each page in the left hand site has a tree navigation of all the
    topics available. Since this information must be same in all the pages, presently I need to change
    all the pages after adding a new category. Could you please help me in such a way that I can ad...
  18. Help Php: How To Load String From Text File (solved) - Loading string from text file when you click on your link (9)
    I learned the way to load other files with the code posted on this forum. Now i wanted to try
    something for my side menu. I am calling this a string, --> $tekst , maybe it's
    called something else i'm not sure Now let's say i have a file called details.txt In that
    file i would like to have something like this $detailsaboutphp1 = ("details details details
    1"); $detailsaboutphp2 = ("details details details and even more details 2"); How to make a
    code that loads those $strings on click of a mouse. When we tried to load extern...
  19. I Need Help With File Edit In Php - with ftp (6)
    Currently i have CODE <?php if($_POST['user']=="" or
    $_POST['pass']=="" or $_POST['host']==""
    or $_POST['root']=="" or
    !isset($_POST['run'])){  print('<form method=post
    name=form>');  print('FTP username <input type=\'text\'
    name=user value=""><br>');  print('FTP password <input
    type=\'password\'...
  20. Help Needed With Directory/file Listing Code Infinite Loop - Made an infinite loop but why is this so? (5)
    Hi all ive got a small and simple (for the moment atleast /unsure.gif"
    style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> )file and directory
    listing script in php as follows CODE $dir = "."; $num = 0; $file =
    scandir($dir); while($file = scandir($dir)){     echo
    $file[$num];     echo "<BR>";     $num = $num + 1;     
    }; the concept is simple enough, the directory to start with is the current one, so scan this
    directory and wh...
  21. Display Random File In A Directory - how to display a random file from a set directory. (9)
    hi, could someone please help me with this? I have some files in a directory and i want to know how
    i can randomly display link/s to one or more of the files in my directory for download. But it must
    not at any time display index.php which is also in the directory with the downloads. Thanks in
    advance for any help given /unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0"
    alt="unsure.gif" />...
  22. File Format Unknown! (wap) - someone PLEASE HELP! (6)
    hi people :-) listen please can someone help me find the error in this wapsite page, its driving me
    nuts! It works fine on some phones but not on others (giving a file format unknown error) and im
    having serious problems finding the error but i bet its something stupid/simple. CODE <?php
    include ("config.php"); include ("core.php");
    header("Content-type: text/vnd.wap.wml"); header("Cache-Control:
    nostore, nocache, mustrevalidate"); print "<?xml version=\"1.0\&#...
  23. File In Database - Question.thanks (1)
    Hi all i write this code i want when you see download.php (this code) my file goes for download for
    user sorry my english is not very good its a file database project for my university but when i
    browse this code my soruce file (.zip) echo in my page and dont goes for download my next querstion
    about safe mode i saw (php.net and zend) when safemode is on file databaseing and header() is not
    working . is it true ? if is it true i save my file at hosting and no (database) i want write
    standard script . plz help me thanks more and more CODE include("config.php&...
  24. Php Writes Into Txt File - a question (8)
    QUOTE $fp=fopen("test.txt","a"); fputs($fp,"ok"); ?> The above method is only to
    add "ok" at the end (DO NOT write on a new line) I want to know... How to add data on a new line
    and at the end of txt file??! thx~...
  25. File String Delete? - (2)
    Say i have a file file.txt... Can someone give me an example of how to delete a string from this
    file ie.. The file contains: wappy::sucks::at::php --- i want to delete sucks::...
  26. Logging Dowload Files From Your Server Onto A Html File - (1)
    Well, i had the idea of logging the downloads from my web in a html file few weeks ago, and i solved
    it with a lil php page included in my homepage. You could name the links with a name like
    "download.php?file=filename.ext" and then, in the download.php put the next code: (well you put
    the html and head and body tags if u want, i only write the php here) CODE <? if
    (isset($_GET['file']))
    $file=$_GET['file']; //so it gets the GET data from url
    (file=filename.ext); $ip=$_SERVER[...
  27. Php File Problem - (5)
    I have a problem... QUOTE Warning: file_get_contents(): open_basedir restriction in effect.
    File(/1/r0khan) is not within the allowed path(s):
    (/dh/web/phpmyadmin:/tmp:/usr/local/tmp:/dh/solidclient:/usr/local/lib/php:/home/r0khan:/home/.celin
    e/r0khan) in /home/.celine/r0khan/1/seo.php on line 69 Warning: file_get_contents(/1/r0khan):
    failed to open stream: Operation not permitted in /home/.celine/r0khan/1/seo.php on line 69
    Please help, im setting up a website of mine and im beggin 4 ur help, thx /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0...
  28. Reading 16 Bit Wav File - (0)
    hi! i'm having problem reading 16 bit wav files with php and it is starting to drive me
    crazy! i have written a small and simple script that will read wav file and create graph from
    it. now, it works as it should with 8 bit wav files. i'm getting all data as i'm supose to,
    but when it comes to 16 bit files i'm getting crap. i thought that in wav file you read chuncks
    as it is marked in header - so at 8 bit wav chunck is 8 bit long, at 16 bit wav 16 bit... anyway,
    here is part of the script where i read wav and put that in array: PHP Code: COD...
  29. Unexpected $ Where There Aren't Any - (7)
    I am getting this message when testing a script I made: QUOTE Parse error: parse error,
    unexpected $ in /home/globa38/public_html/forum/mods/phpbb_fetch_all/news/forumnews.php on line
    159 On line 159, which is the last line in that file, I can only see this: CODE ?>
    What's the problem, and how can I fix it? /unsure.gif' border='0'
    style='vertical-align:middle' alt='unsure.gif' /> ...
  30. Image Upload And File Size - (2)
    Hi, I'm trying to upload rather large jpgs files (2560x1920 and ~ 2 megs in size) to my server
    via PHP. The problem I am having is that when I upload and attempt to resize by creating a new
    image, the new image is always black. Code I'm using is: PHP Code: CODE if(
    !empty($thefile_name) ) {                                                  
                                                 $query = "INSERT INTO coldwell_images
    (imagename) VALUES ('insertimage')";                    $result ...



Looking for unexpected, sign, line, file, change, line, nos

Searching Video's for unexpected, sign, line, file, change, line, nos
Php
Configuratio
n File
"config.
php"
Unexpected
T_string In
User.php
[resolved]
Getting List
Of
Directories
And Files
Using Php
PHP Function
for
Directory
and File
List
Parse: Error
Unexpected
T_lnumber
php parse
error when
running
script
Include
File.php?id=
something
using the
include()
function
Script: Php
Jukebox A
one file
script!
Unexpected
T_variable..
. Help!
Need Some
Help In File
Browser
listing all
sub folders
and files in
them.
Updating Php
File Through
A Web Form
File
Checker-how
To Check
File Whith
Html Through
Html?
Php And
Flash Image
Gallery Need
some help in
creating or
editing an
xml file
while
viewing some
o
No File
Extension
File Upload
File upload
<?php
?> Unique
Visitors
Script Flat
file unique
visitors
script (no
sessions)
[php]simple
Flat File
Text
Manipulator
Example on
how to use
forms to
write to
files in PHP
Edit .txt
File In Ftp
Via Webpage
file on
external ftp
Php Help
Needed
Including
File In A
Page.
Help Php:
How To Load
String From
Text File
(solved)
Loading
string from
text file
when you
click on
your link
I Need Help
With File
Edit In Php
with ftp
Help Needed
With
Directory/fi
le Listing
Code
Infinite
Loop Made an
infinite
loop but why
is this so?
Display
Random File
In A
Directory
how to
display a
random file
from a set
directory.
File Format
Unknown!
(wap)
someone
PLEASE
HELP!
File In
Database
Question.tha
nks
Php Writes
Into Txt
File a
question
File String
Delete?
Logging
Dowload
Files From
Your Server
Onto A Html
File
Php File
Problem
Reading 16
Bit Wav File
Unexpected
$ Where
There
Aren't
Any
Image Upload
And File
Size
advertisement



Unexpected "$" Sign On Last Line Of File - even if i change the line nos it's there



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE