On Wed, 26 Jul 2006 17:01:51 +0200, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote: >> I sure wont. >> On the topic of my array, what would be an efficient way of checking my > username/passwordd pairs match the user input form my login form. >> The text file contains username and passwords in the following format: >> username1,password1 >> username2,password2 > > I dunno, something like this maybe: > > $u = trim($_POST['usr']); > $p = trim($_POST['pwd']); > > $lines = file('/you/pwd/file'); > $users = array(); > foreach ($lines as $line) { > list($usr, $pwd) = explode(',',$line); > $users[ $usr ] = $pwd; > } > > if (isset($users[ $u ]) && ($users[ $u ] === $p)) { > echo "Found {$u}, and password is correct."; > } That works very well. Thanks Jochem. Eoghan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php