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); //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 //Decide what page to load
if(isset($_SESSION['user'])){ if(isset($_SESSION['user'])){
$page = 'home'; $page = 'home';
$return['username'] = $_SESSION['user'];
}else{ }else{
//default page //default page
$page = 'login'; $page = 'login';
@ -19,13 +26,6 @@ if ( isset( $_GET["page"] ) ){
$page = $_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 ){ function loadpage ( $page ){
$filename = 'autoload/' . $page . '.php'; $filename = 'autoload/' . $page . '.php';
if(is_file($filename)){ if(is_file($filename)){

View file

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

View file

@ -15,12 +15,12 @@
<form method="post" action="index.php" class="form-horizontal"> <form method="post" action="index.php" class="form-horizontal">
<fieldset> <fieldset>
<div data-rel="tooltip" class="input-prepend" data-original-title="Username"> <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>
<div class="clearfix"></div> <div class="clearfix"></div>
<div data-rel="tooltip" class="input-prepend" data-original-title="Password"> <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>
<div class="clearfix"></div> <div class="clearfix"></div>