I have a chunk of code for password protect a php page but want to be able to add more then one field for this and dont know how to do it. want to be able to add as many log in details as i like for each user. the code inside of the ( ) fields has been added by me for demo reasons. how do I add $username2 $username3 and so on...> to the IF statement so it will log in user by custom password?? thanks Jeff // Define your username and password $username = "user1"; $password = "pass1"; ($username2 = "user2"; ) ($password2 = "pass2"; ) if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {
First you should use associative array. key => value (user=>pass) Next you need to compare your POST results with elements of you array in a cycle
sorry... I should have said I know very little about php. I dont understand what that means. can you show me how? Thanks