Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2. if($_SERVER['REQUEST_METHOD'] == 'POST') {
  3. $directorie = './'; //You can change this to ../, or ./users/, just make sure it ends with a slash
  4.  
  5. $fp = fopen($_POST['username'] .".txt", "w") or die("Can not create file"); //Create's the file
  6. fwrite($fp, "Username = ". $_POST['username'] . PHP_EOL ."Password = ". $_POST['password']); //Write's to file
  7. fclose($fp); //Close connection to file
  8. echo 'Done!'; //Display this when they click submit
  9. } else {
  10. echo '<form method="post">';
  11. echo 'Username: <input type="text" name="username" /><br />';
  12. echo 'Password: <input type="password" name="password" /><br />
  13. <input type="submit" value="Submit" />';
  14. echo '</form>';
  15. }
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement