How to load any activity by default when Page loads? - php

Below is my Code where user after sucessfully login can enter into website, but then it shows empty with left and right sidebar
I want the dashboard activity to load by default as the user signed in. How can I do that.
Here it is an library managment system whre user can borrow , edit return books and all history is recorded.
<?php
session_start();
error_reporting(0);
include("databaseConnection.php");
$username = $_SESSION['username'];
if($_REQUEST['activity'] == 'logout'){
$username = null;
$username ="";
unset($username);
$_SESSION['username'] = null;
$_SESSION['username'] ="";
unset($_SESSION['username']);
session_destroy();
}
if(empty($username)){
header("location: ../Index.php");
}
?>
<html>
<head>
</head>
<body>
<!--CONTAINER AREA SECTION-->
<div class="containerHome">
<!--HEAD SECTION-->
<div class="headSection">
<?php include("headSection.php"); ?>
</div>
<!--HEAD SECTION-->
<div class="navSection">
<div class="welcomeTitle">Welcome</div>
<div class="tooltip">Contact Us
<span class="tooltiptext">
<b>Address:</b> Central Department Of Physics, Kirtipur<br>
<b>Phone:</b> 01-4331054
</span>
</div>
<div class="logoutLink">Logout</div>
</div>
<!--LEFT BAR SECTION-->
<div class="leftSection">
<?php include("leftSection.php");?>
</div>
<!--LEFT BAR SECTION-->
<!--CONTENT AREA SECTION-->
<div class="contentSection">
<?php
// CODE FOR PERFORMMING ACTIVITY..
$activity = $_REQUEST['activity'];
if($activity) {
if(isset($_POST['activity'])) {
include("dashboard.php");
}
if($activity) {
if($activity == 'addMember'){
include("addMember.php");
}
if($activity == 'dashboard'){
include("dashboard.php");
}
if($activity == 'issueBooks'){
include("issueBooks.php");
}
if($activity == 'returnBooks'){
include("returnBooks.php");
}
if($activity == 'updateBook'){
$uBookId = $_REQUEST['uBookId'];
$return = mysql_num_rows(mysql_query("SELECT bookId From borrow Where bookId = '$uBookId'"));
if(empty($return)){
$query = mysql_query("SELECT bookId,title,author,price,publisher From books Where bookId = '$uBookId'");
$result = mysql_fetch_assoc($query);
?>
</div>
<!--CONTENT AREA SECTION-->
<!--RIGHT AREA SECTION-->
<div class="rightSection">
<?php include("rightSection.php");?>
</div>
<!--RIGHT AREA SECTION-->
</div>
<!--CONTAINER AREA SECTION-->
</body>
</html>

Change code below
<?php
// CODE FOR PERFORMMING ACTIVITY..
$activity = $_REQUEST['activity'];
if(isset($activity) || empty($activity)) {
include("dashboard.php");
}
else {
if($activity == 'addMember'){
include("addMember.php");
.............your code............
My advice is DO NOT USE $_REQUEST use $_GET, $_POST instead.

Related

How do I output two values from two different tables to a href?

I want to output something like this:
viewlogs.php?id=1&EmployeeNo=15000000600
However, I'm not sure what condition I should be using. I have two separate database to call, one is on MySQL which is easily taken to the localhost, and MSSQL which I'm not very familiar with.
I'm trying a logic where I use && within a while loop.
My code works something like this:
<?php
session_start();
if (!isset($_SESSION['username']))
{
header('location: login.php');
die();
}
?>
<?php
try {
include ("config.php");
include ("sqlsrv.php");
}catch(Exception $e){
die("ERROR:".$e->getMessage());
}
if(isset($_POST['usn']) && $_POST['usn']!=""){
$res = $conn->prepare("SELECT EmployeeNo, FirstName, MiddleName, LastName, DateHired, ResignationDate FROM TA3.dbo.Employees");
$res->execute();
$req = $db->prepare("SELECT * FROM students WHERE usn LIKE :usn");
$req->execute(array(
'usn'=>'%'.$_POST['usn'].'%'));
if ($req->rowCount()==0 && $_SESSION['type']=="Super_Admin") { ?>
<span class="notfound">Student not found? <a class="addstud" href="create.php">add student?</a></span>
<?php
}
elseif ($req->rowCount()==0 && $_SESSION['type']=="Admin") { ?>
<span class="henhen">Student not found</span>
<?php
}
else{
while ($data=$req->fetch() && $outcome=$res->fetch()){
?>
<div class="infohen">Info </div>
<div class="uy">
<div class="name"><?php echo $data['fname']." ".$data['mname']." ".$data['lname']; ?></div>
<div class="email"><?php echo $data['email']; ?></div>
<div class="usn"><?php echo $data['usn']; ?></div>
<div class="schedule"><?php echo $data['schedule']; ?></div>
<div class="strand"><?php echo $data['strand']; ?></div></div>
<?php if ($_SESSION['type']=="Super_Admin")
{ ?>
<div class="gridme">
<div class="action-list">
<div class="action">Action</div>
<div class="edit"> Edit</div>
<div class="logs">Logs</div>
<?php } else { ?>
<div class="gridme">
<div class="action-list">
<div class="action">Action</div>
<div class="logs">Logs</div>
<?php } ?>
</div>
</div>
</div>
</div>
<?php
}
}
}else { ?>
<span class="message">Enter USN!</span>
<?php
}
?>
<!-- <div class="enable"> <a onclick="return confirm('Are you sure you want to Enable student?')" href="enable.php?id=<?= $data['id']?>"> Enable </div>
<div class="disable"> <a onclick="return confirm('Are you sure you want to disable student?')" href="disable.php?id=<?= $data['id']?>">Disable</a>
</div> -->
<!-- </div>
<div class="status-list">
<div class="status">Status</div>
<div class="active">Active</div>
</div> -->
If I use while ($data=$req->fetch() && $outcome=$res->fetch()), the details called from $data are all gone.
I'm having trouble with logic since I'm not very good at it.
If anyone might need it, I found a solution.
I just needed to use open and close parenthesis.
while (($data=$req->fetch()) && ($outcome=$res->fetch()))

How to Implement Login/ PHP Web App within Wordpress

I've included a manual php file inside the template folder of wordpress.
Then created a page of its type in wordpress.
Then the user interface related to the specific php file will be displayed.
It contains a simple login functionality.
When the username and password is matched, it should redirect to the next php welcome page. Instead it reloads itself.
How to load the next php file to this page ?
<?php
include("config.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from form
$myusername = mysqli_real_escape_string($db,$_POST['username']);
$mypassword = mysqli_real_escape_string($db,$_POST['password']);
$sql = "SELECT varEmail FROM tblUser WHERE varEmail = '$myusername' and varPassword = '$mypassword'";
$result = mysqli_query($db,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$active = $row['active'];
$count = mysqli_num_rows($result);
$error = "Inside";
// If result matched $myusername and $mypassword, table row must be 1 row
if($count == 1) {
wp_redirect( 'http://www.example.com', 302 );//exit;
$error = "{$myusername}{':'}{$mypassword }";
}else {
$error = "Your Login Name or Password is invalid";
}
}
?>
<?php
/*
Template Name: Online Survey
*/
get_header();
?>
<?php
$page_title = get_post_meta($post->ID, 'iweb_page_title', TRUE);
$mb_portfolio = get_post_meta($post->ID, 'iweb_page_portfolio', TRUE);
$mb_signup = get_post_meta($post->ID, 'iweb_page_signup', TRUE);
$mb_clients = get_post_meta($post->ID, 'iweb_page_clients', TRUE);
?>
<!-- PAGE TITLE -->
<div class="container clearfix">
<div class="sixteen columns">
<div class="page-title-container clearfix">
<?php if ($page_title != '') { ?>
<h1 class="page-title"><?php echo $page_title; ?></h1>
<?php } else { ?>
<?php get_template_part('includes/breadcrumbs'); ?>
<?php } ?>
</div>
</div>
</div>
</div> <!-- Grey bg end -->
<div class="clearfix">
<div class="m-bot-10">
<?php if(iwebtheme_smof_data('map_enable') != 0) { ?>
<!-- Google Maps -->
<section class="google-map-container">
<div id="googlemaps" class="google-map"></div>
</section>
<!-- Google Maps / End -->
<?php } ?>
</div>
</div>
<!-- CONTACT FORM-->
<div class="container clearfix">
<div class="ten columns m-bot-35">
<form action = "" method = "post">
<label>Email :</label><input type = "text" name = "username" class = "box"/><br /><br />
<label>Password :</label><input type = "password" name = "password" class = "box" /><br/><br />
<input type = "submit" value = " Submit "/><br />
</form>
<div style = "font-size:11px; color:#cc0000; margin-top:10px"><?php echo $error; ?></div>
</div>
</div>
<?php if($mb_portfolio != 'Disable') { ?>
<?php get_template_part( 'includes/part-portfolio' ); ?>
<?php } ?>
<?php if($mb_signup != 'Disable') { ?>
<?php get_template_part( 'includes/part-newsletter' ); ?>
<?php } ?>
<?php if($mb_clients != 'Disable') { ?>
<?php get_template_part( 'includes/part-clients' ); ?>
<?php } ?>
How can I load the welcoome.php file ?
wp_redirect( 'http://www.example.com', 302 );//exit;
It's hosted shared. Is it possible to create a php web application alongside wordpress , and call that application inside php or redirect a php page to the web application ?
Login is successful, but I cannot load the other pages. Or should I load them dynamically ?

Add to cart $_SESSION has been destroy after logged in

Why my $_SESSION["products"] has been destroy after logged in, How do I keep my $_SESSION["products"] after I logged in?
Add product to cart before logged in.
After logged in my cart is empty.
CODE
login.php
<?php
ob_start();
session_start();
include 'init.php';
require_once 'config.php';
//initalize user class
$user_obj = new Cl_User();
if(!empty( $_POST )){
try {
$user_obj = new Cl_User();
$data = $user_obj->login( $_POST );
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']){
header('Location: home.php');
}
} catch (Exception $e) {
$error = $e->getMessage();
}
}
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']){
header('Location: home.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Smart Login Page</title>
<link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/login.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<?php require_once 'templates/ads.php';?>
<div class="login-form">
<?php require_once 'templates/message.php';?>
<h1 class="text-center">Login</h1>
<div class="form-header">
<i class="fa fa-user"></i>
</div>
<form id="login-form" method="post" class="form-signin" role="form" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input name="email" id="email" type="email" class="form-control" placeholder="Email" autofocus>
<input name="password" id="password" type="password" class="form-control" placeholder="Password">
<button class="btn btn-block bt-login" type="submit" id="submit_btn" data-loading-text="loging in....">Login</button>
<br>
</form>
<div class="form-footer">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<i class="fa fa-lock"></i>
Forgot Password?
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<i class="fa fa-check"></i>
Sign up
</div>
</div>
</div>
</div>
</div>
<!-- /container -->
<script src="js/jquery.validate.min.js"></script>
<script src="js/login.js"></script>
</body>
</html>
<?php ob_end_flush(); ?>
login function in User.php
public function login( array $data )
{
$_SESSION['logged_in'] = false;
if( !empty( $data ) ){
// Trim all the incoming data:
$trimmed_data = array_map('trim', $data);
// escape variables for security
$email = mysqli_real_escape_string( $this->_con, $trimmed_data['email'] );
$password = mysqli_real_escape_string( $this->_con, $trimmed_data['password'] );
if((!$email) || (!$password) ) {
throw new Exception( LOGIN_FIELDS_MISSING );
}
$password = md5( $password );
$query = "SELECT member_id, member_display_name, member_email, member_status, roles_id FROM fm_member where member_email = '$email' and member_pwd = '$password' ";
//$query = "SELECT user_id, name, email, created, roles_id, id FROM users where email = '$email' and password = '$password'"
$result = mysqli_query($this->_con, $query);
$data = mysqli_fetch_assoc($result);
$count = mysqli_num_rows($result);
mysqli_close($this->_con);
if( $count == 1){
$_SESSION = $data;
if($_SESSION['member_status'] == 'Activated') {
$_SESSION['logged_in'] = true;
return true;
} else {
throw new Exception( 'Your account is Deactiavted! <br> Please contact to Adminnistrator for more information.' );
$_SESSION['logged_in'] = false;
}
}else{
throw new Exception( LOGIN_FAIL );
}
} else{
throw new Exception( LOGIN_FIELDS_MISSING );
}
}
cart_process.php
session_start(); //start session
include_once("config.inc.php"); //include config file
setlocale(LC_MONETARY,"en_US"); // US national format (see : http://php.net/money_format)
############# add products to session #########################
if(isset($_POST["product_code"]))
{
foreach($_POST as $key => $value){
$new_product[$key] = filter_var($value, FILTER_SANITIZE_STRING); //create a new product array
}
//we need to get product name and price from database.
$statement = $mysqli_conn->prepare("SELECT fm_product.p_name, fm_product.p_price, fm_product.p_member_id, fm_product.p_discount, fm_member.member_display_name, fm_member.member_payment, fm_product_image.img_1, shipping_cost.shipping_register,
shipping_cost.shipping_normal, shipping_cost.shipping_ems FROM fm_product LEFT JOIN fm_member ON fm_member.member_id = fm_product.p_member_id LEFT JOIN fm_product_image ON fm_product_image.p_id_img = fm_product.p_id LEFT JOIN shipping_cost ON shipping_cost.shipping_vendor = fm_member.member_id WHERE p_id=?");
$statement->bind_param('s', $new_product['product_code']);
$statement->execute();
$statement->bind_result($product_name, $product_price, $p_member_id, $p_discount, $member_display_name, $member_payment, $img_1, $shipping_register, $shipping_normal,$shipping_ems);
while($statement->fetch()){
$new_product["p_name"] = $product_name; //fetch product name from database
$new_product["p_price"] = $product_price;
$new_product["p_member_id"] = $p_member_id;
$new_product["p_discount"] = $p_discount;
$new_product["member_display_name"] = $member_display_name;
$new_product["member_payment"] = $member_payment;
$new_product["img_1"] = $img_1;
$new_product["shipping_register"] = $shipping_register;
$new_product["shipping_normal"] = $shipping_normal;
$new_product["shipping_ems"] = $shipping_ems;
//fetch product price from database
if(isset($_SESSION["products"])){ //if session var already exist
if(isset($_SESSION["products"][$new_product['product_code']])) //check item exist in products array
{
unset($_SESSION["products"][$new_product['product_code']]); //unset old item
}
}
$_SESSION["products"][$new_product['product_code']] = $new_product; //update products with new item array
}
$total_items = count($_SESSION["products"]); //count total items
die(json_encode(array('items'=>$total_items))); //output json
}
################## list products in cart ###################
if(isset($_POST["load_cart"]) && $_POST["load_cart"]==1)
{
if(isset($_SESSION["products"]) && count($_SESSION["products"])>0){ //if we have session variable
$cart_box = '<ul class="cart-products-loaded">';
$total = 0;
foreach($_SESSION["products"] as $product){ //loop though items and prepare html content
//set variables to use them in HTML content below
$product_name = $product["p_name"];
if(!empty($product["p_discount"]))
{
$product_price = $product["p_discount"];
} else if(empty($product["p_discount"])) {
$product_price = $product["p_price"];
}
$product_code = $product["product_code"];
$p_member_id = $product["p_member_id"];
$member_display_name = $product["member_display_name"];
$member_payment = $product["member_payment"];
$product["product_qty"] = 1;
$product_qty = $product["product_qty"];
$cart_box .= "<li>$product_name — Price ".$product_price." x ".$product_qty." = ".sprintf($product_qty * $product_price)."×</li>";
$subtotal = ($product_price * $product_qty);
$total = ($total + $subtotal);
}
$cart_box .= "</ul>";
$cart_box .= '<div class="cart-products-total" style="border-top: 1px solid #C0C0C0;">'.$quantity.'Total : '.sprintf($total).'<u>Check Out</u></div>';
die($cart_box); //exit and output content
}else{
die("Empty Cart!"); //we have empty cart
}
}
EDIT
home.php added
<?php
session_start();
include('connect.php');
$ID = $_SESSION['member_id'];
if(!isset($_SESSION['logged_in'])){
header('Location: index.php');
}
?>
<?php require_once 'templates/header.php';?>
<?php if($_SESSION['roles_id']=='1') { ?>
<div class="content">
<div class="container">
<div class="col-md-8 col-sm-8 col-xs-12">
<br>
<h1 class="text-center"> Admin Page </h1>
<br>
</div>
<?php require_once 'templates/sidebar.php';?>
</div>
</div> <!-- /container -->
<?php } else if($_SESSION['roles_id']=='2') { ?>
<div class="content">
<div class="container">
<div class="col-md-8 col-sm-8 col-xs-12">
<br>
<h1 class="text-center"> User Page </h1>
<br>
</div>
<?php require_once 'templates/sidebar.php';?>
</div>
</div> <!-- /container -->
<?php } ?>
looks like $_SESSION = $data; may be your culprit, you're resetting the entire session variable with data.
EDIT
Where $_SESSION = $data is change it to this;
$data["products"] = $_SESSION["products"];
$_SESSION = $data;

May i know what is wrong with my phpcode?

This is what i have for headers.php anyway it is suppose to be my navigation bar. Here's the problem, when I login with a user as Member the whole header does not come out. But when I login with admin the navigations will "magically" come out!
<?php
if(!isset($_SESSION['sRole'])){
?>
<div id="header">
<div id="fb-root"></div>
<div id ="inthebox">
<b>LOGIN</b>|
<b>REGISTER</b>
</div>
<div id ="outthebox">
HOME|
BOOKSHELF|
SHOPPING CART|
ABOUT|
ABOUT|
</div>
</div>
<?php
}
else{
if($_SESSION['sRole'] == "member"){
?>
<div id="header">
<div id ="inthebox">
<b>LOGOUT</b>
</div>
<div id ="outthebox">
HOME|
BOOKSHELF|
SHOPPING CART|
ABOUT|
PROFILE
<?php
echo("You have Login as :" . $_SESSION['sUsername']);
?>
</div>
</div>
<?php
}else{
if($_SESSION['sRole']=="admin"){
?>
<div id="header">
<div id ="inthebox">
<b>LOGOUT</b>
</div>
<div id="outthebox">
HOME|
BOOKSHELF|
SHOPPING CART|
ABOUT|
Manage Account|
Manage Books|
Manage Orders|
<?php
echo("You have Login as :" . $_SESSION['sUsername']);
?>
</div>
</div>
<?php
}
}
}
?>
This is my doLogin.php page , maybe it might help anyone here to solve this. I store the id, username, firstname and last name into the session. Inside have alr . The website hor when I go in is no error one . no html code error or whatsoever. Just that it does not appear. However the words below the nav links will still come out.
<?php
//connect to database
include ('dbfunction.php');
if (!isset($_POST['Login'])) {
if (isset($_POST['username'])) {
//retrieve form data
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE username='" . $username . "'AND password = '" . $password . "'";
$result = mysql_query($query) or die('The error :' . mysql_error());
$num_rows =mysql_num_rows($result);
if($num_rows == 0){
header('Location:login.php');
exit();
}
//if record is found, store id and username into session
else{
$row = mysql_fetch_array($result);
$_SESSION['sUsername'] = $row['username'];
$_SESSION['sRole'] = $row['role'];
$_SESSION['sFirst_name'] = $row['first_name'];
$_SESSION['sLast_name'] = $row['last_name'];
header('location:successful_login.php');//redirect to this page
exit();
}
}
else {
}
} else {
header('Location:successful_login.php');
exit();
}
mysql_close();
?>
I think the problem here is you are using } else { conditions, but then nesting an if statement inside of them. In fact it looks like you had some broken closing braces. Here is the revised code:
<?php if(!isset($_SESSION['sRole'])){ ?>
<div id="header">
<div id="fb-root"></div>
<div id ="inthebox">
<b>LOGIN</b>|
<b>REGISTER</b>
</div>
<div id ="outthebox">
HOME|
BOOKSHELF|
SHOPPING CART|
ABOUT|
ABOUT|
</div>
</div>
<?php } else if($_SESSION['sRole'] == "member") { ?>
<div id="header">
<div id ="inthebox">
<b>LOGOUT</b>
</div>
<div id ="outthebox">
HOME|
BOOKSHELF|
SHOPPING CART|
ABOUT|
PROFILE
<?php
echo("You have Login as :" . $_SESSION['sUsername']);
?>
</div>
</div>
<?php }else if($_SESSION['sRole']=="admin"){ ?>
<div id="header">
<div id ="inthebox">
<b>LOGOUT</b>
</div>
<div id="outthebox">
HOME|
BOOKSHELF|
SHOPPING CART|
ABOUT|
Manage Account|
Manage Books|
Manage Orders|
<?php
echo("You have Login as :" . $_SESSION['sUsername']);
?>
</div>
</div>
<?php
}
try this:
<?php if( (!isset($_SESSION['sRole'])) || (empty($_SESSION['sRole'])) || (is_null($_SESSION['sRole'])) ): ?>
<html>your code</html>
<?php else: ?>
<?php switch($_SESSION['sRole']) {
case 'admin': { // admin code } break;
case 'member': { // member code } break;
default: { // something happened } break;
}
?>
<?php endif; ?>
check and diagnose the issue

Weird "?>" being displayed

I have the following navigation bar script:
<?php session_start();
require('includepath.inc.php');
require($include_path.'loginsysfunc.inc.php');
$current_page = $_SERVER['REQUEST_URI'];
?>
<div class="navbar">
<img class="navlogo" src="logo.png">
<div class="navbutton">Home</div>
<div class="navbutton">About</div>
<div class="navbutton">Donate</div>
<?php
if (loggedIn()){
?>
<div class="navusername"><?php echo $_SESSION['username']; ?></div>
<div class="navtoolsettings">Settings</div>
<div class="navtoollogout">Log out
<?php
} elseif ($current_page == '/login.php') {
?>
<div class="navregister">Register</div>
<?php
} else {
?>
<div class="navusername">Log in</div>
<?php
}
?>
</div>
For some reason, a strange "?>" is being displayed. I am super confused, so please help.
Here is includepath.inc.php (the only I reason it's there is because I am on a shared host, and I don't want to type '/home/bigdumbhash/public_html/include' everytime. But, here it is:
<?php
$include_path = '/home/a6595899/public_html/include/';
?>
Here is loginsysfunc.inc.php. These are functions that go with my login system to save time:
<?php
function valUser() {
session_regenerate_id();
$_SESSION['valid'] = true;
$_SESSION['username'] = $userid;
echo '<meta http-equiv="refresh" content="0;URL=\'index.php\'">';
}
function loggedIn()
{
if($_SESSION['valid'] == true) {
return true;
} else {
return false;
}
}
function createSalt() {
$string = $string = md5(uniqid(rand(), true));
return substr($string, 0, 3);
}
function logout()
{
$_SESSION = array();
session_destroy();
echo '<meta http-equiv="refresh" content="0;URL=\'index.php\'">';
}
?>
Here is the actual HTML of the page:
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
<title>
Log in
</title>
</head>
<body>
<div class="navbar">
<img class="navlogo" src="logo.png">
<div class="navbutton">Home</div>
<div class="navbutton">About</div>
<div class="navbutton">Donate</div>
<div class="navregister">Register</div>
</div> ?>
<div class="loginbox">
<h1>Log in</h1>
<form action="logingo.php" method="POST">
<input class="userpass" type="text" name="username" value="Username" onFocus="this.value='';">
<br>
<input class="userpass" type="password" name="password" value="Password" onFocus="this.value='';">
<br>
<input class="loginbutton" type="submit" value="Log in!">
</form>
</div>
</body>
</html>
<?php session_start();
require('includepath.inc.php');
require($include_path.'loginsysfunc.inc.php');
$current_page = $_SERVER['REQUEST_URI'];
?>
<div class="navbar">
<img class="navlogo" src="logo.png">
<div class="navbutton">Home</div>
<div class="navbutton">About</div>
<div class="navbutton">Donate</div>
<?php
if(loggedIn()){
?>
<div class="navusername"><?php echo $_SESSION['username']; ?></div>
<div class="navtoolsettings">Settings</div>
<div class="navtoollogout">Log out
<?
}else if($current_page == '/login.php'){
?>
<div class="navregister">Register</div>
<?
}else{
?>
<div class="navusername">Log in</div>
<?php
}
?>
</div>
According to the HTML output you posted, the problem seems to be somewhere in the file that displays <div class="loginbox"> (before that).
Have a look to the contents of that file.

Categories