Example #1
0
function doInsert()
{
    if (isset($_POST['save'])) {
        //primary Details
        $DOMAINNAME = $_POST['domainname'];
        $DESCRIPTION = $_POST['description'];
        $SECTOR = $_POST['sector'];
        $domain = new Domain();
        $domain->domain_name = $DOMAINNAME;
        $domain->description = $DESCRIPTION;
        $domain->sector_id = $SECTOR;
    }
    if ($DOMAINNAME == "") {
        message('Domain name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($DESCRIPTION == "") {
        message('Description is required!', "error");
        redirect('index.php?view=add');
    } elseif ($SECTOR == "") {
        message('Sector is required!', "error");
        redirect('index.php?view=add');
    } else {
        $domain->create();
        message('New domain addedd successfully!', "success");
        redirect('index.php?view=list');
    }
}
Example #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     if (!$request->domain) {
         return Response::json(['error' => ['message' => 'Please provide a Domain']], 422);
     }
     $userId = $user->id;
     $domain = Domain::create(['domain' => $request->domains, 'sld' => $this->splitDomain($request->domain)[0], 'tld' => $this->splitDomain($request->domain)[1], 'orderType' => $request->ordertype, 'user_id' => $userId]);
     return Response::json(['message' => 'Domain created successfully', 'data' => $this->transform($domain)], 200);
 }
Example #3
0
 public function action_query($domain)
 {
     $domain = strtolower($domain);
     $index_alpha = Sitemap::get_filters();
     Log::write('check', 'whois: ' . $domain);
     //Cache::forget('whois.'.$domain);
     $whois = Cache::remember('whois.' . $domain, function () use($domain) {
         return new Whois\Whois($domain);
     }, 60 * 24);
     $data = $whois->get_all_data();
     if ($data === 0) {
         $valid = 0;
     } else {
         $valid = $data[0]->valid();
     }
     if (!$valid) {
         return View::make('whois.index')->with('valid', 0)->with('type', 'whois')->with('title', 'WHOIS Search')->with('index_alpha', $index_alpha);
     }
     $data = $whois->email_mask($data);
     $available = $whois->available();
     $domain = $data[sizeof($data) - 1];
     $domain = $domain->get_query_domain();
     $meta = array('title' => '', 'ip' => '');
     if ($valid && !$available) {
         if (!Domain::where('name', '=', $domain)->first()) {
             @Domain::create(array('name' => $domain));
         }
         $meta['title'] = Domain::get_domain_title($domain);
         $ip = gethostbyname($domain);
         if ($ip != $domain) {
             $meta['ip'] = $ip;
         }
     }
     $expires_on = $whois->expires_on();
     $created_on = $whois->created_on();
     $updated_on = $whois->updated_on();
     if (is_numeric(end($data)->get_body())) {
         Cache::forget('whois.' . $domain);
     }
     return View::make('whois.query', array('i' => 1, 'data' => $data, 'meta' => $meta, 'type' => 'whois', 'valid' => $valid, 'domain' => $domain, 'available' => $available, 'expires_on' => $expires_on, 'created_on' => $created_on, 'updated_on' => $updated_on, 'index_alpha' => $index_alpha, 'title' => $domain . '\'s whois info'));
 }
 /**
  * Add a domain to the project.
  *
  * @param string $name
  * @param array  $ssl
  *
  * @return Domain
  */
 public function addDomain($name, array $ssl = [])
 {
     $body = ['name' => $name];
     if (!empty($ssl)) {
         $body['ssl'] = $ssl;
     }
     return Domain::create($body, $this->getLink('domains'), $this->client);
 }