gauri_agr
13 Oct 2009, 10:25 AM
Hi All,
When I see this in browser, Why I am not getting the form and error div inside the maincontainer div? Here is the code:
<div class="maincontainer">
<?php
// this to keep the same session for login, logout, register and index page
session_start();
ob_start();
if (isset($_GET['submitted'])) { // Form Handler
?>
<div class="error">
<?php
// To clear The form Data.
if (isset($_GET['clear']))
{
ob_end_clean(); // Delete the bfuffer.
header("Location: login.php");}
//Collect your info from login form
$username = $_GET['username'];
$password = $_GET['password'];
//Find if entered data is correct
// check if both the field are empty
if(empty($username))
{$message=$message."* Username is required<br>";}
if(empty($password))
{$message=$message."* Password field is required<br>";}
echo $message;
if ($message=='')
{
require_once ('mysql.php');
$result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");
$row = mysql_fetch_array($result);
$id = $row['id'];
// this would be 0 if not the right user AND PASSWORD
if(empty($id)){echo "* Either username or password is wrong";}
else
{
//Now if everything is correct let's finish his/her/its login
echo "username is $username<br>";
$_SESSION['username']=$username;
$_SESSION['password']=$password;
echo "saved session user is <br>";
echo $_session['username'];
//echo "Welcome, ".$username." please continue on our <a href=index.php>Index</a>";
if($a==$a)
{
ob_end_clean(); // Delete the buffer.
header('Location: index.php');}
}
}//message loop
}
?>
</div>
<div class="form">
<form action='?act=login' method='get'>
<p>Username: </p><input type='text' name='username' size='30'><br>
<p>Password: </p><input type='password' name='password' size='30'><br>
<p></p><input type='submit' value="Login"> <input type='submit' value='Clear' name='clear'><br><br>
<p>If New User, Register <a href="register.php">Here </p></a>
<input type="hidden" name="submitted" value="TRUE" />
</form>
</div>
<!--maincontainer></div>
--------------
could any one explain why is this happening
Thanks & regards
Gauri
When I see this in browser, Why I am not getting the form and error div inside the maincontainer div? Here is the code:
<div class="maincontainer">
<?php
// this to keep the same session for login, logout, register and index page
session_start();
ob_start();
if (isset($_GET['submitted'])) { // Form Handler
?>
<div class="error">
<?php
// To clear The form Data.
if (isset($_GET['clear']))
{
ob_end_clean(); // Delete the bfuffer.
header("Location: login.php");}
//Collect your info from login form
$username = $_GET['username'];
$password = $_GET['password'];
//Find if entered data is correct
// check if both the field are empty
if(empty($username))
{$message=$message."* Username is required<br>";}
if(empty($password))
{$message=$message."* Password field is required<br>";}
echo $message;
if ($message=='')
{
require_once ('mysql.php');
$result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");
$row = mysql_fetch_array($result);
$id = $row['id'];
// this would be 0 if not the right user AND PASSWORD
if(empty($id)){echo "* Either username or password is wrong";}
else
{
//Now if everything is correct let's finish his/her/its login
echo "username is $username<br>";
$_SESSION['username']=$username;
$_SESSION['password']=$password;
echo "saved session user is <br>";
echo $_session['username'];
//echo "Welcome, ".$username." please continue on our <a href=index.php>Index</a>";
if($a==$a)
{
ob_end_clean(); // Delete the buffer.
header('Location: index.php');}
}
}//message loop
}
?>
</div>
<div class="form">
<form action='?act=login' method='get'>
<p>Username: </p><input type='text' name='username' size='30'><br>
<p>Password: </p><input type='password' name='password' size='30'><br>
<p></p><input type='submit' value="Login"> <input type='submit' value='Clear' name='clear'><br><br>
<p>If New User, Register <a href="register.php">Here </p></a>
<input type="hidden" name="submitted" value="TRUE" />
</form>
</div>
<!--maincontainer></div>
--------------
could any one explain why is this happening
Thanks & regards
Gauri