display logged in status of an external cookie

A place to make for-pay "CMS made simple" job offerings
Post Reply
martinneil
Forum Members
Forum Members
Posts: 15
Joined: Thu Mar 12, 2009 6:02 pm

display logged in status of an external cookie

Post by martinneil »

Hello CMS developers.

I require my CMS template to include a file in it's template that displays the logged in / not logged in status of my users based on another cookie on the website.

I beleive the code that does this on my other pages is

Code: Select all

<?php		if(@$_SESSION['clientID']!='' && @$customeraccounturl!=''){ ?>
Welcome back <?php print $_SESSION['clientUser']?>. <a href="<?php print $customeraccounturl?>">Client area</a> / <a href="cart.php">My Basket</a><br />
<?php		}else{ ?><?php		} ?>
<?php	if(@$enableclientlogin!=TRUE && @$forceclientlogin!=TRUE){ ?>
client login not enabled
<?php	}elseif(@$_SESSION['clientID'] != ''){ ?>
Welcome back <?php print $_SESSION['clientUser']?> (<a href="clientlogin.php">My Account</a> / <a href="login.php?mode=logout">Logout</a> )<?php	}else{ ?>
<a href="login.php">Login</a> / <a href="register.php">Register an Account</a><br />
<?php	} ?>
and my other pages use includes at the top of tha page something like this

Code: Select all

<?php

session_cache_limiter('none');

session_start();

ob_start(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<__html xmlns="http://www.w3.org/1999/xhtml">

<?php include "vsadmin/db_conn_open.php" ?>

<?php include "vsadmin/includes.php" ?>

<?php include "vsadmin/inc/languagefile.php" ?>

<?php include "vsadmin/inc/incfunctions.php" ?>

<?php include "vsadmin/inc/metainfo.php" ?>
If anyone feel sthey are familiar with this situation and can offer a solution to how i can display the "if logged in display X link / if not logged in display Y link" in my CMS header please get in touch.

Many thanks

Martin Neil
SimonSchaufi

Re: display logged in status of an external cookie

Post by SimonSchaufi »

you can put the code without the starting and closing php tag in a UDT and call this UDT from your template. for information about UDTs, read the documentation ;)
Last edited by SimonSchaufi on Thu Mar 12, 2009 6:42 pm, edited 1 time in total.
martinneil
Forum Members
Forum Members
Posts: 15
Joined: Thu Mar 12, 2009 6:02 pm

Re: display logged in status of an external cookie

Post by martinneil »

Hello Simon

Thank you for your reply. I've already had a try at the UDT myself but haven't managed to get it working. (hence why I'm posting in the commercial help section not technical queries)

If anyone has experience of integrating this into the CMS system please get in touch as we need to be able to show the users status in the CMS template.

Thanks!
SimonSchaufi

Re: display logged in status of an external cookie

Post by SimonSchaufi »

should not be too complicated:

Code: Select all

if(isset($_SESSION['clientID']) && $_SESSION['clientID'] != ""){
echo "user logged in!";
}
Post Reply

Return to “Help Wanted (commercial)”