NameSilo

PHP Syntax Error

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

lpxxfaintxx

Established Member
Impact
13
PHP:
<?php
	require_once "maincore.php";
	session_start();
	session_checker(); 
	require_once "connect.php";

if(isset($_GET['and'])) {

echo <<<__HTML_END

	Upload Successful! <a href="membersarea.php">Click Here to Continue...</a>

__HTML_END;

} else {


echo <<<__HTML_END
	<center>
	<u>Navigation:</u><Br><br><br>
	<a href="myfiles.php">My files<br><a>
	<a href="upload.php">Upload New File<br></a>
	Edit Profile<br>
	<br><br>
	<a href="logout.php">Log Out</a>
__HTML_END;


if($_SESSION['user_level'] == 1){
echo <<<__HTML_END
	Welcome, $username. You are a Moderator. <Br><br>
	<a href="today.php?view=files">Todays Upload</a>
	<a href="today.php?view=users">New Registed Members Today</a>
	<a href="logout.php">Log Out</a>
__HTML_END;
}
if($_SESSION['user_level'] == 2){
echo <<<__HTML_END
	Welcome, $username. You are an Administrator.
	<a href="today.php?view=files">Todays Upload</a>
	<a href="today.php?view=users">View All Uploads</a>
	<a href="today.php?view=users">New Registed Members Today</a>
	<a href="today.php?view=files">View All Members</a>
	<a href="logout.php">Log Out</a>

__HTML_END;
}}

?>


Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/informed/public_html/projects/membership/membersarea.php on line 51


I REALLY don't know where I went wrong. Looked everywhere, but just can't find it. Anyone care to show me where I went wrong?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
This file does not have 51 lines of code, it only has 49, but my "guess" would be at the end, were you have the }} back to back, remove the second one.
 
0
Close
Is the code you posted membersarea.php?

PHP:
<?php

require_once "maincore.php";
session_start();
session_checker(); 
require_once "connect.php";

if(isset($_GET['and'])) {
	?>
		Upload Successful! <a href="membersarea.php">Click Here to Continue...</a>
	<?php
} else {
	?>
		<center>
		<u>Navigation:</u><Br><br><br>
		<a href="myfiles.php">My files<br><a>
		<a href="upload.php">Upload New File<br></a>
		Edit Profile<br>
		<br><br>
		<a href="logout.php">Log Out</a>
	<?php
	if($_SESSION['user_level'] == 1){
		?>
			Welcome, $username. You are a Moderator. <Br><br>
			<a href="today.php?view=files">Todays Upload</a>
			<a href="today.php?view=users">New Registed Members Today</a>
			<a href="logout.php">Log Out</a>
		<?php
	}
	if($_SESSION['user_level'] == 2){
		?>
			Welcome, $username. You are an Administrator.
			<a href="today.php?view=files">Todays Upload</a>
			<a href="today.php?view=users">View All Uploads</a>
			<a href="today.php?view=users">New Registed Members Today</a>
			<a href="today.php?view=files">View All Members</a>
			<a href="logout.php">Log Out</a>
		<?php
	}
}

?>

Try that?
 
0
Close
I agree,

what's with all the:

echo <<<__HTML_END stuff? you don't need all that rubbish to produce the same code you are trying to produce. In fact, I'm not sure why you do that, but to each is their own :)

What about simple string functions?

$html = 'my html code here';
echo $html;

Will save you more time in the end. :)
 
0
Close
Sorry for not keeping you guys updated. I have fixed the problem long before, but thanks for your efforts.

@psalzmann : echo <<<__HTML_END is my preference, and I feel more comfortable with it. It also helps me produce MUCH more less errors.
 
0
Close
lpxxfaintxx: I bet you were a Perl coder at one stage :)

Like Dan Friedman did in his example, I prefer to just 'break out' of the PHP interpreter by using a closing PHP tag then writing HTML directly, but I do appreciate the old-school feel of a heredoc!
 
0
Close
The code is correct but error can be in "require" fields : maincore.php, connect.php

Regards
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Member card: see how many threads a member started
The member card now shows a Threads number, right after Posts. The member card is the box that opens when you point at a name. Profile...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back