User Status: Online / Offline
Moderator: General Moderators
- Heavy
- Forum Contributor
- Posts: 478
- Joined: Sun Sep 22, 2002 7:36 am
- Location: Viksjöfors, Hälsingland, Sweden
- Contact:
Firstly:
Define what beeing online is.
If beeing online is when you have a page (without frames) open and doing nothing with the server, you have a problem.
One solution could be to write a flash or java applet and let it access something on a regular basis, and let that keep track of who does what.
If beeing online is about fetching new pages now and then, you could always register the access time of a user when he loads a page. If that timestamp is too old, he's offline.
Define what beeing online is.
If beeing online is when you have a page (without frames) open and doing nothing with the server, you have a problem.
One solution could be to write a flash or java applet and let it access something on a regular basis, and let that keep track of who does what.
If beeing online is about fetching new pages now and then, you could always register the access time of a user when he loads a page. If that timestamp is too old, he's offline.
because let's say i login at 10 but keep on the site till 1700
at some point it'll say i'm offline when i'm here answering people. what they would have to do for your suggestion is "last page load" in session and look at that. but that wouldn't work. they want tohers to know when you're online
that requires a db feild to check.
personally i don't think it would be a big strain on a db, so i'm thinking of using that.
at some point it'll say i'm offline when i'm here answering people. what they would have to do for your suggestion is "last page load" in session and look at that. but that wouldn't work. they want tohers to know when you're online
that requires a db feild to check.
personally i don't think it would be a big strain on a db, so i'm thinking of using that.
Enough theory please
(we are not at school here), I still not quit sure how to do a finale script…
I like the example that count the number of session files, but it can’t show me the “names” of the users… I tried to play with msession_list() but I didn’t get it to work…
And actually I (and probably every one else) don’t cares will it use DB or no, because we can record page load time at any time we want…
Let assume that we will use that session example than how can I gat the username from the session files… (Certainly the session contains not only username but also things like access levels + some temp info and ip)
PS: Does anyone know how ICQ online status works (like that web based ISQ and regular Win APP)
I like the example that count the number of session files, but it can’t show me the “names” of the users… I tried to play with msession_list() but I didn’t get it to work…
And actually I (and probably every one else) don’t cares will it use DB or no, because we can record page load time at any time we want…
PS: Does anyone know how ICQ online status works (like that web based ISQ and regular Win APP)
I think that is the best method. Inline frames aren't like regular frames. they don't take up any horizontal or vertical web space. They are hidden from the user within the code (by making them 1px by 1px in width+height and blending in the BG of the inline with the bg of the page). This provides for a very powerful solution and a very slick solution since it's practically invisible to a user who doesn't view source. And in theory, it is the best solution.habitat675 wrote:I have mine run an inline frame that refreshes every 50 seconds or so and updates the user's status. then another script deletes all files older than 1 minute and displays all of the file names for the rest (which are named as user's names). It probably wouldn't be very efficient for a large site but for mine it runs quickly and works well.
And I would imagine it would work best with big sites, habitat.
my 2 cents.
- mudkicker
- Forum Contributor
- Posts: 479
- Joined: Wed Jul 09, 2003 6:11 pm
- Location: Istanbul, TR
- Contact:
log.php
---------------------------------------------------------------------------
ADMIN.PHP (ONLY THE PARTS WHERE YOU USE NAMES FROM SESSION)
------------------------------------------------------------------------
SECURE.PHP
By the way, Secure.php is included in admin.php at the beginning of document.
(require("secure.php");)
Code: Select all
<?
if (!isset($user) or !isset($pass) or empty($user) or empty($pass))
{
header( "Location: index.php" );
}
else
{
$connect= mysql_connect("localhost","root","boot") or die("Cannot connect to the server! Please try again later.");
mysql_select_db("db_cv",$connect) or die("Cannot connect to the database! Please try again later.");
$query = mysql_query("SELECT * FROM tbl_users WHERE user='$user' AND pass='$pass'",$connect);
$row = mysql_fetch_array($query);
$num = mysql_num_rows($query);
if ($num > 0)
{
session_start();
session_register("user","uname","dbname","dbpass");
$uname = $rowї"name"];
$dbname = $rowї"dbname"];
$dbpass = $rowї"dbpass"];
header("Location: admin.php");
}
else
{
echo "Incorrect login name or password. Please try again.";
}
mysql_close($connect);
}
?>ADMIN.PHP (ONLY THE PARTS WHERE YOU USE NAMES FROM SESSION)
Code: Select all
<td width=150><div align="center"><a class="arif" href="logout.php">Logout <? echo $uname; ?></a></div></td>SECURE.PHP
Code: Select all
<?
ob_start();
session_start();
if(!session_is_registered("user"))
{
header("Location: index.php");
session_unset();
exit();
}
?>(require("secure.php");)
I use the IFRAME method myself as it seems to be the best way.
The only difference is I put the IFRAME within a DIV and just set the position:absolute and the visibility:hidden in it's style... that way it is completely invisible and doesn't take up any page space at all.
Another use for this is to have the IFRAME pull information from say a 'shout box' database and then use a bit of javascript... object.innerHTML .... to update some page content on-the-fly without the user having to refresh the main page at all.
You could use the same method to update who is on-line more or less in real-time without the user having to refresh the page to find out.
And..... ( I've nearly finished )...... how about alerting the user using the same method whenever they get a new reply added to their forum topics.. or get a new note from another user!?
As the old saying goes "It's not what you've got, it's how you use it".
The only difference is I put the IFRAME within a DIV and just set the position:absolute and the visibility:hidden in it's style... that way it is completely invisible and doesn't take up any page space at all.
Another use for this is to have the IFRAME pull information from say a 'shout box' database and then use a bit of javascript... object.innerHTML .... to update some page content on-the-fly without the user having to refresh the main page at all.
You could use the same method to update who is on-line more or less in real-time without the user having to refresh the page to find out.
And..... ( I've nearly finished )...... how about alerting the user using the same method whenever they get a new reply added to their forum topics.. or get a new note from another user!?
As the old saying goes "It's not what you've got, it's how you use it".
Well... my view on that is that all modern browsers can use IFRAMEs... if people are still using browsers old enough not to support IFRAMEs then they don't deserve to access the site. simple.m3rajk wrote:ummm... not everyone has iframe support.
I can't stand people who can't be bothered to update their browser.. it holds back website development and the evolution of the web as a whole.
These days I develop sites for IE5+ and NS6+ only.. if you don't have either of those then you don't get access to the site.
Having to constantly downgrade sites and limit the possibilites of website development just to keep the people using old browsers happy won't last much longer because people will just get fed up of being held back.
..a bit off-topic but those couple of words really annoyed me.. sorry!
well.. the site i'm making, we decided that we wanted a certain set up and that it would require them.
ie is only at 6. i think 5 doesn't have full iframe support but 5.5 does. enough people still use 5...
i knoq a lot of people switched to mozilla iinstead of netscape 6.
mozilla is actually better with all that. i know because i'm one of them. and those i know that didn't switch to netscape 6 ( a small number) use 4.81, the last 4.xx that will be made according to netscape.
personally, i know that i consider what i'm making the site for with what i use. i don't een use frames if i am making a site for someone that wants it to be universally accessable. (haven't done that in ages)
at this point anyone that doesn't have the support of iframes is problaby using a web clipper or text-only (ie: lynx... yes it's still around)
ie is only at 6. i think 5 doesn't have full iframe support but 5.5 does. enough people still use 5...
i knoq a lot of people switched to mozilla iinstead of netscape 6.
mozilla is actually better with all that. i know because i'm one of them. and those i know that didn't switch to netscape 6 ( a small number) use 4.81, the last 4.xx that will be made according to netscape.
personally, i know that i consider what i'm making the site for with what i use. i don't een use frames if i am making a site for someone that wants it to be universally accessable. (haven't done that in ages)
at this point anyone that doesn't have the support of iframes is problaby using a web clipper or text-only (ie: lynx... yes it's still around)