Re: keeping page count



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.


.



Relevant Pages

  • Re: question about database injection
    ... i am working on the registeration page for the forum website and its ... USER NAME VALIDATION ... however i would like the username to be Letters First(upper or ... NOTE = in my php settings magic_quotes_gpc is ON, ...
    (comp.lang.php)
  • Re: login at a site.
    ... then the script redirects to ... $warning is a string to be ... Then test if the username and password entered match with the ones on ...
    (alt.php)
  • question about database injection
    ... i am working on the registeration page for the forum website and its ... i am using php 5.2.5 ... as i am stuck with regards to database injection. ... however i would like the username to be Letters First(upper or ...
    (comp.lang.php)
  • question about database injection
    ... i am working on the registeration page for the forum website and its ... i am using php 5.2.5 ... as i am stuck with regards to database injection. ... however i would like the username to be Letters First(upper or ...
    (comp.lang.php)
  • Re: login at a site.
    ... This is the PHP for processing a login. ... $warning is a string to be ... Then test if the username and password entered match with the ones on ...
    (alt.php)