Guest User

Untitled

a guest
Sep 12th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. Comparing strings does not work php
  2. <?php
  3. $user = $_POST['myusername'];
  4. $pass = $_POST['mypassword'];
  5. $file_handle = fopen("db.txt", "rb");
  6. while (!feof($file_handle)){
  7. $line_of_text = fgets($file_handle);
  8. $parts = explode('=', $line_of_text);
  9. if($parts[0] == $user){
  10. echo $parts[0];
  11. }
  12. if($parts[1] == $pass){
  13. echo $parts[1];
  14. }
  15. }
  16. fclose($file_handle);
  17. ?>
  18.  
  19. if(trim($parts[0]) == trim($user)){
  20. echo $parts[0];
  21. }
  22. if(trim($parts[1]) == trim($pass)){
  23. echo $parts[1];
  24. }
Add Comment
Please, Sign In to add comment