My problem was solved no need to argue. I don't see why use a while
loop with a count variable when it produces the same result as a
foreach loop. As for using a break in the loop, I could add it but the
loop is gonna stop anyway as soon as it hits the end of the array. I
also didn't see the point in using the explode() function as long as I
remove the (in my opinion) useless index numbers from the text file
containing the username. The following code works as I expect it to:

        $users = file("../inc/");
                if(!empty($_POST['username']) && !empty($_POST['password'])){
                                foreach($users as $row){
                                        $row = trim($row);
                                        if($_POST['username'] == $row){
                                                $_SESSION['logged_in'] = 1;
                                                $_SESSION['username'] = $row;
                                if($_SESSION['logged_in'] != 1){
                                        $error = "2";
                                $error = "4";
                        $error = "3";

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to