Closed Thread Icon

Topic awaiting preservation: Indicate if I am on line (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=28532" title="Pages that link to Topic awaiting preservation: Indicate if I am on line (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Indicate if I am on line <span class="small">(Page 1 of 1)</span>\

 
Jassper
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Oct 2006

posted posted 10-13-2006 03:56

Hello - newbe here

Is there a simple way to show an Icon on my site if I am currently viewing my web site, and hide the Icon if I am not?

Thanks

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 10-13-2006 09:23

Well, yes and no...

You can of course make a special page that toggles the icon on, for I don't know, maybe 5 minutes,
than have your computer reload that page every 5 minutes, but it certainly no ideal solution.

Or you could do the ICQ-user-is-on-thing - but be prepared to receive lots of spam.
(You will get spam if your icq status is visible on the web. Don't ask me why).


so long,

->Tyberius Prime

Jassper
Obsessive-Compulsive (I) Inmate

From:
Insane since: Oct 2006

posted posted 10-13-2006 22:08

Thanks for the reply.
The first option sounds slugish, and I don't use ICQ for the second option. Can't I do a PHP script that will compair my IP or check for a special cookie or something like that?

WebShaman
Lunatic (VI) Mad Scientist

From: Happy Hunting Grounds...
Insane since: Mar 2001

posted posted 10-13-2006 22:38
quote:
Can't I do a PHP script that will compair my IP or check for a special cookie or something like that?



Of course you can.

Take a look here - http://mythdrannor.11.forumer.com/index.php

Go to the very bottom of the forum there. You will see that the registered users are shown as either being online or not (well, if they are online - it will not show them if they are offline).

WebShaman | The keenest sorrow (and greatest truth) is to recognize ourselves as the sole cause of all our adversities.
- Sophocles

Jassper
Obsessive-Compulsive (I) Inmate

From:
Insane since: Oct 2006

posted posted 10-14-2006 00:55
quote:

WebShaman said:

quote:

Can't I do a PHP script that will compair my IP or check for a special cookie or something like that?


Of course you can.Take a look here - http://mythdrannor.11.forumer.com/index.phpGo to the very bottom of the forum there. You will see that the registered users are shown as either being online or not (well, if they are online - it will not show them if they are offline).WebShaman | The keenest sorrow (and greatest truth) is to recognize ourselves as the sole cause of all our adversities.- Sophocles



Ok, but how do I do it?

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 10-14-2006 09:16

You still need to visit a page on your website regularly, to tell the server you're online.
(If you get the rest running, we can probably whip up a little application sitting in the notification area of your
taskbar that will do this without user interaction).

If that's a special page, or maybe it detects you based on a cookie, or an url paramter, is pretty much of
no consequence.

Your IP will most likely change every time you (re)connect to the net, since most providers assign dynamic addresses.
(ie. you get a different one each time), so you won't have much luck with that.


The server side itself is pretty simple:
-Store the date the server has last seen you. Maybe just write timestamp into a textfile.
-Wherever you want to display whether you're online, read that stored value, add whatever time offset you want ( 5 minutes?, 10 minutes? )
and see if the current timestamp is still smaller than then. If true, show 'Jassper is online' else show 'Jassper isn't here at the moment'.

So long,

->Tyberius Prime

WebShaman
Lunatic (VI) Mad Scientist

From: Happy Hunting Grounds...
Insane since: Mar 2001

posted posted 10-14-2006 13:24

TP, he is asking

quote:
Is there a simple way to show an Icon on my site if I am currently viewing my web site, and hide the Icon if I am not?



I mean, that is basically part of every PHP forum that exists, to show users that are currently logged into the website when they are "viewing it" (i.e. logged in).

WebShaman | The keenest sorrow (and greatest truth) is to recognize ourselves as the sole cause of all our adversities.
- Sophocles

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 10-14-2006 14:42

And my point is that it's a whole lot easier to build this from skratch then to try to rip it out of an existing forum software.
(You don't need a user database, or even the possibilty to display multiple users with the most basic variant.)

It could just be as special page (imhere.php) that does nothing but

code:
$fh = fopen ( "lastseenwebmaster.dat",'wb'); 
if ( $fh ) 
{  
  fwrite($fh, time()); 
  fclose($fh);
  print "I know now my user is online.";
}
else
  print "Could not store your presence :(";



and

code:
$bUserIsOn = false;
$minutesToAppearOnline = 5;
$fh = fopen ( "lastseenwebmaster.dat",'rb'); 
if ( $fh ) 
{
      $timeLastSeen = fread($fh, 1024); 
      fclose($fh);
      $timeLastSeen = intval ( $timeLastSeen);
      if ( $timeLastSeen != 0 && $timeLastSeen + $minutesToAppearOnline * 60 <= time()  ) 
          $bUserIsOn = true;
}

if ( $bUserIsOn ) 
{
   print "The user is online";
}



in the actual website.


This in no way compares to trying to integrate a forum into any existing website. There are serveral orders of magnitude between those two extremes.

So long,

->Tyberius Prime

WebShaman
Lunatic (VI) Mad Scientist

From: Happy Hunting Grounds...
Insane since: Mar 2001

posted posted 10-14-2006 23:35

*sigh*

Yes, I know that TP. I was only using it as an example to what you had posted above

quote:
Well, yes and no...

You can of course make a special page that toggles the icon on, for I don't know, maybe 5 minutes,
than have your computer reload that page every 5 minutes, but it certainly no ideal solution.

Or you could do the ICQ-user-is-on-thing - but be prepared to receive lots of spam.
(You will get spam if your icq status is visible on the web. Don't ask me why).



I mean, it is really not necessary to do that.

Enough from me *wanders down the corridor*

WebShaman | The keenest sorrow (and greatest truth) is to recognize ourselves as the sole cause of all our adversities.
- Sophocles

Jassper
Obsessive-Compulsive (I) Inmate

From:
Insane since: Oct 2006

posted posted 10-16-2006 01:02

Thanks everyone, I think I sorta understand. I'll play with it a bit and see what I can come up with.

DL-44
Lunatic (VI) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 10-16-2006 18:09

Ws - the point is that, well....it is pretty much necessary to do that kind of thing. Yes, forum's do it all the time. But there obviously msut be a method by which they achieve this.

To accomplish it, you need a couple of basic thigns -

- something that checks whether you are there.
- some way to indicate that you are in fact there.
- some way for the server to know who exactly you are in the first place.
- some time period for the server to wait before trying to check again if you are still there.

Which is basically wht TP is trying to outline.
Forum's, incidentally, do a lot of the above things already, which is why it is easy to add the indicator to a forum page. The mechanisms within a forum that accomplish this consist of an *awful* lot of overhead for a site that only wants to log a single person
It is also a very imperfect system, even on all of those forums.

FWIW

WebShaman
Lunatic (VI) Mad Scientist

From: Happy Hunting Grounds...
Insane since: Mar 2001

posted posted 10-16-2006 22:13

Yes, I do understand that DL. I just was a bit puzzled by the initial reply that TP posted.

One could reduce it to a manual method, if one wanted. Push this button - "the Owner is in" Push that button "the Owner is out" sort of thing on a page that is only reachable by the Owner (perhaps password protected?)

Or one could set a cookie, and check for the cookie when one logs in/out of the website. If it is the owner cookie, then it fires a small script that sets the "Owner is in" flag to on.

WebShaman | The keenest sorrow (and greatest truth) is to recognize ourselves as the sole cause of all our adversities.
- Sophocles

« BackwardsOnwards »

Show Forum Drop Down Menu