Commit
This commit is contained in:
parent
28d451c0d4
commit
c4fcaee34d
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/app/config.php
|
14
app/config.example.php
Normal file
14
app/config.example.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
return [
|
||||
'root_url' => '/public',
|
||||
'database' => [
|
||||
'name' => 'mysql',
|
||||
'args' => [
|
||||
'host' => 'localhost',
|
||||
'database' => 'test',
|
||||
'user' => 'root',
|
||||
'password' => '',
|
||||
'charset' => 'utf8mb4',
|
||||
],
|
||||
],
|
||||
];
|
@ -3,11 +3,11 @@
|
||||
// Encapsulates a single connection to a database
|
||||
class DBHandle
|
||||
{
|
||||
private string $host = '127.0.0.1';
|
||||
private string $db = 'test';
|
||||
private string $user = 'root';
|
||||
private string $pass = '';
|
||||
private string $charset = 'utf8mb4';
|
||||
private string $host = CONFIG['database']['args']['host'];
|
||||
private string $db = CONFIG['database']['args']['database'];
|
||||
private string $user = CONFIG['database']['args']['user'];
|
||||
private string $pass = CONFIG['database']['args']['password'];
|
||||
private string $charset = CONFIG['database']['args']['charset'];
|
||||
|
||||
public object $dbh;
|
||||
|
||||
|
@ -12,6 +12,12 @@
|
||||
Tread carefully
|
||||
*/
|
||||
|
||||
// Autoloader
|
||||
spl_autoload_register(function ($class_name) {
|
||||
require __DIR__ . '/core/' . $class_name . '.php';
|
||||
});
|
||||
|
||||
// Define global CONFIG constant.
|
||||
define("CONFIG",
|
||||
require __DIR__ . '/config.php'
|
||||
);
|
@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?=htmlspecialchars($title);?> – Stafett for livet</title>
|
||||
|
||||
<link rel="stylesheet" href="static/style/main.css">
|
||||
<link rel="stylesheet" href="<?=CONFIG['root_url']?>/static/style/main.css">
|
||||
<body>
|
||||
|
||||
<div id="header">
|
||||
@ -18,7 +18,7 @@
|
||||
<div id="menu">
|
||||
<small>
|
||||
<span>Ikke pålogget</span>
|
||||
<a href="">Logg inn</a>
|
||||
<a href="<?=CONFIG['root_url']?>/login.php">Logg inn</a>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
@ -28,9 +28,9 @@
|
||||
|
||||
<div id="nav">
|
||||
<ul>
|
||||
<li><a href="">Forside</a></li>
|
||||
<li><a href="">Logg inn</a></li>
|
||||
<li><a href="">Eksempel</a></li>
|
||||
<li><a href="<?=CONFIG['root_url']?>/index.php">Forside</a></li>
|
||||
<li><a href="<?=CONFIG['root_url']?>/login.php">Logg inn</a></li>
|
||||
<li><a href="<?=CONFIG['root_url']?>">Eksempel</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user