Re: PHP analytics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<?php
  //untested code:
  session_start();
  if (!isset($_SESSION['username'])){
    require 'login.inc'; //login form to set $_SESSSION['username']
    exit;
  }
  $username_sql = mysql_real_escape_string($_SESSION['username']);
  $self_sql = mysql_real_escape_string($_SERVER['PHP_SELF']);
  $query = "insert into analytics (username, page) ";
  $query .= " values ('$username_sql', '$self_sql') ";
  mysql_query($query) or error_log(mysql_error() . $query);
?>

There are a few zillion refinements to be done here, and you had
better make sure the username you stuff into your $_SESSION is
validated, but, really, it's not exactly rocket science to hack
something up to know what the user clicked, once you force them to
login...

On Wed, December 6, 2006 5:48 am, Rick. wrote:
> Hello
>
>
>
> I am new to php and I would like some guidance from those who have a
> bit more expereince with PHP
>
>
> I will be attempting to do a bit of tracking and web analytics.
> Basically, the user will login
> and from there everything that he clicked will be recorded in a
> database and analyzed
> i.e user behaviour, patterns with different user groups.
>
> Is this possible with php and it is a major undertaking ? just trying
> not to get ahead of myself here..
>
> are there any tutorials or scripts or books that you know of ?
>
>
>
> Thanks
> Regards
> Rick
>
>
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux