Skip to content
Snippets Groups Projects
Commit 75099a5f authored by root's avatar root
Browse files

base path

parent 57391173
No related branches found
No related tags found
No related merge requests found
......@@ -7,10 +7,10 @@
<title>Login to Photogram</title>
<!-- Bootstrap core CSS -->
<link href="/photogram/assets/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="<?=get_config('base_path')?>assets/dist/css/bootstrap.min.css" rel="stylesheet">
<title>Photogram by LAHTP</title>
<? if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/photogram/css/' . basename($_SERVER['PHP_SELF'], ".php") . ".css")) { ?>
<link href="/photogram/css/<?= basename($_SERVER['PHP_SELF'], ".php") ?>.css" rel="stylesheet">
<? if (file_exists($_SERVER['DOCUMENT_ROOT'] .get_config('base_path').'css/' . basename($_SERVER['PHP_SELF'], ".php") . ".css")) { ?>
<link href="<?=get_config('base_path')?>css/<?= basename($_SERVER['PHP_SELF'], ".php") ?>.css" rel="stylesheet">
<? } ?>
</head>
\ No newline at end of file
......@@ -18,7 +18,7 @@ if ($signup) {
<main class="container">
<div class="bg-light p-5 rounded mt-3">
<h1>Signup Success</h1>
<p class="lead">Now you can login from <a href="/photogram/login.php">here</a>.</p>
<p class="lead">Now you can login from <a href="<?=get_config('base_path')?>login.php">here</a>.</p>
</div>
</main>
......
......@@ -19,7 +19,7 @@ include 'libs/load.php';
</main>
<? load_template('_footer'); ?>
<script src="/photogram/assets/dist/js/bootstrap.bundle.min.js"></script>
<script src="<?=get_config('base_path')?>assets/dist/js/bootstrap.bundle.min.js"></script>
</body>
......
......@@ -6,9 +6,10 @@ include_once 'includes/Database.class.php';
include_once 'includes/UserSession.class.php';
global $__site_config;
// global $__base_path;
//Note: Change this path if you run this code outside lab.
$__site_config = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/../photogramconfig.json');
// $__base_path = get_config('base_path');
Session::start();
function get_config($key, $default=null)
......@@ -24,7 +25,7 @@ function get_config($key, $default=null)
function load_template($name)
{
include $_SERVER['DOCUMENT_ROOT'] . "/photogram/_templates/$name.php"; //not consistant.
include $_SERVER['DOCUMENT_ROOT'] . get_config('base_path'). "_templates/$name.php"; //not consistant.
}
function validate_credentials($username, $password)
......
<?php
include 'libs/load.php';
?>
......@@ -17,7 +16,7 @@ include 'libs/load.php';
</main>
<? load_template('_footer'); ?>
<script src="/photogram/assets/dist/js/bootstrap.bundle.min.js"></script>
<script src="<?=get_config('base_path')?>assets/dist/js/bootstrap.bundle.min.js"></script>
</body>
......
......@@ -17,7 +17,7 @@ include 'libs/load.php';
</main>
<? load_template('_footer'); ?>
<script src="/photogram/assets/dist/js/bootstrap.bundle.min.js"></script>
<script src="<?=get_config('base_path')?>assets/dist/js/bootstrap.bundle.min.js"></script>
</body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment