HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: /homepages/29/d194883696/htdocs/firstnetworking/Config.php
<?php
/**
**Config Class File
** Configure Links, Database Info, Live & Local links
**/

class Config{
	private $_protocol,
	$_domainName,
	$_root,
	$_admin_user,
	$_dsn;

	public $url,
	$images,
	$css,
	$Controllers,
	$Models,
	$Views,
	$js,
	$handlers;

	protected $_attributes = [];

	private $ADMIN = "browbytrude";

	public function __construct(){
		$this->_admin_user = $ADMIN;
		$this->url = $this->setProtocol().$this->setDomainName();
		$this->setUpDirectories();
	}

	public function Path(){
		$this->url = $this->setProtocol().$this->setDomainName();
		return $this->url;
	}

	public function GetAdminUser(){
		$this->_admin_user = $ADMIN;
	}

	public function setProtocol(){

		if($_SERVER['SERVER_NAME'] === "localhost"){
			$this->_protocol = "http://localhost/";
		}else{
			$this->_protocol = "http://";
		}

		return $this->_protocol;
	}

	public function setDomainName(){

		if($_SERVER['SERVER_NAME'] === "localhost"){
			$this->_domainName = $this->_admin_user."/";
			$this->_root = $_SERVER["DOCUMENT_ROOT"]."/".$this->_admin_user ."/";
		}else{
			$this->_domainName = $_SERVER['SERVER_NAME']."/";
		}

		return $this->_domainName;
	}

	public function setupDNS(){

		if($_SERVER['SERVER_NAME'] === "localhost"){
			$this->_dsn = array(
				'driver' 	=> 'mysql',
				'host' 		=> 'localhost',
				'dbname' 	=> 'template',
				'username' 	=> 'root',
				'password' 	=> ''
			);
		}else{
			$this->_dsn = array(
				'driver' 	=> 'mysql',
				'host' 		=> 'localhost',
				'dbname' 	=> 'temp',
				'username' 	=> 'root',
				'password' 	=> ''
			);
		}

	}

	public function loadDsn(){
		return $this->_dsn;
	}

	protected function setUpDirectories(){

			$this->images 			= $this->url . "images/"
			$this->css 					= $this->url . "css/";
			$this->js		 				= $this->url . "js/";
			$this->Controllers 	= $this->_root . "controllers/";
			$this->Views 				= $this->_root . "views/";
			$this->Models 			= $this->_root . "models/";
			$this->handlers 		= $this->_root . "handlers/";

	}

	public function setAttr($attrName, $attrValue){

		$this->_attributes[$attrName] = $attrValue;
		return $this;

	}

	public function getAttr($attrName){
		if(isset($this->_attributes[$attrName]) && !empty($this->_attributes[$attrName])){
			return $this->_attributes[$attrName];
		}

		return false;
	}
}