0

I've been having a bit of problems with a file. Here is the script that I'm having issues with and the exact error is as follows:

Parse error: syntax error, unexpected $end in /hermes/bosweb/web168/b1683/ipg.xoizocom/pba/login/index.php on line 239

<?PHP
require_once("globals.php");
$INFO = array();
$ipsclass = new ipsclass();
$ipsclass->vars = $INFO;
$script = '';

if($_SESSION['msg'])
{
    // The script below shows the sliding panel on page load

    $script = '
    <script type="text/javascript">

        $(function(){

            $("div#panel").show();
            $("#toggle a").toggle();
        });

    </script>';

}
$errors2 = array();
    if ($_SESSION['SessionLoggedIn'] == 'true') {
        echo "<div id='notices' align='center'>You are already logged in.</div>";
    }elseif ($_SESSION['SessionLoggedIn'] != 'true') {

    if(isset($_POST['login'])) {
        $username = addslashes(trim($_POST['username']));
        $pass = addslashes(trim($_POST['password']));
        $password = md5($pass);
        $errors = array();

        if(!$username){
            $errors[] = "You did not supply a username!";
        }

        if(!$pass){
            $errors[] = "You did not supply a password!";
        }

        $query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());
        $row = mysql_fetch_assoc($query);

        $query2 = mysql_query("SELECT * FROM Users WHERE Username = '$username' LIMIT 1") or die(mysql_error());


        if(mysql_num_rows($query2) == 0) {
            print "<div align=\"center\">Username does not exist!</div>";
        }elseif(mysql_num_rows($query) == 0) {
            print "<div align=\"center\">Username and password combination incorrect!</div>";
        }

        if(count($errors) > 0){
            echo 'There were some problems with loggin in:<br /><ul>';
            foreach($errors as $error){
                echo '<li>' . $error . '</li>';
                }
            echo '</ul>';
        }elseif(count($errors) == 0) {      
            if (mysql_num_rows($query) > 0) {
                if ($row[Ban] == '1') {
                    print "Your account is banned. Please contact an admin at admin@darkshadowsbreedables.com";
                }elseif ($row[Activated] = 0 AND $row[Ban] == '0') {
                    print "Your account is not activated, Plese check your e-mail for the activation e-mail.";
                    return;
                }elseif ($row[Activated] = 1 AND $row[Ban] == '0') {
                    if(!$username){
                        $errors2[] = "You did not supply a username!";
                    }                   
                    if(!$pass){
                        $errors2[] = "You did not supply a password!";
                    }

                    if(count($errors2) > 0){
                        echo 'There were some problems with loggin in:<br /><ul>';
                        foreach($errors2 as $error2){
                            echo '<li>' . $error2 . '</li>';
                            }
                        echo '</ul>';
                    }elseif(count($errors2) == 0) {
                                $_SESSION['SessionLoggedIn'] = 'true';
                                $_SESSION['SessionUserName'] = $row['Username'];
                                $_SESSION['SessionUserID'] = $row['ID'];
                                setcookie("cookname", $_SESSION['SessionUserName'], time()+60*60*24*100, "/");
                                setcookie("cookpass", $password, time()+60*60*24*100, "/");
                                setcookie("id", $_SESSION['SessionUserID'], time()+60*60*24*100, "/");

                                print "You are now logged in!";
                                mysql_query("UPDATE Users SET DateLastLogin = NOW() WHERE Username = '".$username."' LIMIT 1") or die(mysql_error());
                                header ("Location: index.php");
                    }
                }

            }
            }
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Xoizo : A Unique Pet Breeding Sim</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="/forum/bbcode.js" /></script />
    <script type="text/javascript" src="/layouts/java/homeslanXoizo.js" /></script />
    <script type="text/javascript" src="/images/java/overlib.js"><!-- overLIB (c) Erik Bosrup --></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

    <link rel="stylesheet" type="text/css" href="demo.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="login_panel/css/slide.css" media="screen" />


    <!-- PNG FIX for IE6 -->
    <!-- http://24ways.org/2007/supersleight-transparent-png-in-ie6 -->
    <!--[if lte IE 6]>
        <script type="text/javascript" src="login_panel/js/pngfix/supersleight-min.js"></script>
    <![endif]-->

    <script src="login_panel/js/slide.js" type="text/javascript"></script>
    <?php echo $script; ?>
</head>

<body>
<!-- Panel -->
<div id="toppanel">
    <div id="panel">
        <div class="content clearfix">
            <div class="left">
                <h1>Xoizo :: A Unique Pet Breeding Sim</h1>
                <h2>Want to help?</h2>        
                <p class="grey">We are now taking donations to help push the development of Xoizo! Please see <a href="/donate.php">the list of donation perks</a> for more information! </p>
                <h2>Donate!</h2>
                <p class="grey"><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="TAFM9UCUA2PPE">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</p>
            </div>

            <div class="left">
                <!-- Login Form -->
                    <h1>Member Login</h1>

<?php
  // If the session var is empty, show any error message and the log-in form; otherwise confirm the log-in
  if (empty($_SESSION['SessionLoggedIn'])) {
    echo '<p class="error">' . $errors2 . '</p>';
    ?>
<center><h2>:: Login ::</h2></center>
  <form method="post" class="clearfix" action="<?php echo $_SERVER[’SCRIPT_NAME’]; ?>">
  <label class="grey" for="username">Username: </label></td>
  <input class="field" type="text" name="username" id="username" value="" size="23"/></td>
  <label class="grey" for="password">Password: </label></td>
  <input type="password" name="password" id="password" /></td>
  <input type="checkbox" name="remember" id="remember" />
  <label><input name="rememberMe" id="rememberMe" type="checkbox" checked="checked" value="1" /> &nbsp;Remember me</label>
  <input type="submit" name="submit" value="Login" class="bt_login" />
</tr>
</form>                  
            <a href="resetpassword.php">Reset password</a> - <a href="resendactivate.php">Resend Activation Link</a></div>
            </div>
            <div class="left right"> 
                    <h1>Want to apply for an account?</h1>        
                    <h2>Go fill out an <a href="apply.php">application!</a></h2>
            </div>

            <?php

            else:

            ?>

            <div class="left">

            <h1>Members panel</h1>

            <p>You can put member-only data here</p>
            <a href="registered.php">View a special member page</a>
            <p>- or -</p>
            <a href="?logoff">Log off</a>

            </div>

            <div class="left right">
            </div>

            <?php
            endif;
            ?>
        </div>
    </div> <!-- /login -->    

    <!-- The tab on top -->  
    <div class="tab">
        <ul class="login">
            <li class="left">&nbsp;</li>
            <li>Hello <?php echo $_SESSION['usr'] ? $_SESSION['usr'] : 'Guest';?>!</li>
            <li class="sep">|</li>
            <li id="toggle">
                <a id="open" class="open" href="#"><?php echo $_SESSION['id']?'Open Panel':'Log In | Register';?></a>
                <a id="close" style="display: none;" class="close" href="#">Close Panel</a>           
            </li>
            <li class="right">&nbsp;</li>
        </ul> 
    </div> <!-- / top -->

</div> <!--panel -->

EDIT: I realized I posted the wrong script. I've added the correct script. Thank you in advance for any help.

Edited by kbat115: added wrong script snippet

3
Contributors
5
Replies
9
Views
5 Years
Discussion Span
Last Post by andyy121
0

Change this

  else {
// Confirm the successful log-in
echo $login_name || $user_id; || "<a href=\"logout.php\">Logout</a>";
}

to this

 else {
// Confirm the successful log-in
echo $login_name."|| ".$user_id." || <a href=\"logout.php\">Logout</a>";
}
0

Thank you! Unfortuantley, I messed up and put the wrong code in the starting post. :C If you wouldn't mind looking back over the correct script? It's been updated in the first post. Thank you for the quick reply anyways.

0

else: on line 172, and elseif; on line 191 above. Is that how you itend it to be? or something like this else{ } and eleseif(){}?

Edited by veedeoo: more info added

0
<?php
$submit = @$_POST['submit'];
//form data
$fullname = strip_tags (@$_POST['fullname']);
$username = strip_tags (@$_POST['username']);
$password= strip_tags(@$_POST['password']);
$repeatpassword = strip_tags(@$_POST['repeatpassword']);
$date =("Y-m-d");
if ($submit);
{
// check for existance
if($fullname&&$username&&$password&&$repeatpassword)
{
//encrypt password
$password = md5 ($password);
$repeatpassword =md5 ($repeatpassword);

if ($password==$repeatpassword)
{
// check char length of username and fullname
if (strlen($username)>25||strlen($fullname)>25)
{
echo ("Length of username or fullname is too long");
}
else
{
//check password length
if (strlen($password)>25|| strlen($password)<6)
{
 echo ("Password mus be betwen 6 and 25 characters");
}
else
{
//register the user!!
echo ("Success!!");
}

}
else
 echo ("Your password do not match");
}
else
echo("Please fill in <b>all</b> fields!");
}


?>
0

it show mw this:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\site 2\register.php on line 58

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.