Esempio n. 1
0
 function zb_AnnihilateUser($login)
 {
     global $billing;
     $alter_conf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
     $user_ip = zb_UserGetIP($login);
     $user_aptdata = zb_AddressGetAptData($login);
     @($user_aptid = $user_aptdata['aptid']);
     zb_AddressDeleteApartment($user_aptid);
     zb_AddressOrphanUser($login);
     zb_UserDeleteEmail($login);
     zb_UserDeleteNotes($login);
     zb_UserDeletePhone($login);
     zb_UserDeleteRealName($login);
     zb_UserDeleteSpeedOverride($login);
     if (!$alter_conf['STRICT_CONTRACTS_PROTECT']) {
         zb_UserDeleteContract($login);
     }
     zb_VserviceCashClear($login);
     log_register("DELETE VCASH (" . $login . ")");
     cf_FlushAllUserCF($login);
     zb_FlushAllUserTags($login);
     vlan_delete_host($login);
     multinet_delete_host($user_ip);
     multinet_rebuild_all_handlers();
     //destroy stargazer user
     $billing->deleteuser($login);
     log_register("StgUser DELETE (" . $login . ")");
 }
Esempio n. 2
0
 function docsis_ModemDelete($modemid)
 {
     $modemid = vf($modemid, 3);
     $modemdata = docsis_ModemGetData($modemid);
     if (!empty($modemdata)) {
         $modemip = $modemdata['ip'];
         $query = "DELETE from `modems` WHERE `id`='" . $modemid . "'";
         nr_query($query);
         log_register("DOCSIS MODEM DELETE IP " . $modemip . " [" . $modemid . "]");
         multinet_delete_host($modemip);
         multinet_rebuild_all_handlers();
     }
 }
Esempio n. 3
0
 /**
  * Performs user changing IP subroutine
  * 
  * @global object $billing
  * @param int $serviceId
  * @param string $newIp
  * 
  * @return void/string
  */
 public function changeUserIp($serviceId, $newIp)
 {
     global $billing;
     $result = '';
     $serviceId = vf($serviceId, 3);
     $networkId = multinet_get_service_networkid($serviceId);
     if (isset($this->allServices[$serviceId])) {
         if (zb_ip_unique($newIp)) {
             if (!empty($this->currentIp)) {
                 if ($this->isNethostExists()) {
                     //force user disconnect
                     if ($this->billingCfg['RESET_AO']) {
                         $billing->setao($this->login, 0);
                     } else {
                         $billing->setdown($this->login, 1);
                     }
                     $billing->setip($this->login, $newIp);
                     multinet_delete_host($this->currentIp);
                     multinet_add_host($networkId, $newIp, $this->currentMac);
                     log_register("CHANGE MultiNetIP (" . $this->login . ") FROM " . $this->currentIp . " ON " . $newIp . "");
                     multinet_rebuild_all_handlers();
                     multinet_RestartDhcp();
                     //back teh user online
                     if ($this->billingCfg['RESET_AO']) {
                         $billing->setao($this->login, 1);
                     } else {
                         $billing->setdown($this->login, 0);
                     }
                 } else {
                     log_register("CHANGE FAIL MultiNetIP (" . $this->login . ") FROM " . $this->currentIp . " ON " . $newIp . " NO_NETHOST");
                     $result = __('No existing nethost for current IP');
                 }
             } else {
                 log_register("CHANGE FAIL MultiNetIP (" . $this->login . ") FROM " . $this->currentIp . " ON " . $newIp . " EMPTY_IP");
                 $result = __('Something went wrong') . ': ' . __('empty current IP');
             }
         } else {
             log_register("CHANGE FAIL MultiNetIP (" . $this->login . ") FROM " . $this->currentIp . " ON " . $newIp . " IP_DUPLICATE");
             $result = __('This IP is already used by another user');
         }
     } else {
         log_register("CHANGE FAIL MultiNetIP (" . $this->login . ") FROM " . $this->currentIp . " ON " . $newIp . " NO_SERVICE");
         $result = __('Unexistent service');
     }
     return $result;
 }
Esempio n. 4
0
 $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') . '");
           document.location.href="?module=expresscard&username='******'";
         </script>
         ';
             die($alert);
         }
     } else {
         //no free IPs left in network
Esempio n. 5
0
 /**
  * Flushes all old user`s networking data and applies new one
  * 
  * @param   string   $current_ip        current users`s IP
  * @param   string   $current_mac       current users`s MAC address
  * @param   int      $new_multinet_id   new network ID extracted from service
  * @param   string   $new_free_ip       new IP address which be applied for user
  * @param   string   $login             existing stargazer user login
  * 
  * @return void
  */
 function zb_IPChange($current_ip, $current_mac, $new_multinet_id, $new_free_ip, $login)
 {
     global $billing;
     global $billingConf;
     //force user disconnect
     if ($billingConf['RESET_AO']) {
         $billing->setao($login, 0);
     } else {
         $billing->setdown($login, 1);
     }
     $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);
     }
 }