Posted: Mon Nov 01, 2004 5:04 pm
theres plenty of tutroials on how to use databses such as mysql. google will return more results than you could read in a year probably lol. theres prob some good ones on this board as well.
but you dont really need a db to have more than 1 user, heres a sample:
but you dont really need a db to have more than 1 user, heres a sample:
Code: Select all
<?php
$users = array( // add as many as you want
'username1' => 'password1',
'username2' => 'password2',
'username3' => 'password3',
);
$username = $_POST['username'];
$password = $_POST['password'];
$valid_user = false;
foreach ($users as $uname => $upass) {
if (($username === $uname) && ($password === $upass)) {
$valid_user = true;
break;
}
}
if ($valid_user) {
echo 'valid';
} else {
echo 'go away';
}
?>