Jump to content

Recommended Posts

require('config.php');
$query24 = mysql_query("SELECT confirmed FROM users WHERE username = '$nicke'") or die(mysql_error());
$query123 = mysql_fetch_array($query24);
if($query123 = 0) {
echo "Activate your account via email please.";
}else{

 

OK what I am trying to do is get the value for confirmed from the users table where the username is = $nicke ($nicke is their nickname/username)

 

For some reason it still lets users which have a 0 in the confirmed value login. If the confirmed column is 1 or something else it means they confirmed their account.

 

Here is the entire page.

 

<?
session_start();


if ($_POST['username']) {





if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){ 

include('header.php'); 


echo "<br><br>SECURITY CODE ERROR... "; 

include('footer.php');

exit();
}


//Comprobacion del envio del nombre de usuario y password
require('funciones.php');
$username=uc($_POST['username']);
$password=uc($_POST['password']);

if ($password==NULL) {
echo "Login Incorrect. Try again.";
}else{
require('config.php');
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['password'] != $password) {
echo "Login incorrect. Try again";
}else{
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
mysql_close($con);
$nicke=$row['username'];
$passe=$row['password'];
require('config.php');
$query24 = mysql_query("SELECT confirmed FROM users WHERE username = '$nicke'") or die(mysql_error());
$query123 = mysql_fetch_array($query24);
if($query123 = 0) {
echo "Activate your account via email please.";
}else{
//90 dias dura la cookie
setcookie("usNick",$nicke,time()+7776000);
setcookie("usPass",$passe,time()+7776000);


$lastlogdate = date("F j, Y - g:i a");
$lastip = getRealIP();
require('config.php');
$querybt = "UPDATE users SET lastlogdate='$lastlogdate', lastiplog='$lastip' WHERE username='$nicke'";
mysql_query($querybt) or die(mysql_error());
mysql_close($con);

?>

<META HTTP-EQUIV="REFRESH" CONTENT="0;URL=members.php">

<?
}
}
}
}else{
?>
<? include('header.php'); ?>

<h3>Login</h3>
<br />

<a href="register.php">New User Register Free Account</a>
<br>
<a href="recoverpwd.php">Lost password?</a>
<br><br>


<div align="center"><div id="form">
<fieldset>
<legend>Login</legend>

<form action='login.php' method='POST'>

<table width="400" border="0" align="center">
  <tr>
    <td width="150" align="left"><p><label>Username</label></p></td>
    <td width="250" align="left"><input type='text' size='15' maxlength='25' name='username' autocomplete="off"value="" tabindex="1" /></td>
  </tr>
  <tr>
    <td width="150" align="left"><p><label>Password</label></p></td>
<td width="250" align="left"><input type='password' size='15' maxlength='25' name='password' autocomplete="off" value="" tabindex="2" /></td>
  </tr>
  <tr>
    <td width="150" align="left"><p><label>Security Code </label></p></td>
    <td width="250" align="left"><input type='text' size='3' maxlength='3' name='code' autocomplete="off" class="securitycode" value="" tabindex="3" /></td>
  </tr>
  <tr>
    <td width="150" align="left"> </td>
    <td width="250" align="left"><img src="image.php?<?php echo $res; ?>" /></td>
  </tr>

  <tr>
    <td width="150" align="left"> </td>
    <td width="250" align="right"><input type="submit" value="Enter" class="submit" tabindex="4" />
</td>
  </tr>
</table>
</form>
</fieldset>
</div></div>





<? include('footer.php'); ?>
<?
}
?>

 

And then here is a SS of my database

helpqd1.png

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.