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?
online users?!
Started by amrosama, Aug 30 2009 11:57 AM
23 replies to this topic
#1
Posted 30 August 2009 - 11:57 AM
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
Posted 30 August 2009 - 12:13 PM
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.
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_*
Posted 30 August 2009 - 01:19 PM
Guest_Jordan_*
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.
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
Posted 30 August 2009 - 01:32 PM
nice thnx for both of you :amr:
ill do that rightnow +rep to both
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
Posted 30 August 2009 - 01:49 PM
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.
I suppose if that is all you need then yours is probably better.
#6
Posted 30 August 2009 - 01:50 PM
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
Posted 30 August 2009 - 01:52 PM
Replace? for what? lol
You should post up your code! :D
You should post up your code! :D
#8
Guest_Jordan_*
Posted 30 August 2009 - 02:03 PM
Guest_Jordan_*
Yeah, lets see some code! :)
#9
Posted 30 August 2009 - 02:04 PM
/*
* `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 displayquery2 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_*
Posted 30 August 2009 - 02:07 PM
Guest_Jordan_*
Very nice! Which three bastards are active?
#11
Posted 30 August 2009 - 02:10 PM
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_*
Posted 30 August 2009 - 02:11 PM
Guest_Jordan_*
Did you label it like that?
Active bastards online: 3
Active bastards online: 3


Sign In
Create Account


Back to top










