tarun Posted April 10, 2007 Share Posted April 10, 2007 users.txt user1|||pass1 user2|||pass2 user3|||pass3 login.php <?php $user = $_POST["u"]; $pass = $_POST["p"]; $db = file("users.txt"); foreach($db as $key => $val) { $data[$key] = explode("|||", $val); } for($k = 0; $k < sizeof($db); $k++) { $u = $data[$k][0]; $p = $data[$k][1]; if ( $u == "$user" ) { if ( $p == "$pass" ) { echo 'You Are Now Logged In As: '.$u.''; } else { echo 'Username And Password Do Not Match'; } } } ?> The If Statement Doesn't Work I Get The Error: "Username And Password Do Not Match" Even If The Username And Password Are Actually Right AnyHelp? Thnx, Tarun Link to comment https://forums.phpfreaks.com/topic/46476-solved-arrays-and-if-statements/ Share on other sites More sharing options...
tarun Posted April 10, 2007 Author Share Posted April 10, 2007 Sorry Made An Unnesscary Topic Ive Been Helped With This Before Please Forgive Me Link to comment https://forums.phpfreaks.com/topic/46476-solved-arrays-and-if-statements/#findComment-226086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.