Make use of Yapter Template Engine
This commit is contained in:
73
header.php
73
header.php
@@ -1,17 +1,26 @@
|
||||
<?php
|
||||
session_start();
|
||||
ob_start();
|
||||
|
||||
// check for user_id, if unnkown -> login
|
||||
if(empty($_SESSION['suser_id'])) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// includes
|
||||
include("config.php");
|
||||
include("dbconnect.php");
|
||||
include("functions.php");
|
||||
include("yapter.php");
|
||||
|
||||
// check for session
|
||||
if(empty($_SESSION['suser_id'])) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
// include language file
|
||||
include('lang/' . $_SESSION['suser_lang'] . '.php');
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/header.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// fill search box
|
||||
if (isset($_POST['search'])) {
|
||||
@@ -25,47 +34,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
// start header output
|
||||
?>
|
||||
<html>
|
||||
<header>
|
||||
<title>IP Reg</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</header>
|
||||
<body>
|
||||
<form method="POST" action="search.php">
|
||||
<table border="0" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
View by: <a href="asset.php">Asset</a> -
|
||||
<a href="assetclass.php">Assetclass</a> -
|
||||
<a href="location.php">Location</a> -
|
||||
<a href="subnet.php">Subnet</a> -
|
||||
<a href="vlan.php">VLAN</a>
|
||||
.:<input type="text" name="search" value="<?php echo $search; ?>"><input type="submit" value="Search!">
|
||||
</td>
|
||||
<td align="right">
|
||||
<?php
|
||||
$suser_id = $_SESSION['suser_id'];
|
||||
|
||||
$result = mysql_query("SELECT displayname FROM user WHERE user_id='$suser_id'");
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
echo $displayname = $row->displayname . ' - ';
|
||||
}
|
||||
|
||||
// TEMP display only if admin
|
||||
if($_SESSION['suser_level'] >= 2) {
|
||||
echo '<a href="nodeadd.php">Add new node</a> - ';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<a href="options.php">Options</a> -
|
||||
<a href="logout.php">Log out</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
// give these to the templates too
|
||||
$tp->set("suser_displayname", $_SESSION['suser_displayname']);
|
||||
$tp->set("search", $search);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
?>
|
||||
Reference in New Issue
Block a user