2015-01-23 13:09:30 +00:00
|
|
|
<?php
|
|
|
|
|
2015-02-17 11:48:53 +00:00
|
|
|
require_once ('vn/web/auth.php');
|
2015-01-31 01:05:12 +00:00
|
|
|
require_once ('vn/hedera/init.php');
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-02-17 11:48:53 +00:00
|
|
|
use Vn\Web\Auth;
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-02-17 11:48:53 +00:00
|
|
|
// Update the visit info using browscap
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-02-17 11:48:53 +00:00
|
|
|
Auth::getCredentials ();
|
|
|
|
$conn = new mysqli
|
2015-01-23 13:09:30 +00:00
|
|
|
(
|
|
|
|
$conf['db']['host']
|
2015-02-17 11:48:53 +00:00
|
|
|
,Auth::getUser ()
|
|
|
|
,Auth::getPassword ()
|
2015-01-23 13:09:30 +00:00
|
|
|
,$conf['db']['schema']
|
|
|
|
);
|
|
|
|
|
2015-02-17 11:48:53 +00:00
|
|
|
if ($conn->connect_error)
|
|
|
|
exit ($conn->connect_error);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-02-17 11:48:53 +00:00
|
|
|
$result = $conn->query ("SELECT id, agent FROM visit_agent "
|
2015-01-23 13:09:30 +00:00
|
|
|
."WHERE version = '0.0' OR platform = 'unknown' OR cookies IS NULL ORDER BY id DESC");
|
|
|
|
|
2015-02-17 11:48:53 +00:00
|
|
|
$stmt = $conn->prepare (
|
2015-01-23 13:09:30 +00:00
|
|
|
'UPDATE visit_agent SET platform = ?, browser = ?, version = ?, javascript = ?, cookies = ? WHERE id = ?');
|
|
|
|
|
|
|
|
if ($result && $stmt)
|
|
|
|
{
|
|
|
|
set_time_limit (0);
|
|
|
|
|
|
|
|
$stmt->bind_param('sssiii'
|
|
|
|
,$platform
|
|
|
|
,$browser
|
|
|
|
,$version
|
|
|
|
,$javascript
|
|
|
|
,$cookies
|
|
|
|
,$id
|
|
|
|
);
|
|
|
|
|
|
|
|
while ($row = $result->fetch_assoc ())
|
|
|
|
{
|
|
|
|
echo sprintf ("Processing row: %d\n", $row['id']);
|
2015-02-17 11:48:53 +00:00
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
$info = get_browser ($row['agent']);
|
|
|
|
$platform = $info->platform;
|
|
|
|
$browser = $info->browser;
|
|
|
|
$version = $info->version;
|
|
|
|
$javascript = $info->javascript;
|
|
|
|
$cookies = $info->cookies;
|
|
|
|
$id = $row['id'];
|
|
|
|
$stmt->execute ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($stmt)
|
|
|
|
$stmt->close ();
|
|
|
|
if ($result)
|
|
|
|
$result->free ();
|
2015-02-17 11:48:53 +00:00
|
|
|
|
|
|
|
if ($conn->errno)
|
|
|
|
exit ($conn->error);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-02-17 11:48:53 +00:00
|
|
|
$conn->close ();
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
?>
|