Using Sessions in the header

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Leav
Forum Members
Forum Members
Posts: 38
Joined: Fri Aug 11, 2006 8:26 pm

Using Sessions in the header

Post by Leav »

hello.

In my design I would like to have "flash file A" if this is the first time the user has browsed to this page this session and "flash file B" if they have already visited the site in their current session.

what is the best way to do this without getting tangled with any of the other sessions that CMSMS or phpBB may be using?

to be clear I am asking for help with the code as well since my php coding skills are lacking...

I have done this in school with ASP but php is new to me....

Thanks!

-Leav
Pierre M.

Re: Using Sessions in the header

Post by Pierre M. »

Please try the module "random image" or "rotate ad" (I don't remember its name). May be it will help.

If your "newsession" is a strict requirement, you must set/test a "flashanim" volatile cookie, as with asp &co. It is just http extension whatever the programming language. (see php.net)

PM
Leav
Forum Members
Forum Members
Posts: 38
Joined: Fri Aug 11, 2006 8:26 pm

Re: Using Sessions in the header

Post by Leav »

I resorted to writing my own code.
put this in a user created tag and call it when you want:

Code: Select all

session_start();
if ($_SESSION["flash_header"]==1)
{
	$header = "header2.swf";
}
else
{
	$_SESSION["flash_header"] = 1;
	$header = "header1.swf";
}
however in some embed tags you need to call the same file name twice so you can use this:

Code: Select all

session_start();
if ($_SESSION["flash_header"]==2)
{
	$header = "header2.swf";
}
else
{
	$_SESSION["flash_header"] += 1;
	$header = "header1.swf";
}
that will show the same file name twice and then change back to second file name and show that for the rest of the session.

hope that helps someone that needs it....

-Leav
Post Reply

Return to “CMSMS Core”