Customizing SMF > Portals, Bridges, and Integrations
Custom header with Login SSI
(1/1)
NIAB:
Hi,
Currently I am trying to use a custom header for my own SMF Board, but I cannot get it to work correctly.
I have my own Index.php page acting as the 'portal' on the webroot (.com/index.php) and the forum is location in a sub folder (.com/forum/). I can't seem to get it to work as it should. What I want is for it to show a different menu for when the user is logged in and logged out, but when I log in the menu only changes on the index.php I made, where the forum menu (header) still shows the guest menu. I am using an include('header location') for it, and both pages are using the same include script and file.
The script I have for it:
--- Code: ---<?php
define('ROOT', dirname(__FILE__));
require_once ROOT . '/forum/SSI.php';
if ($context['user']['is_guest']){
ssi_login();
}
else
{
echo' This means you are logged in';
}
?>
--- End code ---
Please let me know if there is anything I am missing. Oh, and the guest menu works as it should via the SSI.
EDIT: I have also downloaded the API, but have no idea on how to use it.
Kindred:
You don't need the API. Give us a URL?
NIAB:
http://[Link removed].com
Still working on the overall theme, so ignore any errors you come across. I've also changed the login script to
--- Code: ---<?php
require("/home/*******/public_html/forum/SSI.php");
global $context;
$sesc= &$context['session_id'];
echo '<div class="overalllayout" style="margin-bottom: -10px;">
<div class="umbackground">';
// Offline Menu
session_start();
$_SESSION['MYuserID'] = $user_info["id"] ;
$_SESSION['MYaliasSTR'] = $user_info["username"] ;
$_SESSION['MYuserNameSTR'] = $user_info["name"] ;
$_SESSION['MYisAdminFLAG'] = $user_info["is_admin"] ;
if ($_SESSION['MYuserID'] != 1) // user logged Out
{
$_SESSION['login_url'] = 'http://www.[Link Removed].com' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
ssi_login();
}
else if ($_SESSION['MYuserID'] != 0) // not logged in
{
$_SESSION['logout_url'] = 'http://www.[Link Removed].com' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
echo 'Logged in - Message 01';
}
?>
--- End code ---
But still no luck.
NIAB:
Is there any simple way to get a session or cookie working with the header, since it's site wide.
NIAB:
Nevermind. Solved it myself :)
Method: Replaced the Include of the header in the index template with the full script. Works like a charm now, just sucks I have 2 of them now.
SOLVED
Navigation
[0] Message Index
Go to full version