Jump to content

online users?!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
23 replies to this topic

#1
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
hi guys,
ive finally hosted the company i work in website, and they asked for more stuff to do. but theres one thing that drives me crazy, they want to add a page in the backend that shows the currently active users.
i have no idea how to do that, because ive never worked on an online website before. how can this be done?
the only solution i thought of is making a table in database with active users that gets updated everytime a user navigates through a page, but the problem is: most users will not be inactive normally because they dont always logout normally(closing browser or leaving it open)
i want some thing like "active members" that appears at the bottom of cc pages

any ideas?
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#2
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Table:
id, ip, datetime


Every page should add a new row in there, do a query selecting rows within the past 5 minutes, based on a unique IP address.

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
That would be a lot of rows if you added one per visitors per page. I think you need one table:

id, ip, datetime, pageurl

Every time IP visits a page, the pageurl column is updated. If you are only tracking logged in users:

id, userid, dattime, pageurl

This will allow you to see what they are viewing as well (if they ever ask you for that). The method you described in your initial post is exactly how the one on CC works. Do as Blain suggested and have the query select for the amount of time you choose. I think the one on here is 30 minutes. I'd also add a second query that deletes any rows older than 30 minutes to keep your database small.

#4
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
nice thnx for both of you :amr:
ill do that rightnow +rep to both
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#5
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Yes Jordan you are probably right, that was how I did mine, but I was using my own stat program for that site, not a different one so this was also how I tried which pages where visited and from where etc.

I suppose if that is all you need then yours is probably better.

#6
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
tried that, and its working now. i used a "replace" statement. just love it :D
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#7
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Replace? for what? lol

You should post up your code! :D

#8
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Yeah, lets see some code! :)

#9
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
/*

 * `navigation` (

`username` VARCHAR( 50 ) NOT NULL  PK,

`ip` VARCHAR( 120 ) NOT NULL ,

`time` DATETIME NOT NULL ,

`page` VARCHAR( 200 ) NOT NULL PK

)

*/

$date=date('c');

query2("replace into navigation (username,ip,time,page) values('$_SERVER[REMOTE_ADDR]','$_SERVER[REMOTE_ADDR]','$date','$_SERVER[PHP_SELF]')  ");

}

its pretty small but the size doesnt matter :amr:, now i will code the display
query2 is a function i use to check for log and checking user privileges
the $_SESSION['v_user'] is the session variable for user-name
theres three active bastards rightnow :D
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#10
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Very nice! Which three bastards are active?

#11
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
me, my boss, and a co-worker
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#12
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Did you label it like that?

Active bastards online: 3