show name when logged in in main top bar

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-06-26 17:43:29 +02:00
parent 9e6597e937
commit f9cdc45ed8
3 changed files with 13 additions and 11 deletions

View file

@ -7,9 +7,16 @@ session_start();
//print_r($_SESSION);
//perform an action in case one is specified
if ( isset( $_POST["function"] ) ){
require( "inc/" . $_POST["function"] . ".php" );
$return = $_POST["function"]();
}
//Decide what page to load
if(isset($_SESSION['user'])){
$page = 'home';
$return['username'] = $_SESSION['user'];
}else{
//default page
$page = 'login';
@ -19,13 +26,6 @@ if ( isset( $_GET["page"] ) ){
$page = $_GET["page"];
}
//perform an action in case one is specified
if ( isset( $_POST["function"] ) ){
require( "inc/" . $_POST["function"] . ".php" );
$return = $_POST["function"]();
}
function loadpage ( $page ){
$filename = 'autoload/' . $page . '.php';
if(is_file($filename)){

View file

@ -89,17 +89,19 @@
</div>
<!-- theme selector ends -->
<!-- user dropdown starts -->
{if isset($username)}
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-user"></i><span class="hidden-phone"> admin</span>
<i class="icon-user"></i><span class="hidden-phone">{$username}</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">Profile</a></li>
<li class="divider"></li>
<li><a href="login.php">Logout</a></li>
<li><a href="index.php?page=logout">Logout</a></li>
</ul>
</div>
{/if}
<!-- user dropdown ends -->

View file

@ -15,12 +15,12 @@
<form method="post" action="index.php" class="form-horizontal">
<fieldset>
<div data-rel="tooltip" class="input-prepend" data-original-title="Username">
<span class="add-on"><i class="icon-user"></i></span><input type="text" value="" id="Username" name="Username" class="input-large span10" autofocus="">
<span class="add-on"><i class="icon-user"></i></span><input type="text" value="" id="Username" name="Username" class="input-large span10" placeholder="Username">
</div>
<div class="clearfix"></div>
<div data-rel="tooltip" class="input-prepend" data-original-title="Password">
<span class="add-on"><i class="icon-lock"></i></span><input type="password" value="" id="Password" name="Password" class="input-large span10">
<span class="add-on"><i class="icon-lock"></i></span><input type="password" value="" id="Password" name="Password" class="input-large span10" placeholder="Password">
</div>
<div class="clearfix"></div>