user validation always displaying invalid ? please help

Posted on 16th Feb 2014 07:03 pm by admin


I have 2 accounts and there is a field in mysql called validated it can be either "true" or "false"

I tried writing a code so when the user logs in if the user is validated meaning
$username = $_POST['username'];
$validated = true
$validation = a mysql query that selects validated from members where username = $username

$validated == $validation

and I have to accounts made
1 account username is "google" its validation is set to false
2nd account username is "jaydesigns" its validation is set to true

but when I login both come up as not validated

here is the page code:

Code: <?

$final_report = "Please complete all the fields below..";
$username= trim($_POST['username']);
$password = trim($_POST['password']);
if($username == NULL OR $password == NULL){
$final_report = "Please complete all the fields below..";
$check_user_data = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
if(mysql_num_rows($check_user_data) == 0){
$final_report = "This username does not exist..";
$get_user_data = mysql_fetch_array($check_user_data);
if($get_user_data['password'] == $password){

$start_idsess = $_SESSION['username'] = "".$get_user_data['username']."";
$start_passsess = $_SESSION['password'] = "".$get_user_data['password']."";
$validation = mysql_query("SELECT validated FROM `members` WHERE `username` = '$username'") or die(mysql_error());
$validated = "true";
if($validation == $validated) {

$final_report ="You are now logged in $start_idsess ";

} else {

$final_report ="Your account is not validated $start_idsess,

Please Activate your account from the email you recieved from us.

If you did not recieve an email click <a href='./activate-send.php'>here</a> to resend the email

You will be logged out Now";


<meta http-equiv="Refresh" content="0; URL=./members.php">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Funky Vision Membership Script</title>

<body><form action="" method="post">
<table width="312" align="center">
<tr><td colspan='2'><?php echo "$final_report" ?></td></tr><tr>
<td width="120">Username:</td>
<td width="180"><input type="text" name="username" size="30" maxlength="25"></td>
<td><input type="password" name="password" size="30" maxlength="25"></td>
<td><input type="submit" name="login" value="Login" /></td>


No comments posted yet

Your Answer:

Login to answer
209 Like 12 Dislike
Previous forums Next forums
Other forums

Alta qualità Beads Pandora con pietre Outlet Store : Trova originali rivenditori online per Bracciali Pandora .
[b][url=]pandora outlet on-line[/url][/b] [b][url=http://www.pandoracharm.

Spyder куртки
[b][url=]Spyder куртки[/url][/b] [b]Spyder

Neues Konto erstellen : Professionelle Replik-Uhren-Shops,
[b][url=]Replik Schweizer Uhren aaa +[/url][/b] [b][url=http://www.wat

batch file not building to webapps folder
Hello. I just started running Vista :P and can't seem to get my projects deployed. I found out how

HeaderSelectedCssClass not working
I have an accordian where I have a drop down list in the first pane and a grid in the second pane.

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Google+ Indyaspeak @ Pinterest RSS