pdns-web/app/Http/Controllers/PagesController.php

105 lines
2.7 KiB
PHP
Raw Normal View History

2018-03-30 07:55:34 -04:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
2018-03-30 08:04:18 -04:00
use Illuminate\Support\Facades\DB;
use View;
Use App\helpers;
2018-03-30 09:52:08 -04:00
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
2018-03-30 07:55:34 -04:00
class PagesController extends Controller
{
2018-03-30 08:04:18 -04:00
public function home()
{
return view('home');
}
2018-03-30 09:16:28 -04:00
public function createzone(Request $createzone_req)
{
2018-03-30 09:52:08 -04:00
if(!$createzone_req->zonename){
return view('createzone');
}
$zone_name = $createzone_req->zonename;
$zone_ttl = $createzone_req->zonettl;
$zone_primary_ip = $createzone_req->primaryip;
2018-03-30 09:52:57 -04:00
$headers = [
2018-03-30 09:52:08 -04:00
'Authorization' => 'X-API-Key: '. 'b$L0S3BHhOFp!VXDJ*PB*5M2DAh!mO5s'
];
$client = new Client(); //GuzzleHttp\Client
$result = $client->post('http://127.0.0.1:8081/servers/localhost/zones', [
'form_params' => [
2018-03-30 09:53:25 -04:00
'headers' => $headers,
2018-03-30 09:52:08 -04:00
'kind' => 'Native',
'name' => $zone_name,
'nameservers' => 'pdnstest.tfmm.co',
'records' => [
'0' => [
'content' => 'pdnstest.tfmm.co. hostmaster.tfmm.co. 1 1800 900 604800 86400',
'disabled' => 'false',
'ttl' => '86400',
'type' => 'SOA'
],
'1' => [
'content' => $zone_primary_ip,
'disabled' => 'false',
'name' => $zone_name,
'ttl' => '3600',
'type' => 'A'
]
]
]
}]);
return redirect('createzone');
2018-03-30 09:16:28 -04:00
}
2018-03-30 08:04:18 -04:00
public function domains(Request $domain_req)
{
return view('domains');
}
public function newrecord(Request $newrec_req)
{
return view('newrecord');
}
public function updaterecord(Request $updaterec_req)
{
return view('updaterecord');
}
2018-03-30 07:55:34 -04:00
}
2018-03-30 09:52:08 -04:00
public function bidders(Request $bidder_req)
{
if(!$bidder_req->bidderlname){
return view('bidders');
}
$bidder_lname = $bidder_req->bidderfname;
$bidder_fname = $bidder_req->bidderlname;
$bidder_addr = $bidder_req->bidderaddr;
$bidder_city = $bidder_req->biddercity;
$bidder_state = $bidder_req->bidderstate;
$bidder_zip = $bidder_req->bidderzip;
$bidder_phone = $bidder_req->bidderphone;
$bidder_email = $bidder_req->bidderemail;
$bidder_assigned_number = $bidder_req->biddernum;
$bidder_insert = DB::table('bidders')->insert(
[
'bidder_lname' => $bidder_lname ,
'bidder_fname' => $bidder_fname ,
'bidder_addr' => $bidder_addr ,
'bidder_city' => $bidder_city ,
'bidder_state' => $bidder_state ,
'bidder_zip' => $bidder_zip ,
'bidder_phone' => $bidder_phone ,
'bidder_email' => $bidder_email ,
'bidder_assigned_number' => $bidder_assigned_number
]);
return redirect('bidders');
}