Exemple #1
0
 private function isVPS($ip)
 {
     $out = array();
     //
     if ($ip->type == 3) {
         $vps_port = \Basic\Model_Vps_Ports::query()->where('portID', $ip->id)->get_one();
         $vps = $vps_port->vps;
         $out = array('name' => $vps->hostname, 'id' => $vps->id);
     }
     return $out;
 }
Exemple #2
0
 public function action_remip()
 {
     $val = \Validation::forge();
     $val->add_field('vps', 'vps id', 'required|min_length[1]|max_length[20]');
     $val->add_field('val', 'ip value', 'required|min_length[1]|max_length[20]');
     //validate input
     $out = array('status' => 'ok', 'data' => array());
     if ($val->run()) {
         $v = $val->validated('vps');
         $ip = $val->validated('val');
         $vps = \Basic\Model_Vps::find($v);
         if ($vps) {
             $port = \Basic\Model_Vps_Ports::query()->where('portID', $ip)->get_one();
             if ($port) {
                 $ips = \Basic\Model_Network_Ip::find($port->portID);
                 if ($ips) {
                     $ips->delete();
                 }
                 $port->delete();
             }
         }
     }
     echo json_encode($out);
 }