1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

agent added to online table for easier detection of bots

This commit is contained in:
CaMer0n
2009-12-24 10:00:30 +00:00
parent 2ae50931ea
commit 1e15f1c92b
3 changed files with 26 additions and 10 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/infopanel.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/includes/infopanel.php,v $
| $Revision: 1.17 $ | $Revision: 1.18 $
| $Date: 2009-11-18 01:04:42 $ | $Date: 2009-12-24 10:00:30 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -133,6 +133,7 @@ $text .= "
<th>Username</th> <th>Username</th>
<th>IP</th> <th>IP</th>
<th>Page</th> <th>Page</th>
<th>Agent</th>
</tr> </tr>
</thead> </thead>
<tbody>"; <tbody>";
@@ -146,6 +147,7 @@ $text .= "
<td>".renderOnlineName($val['online_user_id'])."</td> <td>".renderOnlineName($val['online_user_id'])."</td>
<td>".e107::ipDecode($val['online_ip'])."</td> <td>".e107::ipDecode($val['online_ip'])."</td>
<td class='nowrap'><a href='".$val['online_location']."'>".$tp->text_truncate($val['online_location'],50)."</a></td> <td class='nowrap'><a href='".$val['online_location']."'>".$tp->text_truncate($val['online_location'],50)."</a></td>
<td class='nowrap'>".$tp->text_truncate($val['online_agent'],20,'...')."</td>
</tr> </tr>
"; ";
} }

View File

@@ -9,8 +9,8 @@
* Core SQL * Core SQL
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
* $Revision: 1.45 $ * $Revision: 1.46 $
* $Date: 2009-12-15 11:51:02 $ * $Date: 2009-12-24 10:00:30 $
* $Author: e107coders $ * $Author: e107coders $
*/ */
@@ -354,7 +354,8 @@ CREATE TABLE online (
online_ip varchar(45) NOT NULL default '', online_ip varchar(45) NOT NULL default '',
online_location text NOT NULL, online_location text NOT NULL,
online_pagecount tinyint(3) unsigned NOT NULL default '0', online_pagecount tinyint(3) unsigned NOT NULL default '0',
online_active int(10) unsigned NOT NULL default '0' online_active int(10) unsigned NOT NULL default '0',
online_agent varchar(255) NOT NULL default ''
) TYPE=MyISAM; ) TYPE=MyISAM;
# -------------------------------------------------------- # --------------------------------------------------------

View File

@@ -9,8 +9,8 @@
* e107 Main * e107 Main
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/online_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/online_class.php,v $
* $Revision: 1.7 $ * $Revision: 1.8 $
* $Date: 2009-11-18 01:04:43 $ * $Date: 2009-12-24 10:00:30 $
* $Author: e107coders $ * $Author: e107coders $
*/ */
@@ -41,7 +41,20 @@ class e_online
$page = (strpos(e_SELF, "content") !== FALSE) ? e_SELF.".".e_QUERY : $page; $page = (strpos(e_SELF, "content") !== FALSE) ? e_SELF.".".e_QUERY : $page;
$page = $tp -> toDB($page, true); $page = $tp -> toDB($page, true);
$ip = $e107->getip(); $ip = $e107->getip();
$udata = (USER === true ? USERID.".".USERNAME : "0"); $udata = (USER === true) ? USERID.".".USERNAME : "0";
$agent = $_SERVER['HTTP_USER_AGENT'];
$insert_query = array(
'online_timestamp' => time(),
'online_flag' => 0,
'online_user_id' => $udata,
'online_ip' => $ip,
'online_location' => $page,
'online_pagecount' => 1,
'online_active' => 0,
'online_agent' => $agent
);
if (USER) if (USER)
{ {
// Find record that matches IP or visitor, or matches user info // Find record that matches IP or visitor, or matches user info
@@ -80,7 +93,7 @@ class e_online
} }
else else
{ {
$sql->db_Insert("online", " '".time()."', '0', '{$udata}', '{$ip}', '{$page}', 1, 0"); $sql->db_Insert("online",$insert_query);
} }
} }
else else
@@ -106,7 +119,7 @@ class e_online
} }
else else
{ {
$sql->db_Insert("online", " '".time()."', '0', '0', '{$ip}', '{$page}', 1, 0"); $sql->db_Insert("online",$insert_query);
} }
} }