This repository was archived by the owner on Jan 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbrowse.php
More file actions
79 lines (76 loc) · 3.08 KB
/
browse.php
File metadata and controls
79 lines (76 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require './config.inc.php';
require './header.inc.php';
$id = $_GET['id'];
read_passwd_file($id);
if (isset($_GET['userid'])) {
$userid = $_GET['userid'];
if (!is_user($htpUser[$userid]['username']))
ht_error("No such user (UserID: $userid)", "Browse Page (Delete)");
echo "<font class=\"tdmain\">User \"".$htpUser[$userid]['username']."\" deleted successfuly</font><p>\n";
$htpUser[$userid]['username'] = '';
$htpUser[$userid]['password'] = '';
$htpUser[$userid]['realname'] = '';
$htpUser[$userid]['email'] = '';
write_passwd_file($id);
read_passwd_file($id);
}
?>
<script language="JavaScript">
function delUser(userid) {
cf = confirm("Are you sure you want to delete this user?");
if (cf) {
document.location = "browse.php?id=<?php echo $id ?>&userid="+userid+"&sid=<?php echo random() ?>";
}
}
</script>
<table border="0" cellspacing="3" cellpadding="2" width="600">
<tr>
<td colspan="5" width="100%" align="left" class="tdheader"><?php echo $cfgProgName.' '.$cfgVersion ?></td>
</tr>
<tr>
<td colspan="5" width="100%" align="left" class="tdheader">[ <?php echo $cfgHTPasswd[$id]['D'] ?> ]</td>
</tr>
<tr>
<td align="left" class="tdheader"># Username</td>
<td align="left" class="tdheader">Realname</td>
<td align="left" class="tdheader">E-Mail</td>
<td align="center" class="tdheader">Edit</td>
<td align="center" class="tdheader">Delete</td>
</tr>
<?php
$htpCount = 0;
for ($userid = 0; $userid < count($htpUser); $userid++) {
$bgcolor = "#EEEEEE";
if ($userid % 2) $bgcolor = "#FFFFFF";
if (!empty($htpUser[$userid]['username'])) {
$htpCount++;
echo " <tr>\n".
" <td bgcolor=\"$bgcolor\" align=\"left\" class=\"tdmain\"><b>".($userid+1).")</b> ".$htpUser[$userid]['username']."</td>\n".
" <td bgcolor=\"$bgcolor\" align=\"left\" class=\"tdmain\">".$htpUser[$userid]['realname']."</td>\n".
" <td bgcolor=\"$bgcolor\" align=\"left\" class=\"tdmain\">".$htpUser[$userid]['email']."</td>\n".
" <td bgcolor=\"$bgcolor\" align=\"center\" class=\"tdmain\"><a href=\"edit.php?id=$id&userid=$userid&sid=".random()."\">[ Edit ]</a></td>\n".
" <td bgcolor=\"$bgcolor\" align=\"center\" class=\"tdmain\"><a href=\"javascript:delUser('$userid')\">[ Delete ]</a></td>\n".
" </tr>\n";
}
}
if ($htpCount < 1) {
echo " <tr>\n".
" <td colspan=\"5\" bgcolor=\"$bgcolor\" width=\"100%\" align=\"left\" class=\"tdmain\">This .htpasswd file is empty</td>\n".
" </tr>\n";
}
?>
</table>
<table border="0" cellspacing="3" cellpadding="2" width="600">
<tr>
<td width="100%" align="left" class="tdmain">[
<a href="index.php?<?php echo random() ?>">Main Page</a> |
Browse User List |
<a href="add.php?id=<?php echo $id ?>&sid=<?php echo random() ?>">Add New User</a> |
<a href="view-htpasswd.php?id=<?php echo $id ?>&sid=<?php echo random() ?>">View .htpasswd file</a> |
<a href="create-htaccess.php?id=<?php echo $id ?>&sid=<?php echo random() ?>">Create a Simple .htaccess File</a> ]</td>
</tr>
</table>
<?php
require './footer.inc.php';
?>