case sensitive

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mlecho
Forum Commoner
Posts: 53
Joined: Wed Feb 02, 2005 9:59 am

case sensitive

Post by mlecho »

hi all...i have this bit of code to check passwords in a data base...however, neither the logon or pass checks are case sensitive...how can i do this with php?

Code: Select all

<?php
include("sqlConnect/localhost.php");
$pass_entry=$_POST['pass'];
$logon_entry=$_POST['logon'];
testLogon($pass_entry,$logon_entry);
function testLogon($pass_entry,$logon_entry){
	$table="users";
	$sql="SELECT * from $table WHERE username='".$logon_entry."'";
	$result=mysql_query($sql);
		while($row=mysql_fetch_row($result)){
			$userPassWord=$row[2];
			if($userPassWord==$pass_entry){
			echo ("good");
		}
	}
}

?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Your password check is case sensitive. The username would be if the field in the database was set to BINARY.
Post Reply