akiznin Posted July 3, 2009 Share Posted July 3, 2009 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/164624-solved-error-with-my-login-script/ Share on other sites More sharing options...
celsoendo Posted July 3, 2009 Share Posted July 3, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/164624-solved-error-with-my-login-script/#findComment-868201 Share on other sites More sharing options...
akiznin Posted July 3, 2009 Author Share Posted July 3, 2009 thanks and i do the indents cuz i am a perfectionist, i thought it looked really nice i making a clan managment system, all ready did register, just need login, and for user cp: change pass, PM other members, buy premium services, etc. Quote Link to comment https://forums.phpfreaks.com/topic/164624-solved-error-with-my-login-script/#findComment-868224 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.