How to include the "check if user logged in" code in custom code.

Started by danskmacabre, July 03, 2006, 03:15:20 AM

Previous topic - Next topic

danskmacabre

Basically, I'm coding a database maintenance page for a wargame I'm running online, partially using SMF forums for information.

The code I want to generate should check if the user is currently logged in and if so use those user details to show appropriate content to the specific user.

I know I can just scan the code and find the appropriate part eventually, but if anyone has any experience with this, then advice would be appreciated.


Website: cantref.org.uk chaos8.com | SmF version: 2 | Portal software: PortaMx 1.3 | Default theme: Coal Black

Elmacik


<?php
include("/absolute/forum/path/SSI.php");
if (
$context['user']['is_logged'])
echo 
' Hi User! ';
if (
$context['user']['is_admin'])
echo 
' Administration options ';
if (
$context['user']['is_guest'])       # or !$context[user']['is_logged'] can be used instead..
echo ' You are a guest, please login or register. ';
?>



This is the easier way.
Home of Elmacik

danskmacabre

Website: cantref.org.uk chaos8.com | SmF version: 2 | Portal software: PortaMx 1.3 | Default theme: Coal Black

Advertisement: