Jump to content
The Uniform Server Community

Username problem


Tucker
 Share

Recommended Posts

I am trying to figure out a way so i can allow people to use their username with the worry of caps lock on. any suggestions?

Link to comment
Share on other sites

What are you building? Is it in PHP??

 

if ( $_REQUEST['username'] === "JoHn SmItH")

 

That would match EXACTLY in PHP.

ATOMIC Web Hosting 2007 - 2011

Shared Hosting - Reseller Hosting - Dedicated Servers - Virtual Private Servers (Request Dedicated/VPS Servers via E-mail)

E-mail: sales@atomicwebhosting.com Website: http://www.atomicwebhosting.com/

Link to comment
Share on other sites

oh sorry yes. i am making a new site and i am trying to make it so people can use the username without the worry of case sensitivity.

 

Ie, someone types tuCker and can loging it with that matches tucker.

Link to comment
Share on other sites

The caps lock key is a real pain. For home users why not turn it into something that is more useful. Take a look at ClipControl turns that caps lock key into a clipboard control key.

 

http://sourceforge.net/project/downloading...xe&47440710

 

Additional information:

http://clipcontrol.anticapslock.com/

 

The ideal solution would be to disable the key using PHP; a user visiting your site would not then have this problem. The bottom line, you cant in any version of PHP or in future versions (security risk).

 

If a user accidentally hits the caps lock key that person will have problems not only entering a user name but also a password and any forms they fill in. I mention passwords because ideally these contain both upper and lowercase characters along with digits (security).

 

Mixed case characters in a name are easy to handle just convert all characters to either upper or lower case and then perform a comparison. You can do the same with a password (note this reduces security). I have assumed you just want to do this for web pages and not server access. If this is the case you need to use something similar to this:

 

Save as form.html

 

<html>
<head>
<title>Test form</title>
</head>
<body >
<p>Please enter your name<p/>
<form action="check.php" method="post" >
User Name: <input type="text" name="Name" value="Mike SmITH" />
<p>Calls page check.php</p>
<input value="Enter" type="submit">
</form>
</body>
</html>

 

Save as check.php

 

<html>
<head>
<title>Check</title>
</head>
<body >
<?
$some_name = $_REQUEST['Name']; //read name
$upper_case_name = strtoupper($some_name); // convert to upper case

echo "Your name is : <b> $some_name</b><br>";
echo "Your name is : <b> $upper_case_name</b><br>";
if($upper_case_name == "MIKE SMITH"){
echo "Your name is valid welcome<br>";
}
else{
echo "Your name is invalid!!!<br>";
}

?>
<p><a href="form.html">Back to form page form.html</a></p>

</body>
</html>

 

The above is just an example what you use depend on the application.

 

It will not resolve the form-filling problem. :lol:

Link to comment
Share on other sites

Oops, Sorry I misread your initial question. The code Ric posted is what you want.

ATOMIC Web Hosting 2007 - 2011

Shared Hosting - Reseller Hosting - Dedicated Servers - Virtual Private Servers (Request Dedicated/VPS Servers via E-mail)

E-mail: sales@atomicwebhosting.com Website: http://www.atomicwebhosting.com/

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
 Share

×
×
  • Create New...