]> git.treefish.org Git - banana.git/blob - admin/password.php
added next session to summary.
[banana.git] / admin / password.php
1 <?php
2   require 'include/head.inc';
3   require 'include/common.inc';
4
5   if(isset($_POST['submit']) && $_POST['password']!="") {
6
7     $fh_pass = fopen(".htpasswd", 'w');
8     fwrite($fh_pass, "admin:" . crypt($_POST['password'], base64_encode($_POST['password'])) . "\n");
9     fclose($fh_pass);
10
11     $fh_access = fopen(".htaccess", 'w');
12     fwrite($fh_access, "AuthUserFile " . getcwd() . "/.htpasswd\n");
13     fwrite($fh_access, "AuthGroupFile /dev/null\n");
14     fwrite($fh_access, "AuthName \"Banana Admin\"\n");
15     fwrite($fh_access, "AuthType Basic\n");
16     fwrite($fh_access, "require user admin\n");
17     fclose($fh_access);
18
19     block("lightgreen", "admin password set");
20     exit;
21   }
22 ?>
23
24 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
25   <table bgcolor="black">
26     <tr><th><b><font color="white">set admin password</font></b></th><tr>
27   </table>
28
29   <table>
30     <tr>  
31       <th align="left">Password:</th> <th><input type="text" name="password"></th>
32     </tr>
33   
34     <tr>
35       <th></th><th align="right" columnspan=2><input type="submit" name="submit" value="Set"></th>
36     </tr>
37   </table>
38 </form>