![]() |
|
|
|
||||||||||
![]() |
|
|
Thread Tools |
|
#1
|
|||
|
|||
|
Parse error: syntax error, unexpected $end
php Code:
Thanks Mike. |
|
#2
|
|||
|
|||
|
It doesn't look like you have any syntax errors in there. I copied and pasted the code and was able to run it with no problem.
The problem may occur after a header() redirect. Try checking all of the files that you're redirecting to to see if one of them is busted. - Walkere |
|
#3
|
||||
|
||||
|
If I may point out you're also throwing un-sanitized user supplied data at your mysql database. Be careful with that... in fact don't do it.
![]() php Code:
|
|
#4
|
|||
|
|||
|
Quote:
Thanks Mike. |
|
#5
|
||||
|
||||
|
Well, you are assuming that people will only enter real user names and passwords.
What about people who enter stuff like this ' union select password from users where username like '%admin%' or '' = ' Read this... http://en.wikipedia.org/wiki/SQL_injection and this http://shiflett.org/articles/sql-injection Never trust user supplied data. You will get hacked that way. |
|
#6
|
|||
|
|||
|
TTT For today!
|
|
#7
|
|||
|
|||
|
Would appreciate some help!! I know that the data is not validated but i am living with that for the moment and attempting to remove the error message.
Thanks Mike. |
|
#8
|
|||
|
|||
|
You should listen to RoscoeT.
Check out the addslahes php function: http://no.php.net/manual/en/function.addslashes.php Run the addslashes function on the user supplied data before using it in any query. The problem is not really that you can get invalid data in the database, it's rather that SQL injection is used to gain unauthorized access to your data.
__________________
ShowYourSite.com - Free 10:9 Banner Exchange |
|
#9
|
|||
|
|||
|
Post the exact error messages here.
__________________
Acio! Proxy Script With auto myspace friend adder and bulletin poster Server License for only $99 ($100 discount for one week) |
|
#10
|
|||
|
|||
|
Parse error: syntax error, unexpected $end in /login.php on line 2
|
|
#11
|
|||
|
|||
|
There is no syntax error in the piece of code you posted. Are you sure the code you posted is exact login.php file? Is there any auto_prepend_file in php configuration?
__________________
Acio! Proxy Script With auto myspace friend adder and bulletin poster Server License for only $99 ($100 discount for one week) |
|
#12
|
||||
|
||||
|
I have seen some strange behavior on some servers and in various similar situations. I would make sure there are no blank lines or white space between your <?php and the start of the file.
There have been weird situations with non printing characters getting inserted in there. Also do check your php config for the prepend_file settings. As a simple test, comment out line #2 # session_start(); and see if that changes the error. |
|
#13
|
|||
|
|||
|
Now there is no error!
|
|
#14
|
|||
|
|||
|
Don't i need the session_start()??
And another note: The Login button doesnt work :S Sorry for all the problems. Cheers Mike. |
|
#15
|
|||
|
|||
|
Since you still want to use session_start(), do the other thing RoscoeT said; make sure there is no white space (or any text for that matter) before your <?php. Normally if there's whitespace (a new line even) before you do your session_start(), it'd just not do it and maybe throw an error because headers must be altered before anything is sent. Not sure if this would throw your error though.. seems odd
__________________
Make money off MySpace today! |
|
#16
|
|||
|
|||
|
Even with no whitespaces the error message is still displayed :S
|
|
#17
|
||||
|
||||
|
run the following and tell us the results.
php Code:
|
|
#18
|
|||
|
|||
|
This is the result
Welcome to page #1 page 2 page 2 |
|
#19
|
|||
|
|||
|
php Code:
|
|
#20
|
||||
|
||||
|
Quote:
Is this script being included as part of something else per chance? Something that could already start the headers? Which version of PHP is it? Is this Linux + Apache or something else? Does your error log give any more specific information when this is run. I suggest you increase the error level in the script and have it output all notices and warnings. That might give us a clue. |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Parse error: syntax error, unexpected $end in /register.php on line 2 | Hontoir | PHP | 7 | Feb 28th 2008 3:26 pm |
| Parse error: syntax error, unexpected $end | abhiN | PHP | 9 | Feb 17th 2008 9:44 am |
| Parse error: syntax error, unexpected $end in xxx on line 1 | adams95ta | PHP | 3 | Jan 2nd 2008 9:32 am |
| another error.help needed Parse error: syntax error, unexpected T_STRING in /home/tam | sandeepdude | PHP | 2 | Dec 17th 2007 10:04 am |
| Parse error: syntax error, unexpected $end... | gaspacho | PHP | 6 | Nov 17th 2007 7:42 am |