99 lines
2.3 KiB
PHP
99 lines
2.3 KiB
PHP
<?php
|
|
//-- Global Config Variables --\\
|
|
|
|
//**URL & FOLDERS**\\
|
|
define('URL', 'colorstrike.jancokock.me'); //Base url of site
|
|
define('ROOT', '/colorstrike/'); //Root folder of project (if URL -> /)
|
|
define('PHP', '/colorstrike/php/'); //PHP folder
|
|
|
|
//**SYSTEM INFO**\\
|
|
define('DEV', true); //Development mode or not
|
|
|
|
//**DATABASE**\\
|
|
define('DATABASE_NAME', 'colorstrike'); //Database name
|
|
define('DATABASE_USER', 'csadmin'); //Database user
|
|
define('DATABASE_PASS', 'aardbei123'); //Database password
|
|
//-- Global Config Variables --\\
|
|
|
|
|
|
if(DEV)
|
|
{
|
|
ini_set("display_errors", "1");
|
|
error_reporting(E_ALL);
|
|
}
|
|
|
|
//Create message
|
|
function error($page, $msg)
|
|
{
|
|
$link = ROOT . $page . "?error=" . $msg;
|
|
die(header("Location: $link"));
|
|
}
|
|
|
|
function warning($page, $msg)
|
|
{
|
|
$link = ROOT . $page . "?warning=" . $msg;
|
|
die(header("Location: $link"));
|
|
}
|
|
|
|
function success($page, $msg)
|
|
{
|
|
$link = ROOT . $page . "?success=" . $msg;
|
|
die(header("Location: $link"));
|
|
}
|
|
|
|
function info($page, $msg)
|
|
{
|
|
$link = ROOT . $page . "?info=" . $msg;
|
|
die(header("Location: $link"));
|
|
}
|
|
|
|
function url($url)
|
|
{
|
|
echo(ROOT . $url);
|
|
}
|
|
|
|
function php($url)
|
|
{
|
|
echo(PHP . $url);
|
|
}
|
|
|
|
function returnurl($url)
|
|
{
|
|
return (ROOT . $url);
|
|
}
|
|
|
|
function returnphp($url)
|
|
{
|
|
return (PHP . $url);
|
|
}
|
|
|
|
function format($input)
|
|
{
|
|
|
|
$usec = $input % 1000;
|
|
$str_usec = sprintf("%03d", $usec);
|
|
$input = floor($input / 1000);
|
|
|
|
$seconds = $input % 60;
|
|
$str_seconds = sprintf("%02d", $seconds);
|
|
$input = floor($input / 60);
|
|
|
|
$minutes = $input % 60;
|
|
$str_minutes = sprintf("%02d", $minutes);
|
|
$input = floor($input / 60);
|
|
|
|
$str = $str_minutes . ":" . $str_seconds . ":" . $str_usec;
|
|
$array = array(
|
|
'string' => $str,
|
|
'minutes' => $str_minutes,
|
|
'seconds' => $str_seconds,
|
|
'usec' => $str_usec,
|
|
'tminutes' => $minutes,
|
|
'tseconds' => ($minutes*60 + $seconds),
|
|
'tusec' => ($minutes*60 + $seconds*60 + $usec)
|
|
);
|
|
return $array;
|
|
}
|
|
|
|
$connection = mysqli_connect("localhost", DATABASE_USER, DATABASE_PASS, DATABASE_NAME) or die("Connection Failed: " . mysqli_connect_error());
|
|
?>
|