Page 2 of 2

Posted: Mon Nov 01, 2004 5:04 pm
by rehfeld
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:


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';
}






?>

Posted: Tue Nov 02, 2004 8:22 am
by attackle98
so i just need to add lines 11,12,13 to the code for it to work or did you add something else that i need to add to the code?

Posted: Tue Nov 16, 2004 9:54 am
by attackle98
ok........