switched to functions for the header/footer importing, it makes more sense imo
This commit is contained in:
parent
702edc411a
commit
36444b0e85
|
@ -1,4 +1,9 @@
|
|||
<!-- this is such a lonely file... -->
|
||||
<?php
|
||||
function display_footer() {
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
// Load in display variables
|
||||
$title = $title ?? '~chan';
|
||||
function display_header($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>
|
||||
<b>profile:</b> (
|
||||
<?php
|
||||
if (($_SESSION['logged_in'] ?? 0) == 1) {
|
||||
// I just decided to echo everything out here since the <?php ?\> syntax was ugly
|
||||
echo "<a href=\"/profile.php\">profile</a>";
|
||||
echo " / ";
|
||||
echo "<a href=\"logout.php\">log out</a>";
|
||||
echo " )";
|
||||
} else {
|
||||
echo "<a href=\"/register.php\">register</a>";
|
||||
echo " / ";
|
||||
echo "<a href=\"/login.php\">login</a>";
|
||||
echo " )";
|
||||
}
|
||||
if (($_SESSION['logged_in'] ?? 0) == 1) {
|
||||
// I just decided to echo everything out here since the <?php ?\> syntax was ugly
|
||||
echo "<a href=\"/profile.php\">profile</a>";
|
||||
echo " / ";
|
||||
echo "<a href=\"logout.php\">log out</a>";
|
||||
echo " )";
|
||||
} else {
|
||||
echo "<a href=\"/register.php\">register</a>";
|
||||
echo " / ";
|
||||
echo "<a href=\"/login.php\">login</a>";
|
||||
echo " )";
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="main">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
$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="
|
||||
|
@ -12,6 +15,5 @@ require($path . '/core/header.php');
|
|||
hello there!
|
||||
</div>
|
||||
<?php
|
||||
require($path . '/core/footer.php');
|
||||
# the end...
|
||||
display_footer();
|
||||
?>
|
||||
|
|
15
login.php
15
login.php
|
@ -1,14 +1,10 @@
|
|||
<?php
|
||||
// if a login was submitted
|
||||
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
}
|
||||
|
||||
$title = "~chan - login";
|
||||
$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="
|
||||
margin: auto;
|
||||
width: 300px;
|
||||
|
@ -34,6 +30,5 @@ include($path . '/core/header.php');
|
|||
</div>
|
||||
|
||||
<?php
|
||||
include($path . '/core/footer.php');
|
||||
# the end...
|
||||
display_footer();
|
||||
?>
|
||||
|
|
15
register.php
15
register.php
|
@ -1,12 +1,9 @@
|
|||
<?php
|
||||
// page vars
|
||||
$title = "~chan - register";
|
||||
|
||||
// imports
|
||||
$path = $_SERVER['DOCUMENT_ROOT'];
|
||||
require($path . '/core/header.php');
|
||||
require($path . '/core/security.php');
|
||||
require($path . '/core/database.php');
|
||||
require_once($path . '/core/header.php');
|
||||
require_once($path . '/core/footer.php');
|
||||
require_once($path . '/core/security.php');
|
||||
require_once($path . '/core/database.php');
|
||||
|
||||
//TODO: email / invite registration
|
||||
|
||||
|
@ -75,6 +72,7 @@ if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
//TODO: Tell the user they have been registered
|
||||
}
|
||||
|
||||
display_header("~chan - register");
|
||||
?>
|
||||
<div style="
|
||||
margin: auto;
|
||||
|
@ -130,6 +128,5 @@ if(isset($_GET['login_failed'])) {
|
|||
</form>
|
||||
</div>
|
||||
<?php
|
||||
require($path . '/core/footer.php');
|
||||
# the end...
|
||||
display_footer();
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue