Example #1
0
<?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();
?>
";
Example #2
0
function write_passwd_file($filenum)
{
    global $cfgHTPasswd, $htpUser;
    init_passwd_file($filenum, "write_passwd_file");
    if ($fpHt = fopen($cfgHTPasswd[$filenum]['N'], "w")) {
        for ($i = 0; $i < count($htpUser); $i++) {
            if (!empty($htpUser[$i]['username'])) {
                fwrite($fpHt, $htpUser[$i]['username'] . ":" . $htpUser[$i]['password'] . ":" . $htpUser[$i]['realname'] . ":" . $htpUser[$i]['email'] . "\n");
            }
        }
        fclose($fpHt);
    } else {
        ht_error("Could not open " . $cfgHTPasswd[$filenum]['N'] . " file for reading", "write_passwd_file");
    }
    return;
}
Example #3
0
require './header.inc.php';
if (empty($_SERVER['REQUEST_METHOD'])) {
    $method = $REQUEST_METHOD;
} else {
    $method = $_SERVER['REQUEST_METHOD'];
}
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    $id = $_GET['id'];
    $userid = $_GET['userid'];
} else {
    $id = $_POST['id'];
    $userid = $_POST['userid'];
}
read_passwd_file($id);
if (!is_user($htpUser[$userid]['username'])) {
    ht_error("No such user (UserID: {$userid})", "Edit Page");
}
if (isset($_POST['submit'])) {
    $password = trim($_POST['password']);
    $passwordv = trim($_POST['passwordv']);
    $realname = trim($_POST['realname']);
    $realname = ucwords($realname);
    $email = trim($_POST['email']);
    $email = strtolower($email);
    if (is_valid_string($password)) {
        echo "<font class=\"tdmain\">New Password contains bad characters</font><p>\n";
    } elseif (is_valid_string($passwordv)) {
        echo "<font class=\"tdmain\">New Password (Verify) contains bad characters</font><p>\n";
    } elseif ($password != $passwordv) {
        echo "<font class=\"tdmain\">Passwords don't match</font><p>\n";
    } elseif (is_valid_realname($realname)) {