Jump to content

[SOLVED] Only sending first letter


benjihana

Recommended Posts

Hello!

 

This script is parsing username, fname, and lname correctly, but it is only sending the first letter of the password!

 

Help!

 

$sql = 'SELECT username, password, fname, lname FROM authentication WHERE 1'; 	
$sql_result = mysql_query($sql,$dbh) or die ("Couldn't execute username query.");

$totalusers = 0;
while ($row = mysql_fetch_array($sql_result)) 
	{
		$user [$totalusers] = $row["username"];
		$pass [$totalusers] = $row["password"];
		$fname [$totalusers] = $row["fname"];
		$lname [$totalusers] = $row["lname"];
		$totalusers = $totalusers + 1;}
...
...


$checkusers = 0;
while($checkusers < $totalusers) { 
        if($_POST['username'] == $user [$checkusers] && $_POST['password'] == $pass [$checkusers]){ 


$_SESSION['name'] = $user [$checkusers];
$_SESSION['realname'] = $fname [$checkusers]." ".$lname [$checkusers]; //adds the users data to the php session
$_SESSION['pass'] = $pass [$checkusers];
   $logink = true;
   }
   $checkusers = $checkusers + 1;
   }

//insert html for sucessfull log on here
//you can use  . $_SESSION['name'] . for username
// replace name with realname, url, email to display different name
if ($logink == true){
?> 
You are logged in.<br>
You may logout <a href="logout.php">here</a>.

</body>
</html>


<?php
}
    if($logink !== true) { 

// Some TESTING

echo $user [$checkusers]; echo $checkusers; echo $totalusers; $run = 3; echo $run; echo $user [0]; echo $user [1]; echo $user [2]; $pass [0] = "test"; echo $pass [0]; echo $pass [1]; echo $_POST['username']; echo $_POST['password']; $test [0] = "monkey"; $test [1] = "bananas"; echo $test [0]; echo $test [1]; echo $fname [1]; echo $lname [1];

// End testing

?>
<br>Login failed, bad username/password
<?

} 

Link to comment
https://forums.phpfreaks.com/topic/72040-solved-only-sending-first-letter/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.