/** * Shows user register form of express card * * * @return string */ function web_ExpressCardRegForm() { $altconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $allcontracts = zb_UserGetAllContracts(); //contract proposal $top_offset = 100000; //contract generation mode default if ($altconf['CONTRACT_GENERATION_DEFAULT']) { for ($i = 1; $i < $top_offset; $i++) { if (!isset($allcontracts[$i])) { $contract = $i; break; } } } else { //alternate generation method $max_contract = max(array_keys($allcontracts)); $contract = $max_contract + 1; } $mac = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99); $phone = ''; $mobile = ''; $email = ''; $notes = ''; $stgdata = ''; $currenttariff = ''; $birthdate = ''; $passportnum = ''; $passportdate = ''; $passportwho = ''; $pcity = ''; $pstreet = ''; $pbuild = ''; $papt = ''; $inputs = zb_AjaxLoader() . wf_delimiter(); $inputs .= __('Contract'); $inputs .= wf_TextInput('newcontract', '', $contract, false, '10'); $inputs .= __('Contract date'); $inputs .= wf_DatePickerPreset('newcontractdate', @$allcontractdates[$contract]); $inputs .= wf_delimiter(); $inputs .= __('Surname'); $inputs .= wf_TextInput('newsurname', '', '', false, '20'); $inputs .= __('Name'); $inputs .= wf_TextInput('newname', '', '', false, '20'); $inputs .= __('Patronymic'); $inputs .= wf_TextInput('newpatronymic', '', '', false, '20'); $inputs .= __('Birth date'); $inputs .= wf_DatePickerPreset('newbirthdate', $birthdate); $inputs .= wf_delimiter(); $inputs .= __('Passport number'); $inputs .= wf_TextInput('newpassportnum', '', $passportnum, false, '30'); $inputs .= __('Date of issue'); $inputs .= wf_DatePickerPreset('newpassportdate', $passportdate); $inputs .= __('Issuing authority'); $inputs .= wf_TextInput('newpassportwho', '', $passportwho, false, '40'); $inputs .= wf_delimiter(); $inputs .= __('Phone'); $inputs .= wf_TextInput('newphone', '', $phone, false, '20'); $inputs .= __('Mobile'); $inputs .= wf_TextInput('newmobile', '', $mobile, false, '20'); $inputs .= __('email'); $inputs .= wf_TextInput('newemail', '', $email, false, '20'); $inputs .= wf_delimiter(); $inputs .= wf_tag('fieldset'); //address data form $inputs .= __('Address of service') . ' '; //new address creation form $inputs .= web_ExpressAddressOccupancyForm(); $inputs .= wf_delimiter(); //additional address fields $inputs .= __('Registration address') . ' '; $inputs .= zb_JSHider(); $inputs .= web_PaddressUnhideBox(); $inputs .= web_HidingDiv('paddress'); $inputs .= __('City'); $inputs .= wf_TextInput('newpcity', '', $pcity, false, '20'); $inputs .= __('Street'); $inputs .= wf_TextInput('newpstreet', '', $pstreet, false, '20'); $inputs .= __('Build'); $inputs .= wf_TextInput('newpbuild', '', $pbuild, false, '5'); $inputs .= __('Apartment'); $inputs .= wf_TextInput('newpapt', '', $papt, false, '5'); $inputs .= wf_tag('div', true); $inputs .= wf_tag('fieldset', true); $inputs .= wf_delimiter(); $inputs .= __('Tariff'); $inputs .= web_ExpressTariffSelector('newtariff', $currenttariff); $inputs .= __('Service'); $inputs .= web_ExpressServiceSelectorReg(); $inputs .= __('IP'); $inputs .= wf_tag('span', false, '', 'id="dipbox"'); $allservices = multinet_get_services(); if (!empty($allservices)) { $firstService = $allservices[0]; $firstNet = $firstService['netid']; @($ip_proposal = multinet_get_next_freeip('nethosts', 'ip', $firstNet)); if (empty($ip_proposal)) { show_window('', wf_modalOpened(__('Error'), __('No free IP available in selected pool'), '400', '250')); } } else { $ip_proposal = __('Error'); } $inputs .= wf_TextInput('editip', '', $ip_proposal, false, '20'); $inputs .= wf_tag('span', true); //dummy login proposal $login = zb_RegLoginProposal('', '', '', '', $ip_proposal); $inputs .= __('MAC'); $inputs .= wf_TextInput('newmac', '', $mac, false, '20'); $inputs .= __('Login'); $inputs .= wf_TextInput('newlogin', '', $login, false, '20'); $inputs .= wf_delimiter(); $inputs .= __('Notes'); $inputs .= wf_TextInput('newnotes', '', $notes, false, '120'); $inputs .= wf_HiddenInput('expresscardreg', 'true'); $inputs .= wf_delimiter(); $inputs .= wf_Submit('Let register that user'); $expresscardform = wf_Form("", "POST", $inputs, 'expresscard'); show_window(__('Express card user register'), $expresscardform); }
function docsis_ModemAdd($maclan) { $maclan = mysql_real_escape_string($maclan); //random mac for usb $macusb = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99); $altercfg = rcms_parse_ini_file(CONFIG_PATH . '/alter.ini'); $netid = $altercfg['DOCSIS_MODEM_NETID']; $nextfreeip = multinet_get_next_freeip('nethosts', 'ip', $netid); $note = ''; $userbind = ''; $basetemplate = 'short'; $date = curdate(); //check for free ip in subnet if (!empty($nextfreeip)) { $nic = str_replace('.', 'x', $nextfreeip); //check is mac unique? if (multinet_mac_free($maclan) and check_mac_format($maclan)) { $query = "INSERT INTO `modems` (\n `id` ,\n `maclan` ,\n `macusb` ,\n `date` ,\n `ip` ,\n `conftemplate` ,\n `userbind` ,\n `nic` ,\n `note`\n )\n VALUES (\n NULL , '" . $maclan . "', '" . $maclan . "', '" . $date . "', '" . $nextfreeip . "', '" . $basetemplate . "', '' , '" . $nic . "', ''\n );"; nr_query($query); $lastid = simple_get_lastid('modems'); log_register("DOCSIS MODEM ADD MAC" . $maclan . " IP " . $nextfreeip . "[" . $lastid . "]"); multinet_add_host($netid, $nextfreeip, $maclan, ''); multinet_rebuild_all_handlers(); rcms_redirect("?module=docsis&showmodem=" . $lastid); } else { show_window(__('Error'), __('This MAC is currently used') . ' ' . __('This MAC have wrong format')); } } else { show_window(__('Error'), __('No free IP available in selected pool')); } }
$billing->setdstat($randomLogin, '1'); zb_UserRegisterLog($randomLogin); log_register("SAMPLE GENERATION OF (" . $randomLogin . ") DONE"); } } else { //fast SQL users generation directly in database for ($i = 1; $i <= $neednum; $i++) { $randomLogin = '******' . zb_rand_string(10); $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);
/** * Returns register last step form * * @param array $newuser_data * @return string */ function web_UserRegFormNetData($newuser_data) { $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $safe_mode = $alterconf['SAFE_REGMODE']; $citydata = zb_AddressGetCityData($newuser_data['city']); $cityalias = zb_TranslitString($citydata['cityalias']); $streetdata = zb_AddressGetStreetData($newuser_data['street']); $streetalias = zb_TranslitString($streetdata['streetalias']); $buildata = zb_AddressGetBuildData($newuser_data['build']); $buildnum = zb_TranslitString($buildata['buildnum']); if (empty($newuser_data['apt'])) { $newuser_data['apt'] = 0; } $apt = zb_TranslitString($newuser_data['apt']); //assign some agent from previously selected form if (isset($alterconf['LOGIN_GENERATION'])) { if ($alterconf['LOGIN_GENERATION'] == 'DEREBAN') { $agentPrefixID = $newuser_data['contrahent']; } else { $agentPrefixID = ''; } } else { $agentPrefixID = ''; } $ip_proposal = multinet_get_next_freeip('nethosts', 'ip', multinet_get_service_networkid($newuser_data['service'])); $login_proposal = zb_RegLoginProposal($cityalias, $streetalias, $buildnum, $apt, $ip_proposal, $agentPrefixID); $password_proposal = zb_RegPasswordProposal(); if (empty($ip_proposal)) { $alert = wf_tag('script', false, '', 'type="text/javascript"'); $alert .= 'alert("' . __('Error') . ': ' . __('No free IP available in selected pool') . '");'; $alert .= wf_tag('script', true); print $alert; rcms_redirect("?module=multinet"); die; } //protect important options if ($safe_mode) { $modifier = 'READONLY'; } else { $modifier = ''; } $form = wf_tag('table', false, 'glamour', 'width="100%" border="0"'); $form .= wf_tag('form', false, '', ' action="" method="POST"'); $form .= wf_tag('tr', false, 'row3'); $form .= wf_tag('td', false, '', 'width="50%"'); $form .= wf_tag('input', false, '', 'type="text" name="login" value="' . $login_proposal . '" ' . $modifier); $form .= wf_tag('td', true); $form .= wf_tag('td', false); $form .= __('Login') . ' ' . zb_CheckLoginRscriptdCompat($login_proposal); $form .= wf_tag('td', true); $form .= wf_tag('tr', true); $form .= wf_tag('tr', false, 'row3'); $form .= wf_tag('td', false); $form .= wf_tag('input', false, '', 'type="text" name="password" value="' . $password_proposal . '" ' . $modifier); $form .= wf_tag('td', true); $form .= wf_tag('td', false); $form .= __('Password'); $form .= wf_tag('td', true); $form .= wf_tag('tr', true); $form .= wf_tag('tr', false, 'row3'); $form .= wf_tag('td', false); $form .= wf_tag('input', false, '', 'type="text" name="IP" value="' . $ip_proposal . '" ' . $modifier); $form .= wf_tag('td', true); $form .= wf_tag('td', false); $form .= __('IP'); $form .= wf_tag('td', true); $form .= wf_tag('tr', true); $form .= wf_tag('table', true); $form .= wf_HiddenInput('repostdata', base64_encode(serialize($newuser_data))); $form .= wf_Submit(__('Let register that user')); $form .= wf_tag('form', true); $form .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true); return $form; }
if (wf_CheckPost(array('edittariff'))) { $newtariff = $_POST['edittariff']; $billing->settariff($login, $newtariff); log_register('CHANGE Tariff (' . $login . ') ON ' . $newtariff); } //ip editing if (wf_CheckPost(array('editip'))) { $service = $_POST['serviceselect']; //if ip is not a same if ($service != 'SAME') { $currentip = zb_UserGetIP($login); $currentmac = zb_MultinetGetMAC($currentip); $newnetid = multinet_get_service_networkid($service); $newip = trim($_POST['editip']); $newip = mysql_real_escape_string($newip); @($checkfreeip = multinet_get_next_freeip('nethosts', 'ip', $newnetid)); if (!empty($checkfreeip)) { //check is ip acceptable for this pool? $allfreeips = multinet_get_all_free_ip('nethosts', 'ip', $newnetid); $allfreeips = array_flip($allfreeips); if (isset($allfreeips[$newip])) { $billing->setip($login, $newip); multinet_delete_host($currentip); multinet_add_host($newnetid, $newip, $currentmac); multinet_rebuild_all_handlers(); multinet_RestartDhcp(); log_register("CHANGE MultiNetIP (" . $login . ") FROM " . $currentip . " ON " . $newip); } else { $alert = ' <script type="text/javascript"> alert("' . __('Error') . ': ' . __('Wrong IP') . '");
/** * Returns IP selector ajax container content * * @param int $serviceId * * @return string */ public function ajIpSelector($serviceId) { $serviceId = vf($serviceId, 3); $result = ''; if (isset($this->allServices[$serviceId])) { $networkId = multinet_get_service_networkid($serviceId); //default IP selection - first free if (!$this->customFlag) { @($nextFreeIp = multinet_get_next_freeip('nethosts', 'ip', $networkId)); if (!empty($nextFreeIp)) { $result = wf_HiddenInput('ipselector', $nextFreeIp) . ' ' . $nextFreeIp . ' (' . __('first free for this service') . ')'; $result .= wf_HiddenInput('serviceselector', $serviceId); } else { $result = __('No free IP available in selected pool. Please fix it in networks and services module.'); } } else { //custom IP selection box $allFreeIpsRaw = multinet_get_all_free_ip('nethosts', 'ip', $networkId); if (!empty($allFreeIpsRaw)) { $allFreeIpsSelector = array(); foreach ($allFreeIpsRaw as $io => $each) { $allFreeIpsSelector[$each] = $each; } $result = wf_Selector('ipselector', $allFreeIpsSelector, '', '', true); $result .= wf_HiddenInput('serviceselector', $serviceId); } else { $result = __('No free IP available in selected pool. Please fix it in networks and services module.'); } } } return $result; }
$billing->setip($login, $new_free_ip); multinet_delete_host($current_ip); multinet_add_host($new_multinet_id, $new_free_ip, $current_mac); multinet_rebuild_all_handlers(); multinet_RestartDhcp(); //back teh user online if ($billingConf['RESET_AO']) { $billing->setao($login, 1); } else { $billing->setdown($login, 0); } } // primary module part if (isset($_POST['serviceselect'])) { $new_multinet_id = multinet_get_service_networkid($_POST['serviceselect']); @($new_free_ip = multinet_get_next_freeip('nethosts', 'ip', $new_multinet_id)); if (empty($new_free_ip)) { $alert = wf_tag('script', false, '', 'type="text/javascript"') . 'alert("' . __('Error') . ': ' . __('No free IP available in selected pool') . '");' . wf_tag('script', true); print $alert; rcms_redirect("?module=multinet"); die; } zb_IPChange($current_ip, $current_mac, $new_multinet_id, $new_free_ip, $login); log_register("CHANGE MultiNetIP (" . $login . ") FROM " . $current_ip . " ON " . $new_free_ip . ""); rcms_redirect("?module=pl_ipchange&username="******"both" />'); show_window(__('Change user IP'), web_IPChangeFormService()); show_window(__('IP usage stats'), web_FreeIpStats()); } show_window('', web_UserControls($login));