Hello all, I have a question that is more based off of a unique occurrence (unique for me having no real prior php knowledge).
I am trying to create a webpage where a user inputs a password, and a php reads the user inputed key and then compares it to an array of "acceptable" keys. If the key is real, you move on, if not you get an error. When I try various keys, I have noticed something interesting...
Keys in the following format work:
aaaaaaaaaaaaaaaaaaaaaaaaa
HHHHHHHHHHHHHHHHHHHHHHHHH
Keys like this do not work:
ahahahahahahahhahahahhaha
Basically any key that is not the same case & character the whole way through will not work, and I do not understand why. Here is my php, any help is much appreciated.
<html>
<head>
<title> pC </title>
</head>
<body>
<h1 align="center"> This is a heading in html </h1>
<br>
<?php
$var_inputPassword = ($_POST["Pword"]);
?>
<?php
$myFile = "passwords.txt";
$fh = fopen($myFile, 'r');
$var_data = fread($fh, filesize($myFile));
fclose($fh);
$var_list = explode("\n",$var_data);
?>
<?php
if (in_array($var_inputPassword , $var_list, TRUE))
{
//redirect to survey
echo ( '<meta http-equiv="REFRESH" content="0;url=WinthropPoll01.html">');
}
else
{
//redirect to index2.html
echo ( '<meta http-equiv="REFRESH" content="0;url=index2.html">');
}
?>
</body>
</html>