Login gone wrong

Status
Not open for further replies.

Benden

maging ang maganda mamatay
Jun 4, 2010
2,281
1,480
PHP:
<?php

//ob
ob_start();

//session
session_start();

if (isset($_SESSION['username']))
{
 header("Location: me.php");
 exit();  
}

//connect
$error = 'Could not connect to the database';
mysql_connect('localhost','root','password12') or die($error);
mysql_select_db('holodb') or die($error);



if ($_POST['login'])
{
 //get form data
 $username = addslashes(strip_tags(strtolower($_POST['username'])));
 $password = addslashes(strip_tags($_POST['password']));
 
 if (!$username||!$password)
    echo "Please enter a username and password<p />";
 else
 {
  //find username
  $find = mysql_query("SELECT * FROM users WHERE username='$username'");
  if (mysql_num_rows($find)==0)
     echo "Username not found<p />";
  else
  {
   while ($find_row = mysql_fetch_assoc($find))
   {
//get database password
       $password_db = $login_row['password'];	
       
       //check password
       if ($password!=$password_db)
          echo "Incorrect password";
   else if ($check==TRUE)
   {
    $_SESSION['username']=$username;
    header("Location: main.php");
    exit();
   }

  }
 }
 


}

?>
<!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>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
	<title>Zelo 1.0</title>
	<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<div id="TopBar">
 		<div id="Avatar"></div>
 		<div id="WelcomeMsg">UnionRP</div>
 		<div id="Stat">
 			The RP union is by your side		</div> 	</div>  	
<div id="Navigator"> 	</div>
  	<div id="BetaContainer">
 		<div id="LeftBeta">
 			<div id="BetaBox">
 				<div id="TitleBox" class="green">Housekeeping Login</div>
 				<div id="Content">
<form id="login" method="post" action="index.php">
 						<div id="Question">
 							<label for="email">Email</label>
 							<input type="text" name="email" id="email" /><br />
 						</div> 
						<div id="Question">
 							<label for="email">Password</label>
 							<input type="password" name="password" id="password" /><br />
 						</div>
 						<div id="SmartButtonCASE">
 							<div id="SmartButton"> 						
		<div id="SmartButtonTop"></div><div id="ButtonFont"><center>Log In</center></div>


 </div>

 					<div id="Question">
						This login is for staff only! If you're not staff please use the User login. 
</div>					</div> 				</div> </div>
	<div id="BetaBox1" float="right">
	<div id="TitleBox" class="red">User Login</div>
	<div id="Content">
<div id="Content">
<form id="login" method="post" action="index.php">
 						<div id="Question">
 							<label for="email">Username</label>
 							<input type="text" name="username" id="username" /><br />
 						</div> 
						<div id="Question">
 							<label for="email">Password</label>
 							<input type="password" name="password" id="password" /><br />
 						</div>
 						<div id="SmartButtonCASE">
 							<div id="SmartButton"> 	
<input type="submit" name="login" value="Log in">					
		<div id="SmartButtonTop"></div><div id="ButtonFont"><center>Log In</center></div>
 </div>

 					<div id="Question">
						Anyone can use this login. 
</div>					</div>
	</div></div>
</body>
</html>
Error Message: Parse error: parse error in C:\xampp\htdocs\cms\index.php on line 123
Line 123
HTML:
</html>
 
Status
Not open for further replies.

Users who are viewing this thread

Top