Пример #1
0
 $passwd = randString(10);
 //$hash = $hasher->HashPassword($passwd);
 // Create user
 $ch = makeCurlLogin(ADMIN_USER_, ADMIN_PASSWD_);
 createUser($ch, $username, $passwd);
 unset($ch);
 // Make login with newly generated user - the groups won't work before the user has logged in once
 $ch = makeCurlLogin($username, $passwd);
 makeInitialActions($ch);
 // The real login really makes that twice...
 makeInitialActions($ch);
 unset($ch);
 // Make login with admin user and add groups to newly generated user
 if (is_array($group)) {
     $ch = makeCurlLogin(ADMIN_USER_, ADMIN_PASSWD_);
     addGroups($ch, $group, $username);
     unset($ch);
 }
 // Set Email
 setConfig($db, $username, 'settings', 'email', $email);
 // Set Timezone
 if (TIMEZONE_ != '-1') {
     if ($timezone == '') {
         $timezone = TIMEZONE_;
     }
     setConfig($db, $username, 'calendar', 'timezone', $timezone);
 }
 // Set Firstday
 if (FIRSTDAY_ != '-1') {
     if ($firstday == '') {
         $firstday = FIRSTDAY_;
Пример #2
0
     if (!preg_match("/encrypt/i", $dbPassword)) {
         $dbPassword = "******";
     }
     // we now perform the same check but for an MD5-Password attribute
 } elseif (preg_match("/md5/i", $passwordtype)) {
     // if we don't find the md5 function even though we identified
     // a MD5-Password attribute
     if (!preg_match("/md5/i", $dbPassword)) {
         $dbPassword = "******";
     }
 }
 // insert username/password
 $sql = "INSERT INTO " . $configValues['CONFIG_DB_TBL_RADCHECK'] . " (id,Username,Attribute,op,Value) " . " VALUES (0, '" . $dbSocket->escapeSimple($username) . "', '" . $dbSocket->escapeSimple($passwordtype) . "', ':=', {$dbPassword})";
 $res = $dbSocket->query($sql);
 $logDebugSQL .= $sql . "\n";
 addGroups($dbSocket, $username, $profiles);
 addPlanProfile($dbSocket, $username, $planName);
 addUserInfo($dbSocket, $username);
 $userbillinfo_id = addUserBillInfo($dbSocket, $username);
 // create any invoices if required (meaning, if a plan was chosen)
 if ($planName) {
     include_once "include/management/userBilling.php";
     // get plan information
     $sql = "SELECT id, planCost, planSetupCost, planTax FROM " . $configValues['CONFIG_DB_TBL_DALOBILLINGPLANS'] . " WHERE planName='" . $dbSocket->escapeSimple($planName) . "' LIMIT 1";
     $res = $dbSocket->query($sql);
     $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
     // calculate tax (planTax is the numerical percentage amount)
     $calcTax = (double) ($row['planCost'] * (double) ($row['planTax'] / 100));
     $invoiceItems[0]['plan_id'] = $row['id'];
     $invoiceItems[0]['amount'] = $row['planCost'];
     $invoiceItems[0]['tax'] = $calcTax;
Пример #3
0
            // insert username/password
            $sql = "INSERT INTO " . $configValues['CONFIG_DB_TBL_RADCHECK'] . " (id,Username,Attribute,op,Value) " . " VALUES (0, '" . $dbSocket->escapeSimple($macaddress) . "', 'Auth-Type', ':=', 'Accept')";
            $res = $dbSocket->query($sql);
            $logDebugSQL .= $sql . "\n";
            addGroups($dbSocket, $macaddress, $group_macaddress);
            addUserInfo($dbSocket, $macaddress);
            addUserBillInfo($dbSocket, $username);
            addAttributes($dbSocket, $macaddress);
            $successMsg = "Added to database new mac auth user: <b> {$macaddress} </b>";
            $logAction .= "Successfully added new mac auth user [{$macaddress}] on page: ";
        } elseif ($authType == "pincodeAuth") {
            // insert username/password
            $sql = "INSERT INTO " . $configValues['CONFIG_DB_TBL_RADCHECK'] . " (id,Username,Attribute,op,Value) " . " VALUES (0, '" . $dbSocket->escapeSimple($pincode) . "', 'Auth-Type', ':=', 'Accept')";
            $res = $dbSocket->query($sql);
            $logDebugSQL .= $sql . "\n";
            addGroups($dbSocket, $pincode, $group_pincode);
            addUserInfo($dbSocket, $pincode);
            addUserBillInfo($dbSocket, $username);
            addAttributes($dbSocket, $pincode);
            $successMsg = "Added to database new pincode: <b> {$pincode} </b>";
            $logAction .= "Successfully added new pincode [{$pincode}] on page: ";
        } else {
            echo "unknown authentication method <br/>";
        }
    } else {
        $failureMsg = "user already exist in database: <b> {$username} </b>";
        $logAction .= "Failed adding new user already existing in database [{$username}] on page: ";
    }
    include 'library/closedb.php';
}
include_once 'library/config_read.php';