Beispiel #1
0
 function zb_plfixer($login, $field)
 {
     if ($field == 'emails') {
         zb_UserCreateEmail($login, '');
     }
     if ($field == 'contracts') {
         zb_UserCreateContract($login, '');
     }
     if ($field == 'phones') {
         zb_UserCreatePhone($login, '', '');
     }
     if ($field == 'realname') {
         zb_UserCreateRealName($login, '');
     }
     if ($field == 'userspeeds') {
         zb_UserCreateSpeedOverride($login, '0');
     }
     if ($field == 'nethosts') {
         rcms_redirect("?module=pl_ipchange&username="******"?module=pl_checker&username=" . $login);
 }
Beispiel #2
0
    function zb_SpeedControlGetOverrideUsers()
    {
        $query = "SELECT `login` from `userspeeds` WHERE `speed` NOT LIKE '0'";
        $alloverrides = simple_queryall($query);
        $result = array();
        if (!empty($alloverrides)) {
            foreach ($alloverrides as $io => $eachoverride) {
                $result[] = $eachoverride;
            }
        }
        return $result;
    }
    function zb_SpeedControlFix($login)
    {
    }
    //fixing speed override
    if (isset($_GET['fix'])) {
        $login = vf($_GET['fix']);
        $speed = 0;
        zb_UserDeleteSpeedOverride($login);
        zb_UserCreateSpeedOverride($login, $speed);
        log_register("SPEEDFIX (" . $login . ")");
        $billing->resetuser($login);
        log_register("RESET User (" . $login . ")");
        rcms_redirect("?module=speedcontrol");
    }
    $alloverrides = zb_SpeedControlGetOverrideUsers();
    show_window(__('Users with speed overrides'), web_UsersLister($alloverrides));
} else {
    show_error(__('You cant control this module'));
}
Beispiel #3
0
 $iopts = unserialize(base64_decode($import_opts));
 $netid = $iopts['netid'];
 //Ubilling normal registration mode
 if ($iopts['regtype'] == 'UB') {
     $billing->createuser($login);
     log_register("StgUser REGISTER " . $login);
     $billing->setpassword($login, $password);
     log_register("StgUser PASSWORD " . $password);
     $billing->setip($login, $ip);
     log_register("StgUser IP " . $ip);
     multinet_add_host($netid, $ip);
     zb_UserCreateRealName($login, $user['realname']);
     zb_UserCreatePhone($login, $user['phone'], $user['mobile']);
     zb_UserCreateContract($login, $user['contract']);
     zb_UserCreateEmail($login, $user['email']);
     zb_UserCreateSpeedOverride($login, 0);
     multinet_change_mac($ip, $user['mac']);
     multinet_rebuild_all_handlers();
     $billing->setao($login, $user['ao']);
     $dstat = 1;
     $billing->setdstat($login, $dstat);
     $billing->setdown($login, $user['down']);
     $billing->setpassive($login, $user['passive']);
     $billing->settariff($login, $user['tariff']);
     $billing->setcredit($login, $user['credit']);
     $billing->setcash($login, $user['cash']);
     zb_UserCreateNotes($login, $user['address']);
 }
 if ($iopts['regtype'] == 'SQL') {
     $querybuff .= "\n            INSERT INTO `users` (\n            `login`,\n            `Password`,\n            `Passive`,\n            `Down`,\n            `DisabledDetailStat`,\n            `AlwaysOnline`,\n            `Tariff`,\n            `Address`,\n            `Phone`,\n            `Email`,\n            `Note`,\n            `RealName`,\n            `StgGroup`,\n            `Credit`,\n            `TariffChange`,\n            `Userdata0`,\n            `Userdata1`,\n            `Userdata2`,\n            `Userdata3`,\n            `Userdata4`,\n            `Userdata5`,\n            `Userdata6`,\n            `Userdata7`,\n            `Userdata8`,\n            `Userdata9`,\n            `CreditExpire`,\n            `IP`,\n            `D0`,\n            `U0`,\n            `D1`,\n            `U1`,\n            `D2`,\n            `U2`,\n            `D3`,\n            `U3`,\n            `D4`,\n            `U4`,\n            `D5`,\n            `U5`, \n            `D6`, \n            `U6`,\n            `D7`, \n            `U7`, \n            `D8`,\n            `U8`,\n            `D9`,\n            `U9`,\n            `Cash`,\n            `FreeMb`,\n            `LastCashAdd`,\n            `LastCashAddTime`,\n            `PassiveTime`,\n            `LastActivityTime`,\n            `NAS`)\n            VALUES (\n            '" . $login . "',\n            '" . $password . "',\n            '" . $user['passive'] . "',\n            '" . $user['down'] . "',\n            '1',\n            '" . $user['ao'] . "',\n            '" . $user['tariff'] . "',\n            '',\n            '',\n            '',\n            '',\n            '',\n            '',\n            '" . $user['credit'] . "',\n            '', \n            '',\n            '',\n            '',\n            '', \n            '', \n            '', \n            '', \n            '',\n            '', \n            '', \n            '" . $user['creditex'] . "',\n            '" . $ip . "',\n            '0',\n            '0',\n            '0',\n            '0',\n            '0', \n            '0',\n            '0',\n            '0', \n            '0',\n            '0',\n            '0',\n            '0',\n            '0', \n            '0',\n            '0',\n            '0', \n            '0', \n            '0', \n            '0', \n            '0', \n            '" . $user['cash'] . "',\n            '0',\n            '0', \n            '0',\n            '0', \n            '0',\n            '');\n            " . "\n";
     //multinet
 /**
  * Performs available tasks processing
  * 
  * @return void
  */
 public function tasksProcessing()
 {
     global $billing;
     $curdate = curdate();
     $rawUsers = zb_UserGetAllStargazerData();
     $allUsers = array();
     if (!empty($rawUsers)) {
         foreach ($rawUsers as $io => $each) {
             $allUsers[$each['login']] = $each;
         }
     }
     if (!empty($this->allTasks)) {
         foreach ($this->allTasks as $io => $each) {
             if ($each['date'] == $curdate) {
                 if (isset($allUsers[$each['login']])) {
                     $login = $each['login'];
                     $param = $each['param'];
                     switch ($each['action']) {
                         case 'addcash':
                             zb_CashAdd($login, $param, 'add', 1, 'SCHEDULED');
                             break;
                         case 'corrcash':
                             zb_CashAdd($login, $param, 'correct', 1, 'SCHEDULED');
                             break;
                         case 'setcash':
                             zb_CashAdd($login, $param, 'set', 1, 'SCHEDULED');
                             break;
                         case 'credit':
                             $billing->setcredit($login, $param);
                             log_register('CHANGE Credit (' . $login . ') ON ' . $param);
                             break;
                         case 'creditexpire':
                             $billing->setcreditexpire($login, $param);
                             log_register('CHANGE CreditExpire (' . $login . ') ON ' . $param);
                             break;
                         case 'tariffchange':
                             $billing->settariff($login, $param);
                             log_register('CHANGE Tariff (' . $login . ') ON `' . $param . '`');
                             //optional user reset
                             if ($this->altCfg['TARIFFCHGRESET']) {
                                 $billing->resetuser($login);
                                 log_register('RESET User (' . $login . ')');
                             }
                             break;
                         case 'tagadd':
                             stg_add_user_tag($login, $param);
                             break;
                         case 'tagdel':
                             stg_del_user_tagid($login, $param);
                             break;
                         case 'freeze':
                             $billing->setpassive($login, 1);
                             log_register('CHANGE Passive (' . $login . ') ON 1');
                             break;
                         case 'unfreeze':
                             $billing->setpassive($login, 0);
                             log_register('CHANGE Passive (' . $login . ') ON 0');
                             break;
                         case 'reset':
                             $billing->resetuser($login);
                             log_register('RESET User (' . $login . ')');
                             break;
                         case 'setspeed':
                             zb_UserDeleteSpeedOverride($login);
                             zb_UserCreateSpeedOverride($login, $param);
                             $billing->resetuser($login);
                             log_register("RESET User (" . $login . ")");
                             break;
                         case 'down':
                             $billing->setdown($login, 1);
                             log_register('CHANGE Down (' . $login . ') ON 1');
                             break;
                         case 'undown':
                             $billing->setdown($login, 0);
                             log_register('CHANGE Down (' . $login . ') ON 0');
                             break;
                         case 'ao':
                             $billing->setao($login, 1);
                             log_register('CHANGE AlwaysOnline (' . $login . ') ON 1');
                             break;
                         case 'unao':
                             $billing->setao($login, 0);
                             log_register('CHANGE AlwaysOnline (' . $login . ') ON 0');
                             break;
                     }
                     //flush task from database
                     $this->setTaskIsDone($each['id']);
                 } else {
                     log_register('SCHEDULER FAIL ID [' . $taskId . '] USER (' . $each['login'] . ')  NON EXISTS');
                     $this->deleteTask($taskId);
                 }
             }
         }
     }
 }
Beispiel #5
0
                $randomPassword = zb_rand_string(8);
                $randomName = $names[array_rand($names)] . ' ' . $surnames[array_rand($surnames)];
                $randomPhone = rand(111111, 999999);
                $randomMobile = '380' . rand(1111111, 9999999);
                $randomMac = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99);
                $randomApt = $i;
                $randomCash = rand(0, 500);
                $randomIp = multinet_get_next_freeip('nethosts', 'ip', $netID);
                $randomFloor = rand(1, 9);
                $randomEntrance = rand(1, 4);
                //registering subroutine
                $querybuff = "\n            INSERT INTO `users` (\n            `login`,\n            `Password`,\n            `Passive`,\n            `Down`,\n            `DisabledDetailStat`,\n            `AlwaysOnline`,\n            `Tariff`,\n            `Address`,\n            `Phone`,\n            `Email`,\n            `Note`,\n            `RealName`,\n            `StgGroup`,\n            `Credit`,\n            `TariffChange`,\n            `Userdata0`,\n            `Userdata1`,\n            `Userdata2`,\n            `Userdata3`,\n            `Userdata4`,\n            `Userdata5`,\n            `Userdata6`,\n            `Userdata7`,\n            `Userdata8`,\n            `Userdata9`,\n            `CreditExpire`,\n            `IP`,\n            `D0`,\n            `U0`,\n            `D1`,\n            `U1`,\n            `D2`,\n            `U2`,\n            `D3`,\n            `U3`,\n            `D4`,\n            `U4`,\n            `D5`,\n            `U5`, \n            `D6`, \n            `U6`,\n            `D7`, \n            `U7`, \n            `D8`,\n            `U8`,\n            `D9`,\n            `U9`,\n            `Cash`,\n            `FreeMb`,\n            `LastCashAdd`,\n            `LastCashAddTime`,\n            `PassiveTime`,\n            `LastActivityTime`,\n            `NAS`)\n            VALUES (\n            '" . $randomLogin . "',\n            '" . $randomPassword . "',\n            '0',\n            '0',\n            '1',\n            '1',\n            '" . $tariff . "',\n            '',\n            '',\n            '',\n            '',\n            '',\n            '',\n            '0',\n            '', \n            '',\n            '',\n            '',\n            '', \n            '', \n            '', \n            '', \n            '',\n            '', \n            '', \n            '0',\n            '" . $randomIp . "',\n            '0',\n            '0',\n            '0',\n            '0',\n            '0', \n            '0',\n            '0',\n            '0', \n            '0',\n            '0',\n            '0',\n            '0',\n            '0', \n            '0',\n            '0',\n            '0', \n            '0', \n            '0', \n            '0', \n            '0', \n            '" . $randomCash . "',\n            '0',\n            '0', \n            '0',\n            '0', \n            '0',\n            '');\n            ";
                //push da query!
                nr_query($querybuff);
                zb_AddressCreateApartment($lastBuildId, $randomEntrance, $randomFloor, $randomApt);
                zb_AddressCreateAddress($randomLogin, zb_AddressGetLastid());
                multinet_add_host($netID, $randomIp);
                zb_UserCreateRealName($randomLogin, $randomName);
                zb_UserCreatePhone($randomLogin, $randomPhone, $randomMobile);
                zb_UserCreateContract($randomLogin, '');
                zb_UserCreateEmail($randomLogin, '');
                zb_UserCreateSpeedOverride($randomLogin, 0);
                multinet_change_mac($randomIp, $randomMac);
                zb_UserRegisterLog($randomLogin);
                log_register("SAMPLE GENERATION OF (" . $randomLogin . ") DONE");
            }
        }
    }
} else {
    show_error(__('Permission denied'));
}
Beispiel #6
0
/**
 * Performs an user registration
 * 
 * @global object $billing
 * @param array $user_data
 * @param bool $goprofile
 */
function zb_UserRegister($user_data, $goprofile = true)
{
    global $billing;
    // Init all of needed user data
    $login = vf($user_data['login']);
    $login = zb_RegLoginFilter($login);
    $password = vf($user_data['password']);
    $ip = $user_data['IP'];
    $cityid = $user_data['city'];
    $streetid = $user_data['street'];
    $buildid = $user_data['build'];
    @($entrance = $user_data['entrance']);
    @($floor = $user_data['floor']);
    $apt = $user_data['apt'];
    $serviceid = $user_data['service'];
    $netid = multinet_get_service_networkid($serviceid);
    $busylogins = zb_AllBusyLogins();
    //check login lenght
    $maxStLen = 42;
    $loginLen = strlen($login);
    if ($loginLen > $maxStLen) {
        log_register("HUGELOGIN REGISTER TRY (" . $login . ")");
        $alert = __('Attention generated login longer than') . ' ' . $maxStLen . ' ' . __('bytes') . '. (' . $login . ' > ' . $loginLen . ') ' . __('And is not compatible with Stargazer') . '.';
        die($alert);
    }
    // empty login validation
    if (empty($login)) {
        $alert = wf_tag('script', false, '', 'type="text/javascript"');
        $alert .= 'alert("' . __('Error') . ': ' . __('Empty login') . '");';
        $alert .= wf_tag('script', true);
        print $alert;
        rcms_redirect("?module=userreg");
        die;
    }
    //duplicate login validation
    if (isset($busylogins[$login])) {
        $alert = wf_tag('script', false, '', 'type="text/javascript"');
        $alert .= 'alert("' . __('Error') . ': ' . __('Duplicate login') . '");';
        $alert .= wf_tag('script', true);
        print $alert;
        rcms_redirect("?module=userreg");
        die;
    }
    //last check
    if (!zb_ip_unique($ip)) {
        $alert = wf_tag('script', false, '', 'type="text/javascript"');
        $alert .= 'alert("' . __('Error') . ': ' . __('This IP is already used by another user') . '");';
        $alert .= wf_tag('script', true);
        print $alert;
        rcms_redirect("?module=userreg");
        die;
    }
    // registration subroutine
    $billing->createuser($login);
    log_register("StgUser REGISTER (" . $login . ")");
    $billing->setpassword($login, $password);
    log_register("StgUser (" . $login . ") PASSWORD `" . $password . "`");
    $billing->setip($login, $ip);
    log_register("StgUser (" . $login . ") IP `" . $ip . "`");
    zb_AddressCreateApartment($buildid, $entrance, $floor, $apt);
    zb_AddressCreateAddress($login, zb_AddressGetLastid());
    multinet_add_host($netid, $ip);
    zb_UserCreateRealName($login, '');
    zb_UserCreatePhone($login, '', '');
    zb_UserCreateContract($login, '');
    zb_UserCreateEmail($login, '');
    zb_UserCreateSpeedOverride($login, 0);
    zb_UserRegisterLog($login);
    // if random mac needed
    $billingconf = rcms_parse_ini_file(CONFIG_PATH . '/billing.ini');
    $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    if ($billingconf['REGRANDOM_MAC']) {
        // funny random mac, yeah? :)
        $mac = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99);
        multinet_change_mac($ip, $mac);
        multinet_rebuild_all_handlers();
    }
    // if AlwaysOnline to new user needed
    if ($billingconf['REGALWONLINE']) {
        $alwaysonline = 1;
        $billing->setao($login, $alwaysonline);
        log_register('CHANGE AlwaysOnline (' . $login . ') ON ' . $alwaysonline);
    }
    // if we want to disable detailed stats to new user by default
    if ($billingconf['REGDISABLEDSTAT']) {
        $dstat = 1;
        $billing->setdstat($login, $dstat);
        log_register('CHANGE dstat (' . $login . ') ON ' . $dstat);
    }
    //set contract same as login for this user
    if (isset($alterconf['CONTRACT_SAME_AS_LOGIN'])) {
        if ($alterconf['CONTRACT_SAME_AS_LOGIN']) {
            $newUserContract = $login;
            zb_UserChangeContract($login, $newUserContract);
        }
    }
    //cemetery processing
    if (isset($alterconf['CEMETERY_ENABLED'])) {
        if ($alterconf['CEMETERY_ENABLED']) {
            if ($alterconf['CEMETERY_ENABLED'] == 2) {
                $cemetery = new Cemetery(false);
                $cemetery->setDead($login);
            }
        }
    }
    //contract autogeneration
    if (isset($alterconf['CONTRACT_AUTOGEN'])) {
        if ($alterconf['CONTRACT_AUTOGEN']) {
            $contract_proposal = '';
            $allcontracts = zb_UserGetAllContracts();
            $top_offset = 100000;
            //contract generation mode default
            if ($alterconf['CONTRACT_GENERATION_DEFAULT']) {
                for ($i = 1; $i < $top_offset; $i++) {
                    if (!isset($allcontracts[$i])) {
                        $contract_proposal = $i;
                        break;
                    }
                }
            } else {
                //alternate generation method
                $max_contract = max(array_keys($allcontracts));
                $contract_proposal = $max_contract + 1;
            }
            //setting generated contract to new user
            if (!isset($allcontracts[$contract_proposal])) {
                $contractDate = date("Y-m-d");
                zb_UserChangeContract($login, $contract_proposal);
                zb_UserContractDateCreate($contract_proposal, $contractDate);
            }
        }
    }
    ///////////////////////////////////
    if ($goprofile) {
        rcms_redirect("?module=userprofile&username=" . $login);
    }
}