switched to functions for the header/footer importing, it makes more sense imo

This commit is contained in:
hayden 2019-06-29 19:54:26 -05:00
parent 702edc411a
commit 36444b0e85
5 changed files with 44 additions and 41 deletions

View File

@ -1,4 +1,9 @@
<!-- this is such a lonely file... --> <?php
</div> function display_footer() {
?>
</div>
</body> </body>
</html> </html>
<?php
}
?>

View File

@ -1,9 +1,10 @@
<?php <?php
// Load in display variables function display_header($title = "~chan") {
$title = $title ?? '~chan'; // Load in display variables
$title = $title ?? '~chan';
// Start handing session stuff
session_start(); // Start handing session stuff
session_start();
?> ?>
<!-- <!--
# - # - # - # - # - # - # - # - # - # - # - # - # - # - # # - # - # - # - # - # - # - # - # - # - # - # - # - # - #
@ -43,19 +44,22 @@ session_start();
<span> <span>
<b>profile:</b> ( <b>profile:</b> (
<?php <?php
if (($_SESSION['logged_in'] ?? 0) == 1) { if (($_SESSION['logged_in'] ?? 0) == 1) {
// I just decided to echo everything out here since the <?php ?\> syntax was ugly // I just decided to echo everything out here since the <?php ?\> syntax was ugly
echo "<a href=\"/profile.php\">profile</a>"; echo "<a href=\"/profile.php\">profile</a>";
echo " / "; echo " / ";
echo "<a href=\"logout.php\">log out</a>"; echo "<a href=\"logout.php\">log out</a>";
echo " )"; echo " )";
} else { } else {
echo "<a href=\"/register.php\">register</a>"; echo "<a href=\"/register.php\">register</a>";
echo " / "; echo " / ";
echo "<a href=\"/login.php\">login</a>"; echo "<a href=\"/login.php\">login</a>";
echo " )"; echo " )";
} }
?> ?>
</span> </span>
</div> </div>
<div class="main"> <div class="main">
<?php
}
?>

View File

@ -1,6 +1,9 @@
<?php <?php
$path = $_SERVER['DOCUMENT_ROOT']; $path = $_SERVER['DOCUMENT_ROOT'];
require($path . '/core/header.php'); require_once($path . '/core/header.php');
require_once($path . '/core/footer.php');
display_header();
?> ?>
<div style=" <div style="
@ -12,6 +15,5 @@ require($path . '/core/header.php');
hello there! hello there!
</div> </div>
<?php <?php
require($path . '/core/footer.php'); display_footer();
# the end...
?> ?>

View File

@ -1,14 +1,10 @@
<?php <?php
// if a login was submitted
if($_SERVER['REQUEST_METHOD'] == 'POST') {
}
$title = "~chan - login";
$path = $_SERVER['DOCUMENT_ROOT']; $path = $_SERVER['DOCUMENT_ROOT'];
include($path . '/core/header.php'); require_once($path . '/core/header.php');
?> require_once($path . '/core/footer.php');
display_header("~chan - login");
?>
<div style=" <div style="
margin: auto; margin: auto;
width: 300px; width: 300px;
@ -34,6 +30,5 @@ include($path . '/core/header.php');
</div> </div>
<?php <?php
include($path . '/core/footer.php'); display_footer();
# the end...
?> ?>

View File

@ -1,12 +1,9 @@
<?php <?php
// page vars
$title = "~chan - register";
// imports
$path = $_SERVER['DOCUMENT_ROOT']; $path = $_SERVER['DOCUMENT_ROOT'];
require($path . '/core/header.php'); require_once($path . '/core/header.php');
require($path . '/core/security.php'); require_once($path . '/core/footer.php');
require($path . '/core/database.php'); require_once($path . '/core/security.php');
require_once($path . '/core/database.php');
//TODO: email / invite registration //TODO: email / invite registration
@ -75,6 +72,7 @@ if($_SERVER['REQUEST_METHOD'] == 'POST') {
//TODO: Tell the user they have been registered //TODO: Tell the user they have been registered
} }
display_header("~chan - register");
?> ?>
<div style=" <div style="
margin: auto; margin: auto;
@ -130,6 +128,5 @@ if(isset($_GET['login_failed'])) {
</form> </form>
</div> </div>
<?php <?php
require($path . '/core/footer.php'); display_footer();
# the end...
?> ?>