|
-
Jan 21st, 2010, 09:22 AM
#1
Thread Starter
Fanatic Member
Echo Error Message for Incorrect Login
Hi,
I am having default.php and checklogin.php page.
When i login from default.php, it checks for correct login from checklogin .php.
When the login is correct, checklogin.php redirects to other page.
But if it is wrong, the page redirects to default.php page and here i want to echo as Incorrect Login.
I am already having Javascript Validation in default.php.
-
Jan 21st, 2010, 09:51 AM
#2
Re: Echo Error Message for Incorrect Login
you can either:
- set a query string variable
- set a cookie
- or set a session
that says the login was incorrect. then, check if this query string/cookie/session exists on your main page and display an error message if so.
-
Jan 21st, 2010, 10:14 AM
#3
Thread Starter
Fanatic Member
Re: Echo Error Message for Incorrect Login
Ya Thankyou, which is the best one for displaying more errors..
-
Jan 21st, 2010, 03:28 PM
#4
Re: Echo Error Message for Incorrect Login
it doesn't matter, that's why I gave you three different options.
-
Jan 22nd, 2010, 06:56 AM
#5
Thread Starter
Fanatic Member
Re: Echo Error Message for Incorrect Login
Hi,
I used the sessions method, but it has some errors. Each and every time when the page loads the "Invalid Login" error message is displayed, even when the page is not posted to check the login.
checklogin.php coding
Code:
if($hash != $userdata['userpwd'])
{
$_SESSION['ErrorLogin'] = "Invalid Login";
header('Location: ../default.php');
//echo "Fails";
}
login.php coding
Code:
<?PHP
session_start();
if (isset($_SESSION['ErrorLogin']))
{
$error = $_SESSION['ErrorLogin'];
echo "$error";
}
-
Jan 22nd, 2010, 07:51 AM
#6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|