Guest User

Untitled

a guest
Nov 24th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit']))
  3. {
  4. $username = $_POST['username'];
  5. if (file_exists($dirname)) {
  6. echo "Name already taken.";
  7. } else {
  8. mkdir($username, 0755);
  9. }
  10. fopen(".$username./.htaccess", "r+");
  11. $content = "AuthUserFile /.htpasswd\nAuthType Basic\n\nrequire user $username";
  12. file_put_contents(".$username./.htaccess",
  13. echo "Please <a href='$username'>click here</a> to login.";
  14. }
  15. ?>
  16. <!DOCTYPE HTML>
  17. <head>
  18. <meta charset="UTF-8">
  19. <title>Register</title>
  20. </head>
  21. <body>
  22. <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
  23. Username: <input type="text" name="username"><br>
  24. Password: <input type="password" name="password"><br>
  25. <input type="submit" name="submit" value="submit">
  26. </body>
  27. </html>
Add Comment
Please, Sign In to add comment