Help! Unexpected End Syntax Error

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

maudenton
New php-forum User
New php-forum User
Posts: 5
Joined: Mon Oct 01, 2012 9:32 am

Help! Unexpected End Syntax Error

Postby maudenton » Fri Oct 05, 2012 9:27 am

Hello Absolute Newbie Here,

I have this code on a page for a login website. It is the page you land on if you have successfully logged in.
I keep getting this error --->
Parse error: syntax error, unexpected $end in D:\Hosting\9866233\html\newlaw\login_success.php on line 38
What am i doing wrong? All i want is for the user to land on this page if they login properly and that no one can view the page by just entering the direct url.


Code: Select all

<?php
session_start();
if(!empty($_SESSION["myusername"])){        {
        // User not logged in, redirect to login page
        Header("Location: main_login.php");
        }

// Member only content
// ...
// ...
// ...

// Display Member information
echo "<p>User ID: " . $_SESSION["valid_id"];
echo "<p>Username: " . $_SESSION["valid_user"];
echo "<p>Logged in: " . date("m/d/Y", $_SESSION["valid_time"]);

// Display logout link
echo "<p><a href=\"loggout.php\">Click here to logout!</a></p>";
?>



</body>

</html>

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Help! Unexpected End Syntax Error

Postby seandisanti » Fri Oct 05, 2012 9:38 am

The error means that your </html> tag occurred in an unclosed php block. in the selection provided it happens because you double your opening braces after the if statement, but don't close the outter block. may also need to add opening html and body tags if they're not already in the omitted passages.

maudenton
New php-forum User
New php-forum User
Posts: 5
Joined: Mon Oct 01, 2012 9:32 am

Re: Help! Unexpected End Syntax Error

Postby maudenton » Wed Oct 10, 2012 2:23 pm

Thanks a bunch!


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron