function system_track()
{
    $system = PLATFORM_SANDBOX_SYSTEM_CACHES_PATH . DS . 'system.db';
    $db = db_create_sqlite($system);
    $ip = $_SERVER["REMOTE_ADDR"];
    $ua = detect_user_agent();
    $dt = system_device_detection();
    $uri = $_SERVER["REQUEST_URI"];
    $input = $_POST['input'];
    if ($ip == PLATFORM_WHOIS) {
        $ip = $_SERVER["HTTP_X_REAL_IP"];
    }
    if (count($_GET) > 0) {
        $get = print_r($_GET, true);
    }
    if (count($_POST) > 0) {
        $post = print_r($_POST, true);
    }
    $sql = "CREATE TABLE IF NOT EXISTS visits_" . date("Y_m_d") . " AS SELECT * FROM visits WHERE 0";
    db_query_sqlite($sql, $db);
    $sql = "INSERT INTO visits_" . date("Y_m_d") . " \n                 ( url, get, post, input, ua, dt, ip ) \n          VALUES \n                 ('" . sqlite_escape_string($uri) . "', \n                  '" . sqlite_escape_string($get) . "', \n                  '" . sqlite_escape_string($post) . "', \n                  '" . sqlite_escape_string($input) . "',\n                  '" . sqlite_escape_string($ua) . "', \n                  '" . sqlite_escape_string($dt) . "', \n                  '" . sqlite_escape_string($ip) . "')";
    db_query_sqlite($sql, $db);
    unset($db);
}
function db_insert_sqlite($table, $columns, $values, &$db)
{
    $column_part = array_to_string($columns);
    $value_part = array_to_quoted_string($values);
    return db_query_sqlite("INSERT INTO {$table} ({$column_part}) VALUES ({$value_part});");
}