Exemple #1
0
$pagearray = array();
$pagearray['title'] = $bhlang['install:title:bytehoard_installation'] . " :: " . $bhlang['install:title:create_administrator'];
# Random string function. Author: Aidan Lister <aidan at php dot net>.
# From http://aidan.dotgeek.org/lib/?file=function.str_rand.php
function str_rand($length = 8, $seeds = 'abcdefghijklmnopqrstuvwxyz0123456789')
{
    $str = '';
    $seeds_count = strlen($seeds);
    // Seed
    list($usec, $sec) = explode(' ', microtime());
    $seed = (double) $sec + (double) $usec * 100000;
    mt_srand($seed);
    // Generate
    for ($i = 0; $length > $i; $i++) {
        $str .= $seeds[mt_rand(0, $seeds_count - 1)];
    }
    return $str;
}
require_once "../config.inc.php";
require_once "../includes/db/" . $dbconfig['dbmod'];
require_once "../includes/filesystem/filesystem/filesystem.inc.php";
require_once "../includes/users.inc.php";
require_once "../includes/configfunc.inc.php";
bh_loadconfig();
# Create administrator user with random password and add to database
$adminuser = "******";
$adminpass = str_rand();
bh_adduser($adminuser, $adminpass, "/" . $adminuser, "admin");
$pagearray['content'] = $bhlang['install:createadmin:explain'] . "<br><br>" . $bhlang['label:username'] . " " . $adminuser . "<br>" . $bhlang['label:password'] . " " . $adminpass;
$pagearray['continue'] = 1;
return $pagearray;
Exemple #2
0
# FileLink/FileMail functions
# File array
$file = file($_GET['file']) or die("I'm sorry. That isn't a valid file.");
# Loooop through
foreach ($file as $num => $line) {
    if (substr($line, 0, 1) == "#" || substr($line, 0, 1) == ";" || trim($line) == "") {
    } else {
        $linearray = explode(",", $line);
        if (empty($linearray[0])) {
            die("No username provided! Line " . ($num + 1));
        } elseif (empty($linearray[1])) {
            die("No password provided! Line " . ($num + 1));
        } elseif (empty($linearray[2])) {
            die("No email provided! Line " . ($num + 1));
        } else {
            $userrows = select_bhdb("users", array("username" => $linearray[0]), "");
            if (empty($userrows)) {
                if (empty($linearray[4])) {
                    $linearray[4] = "normal";
                }
                bh_adduser($linearray[0], $linearray[1], bh_fpclean("/" . $linearray[0]), $linearray[4]);
                insert_bhdb("userinfo", array("username" => $linearray[0], "itemname" => "fullname", "itemcontent" => empty($linearray[3])));
                insert_bhdb("userinfo", array("username" => $linearray[0], "itemname" => "email", "itemcontent" => empty($linearray[2])));
                echo "User " . $linearray[0] . " added! <br>\n\r";
            } else {
                echo "User " . $linearray[0] . " exists, not added. <br>\n\r";
            }
        }
    }
}
echo $num + 1 . " lines processed. Finished.";