Jump to content

Case Sensitive


cyrixware

Recommended Posts

How to achive this one to make the username and password a case sensitive?

   <?php
if($_REQUEST['Submit'] == "Login")
{
	$username = $_REQUEST['username'];
	$passwrd = md5($_REQUEST['passwrd']);

	include("../connDB.php");

	$sql = "SELECT teacher.*, security.* FROM teacher, security WHERE teacher.TUsername = '$username' AND teacher.TPassword = '$passwrd' AND security.SecStaff = 'Enabled'";

	if(!$q = mysql_query($sql))
	{
		die(mysql_error());
	}

	elseif(mysql_num_rows($q) == 0)
	{
	?>	
		<script language=JavaScript>
		 	alert("Invalid username, password or account disabled. Please contact the Administrator. Try Again!");
		</script>
    <?php
	}

	else
	{
		$r = mysql_fetch_assoc($q);
		$TID = $r['TID'];

		$session_id = md5(date("Y-m-d H:i:s") . $TID);

		$sql1 = "UPDATE teacher SET TSessionID= '$session_id' WHERE TID = '$TID'";

		if(!$q1 = mysql_query($sql1))
		{
			die(mysql_error());
		}

		elseif(mysql_affected_rows() == 0)
		{
			echo "<font size=2 face=Verdana color=red>Failed to create session id!</font>";
		}	

		else
		{
			$_SESSION['session_id'] = $session_id;	
		}
	}

	$session_id = $_SESSION['session_id'];

	if($session_id != null && $session_id != "")
	{
	?>	
		<script language=JavaScript>
		 	win = window.open('faculty.php?ID=<?=$session_id;?>','_self')
		</script>
	<?php	
	}
}

?>

Link to comment
https://forums.phpfreaks.com/topic/98821-case-sensitive/#findComment-505659
Share on other sites

First, I would recommend not making them case sensitive. In my personal opinion, case should not matter in a username. And, when dealing with an MD5() value of a password, case doesn't matter either.

 

But, if still want case to matter here is the info: http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html

Link to comment
https://forums.phpfreaks.com/topic/98821-case-sensitive/#findComment-505665
Share on other sites

First, I would recommend not making them case sensitive. In my personal opinion, case should not matter in a username. And, when dealing with an MD5() value of a password, case doesn't matter either.

 

But, if still want case to matter here is the info: http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html

 

Hi rhodesa what is the best way in a username and password?

Link to comment
https://forums.phpfreaks.com/topic/98821-case-sensitive/#findComment-505680
Share on other sites

First, I would recommend not making them case sensitive. In my personal opinion, case should not matter in a username. And, when dealing with an MD5() value of a password, case doesn't matter either.

 

But, if still want case to matter here is the info: http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html

 

Hi rhodesa what is the best way in a username and password?

 

I don't understand your question.

 

To elaborate on what I said before, I feel if I register my username as Rhodesa, I should be able to log in as RHODESA,rhodesa,Rhodesa,etc. On the same note, I wouldn't want someone else to be able to register the same username as me, but with a different case, as to prevent from confusion.

 

MD5() returns a hash that is a 32-character hexadecimal like this: 5f4dcc3b5aa765d61d8327deb882cf99. With hexadecimal, upper and lower case letters are equivalent.

 

Does that answer your question?

Link to comment
https://forums.phpfreaks.com/topic/98821-case-sensitive/#findComment-505690
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.