0
1
Fork 0
hedera-web-mindshore/package/usr/share/hedera-web/visits-sync.php

63 lines
1.1 KiB
PHP
Executable File

<?php
require_once ('hedera/init.php');
// Update the visit info using browscap
if (TRUE)
exit ();
$db = new mysqli
(
$conf['db']['host']
,$conf['db']['user']
,$conf['db']['pass']
,$conf['db']['schema']
);
if ($db->connect_error)
exit ($db->connect_error);
$result = $db->query ("SELECT id, agent FROM visit_agent "
."WHERE version = '0.0' OR platform = 'unknown' OR cookies IS NULL ORDER BY id DESC");
$stmt = $db->prepare (
'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']);
$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 ();
$db->close ();
?>