Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 136,144 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,069 people online right now. Registration is fast and FREE... Join Now!




Parse error: syntax error, unexpected $end

 
Reply to this topicStart new topic

Parse error: syntax error, unexpected $end, I Have Been Getting This Error But Cant Find The Missing Quote!

Addiction2Code
25 Feb, 2007 - 03:07 PM
Post #1

New D.I.C Head
*

Joined: 19 Dec, 2006
Posts: 39


My Contributions
I Get This Error When Running This (NON-COMPLETLY Shown) File I Have Tested It Seprate From The Login File
And This Is The Code Thats Giving Me The
Parse error: syntax error, unexpected $end in /opt/lampp/htdocs/V3S/login.php on line 86
Error. I Searched Google For This Error And Found Out It Was Because Of A Non Complete Quote
I Cant Find That UnComplete Quote... Can Someone HELP!!!???


CODE

<?php


if($logged_in == 1) {


//Loggout

unset($_SESSION['username']);
unset($_SESSION['password']);
// kill session variables
$_SESSION = array(); // reset session array
session_destroy();   // destroy session.
echo('<h3>You Are Now Logged Out!</h3>');


}







if (isset($_POST['submit'])) { // if form has been submitted





    /* check they filled in what they were supposed to and authenticate */

    if(!$_POST['uname'] | !$_POST['passwd']) {
    echo ('<html><head> <link rel="stylesheet" type="text/css" href="css/master.css"> </head></html>');

        die('<a>You did not fill in a required field.</a>');

    }



    // authenticate.



    if (!get_magic_quotes_gpc()) {

        $_POST['uname'] = addslashes($_POST['uname']);

    }



    $check = $db_object->query("SELECT username, password FROM users WHERE username = '".$_POST['uname']."'");



    if (DB::isError($check) || $check->numRows() == 0) {

        die('<a>That username does not exist in our database.</a>');

    }



    $info = $check->fetchRow();



    // check passwords match


    $_POST['passwd'] = stripslashes($_POST['passwd']);

    $info['password'] = stripslashes($info['password']);

    $_POST['passwd'] = md5($_POST['passwd']);



    if ($_POST['passwd'] != $info['password']) {

        die('<h3>Incorrect password, please try again.</h3>');

    }





    // if we get here username and password are correct,

    //register session variables and set last login time.



    $date = date('m d, Y');



    $update_login = $db_object->query("UPDATE users SET last_login = '$date' WHERE username = '".$_POST['uname']."'");



    $_POST['uname'] = stripslashes($_POST['uname']);

    $_SESSION['username'] = $_POST['uname'];

    $_SESSION['password'] = $_POST['passwd'];

    $db_object->disconnect();

?>

<h1>Logged in</h1>

<h3>Welcome back <?php echo $_SESSION['username']; ?>, you are logged in.</h3>



<?php


} else {    // if form hasn't been submitted



?>

<h1>Login</h1>

<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">

<table align="center" border="1" cellspacing="0" cellpadding="3">

<tr><td><a>Username:</a></td><td>

<input type="text" name="uname" maxlength="40">

</td></tr>

<tr><td><a>Password:</a></td><td>

<input type="password" name="passwd" maxlength="50">

</td></tr>

<tr><td colspan="2" align="right">

<input type="submit" name="submit" value="Login">

</td></tr>

</table>

</form>

User is offlineProfile CardPM
+Quote Post

snoj
RE: Parse Error: Syntax Error, Unexpected $end
25 Feb, 2007 - 03:10 PM
Post #2

$Null
Group Icon

Joined: 31 Mar, 2003
Posts: 3,304



Thanked: 6 times
Dream Kudos: 700
My Contributions
If I remember correctly it means that you have a "?>" set that doesn't have an opening set.
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Parse Error: Syntax Error, Unexpected $end
25 Feb, 2007 - 06:01 PM
Post #3

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,020



Thanked: 81 times
Dream Kudos: 1175
My Contributions
It looks like here:

CODE

<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">


Needs to look like this:

CODE

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">


You are missing the semi-colon
User is offlineProfile CardPM
+Quote Post

snoj
RE: Parse Error: Syntax Error, Unexpected $end
25 Feb, 2007 - 06:15 PM
Post #4

$Null
Group Icon

Joined: 31 Mar, 2003
Posts: 3,304



Thanked: 6 times
Dream Kudos: 700
My Contributions
OMW I was not paying attention! I was just reading up to if (isset($_POST['submit'])) { // if form has been submitted thinking that was all there was! Dang do I ever need sleep.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 10:45PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month