Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts

    login not working

    Im coding a login

    Error message:
    Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\files\login.php on line 105


    Login.php
    PHP Code:
     <?php 



     mysql_connect
    ("localhost""root""root") or die(mysql_error()); 

     
    mysql_select_db("auth") or die(mysql_error()); 




     if(isset(
    $_SESSION['submit']))


     
    //if there is, it logs you in and directes you to the members page

     

         
    $username $_POST['username']; 

         
    $pass $_POST['password'];

              
    $check mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());

         while(
    $info mysql_fetch_array$check ))     

             {

             if (
    $pass != $info['password']) 

                 {

                              }

             else

                 {

                 
    header("Location: members.php");



                 }

             }

     }


     
    //if the login form is submitted 

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



     // makes sure they filled it in

         
    if(!$_POST['username'] | !$_POST['password']) {

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

         }

         
    // checks it against the database



         
    if (!get_magic_quotes_gpc()) {

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

         }

         
    $check mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error());



     
    //Gives error if user dosen't exist

     
    $check2 mysql_num_rows($check);

     if (
    $check2 == 0) {

             die(
    'That user does not exist in our database. <a href=add.php>Click Here to Register</a>');

                     }

     while(
    $info mysql_fetch_array$check ))     

     {

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

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

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



     
    //gives error if the password is wrong

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

             die(
    'Incorrect password, please try again.');

         }

  • #2
    New Coder
    Join Date
    Dec 2012
    Location
    USA
    Posts
    82
    Thanks
    3
    Thanked 17 Times in 17 Posts
    The problem is exactly what the error has shown, you have not terminated the while() or the <?php tags

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,696
    Thanks
    25
    Thanked 657 Times in 656 Posts
    Also
    Code:
    if(isset($_POST["submit"]))
    Not terminated and you should put some code in here or change it
    Code:
    while($info = mysql_fetch_array( $check ))
    {
    	if ($pass != $info['password'])
    	{
    	}  // THIS NEEDS CODE
    	else
    	{
    	  header("Location: members.php");
    	}
    }


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •