with calls specific to the appdb or bugzilla database. Fixes a bug where a call to mysql_insert_id() can potentially retrieve an id from either the bugzilla or appdb database, depending on whichever database was last opened by mysql_connect().
42 lines
1.4 KiB
PHP
42 lines
1.4 KiB
PHP
<?php
|
|
|
|
function log_category_visit($catId)
|
|
{
|
|
global $REMOTE_ADDR;
|
|
|
|
$result = query_parameters("SELECT * FROM catHitStats WHERE ip = '?' AND catId = '?'",
|
|
$REMOTE_ADDR, $catId);
|
|
if($result && query_num_rows($result) == 1)
|
|
{
|
|
$oStatsRow = query_fetch_object($result);
|
|
query_parameters("UPDATE catHitStats SET count = count + 1 WHERE catHitId = '?'",
|
|
$oStatsRow->catHitId);
|
|
} else
|
|
{
|
|
query_parameters("INSERT INTO catHitStats (appHitId, time, ip, catId, count) ".
|
|
"VALUES (?, ?, '?', '?', '?')",
|
|
"null", "null", $REMOTE_ADDR, $catId, "1");
|
|
}
|
|
}
|
|
|
|
function log_application_visit($appId)
|
|
{
|
|
global $REMOTE_ADDR;
|
|
|
|
$result = query_parameters("SELECT * FROM appHitStats WHERE ip = '?' AND appId = '?'",
|
|
$REMOTE_ADDR, $appId);
|
|
if($result && query_num_rows($result) == 1)
|
|
{
|
|
$stats = query_fetch_object($result);
|
|
query_parameters("UPDATE appHitStats SET count = count + 1 WHERE appHitId = '?'",
|
|
$stats->appHitId);
|
|
} else
|
|
{
|
|
query_parameters("INSERT INTO appHitStats (appHitId, time, ip, appId, count) ".
|
|
"VALUES (?, ?, '?', '?', '?')",
|
|
"null", "null", $REMOTE_ADDR, $appId, "1");
|
|
}
|
|
}
|
|
|
|
?>
|