-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.php
38 lines (33 loc) · 1.12 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
session_start();
define('HOST', 'ofline');
error_reporting(0);
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if(HOST == 'online'){
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('HOME_URL','https://learncodeweb/');
define("HOME_PATH",'https://learncodeweb/');
define("HOME_AJAX",HOME_URL.'ajax/');
}else{
define('DB_NAME', 'test');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('HOME_URL',$url);
define("HOME_PATH",$url);
define("HOME_AJAX",HOME_URL.'ajax/');
}
/*** TB DEFINE ***/
define('TB_IMG','images');
/*** DB INCLUDES ***/
include_once 'Database.php';
/*** DB CONNECTION ***/
$dsn = "mysql:dbname=".DB_NAME.";host=".DB_HOST."";
$pdo = '';
try {$pdo = new PDO($dsn, DB_USER, DB_PASSWORD);} catch (PDOException $e) {echo "Connection failed: " . $e->getMessage();}
/*Classes*/
$db = new Database($pdo);
?>