Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-30-2013, 11:02 AM   PM User | #1
amcf1992
Regular Coder

 
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
amcf1992 is an unknown quantity at this point
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.');

     }
amcf1992 is offline   Reply With Quote
Old 01-30-2013, 03:00 PM   PM User | #2
TFlan
New Coder

 
Join Date: Dec 2012
Location: USA
Posts: 82
Thanks: 3
Thanked 17 Times in 17 Posts
TFlan is an unknown quantity at this point
The problem is exactly what the error has shown, you have not terminated the while() or the <?php tags
TFlan is offline   Reply With Quote
Old 01-30-2013, 06:11 PM   PM User | #3
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,496
Thanks: 18
Thanked 361 Times in 360 Posts
sunfighter is on a distinguished road
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");
	}
}
sunfighter is online now   Reply With Quote
Reply

Bookmarks

Tags
login, php, session

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:33 AM.


Advertisement
Log in to turn off these ads.