Jump to content

Make HTML pages aware of logged in SMF users and control elements on them?


Trek15

Recommended Posts

Hello. This is the first time i've visited a PHP community so bare with me...

 

I've got an HTML document with an iframe covering the page and a strip of buttons at the top that changes content in this frame. What i would like to do is to make it so that only visitors who have registered and currently are logged in to the SMF 2 forum, situated one folder down from the position of the HTML document on the server, can see certain ones of those buttons. This would ideally mean that when users back to the site they would see these buttons right away thanks to cookies.

 

This is what i've gotten help with and done so far:

 

Added

<?php require("PATH/SSI.php") ?>

into the first line of the HTML document.

 

And

// Just return the user name
function ssi_getuser()
{
   global $context;
   if ($context['user']['is_guest'])
      return "Guest";
   else
      return $context['user']['name'];
}

// Is the user logged in?
function ssi_getlogin()
{
   global $context;
   if ($context['user']['is_guest'])
      return false;
   else
      return true;
}

to an appropriate place within SSI.php.

 

What i'm apparently supposed to do now is to set up a script around the HTML that i want to make conditional and "echo" the HTML statements if the condition is true. I'm pretty sure that doing this is rather basic PHP, but i'm too scared to screw something up doing it myself, so i would appreciate if someone else could help me with this.

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.