snlildude87 0 Report post Posted May 27, 2005 I've been seeing a whole bunch of sites that have a Statistics corner, and in there, there are things that says "Users Online:", "Page Loads:", "Unique Hits:", and "IP:". Well, I was wondering, where do these users get one of these nifty things?I know that PHPNuke offers one, but most of the sites that I go to do not use PHPNuke.Any reply is appreciated. Share this post Link to post Share on other sites
john_meikle 0 Report post Posted May 27, 2005 Are u not using a Portal and I too would like to know that script, but I personally dont know the site with the script I would Suggest browsing Hotscripts.combut try searching Google, Google has all the answers Share this post Link to post Share on other sites
HmmZ 0 Report post Posted May 27, 2005 Well, I know exactly what you mean...and here will be my attempt..im going to the point right away btw..Ow and im assuming you got a config.php and know your mysqltables..Dont wanna go all over that line again For one, you need to alter or create a new table that has user_active field, this field contains TIMESTAMP and you are to make a line to update this field once a user logs in..like: session_start();$user=$_SESSION['user'];$time=date("F j, Y, g:i a");$active=mysql_query("update usertable set user_active='$time' where username='$user'"); anyway..It requires alot of coding from what i know and i dont have that much time right now, so heres the "first part" (sorry =/)<?php//latest registered user..{ $sql = "SELECT username FROM usertable WHERE username='' ORDER BY user_id DESC LIMIT 1"; list($lastuser) = $db->sql_fetchrow($db->sql_query($sql)); return $lastuser;}//total users{ $sql = "SELECT COUNT(*) FROM usertable WHERE user_id > 1"; list($numrows) = $db->sql_fetchrow($db->sql_query($sql)); return $numrows;}{ $sql = "SELECT COUNT(*) FROM usertable WHERE user_regdate='".date("M d, Y")."'"; list($userCount[0]) = $db->sql_fetchrow($db->sql_query($sql)); $sql = "SELECT COUNT(*) FROM usertable WHERE user_regdate='".date("M d, Y", time()-86400)."'"; list($userCount[1]) = $db->sql_fetchrow($db->sql_query($sql)); return $userCount;} Hope this gives you a small step forward..you know im not a pro at this hehe Share this post Link to post Share on other sites
HmmZ 0 Report post Posted May 27, 2005 ow and these are the most relevant scripts i could find (that were actually NOT based on some CMS) phphits MP Stats Pro Share this post Link to post Share on other sites
karlo 0 Report post Posted May 29, 2005 Well, I know exactly what you mean...and here will be my attempt.. im going to the point right away btw.. Ow and im assuming you got a config.php and know your mysqltables.. Dont wanna go all over that line again For one, you need to alter or create a new table that has user_active field, this field contains TIMESTAMP and you are to make a line to update this field once a user logs in..like: session_start();$user=$_SESSION['user'];$time=date("F j, Y, g:i a");$active=mysql_query("update usertable set user_active='$time' where username='$user'"); anyway..It requires alot of coding from what i know and i dont have that much time right now, so heres the "first part" (sorry =/) <?php//latest registered user..{ $sql = "SELECT username FROM usertable WHERE username='' ORDER BY user_id DESC LIMIT 1"; list($lastuser) = $db->sql_fetchrow($db->sql_query($sql)); return $lastuser;}//total users{ $sql = "SELECT COUNT(*) FROM usertable WHERE user_id > 1"; list($numrows) = $db->sql_fetchrow($db->sql_query($sql)); return $numrows;}{ $sql = "SELECT COUNT(*) FROM usertable WHERE user_regdate='".date("M d, Y")."'"; list($userCount[0]) = $db->sql_fetchrow($db->sql_query($sql)); $sql = "SELECT COUNT(*) FROM usertable WHERE user_regdate='".date("M d, Y", time()-86400)."'"; list($userCount[1]) = $db->sql_fetchrow($db->sql_query($sql)); return $userCount;} Hope this gives you a small step forward..you know im not a pro at this hehe 144983[/snapback] Where did you learn that? I thought I have mastered MySQL, now, I'm not familiar with SELECT COUNT(*) and using greater than and less than... How can I master MySQL? Share this post Link to post Share on other sites
HmmZ 0 Report post Posted May 29, 2005 google is your friend.when i look fora specific statement, such as counting table inserts, i search google and i so far always found my answer :rolleyes:i have not mastered mysql nor any other language of programming, but i do learn alot from making scripts that need new statements, learn through practise Share this post Link to post Share on other sites
karlo 0 Report post Posted May 30, 2005 google is your friend. when i look fora specific statement, such as counting table inserts, i search google and i so far always found my answer i have not mastered mysql nor any other language of programming, but i do learn alot from making scripts that need new statements, learn through practise 145654[/snapback] Can you give me a good MySQL tutorial site that teaches something like that SELECT COUNT(*) and other MySQL hidden functions that i haven't learned yet. Share this post Link to post Share on other sites
HmmZ 0 Report post Posted May 30, 2005 like I said..google is your friend..don't be lazy and search before asking please searchterm: mysql tutorials select count(*) http://www.developerfusion.com/article/3998/mysql-tutorial/7/ http://forums.xisto.com/no_longer_exists/ http://forums.xisto.com/no_longer_exists/ and tons more.. Share this post Link to post Share on other sites