Advertisement
M4_HAX0R

htaccess authentication generator

Feb 4th, 2016
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.18 KB | None | 0 0
  1. <br />
  2. <center>
  3. <img src="https://media4.giphy.com/media/ktW8FqKodoPUk/200_s.gif"/><br />
  4. <br />
  5. <form method="POST">
  6. <big>Path: </big><input type='text' size='30' name='p' placeholder='/home/.../.../'/><br />
  7. <big>Username: </big><input type='text' size='10' name='u' placeholder='m4_haxor'/>
  8. <big>Password: </big><input type='password' size='20' name='pd'/>
  9. <input type='submit' value='>>'/>
  10. <br /><br />
  11. <?php
  12. #M4_HAX0R
  13. @set_time_limit(0);
  14. error_reporting(0);
  15.  
  16. if(isset($_POST['p']) && isset($_POST['u']) && isset($_POST['pd'])){
  17.     $user = trim($_POST['u']);
  18.     $password = trim($_POST['pd']);
  19.     $p = trim($_POST['p']);
  20. }else{
  21.     die('<big>OH DID YOU<br />FORGET?</big>');
  22. }
  23.  
  24. $nwpd = crypt($password, base64_encode($password));
  25. $passwd = "$user:$nwpd";
  26. ////
  27. $acces = 'AuthType Basic
  28. AuthName "Password Protected Area"
  29. AuthUserFile '.$p.'\.htpasswd
  30. Require valid-user';
  31. ////
  32. $f = fopen($p.'.htpasswd', 'w');
  33. if($f){ fwrite($f, $passwd); }
  34. else{ die('<big>ERRORS<br />ERRORS EVERYWHERE</big>'); }
  35. ///
  36. unset($f);
  37. $f = fopen($p.'.htacces', 'w');
  38. if($f){ fwrite($f, $acces); }
  39. else{ die('<big>ERRORS<br />ERRORS EVERYWHERE</big>'); }
  40.  
  41. echo'<big>MY JOB HERE IS DONE</big>';
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement