I was trying to check username in my login form that when someone puts username which is not exactly the same with the registered username, he/she will fail to login. Example. . Registered username is tEst and password is test, when someone tried to log in using "test" as username it will not log in because letter "e" must be "E". So it should be "tEst". How will i'am going to verify that?
Checking username(upper and lower)
Collapse
X
-
Originally posted by arevel View Posttry strtolower($username);
so the user is able to use both upper and lower case at same time.<?php
include ('Ghost');
if ($Post == true) {
echo '
sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '
alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
Comment
-
Hai bro, there is a function in PHP to compare the case of two strings..use strcmp();
PHP Code:$str1 = "TesT";
$str2 = "Test";
$true = strcmp($str1,$str2);
if($true==0){
echo "Two strings are identical";
} else {
echo "Two strings are not identical";
}
hope this will solve your problem.
I'm Proud to be a Sri Lankan!
Comment
-
Originally posted by nimeshka View PostHai bro, there is a function in PHP to compare the case of two strings..use strcmp();
PHP Code:$str1 = "TesT";
$str2 = "Test";
$true = strcmp($str1,$str2);
if($true==0){
echo "Two strings are identical";
} else {
echo "Two strings are not identical";
}
hope this will solve your problem.
strcmp() is case sensitive, strcasecmp() is case insensitive.<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
Comment
Comment