Jump to content

[SOLVED] error with my login script


akiznin

Recommended Posts

I can't find the problem, I am making the login part of my script and I get this error:

 

Parse error: parse error in C:\xampp\htdocs\login\login.php on line 129

 

Here is the script:

 

<?php
include('../configure.php');
include('../database.php');

$username = $_POST['username'];
$password = $_POST['password'];

if (!isset($username) or !isset($password) or strlen($username) < 3 or strlen($username) > 20 or strlen($password) < 3 or strlen($password) > 20 or !ctype_alnum($username)) {
?>
<html>
<head><link rel="stylesheet" href="../webstyle.css" type="text/css" /><title><?php echo TITLE; ?></title></head>
<body>

<div id="wrapperAll">
<div id="top">
<div style="padding-top:26px; padding-right:28px; padding-bottom:0px; padding-left:0px;">
<input type="text" name="search" id="query" value="" style="margin-right:5px; width:100px;"></input>
<input type="button" name="submit" id="search_button" value="Search" style="width:50px;"></input>
</div>
</div>

<div id="content">
<div id="topWrapper">
<div id="logo">Lost <span style="color: #718F49;">Brotherhood</span></div>
<div id="menu"><div style="padding-top:15px;">
<?php echo MENU; ?>
</div></div>
</div>

<div id="sep"> </div>
<div id="archive"><b><?php echo SLOGAN; ?></b></div>
<div id="wrapperContent">
<div id="wrapperNote">
<div id="noteTop">
 
</div>
<div id="noteContent">
<div id="title">Login Error</div>
<hr>
An error has occured with the information you have submitted:
<ul>
<li>Username must be alphanumeric and more than 3 character but less than 20.
<li>Password must be more than 3 character but less than 20.
</ul>
</div>
<div id="noteBottom">
 
</div>
</div>
</div>

</div>

<div id="bottom">
<?php echo COPYRIGHT; ?>
</div>
</div>

<?php echo POWERED; ?>
</body>
</html>
<?php
} else {
$username = mysql_real_escape_string(lower_case($username));
$password = mysql_real_escape_string($password);
$password_sha1 = sha1(lower_case($password));

$query = "SELECT * FROM members WHERE username='$username' and password='$password_sha1'";
$result = mysql_query($query);
$count = mysql_num_rows($result);
if ($count > 0) {
$_SESSION['username'] == $username;
header('Location: http://www.lostbrotherhood.com/panel/');
} else {
?>
<html>
<head><link rel="stylesheet" href="../webstyle.css" type="text/css" /><title><?php echo TITLE; ?></title></head>
<body>

<div id="wrapperAll">
<div id="top">
<div style="padding-top:26px; padding-right:28px; padding-bottom:0px; padding-left:0px;">
<input type="text" name="search" id="query" value="" style="margin-right:5px; width:100px;"></input>
<input type="button" name="submit" id="search_button" value="Search" style="width:50px;"></input>
</div>
</div>

<div id="content">
<div id="topWrapper">
<div id="logo">Lost <span style="color: #718F49;">Brotherhood</span></div>
<div id="menu"><div style="padding-top:15px;">
<?php echo MENU; ?>
</div></div>
</div>

<div id="sep"> </div>
<div id="archive"><b><?php echo SLOGAN; ?></b></div>
<div id="wrapperContent">
<div id="wrapperNote">
<div id="noteTop">
 
</div>
<div id="noteContent">
<div id="title">Login Error</div>
<hr>
An error has occured with the information you have submitted:
<ul>
<li>Username or password is invalid.
</ul>
</div>
<div id="noteBottom">
 
</div>
</div>
</div>

</div>

<div id="bottom">
<?php echo COPYRIGHT; ?>
</div>
</div>

<?php echo POWERED; ?>
</body>
</html>
<?php
}
?>

Link to comment
https://forums.phpfreaks.com/topic/164624-solved-error-with-my-login-script/
Share on other sites

Have you already tried to indent your code? It's a very good practice when you are programming, especially with large blocks of { and } (and more especially when you are mixing HTML and PHP).

 

The problem of your code is that's missing one }

 

The last } on your code is closing the open { from line 74.

 

But where are you closing the open { from line 63?

 

If you put another close bracket at the end of the script it will run as well, but maybe with unexpected results. Review your code and review your if's { } statements.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.