To create login file require high accuracy so that no bugs that compromise security. One of the things that often happens is the neglect of uppercase or lowercase letters in the username creation. Many ways to resolve the issue. Every programmer has tricks and tips respectively. In this article, I will give you one of the ways to distinguish between the username with uppercase and lowercase. We can harness the ingenuity md5. With md5, character: “admin”, “Admin”, or “ADMIN” can be distinguished well. Now we make the script as follows:
$uname1=$_POST[‘uname’];
$uname2=md5($uname1);
$query=mysqli_query($dbconnect, “SELECT * FROM members WHERE username=’$uname1′”);
if($query){
$row=mysqli_fetch_array($query);
$sqluname=$row[‘username’];
$uname3=md5($sqluname);
if($uname3!=$uname2){
echo “Wrong username”;
}else{
echo “True username”;
}
Filed under: Script PHP | Tagged: capital letters, case sensitive, login, lowercase, uppercase, userid, username |
Tinggalkan Balasan