Advertisement
AmarioTommaso

file_get_contents doesn't get contents.

Apr 21st, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. $UserName = $_POST["UserName"];
  2. $UserEmail = $_POST["UserEmail"];
  3. $UserPassword = $_POST["UserPassword"];
  4. // Collecting all 3 inputs succesfully.
  5.  
  6. $User = $UserName;
  7. // still don't know why but that's it.
  8.  
  9. $UserTempFile = FOpen("TempFile ".$User.".txt", "w");
  10. // File opens exactly as expected.
  11.  
  12. If ($UserName && $UserEmail && $UserPassword)
  13. // Checks for errors having to do with those Vars.
  14. {
  15.     FWrite($UserTempFile, $UserName. "\n" .$UserEmail. "\n" .$UserPassword);
  16.     // $UserTempFile gets loaded witht he inputs just fine.
  17.  
  18.     If ((Is_String($UserName && $UserEmail && $UserPassword)))
  19.     // Yup, they're strings and confirmed so.
  20.     {
  21.         $UserFile = FOpen($User.".txt", "w");
  22.         // File opens but stays empty.
  23.        
  24.         $UserData = file_get_contents($UserTempFile,true);
  25.         // $UserData stays empty in all cases.
  26.         // Tested with Ifs and checking the file but still empty.
  27.        
  28.         FWrite($UserFile, $UserData);
  29.         // It has nothing to write on $UserFile cause $UserData stays empty.
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement