|
Posted by Steve on 10/16/06 13:37
no, my email in the posting is not correct. that code should give you a good
start, however there are a couple of problems with it when generating a more
complex report with it. i haven't gotten around to fixing it, but i'm not
sure you'll see some of the problem(s). anyway, it was mean to give you a
start...and, i hope it did.
"Kentor" <kentor@gmail.com> wrote in message
news:1160996789.916102.324140@f16g2000cwb.googlegroups.com...
| Wow :) this is a lot of stuff thanks a lot Steve. I'll play with this
| as soon as I get a chance. Is your email listed on the groups the
| correct one in case i need to contact you about this?
|
| On Oct 13, 8:23 pm, "Steve" <no....@example.com> wrote:
| > ok...been a long day.
| >
| > you'll need this function too (last one, promise). either put a call to
it
| > in each page or call the function in an include_once or require_once php
| > file. notice that it has to call the db::execute function too...so,
replace
| > that call with dbExecute.
| >
| > function siteTracking($page, $user)
| > {
| > $ip = '';
| > if (!$ip = $_SERVER['HTTP_CLIENT_IP'])
| > {
| > if (!$ip = $_SERVER['HTTP_X_FORWARDED_FOR'])
| > {
| > if (!$ip = $_SERVER['REMOTE_ADDR']){ $ip = 'UNKNOWN'; }
| > }
| > }
| > $sql = "
| > INSERT INTO siteTracking
| > (
| > Page ,
| > IpAddress ,
| > UserName ,
| > Stamp
| > )
| > VALUES
| > (
| > '" . $page . "' ,
| > '" . $ip . "' ,
| > '" . $user . "' ,
| > '" . date('Y-m-d H:i:s') . "'
| > )
| > ";
| > db::execute($sql);
| >
| > }to call this function, you'd do something like this:
| >
| > siteTracking(basename($_SERVER['PHP_SELF']), $userName);
| >
| > where $userName is the variable that holds the user name of a logged on
| > user. change $userName to the appropriate variable. this way you can
tell
| > not only ip's but what person was accessing a page.
|
Navigation:
[Reply to this message]
|