i just wanna know if someone is logged in LOL Topic is solved

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
gtron

i just wanna know if someone is logged in LOL

Post by gtron » Sat Oct 27, 2007 11:50 pm

I have a pretty complex page that runs a lot of unix apps back-end style and i need someone to be a member of the site to be able to use this tool. i'm using a wrapper which i dont care for iframes as it is but that's besides the point. i have to laugh lol because i've spent the better half of a day on this and it seems like it should be so simple. anyway, here's what i got (try to laugh with me and not at me)....

Code: Select all

define( '_VALID_MOS', 1 );
require( '/home/xxxxxxx/public_html/globals.php' );
include ('/home/xxxxxx/public_html/includes/joomla.php' );
global $mainframe, $my ;
?>
<HTML><HEAD>
<?php
if ($my->id) {

*FUN CODE GOES HERE

}
else{
echo "<p><font color=red>You must login to use the auditor.</font></p>";}



any help at all will get ya a durb... j/k ;)

oh yea... 1.0.13
Last edited by gtron on Sat Oct 27, 2007 11:56 pm, edited 1 time in total.

TheVigilante
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Sep 11, 2007 8:24 am

Re: i just wanna know if someone is logged in LOL

Post by TheVigilante » Fri Nov 02, 2007 2:26 pm

I think you should check the $user->guest variable which is 0 if the user is logged in I believe. In Joomla 1.5 I do:

$user = & JFactory::getUser();
if($user->guest)
{

}

User avatar
dattard
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Tue Apr 11, 2006 7:29 pm
Contact:

Re: i just wanna know if someone is logged in LOL

Post by dattard » Sat Nov 10, 2007 8:55 am

Your code looks ok. The $my->id is the way to determine whether someone is logged on as far as i know.
http://www.dart-creations.com - We make Joomla Easy: Tutorials, Tips and Tricks, Featured Articles Module, Random Flash Module, Latest News Popup Module, MainMenu Images Module, Popin Window Module

http://www.joomlawire.com - The Joomla DIGG network - Submit and Vote for Joomla News!


Post Reply