I am making a script that is for a local baseball league...its gonna keep track of the standings and junk...its not mission critical data so I am using txt files, for the simplicity of it. so I have this code:
<?
function loginform(){
echo "<form method=\"POST\" action=\"index.php?pg=admin&action=login\">",
"Username: <input type=\"text\" name=\"username\" size=\"15\">",
"<br>",
" Password: <input type=\"password\" name=\"userpass\" size=\"15\">",
"<br>",
"<input type=\"hidden\" name=\"passed\" value=\"yes\">",
"<input type=\"submit\" name=\"login\" value=\"Login\">",
"</form>";
}
if(!isset($_POST['passed'])){
echo "Type your username and password below:<br>";
loginform();
} else {
$fp = fopen("admins.txt", "r");
$contents = fread($fp, filesize("admins.txt"));
fclose($fp);
$admininfo = explode(":","$contents");
if($_POST['username'] == $admininfo['0'] && md5($_POST['userpass']) == $admininfo['1']){
echo "Your Logged In!";
} else {
if($_POST['username'] !== $admininfo['0']){
echo "<b>The username you specified does not exist!</b>";
$wrongname = "yes";
loginform();
}
if($wrongname !== "yes"){
if($_POST['username'] == $admininfo['0'] && md5($_POST['userpass']) !== $admininfo['1']){
echo "<b>The password you entered is incorrect!</b>";
loginform();
}
}
}
}
?>
and then admins.txt that looks like this
shawn🙁32 digit md5 hash...)
how can I make it so that when it checks the username that it is not case sensitive?
because if I log in with Shawn...it doesnt work
but shawn does!