Вход Регистрация
Файл: modules/users/admin.php
Строк: 370
<?php

if ($Siteman->userinfo["level"] >= 4) {
    
    switch (
$mdo) {
        
        case 
"import":
            echo
"<br /><b>Import Siteman 1.1.x user accounts</b><br /><br />
            If you are upgrading from Siteman 1.1.x and want to preserve the accounts for users that registered on your Siteman 1.1.x website, you can import these accounts into your Siteman 2 database. To do this, you will first have to download the members.txt file from the 'data' folder in your Siteman 1.1.x website, and then follow the instructions given here.<br /><br />
            <b>Note:</b><br />
             - accounts that seem to be damaged/corrupt will not be imported<br />
             - accounts with username/email adress that are already registered on this site will not be imported<br />
             - importing large user databases can take a lot of time<br />
             - the file must be named members.txt<br />
             - uploading a file that does not contain Siteman 1.1.x user accounts may in some special cases give unwanted results.<br />
             - the level 5 user (Site owner) will not be imported<br /><br />
             <b>Upload members.txt file:</b><br />
             <form enctype="
multipart/form-data" action="admin.php?module=users&amp;mdo=importusers" method="post">
             <table cellspacing="
0" cellpadding="1">
             <tr><td><input type="
file" name="usersfile" size="30" /></td><td><input type="submit" value="Import" /></td></tr></table></form>";
        break 
1;
        
        case 
"importusers":
            if (isset(
$_FILES["usersfile"])) {
                if (
$_FILES["usersfile"]["name"] == "members.txt") {
                    if (
$_FILES["usersfile"]["size"] > 0) {
                        echo
"<b>Importing Siteman 1.1.x user accounts</b><br /><br />";
                        
$members_file file($_FILES["usersfile"]["tmp_name"]);
                        
$imports 0;
                        
$nimps 0;
                        
$start time();
                        foreach (
$members_file as $accounts) {
                            
$account explode("|",$accounts);
                            if (
$account[3] < 5) {
                                echo
"Importing account ".$account[1]."...".str_repeat("    ",1024);
                                if (
count($account) >= 10 && strlen($account[2]) == 32 && substr_count($account[4],"@") == 1) {
                                    
$exists $db->select(array("table" => "users","db" => "siteman","where" => array("strLower(username) = ".strtolower($account[1]),"OR","strLower(email) = ".strtolower($account[4]))));
                                    if (
strtolower($account[1]) == $exists[0]["username"]) {
                                        
$nimps++;
                                        echo
"<span class="nok">Error: Account with that username already exists</span><br />";
                                    }
                                    else if (
strtolower($account[4]) == $exists[0]["email"]) {
                                        
$nimps++;
                                        echo
"<span class="nok">Error: Account with that email adress already exists</span><br />";
                                    }
                                    else {
                                        
$imports++;
                                        
$db->insert(array("table" => "users","db" => "siteman","values" => array("username" => $account[1],"password" => $account[2],"email" => $account[4],"level" => $account[3],"hide_email" => $account[9],"forum_posts" => $account[11],"forum_signature" => $account[12],"squest" => $account[7],"sanswer" => $account[8])));
                                        echo
"<span class="ok">Done.</span><br />";
                                    }
                                }
                                else {
                                    
$nimps++;
                                    echo
"<span style="color:#CC0000;">Error: invalid account</span><br />";
                                
}
                            }
                        }
                        echo
"<br />Updating table 'last_online', please wait...".str_repeat("    ",1024);
                        
$accounts $db->select(array("table" => "users","where" => array("joined >= $start")));
                        foreach (
$accounts as $gl) {
                            
$db->insert(array("table" => "last_online","values" => array("id" => $gl["id"],"last_online" => 0)));
                        }
                        echo
"Done.<br /><br />$imports accounts imported<br />
                        
$nimps accounts were not imported.<br />
                        <a href="
admin.php?module=users">Done</a>";
                    }
                    else {
                        echo
"ERROR: uploaded file was empty";
                    }
                }
                else {
                    echo
"ERROR: the file must be named members.txt";
                }
            }
            else {
                echo
"ERROR: No file uploaded";
            }
        break 
1;
    
        case 
"edituser":
        if (isset(
$_GET["uid"])) {
            
$where = array("id = ".$_GET["uid"]);
        }
        else {
            
$where = array("strLower(username) = ".strtolower($_POST["uname"]));
        }
        
$user $db->select(array("table" => "users","db" => "siteman","where" => $where));
        if (
strlen($user[0]["username"]) > 0) {
            if (
$Siteman->userinfo["level"] > $user[0]["level"]) {
                
$last_online $db->select(array("table" => "last_online","db" => "siteman","where" => array("id = ".$user[0]["id"])));
                echo
"<br /><br /><b>Editing user account '".$user[0]["username"]."'</b><br /><br />
                User registered: "
.date($Siteman->settings["long_dateformat"],($user[0]["joined"]+$Siteman->settings["timezone_offset"]))."<br />
                Last online: "
;
                if (
$last_online[0]["last_online"]) {
                    echo 
date($Siteman->settings["long_dateformat"],$last_online[0]["last_online"]);
                }
                else {
                    echo
"never";
                }
                if (
strlen($msgs) > 0) {
                    echo
"<br /><br /><b>$msgs</b>";
                }
                echo
"<br /><br />
                <form action="
admin.php?module=users&amp;mdo=saveaccount&amp;uid=".$user[0]["id"]."" method="post">
                <table cellspacing="
0" cellpadding="2"><tr><td>Username</td><td><input type="text" name="uname" size="30" value="".$user[0]["username"]."" /></td></tr>
                <tr><td>Password (don't enter unless you are changing it)</td><td><input type="
password" name="pass" size="30" /></td></tr>
                <tr><td>Repeat new password</td><td><input type="
password" name="rpassword" size="30" /></td></tr>
                <tr><td>Level</td><td><table cellspacing="
0" cellpadding="1"><tr><td><input type="radio" name="level" value="4"";
                if (
$user[0]["level"] == 4) { echo" checked"; }
                echo
" /></td><td>4 (Administrator)</td></tr>
                <tr><td><input type="
radio" name="level" value="3"";
                if (
$user[0]["level"] == 3) { echo" checked"; }
                echo
" /></td><td>3 (Author)</td></tr>
                <tr><td><input type="
radio" name="level" value="2"";
                if (
$user[0]["level"] == 2) { echo" checked"; }
                echo
" /></td><td>2 (Member)</td></tr></table></td></tr>
                <tr><td>Email adress</td><td><input type="
text" name="email" value="".$user[0]["email"]."" size="30" /></td></tr>
                <tr><td>Forum Signature</td><td><input type="
text" name="fsign" size="30" value="".$user[0]["forum_signature"]."" /></td></tr>
                <tr><td>Secret Question (asked to the user if he/she<br />forgets the password)</td><td><input type="
text" name="squest" size="30" value="".$user[0]["squest"]."" /></td></tr>
                <tr><td>Answer to secret question (don't enter unless<br />you're changing it)</td><td><input type="
password" name="sans" size="30" /></td></tr>
                <tr><td>Repeat answer</td><td><input type="
password" name="repsans" size="30" /></td></tr>
                <tr><td></td><td><input type="
submit" value="Save Account" /></td></tr></table></form>";
            }
            else if (
$Siteman->userinfo["id"] == $user[0]["id"]) {
                echo
"Please go to <a href="index.php?module=users">My Account</a> to change your own account details.";
            }
            else {
                echo
"Access denied: You cannot change accounts for users with same or higher level than yourself.";
            }
        }
        else {
            echo
"Error: Account not found.";
        }
        break 
1;
        
        case 
"deluser":
        
$user $db->select(array("table" => "users","db" => "siteman","where" => array("id = ".$_GET["uid"])));
        if (
strlen($user[0]["username"]) > 0) {
            if (
$Siteman->userinfo["level"] > $user[0]["level"] && $_GET["uid"] != 1) {
                echo
"<br /><br />Are you sure you want to delete user '".$user[0]["username"]."' (".$user[0]["email"].")?<br />
                <br /><br />
                <table cellspacing="
0" cellpadding="0" width="250"><tr><td><form action="admin.php?module=users&amp;mdo=confdeluser&amp;uid=".$_GET["uid"]."" method="post"><input type="submit" name="confirm" value="Yes" /></form></td>
                <td align="
right"><form action="admin.php?module=users"><input type="submit" value="No" /></form></td></tr></table>";
            }
        }
        break 
1;
        
        default:
        
$banned $db->select(array("table" => "users","db" => "siteman","where" => array("level = 0")));
        
$pending $db->select(array("table" => "users","db" => "siteman","where" => array("level = 1")));
        echo
"<a href="admin.php?module=users&amp;mdo=import">Import Siteman 1.1.x user accounts</a><br /><br />
        <b>Edit account with this username:</b><br />
        <form action="
admin.php?module=users&amp;mdo=edituser" method="post">
        <table cellspacing="
0" cellpadding="2">
        <tr><td><input type="
text" name="uname" size="30" /></td><td><input type="submit" value="Edit" /></td></tr></table></form><br /><br />";
        if (
strlen($pending[0]["username"]) > 0) {
            
$pending_count count($pending);
            echo
"<b>New users waiting for their accounts to be validated</b> - $pending_count users<br /><br />
            <table cellspacing="
1" cellpadding="1"><tr><td>Actions</td><td>Username</td><td>Email</td><td>Registered date</td></tr>";
            foreach (
$pending as $user) {
                echo
"<tr><td><a href="admin.php?module=users&amp;mdo=edituser&amp;uid=".$user["id"]."">Edit</a> - <a href="admin.php?module=users&amp;mdo=deluser&amp;uid=".$user["id"]."">Delete</a> - <a href="admin.php?module=users&amp;mdo=validate&amp;uid=".$user["id"]."">Validate</a></td><td>".$user["username"]."</td><td>".$user["email"]."</td><td>".date($Siteman->settings["long_dateformat"],($user["joined"]+$Siteman->settings["timezone_offset"]))."</td></tr>";
            }
            echo
"</table><br /><br />";
        }
        if (
strlen($banned[0]["username"]) > 0) {
            
$banned_count count($banned);
            echo
"<b>Banned users</b> - $banned_count users<br /><br />
            <table cellspacing="
1" cellpadding="1"><tr><td>Actions</td><td>Username</td><td>Email</td><td>Registered date</td></tr>";
            foreach (
$banned as $user) {
                echo
"<tr><td><a href="admin.php?module=users&amp;mdo=edituser&amp;uid=".$user["id"]."">Edit</a> - <a href="admin.php?module=users&amp;mdo=deluser&amp;uid=".$user["id"]."">Delete</a> - <a href="admin.php?module=users&amp;mdo=validate&amp;uid=".$user["id"]."">Remove from ban list</a></td><td>".$user["username"]."</td><td>".$user["email"]."</td><td>".date($Siteman->settings["long_dateformat"],($user["joined"]+$Siteman->settings["timezone_offset"]))."</td></tr>";
            }
            echo
"</table><br /><br />";
        }
        
$members $db->select(array("table" => "users","db" => "siteman","where" => array("level > 1")));
        
$members_count count($members);
        echo
"<b>Registered users with active accounts</b> - $members_count users<br /><br />
        <table cellspacing="
1" cellpadding="1"><tr><td>Actions</td><td>Username</td><td>Email</td><td>Level</td><td>Registered date</td></tr>";
        foreach (
$members as $member) {
            
$action "";
            if (
$member["level"] < 5) {
                if (
$Siteman->userinfo["level"] > $member["level"]) {
                    
$action "<a href="admin.php?module=users&amp;mdo=edituser&amp;uid=".$member["id"]."">Edit</a> - <a href="admin.php?module=users&amp;mdo=deluser&amp;uid=".$member["id"]."">Delete</a> - <a href="admin.php?module=users&amp;mdo=banuser&amp;uid=".$member["id"]."">Ban user</a>";
                }
                else {
                    
$action "<b>This is you -></b>";
                }
            }
            else {
                
$action "<b>This is you -></b>";
            }
            echo
"<tr><td>$action</td><td>".$member["username"]."</td><td>".$member["email"]."</td><td>".$member["level"]."</td><td>".date($Siteman->settings["long_dateformat"],($member["joined"]+$Siteman->settings["timezone_offset"]))."</tr>";
        }
        echo
"</table>";        
        break 
1;
    }

}

?>
Онлайн: 2
Реклама