Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 09-22-2005, 07:26 AM   #1 (permalink)
jameswatt
Registered User
 
Join Date: Sep 2005
Posts: 1
jameswatt is on a distinguished road
wants help from PHP experts to add bar chart functionality in exsisting site.........

I want to achieve one functionality using PHP in my current web application
How many users have visited the site and from them how many r unique visitors, how many r first time visitors in a particular date and wants to show in the bar chart visit the site and suggest me how I can achieve this thing. Pls fwd your suggestion and ideas visit ………
.direct2deal.com

Last edited by redhead; 09-22-2005 at 08:01 AM.
jameswatt is offline   Reply With Quote
Old 09-22-2005, 08:12 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,696
redhead is on a distinguished road
Sorry I just had to edit your post, since we dont appreciate first time posters that link direct to their page, in order to achieve clickthrough and promotion based on this sites popularity.

The thing you're requesting, is quite easy, have a way to store a current and old timestamp from your users last visit, if the current timestamp is, say more than 10 minuts from now, update the old timestamp to current timestamp and update current timestamp to now.
Then when someone looks for what they've missed since last visit, just match up agains every timestamp on everyother thing you have stored from the users old timestamp.
The ones who hasn't set old timestamp are first tiem viewers, and the count of users visiting from a given time to a given time kinda gives it self...

Here is a function where I do it..
PHP Code:
function last_seen($first_call=false)
{
  global 
$DB_LINK$USER_ID;
  
/* Check last seen */
  
if($res mysql_query("SELECT profile FROM users WHERE id = \"$USER_ID\""$DB_LINK))
    if(
$urow=mysql_fetch_array($res))
      if(
$res=mysql_query("SELECT last_seen, current_seen FROM profiles WHERE id = \"$urow[profile]\""$DB_LINK))
        if(
$row=mysql_fetch_array($res))
          if(
$first_call && ($row[last_seen] +600) < $row[current_seen])
            
mysql_query("UPDATE profiles SET last_seen = \"$row[current_seen]\"  WHERE id=\"$urow[profile]\""$DB_LINK);
          else
            if((
$row[current_seen] + 60) < time())
              
mysql_query("UPDATE profiles SET current_seen = \"".time()."\" WHERE id=\"$urow[profile]\""$DB_LINK);
  
mysql_free_result($res);

__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 07:09 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting