Author Topic: To anyone with experience with SMF.  (Read 797 times)

0 Members and 1 Guest are viewing this topic.

Offline Rictor

  • Murdered by Brazilian Psychopath
  • 29
To anyone with experience with SMF.
here's a copy-paste of the call for help on SMF's forums. If you can help, please do. If you can't, I'm afraid your safety can not be guaranteed after I assume power and begin settling scores.

edit: damnit! The HLP home page is doing it to.. Literally 5 minutes it said "Hello Rictor, you have X private messages", and now it's telling me I'm a guest. What gives?

---------------------------------------------------------

The problem that I have is that when I integrate SMF's login system into my website (no CMS, just using the SSI functions) it seems to regard me as either logged in or a guest seemingly at random. It tells me I'm a guest even when I'm clearly logged on, then on a whim it gives an accurate status and back and forth like that.

More specifically, I took the simple "Restrict access if not logged on" function from the Basic SSI FAQ and put it on a page just for testing. Even though I am logged it, it tells me I'm a guest. I've also integrated a login box on my site and I have the same problem: innacurate recognition of my (and presumably other user's) online status. It's wierd because at times it does work as it's supposed to, giving me an accurate status as logged in, but I haven't been able to determine what makes it tick.

Here is the code I'm using, straight from the FAQ. And yes, I'm refferencing SSI.php correctly since these and other functions work at all.

Code: [Select]
<?php
require("YOUR_PATH_TO_SSI.php"); 

if (
$context['user']['is_guest'])
 {
   echo 
   
'<h5>Access Denied</h5>
   We are sorry guest, it seems you dont have premission to view these downloads.'
;
 }
else
 {
   echo
   
'<h5>Welcome '$context['user']['name'], '!</h5>
   Here are your downloads:'
;
 }
?>

Any help would be greatly appreciated. I'm trying to get a system for restricting parts of the site to non-members working and I'm working on a tight deadline.

Cheers.
« Last Edit: October 05, 2006, 03:54:18 am by Rictor »

  

Offline Ashrak

  • Not Banned
  • 210
    • Imagination Designs
Re: To anyone with experience with SMF.
use a $_SESSION variable, since the way your doing it now it wont work :p or if it does its gonna ask for password each time you go to new site so do the following on the login page:

Code: [Select]

if(username == 'username' AND pw == 'password') ? $_SESSION['auth'] = 1 : echo('Bad name or password');


make sure you have start_session(); on top of your core file (gets included on all pages the one with DB conn)
then you just check if $_SESSION['auth'] == 1 on the other pages



EDIT: Well i should really read BEFORE posting :/
I hate My signature!