please help me....
i want a error message "invalid user name or password" when i input wrong username or password in the login page. i can do it in an another page .but i need the error message in the same loginpage like gmail(between username and password).
this is my main login page.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Expires" content="Wed, 01 Jan 2020 00:00:01 GMT" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta name="description" content="TBCNA" />
<title>ContractManagement_1 - Main_Login</title>
<script>
function closeMe()
{
var win=window.open("","_self");
win.close();
}
</script>
<script>
function redirectPage()
{
window.location = "login_help.php";
}
</script>
</head>
<body>
<div id="s-9395579f-8d99-4532-9aba-597c3123fb3f">
<input id="screenName" type="hidden" value="Main_Login" />
<input id="canvases" type="hidden" value="s-9395579f-8d99-4532-9aba-597c3123fb3f?t-54111db7-a054-4a0b-a1aa-0177946a18ee" />
<link type="text/css" rel="stylesheet" href="/brando/css/screens/Main_Login.css" charset="UTF-8" />
<link type="text/css" rel="stylesheet" href="/brando/css/templates/Template 1.css" charset="UTF-8" />
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="/brando/css/screens/Main_Login-ie.css" charset="UTF-8" />
<link type="text/css" rel="stylesheet" href="/brando/css/templates/Template 1-ie.css" charset="UTF-8" />
<![endif]-->
<div class="t-54111db7-a054-4a0b-a1aa-0177946a18ee template trigger commentable">
</div>
<div class="s-9395579f-8d99-4532-9aba-597c3123fb3f screen trigger commentable">
<div id="s-Group_2">
<div id="s-Rectangle_1" class="rectangle trigger commentable" ></div>
<div id="s-Rectangle_2" class="rectangle trigger commentable" ></div>
<img id="s-Image_1" class="image trigger commentable" alt="image" src="/brando/images/0- stratechon clear logo-01.png" />
<div id="s-Line_1" class="line trigger commentable" ></div>
<div id="s-Line_2" class="line trigger commentable" ></div>
<div id="s-Label_1" class="label trigger commentable" >Enterprise Management Tool</div>
<div id="s-Label_4" class="label trigger commentable" >Copyright © Stratechon, Inc. 2010</div>
<form name="frm" method="post" action="check_user.php">
<input id="txtusername" class="input trigger commentable" type="text" maxlength="100" name="txtusername" />
<input id="txtpassword" class="input trigger commentable" type="password" maxlength="100" name="txtpassword" />
<div id="s-Label_5" class="label trigger commentable" >Login Name:</div>
<div id="s-Label_6" class="label trigger commentable" >Password:</div>
<div id="s-Button_1" class="label trigger commentable"><input type="submit" name="sub" value="Log in"></div>
</form>
<div id="s-Button_2" class="label trigger commentable"><input type="button" value="Close" onclick="closeMe()"></div>
<div id="s-Button_3" class="label trigger commentable"><input type="button" value="Help" onclick="redirectPage()"></div>
<div id="s-Label_8" class="label trigger commentable" >Version 1.0.2</div>
<div id="s-Group_1">
<div id="s-Label_2" class="label trigger commentable" >BRANDO</div>
<div id="s-Label_3" class="label trigger commentable" >international</div>
</div>
</div>
</div>
</div>
</body>
</html>
----------------------------------------------------------------------------------
this is my logincheck.php
<?php
include("config.php");
$failded_waiting_time = 300;
if(!isset($_SESSION['login_counter']))
$_SESSION['login_counter']=0;
if($_SESSION['login_counter'] = 3)
{
$period = time()-$_SESSION['failed_login'];
if($period < 500)
{
header("location:Main_Login.php");
}
$_SESSION['failed_login'] = time();
}
if(isset($_POST['sub']))
{
$myusername=$_POST['txtusername'];
$mypassword=$_POST['txtpassword'];
}
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE MUSE_NAME='$myusername' and MUSE_PWD='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1)
{
if(!isset($_SESSION['txtusername']))
{
session_register("txtusername");
session_register("txtpassword");
$_SESSION['txtusername']="$myusername";
header("location:Main_Dashboard.php");
}
else
{
$_SESSION['login_counter']=$_SESSION['login_counter']+1;
// register the 3 failed acces time
if($_SESSION['login_counter'] == 3)
{
$_SESSION['failed_login'] = time();
header("location: Main_Login.php");
}
}
}
else
{
header("location: Main_Login.php");
}
?>
Please help me ...