Beispiel #1
0
function parse_form_file($log_file_name)
{
    $sqlite_db_name = preg_replace("/.log\$/", ".sqlite", $log_file_name);
    $db = new DBx(DB_DIR . $sqlite_db_name, "sqlite");
    $sql = "DROP TABLE IF EXISTS actions";
    $db->q($sql);
    $sql = "\nCREATE TABLE actions (\n  unixtime INT NOT NULL,\n  remote_addr CHAR(30),\n  user_agent TEXT,\n  id INT,\n  url TEXT NOT NULL,\n  referer TEXT,\n  input_type TEXT,\n  form_id TEXT,\n  input_name TEXT,\n  time_elapsed TEXT,\n  key_ups INT\n)";
    $db->q($sql);
    $sql = "\nCREATE INDEX IF NOT EXISTS \n  actions_id\n    ON actions(id)\n";
    $db->q($sql);
    global $form_actions;
    $contents = file_get_contents(DB_DIR . $log_file_name);
    $lines = explode("\n", $contents);
    // begin a transaction
    $db->bt();
    foreach ($lines as $line) {
        if (strlen($line) == 0) {
            continue;
        }
        $tic = parse_form_action($line);
        $db->set('actions', $tic);
        // todo add cleanup string
        /** /
            echo "<pre>";
            print_r($tic);
            echo "</pre>";
            /**/
    }
    $db->c();
}
Beispiel #2
0
@copyright: dfhu.org
@report_bugs: bugs(at)dfhu.org
@feature_request: features(at)dfhu.org
@file:
@license: BSD
@description:
  This file is great.
*/
require "./login_is.php";
require "../includes/db.inc.php";
$db_dir = DB_DIR;
if (!preg_match("/[0-9]{6}-site-freetale.sqlite/", $_GET['db'])) {
    echo "BAD DATABSE";
    exit;
}
$db = new DBx(DB_DIR . $_GET['db']);
$sql = "\nSELECT * FROM tics \n  WHERE\n    id=:id and url=:url \n  LIMIT 1\n";
$db->p($sql);
$db->exec(array(":id" => $_GET['id'], ":url" => $_GET['url']));
$init = $db->f();
$_SESSION['id'] = $_GET['id'];
$_SESSION['url'] = $_GET['url'];
$_SESSION['db'] = $_GET['db'];
$_SESSION['replay_motion'] = 1;
$_SESSION['replay_summary'] = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    function MySQLReplicationStatus($host,$clusters) {

        $db = new DBx ($clusters[$host]['ip'],$clusters[$host]['user'],$clusters[$host]['password']);

        if (!$db->query($this->slave_status_query)) {
            printf ("<p><font color=red>Error from MySQL server %s: %s (%s) for query: %s</font>",$clusters[$host]['ip'],$db->Error,$db->Errno,$this->slave_status_query);
            return false;
        }

		$db->next_record();

        $this->slave_master         = $db->f('Master_Host');
        $this->slave_user           = $db->f('Master_User');
        $this->slave_master_port    = $db->f('Master_Port');
        $this->slave_log_file	    = $db->f('Master_Log_File');
        $this->slave_position       = $db->f('Read_Master_Log_Pos');
        $this->slave_sql_running	= $db->f('Slave_SQL_Running');
        $this->slave_io_running	    = $db->f('Slave_IO_Running');
        $this->slave_last_errno	    = $db->f('Last_Errno');
        $this->slave_last_error 	= $db->f('Last_Error');
        $this->slave_seconds_behind = $db->f('Seconds_Behind_Master');

        if (!$db->query($this->master_status_query)) {
            printf ("<p><font color=red>MySQL error: %s (%s) for query: %s</font>",$db->Error,$db->Errno,$this->slave_status_query);
            return;
        }

		$db->next_record();

    	$this->master_position	    = $db->f('Position');
    	$this->master_log_file	    = $db->f('File');
        $this->slave_of     	    = $clusters[$host]['slave_of'];
        $this->color         	    = $clusters[$host]['color'];
    }
Beispiel #4
0
$db_dir = DB_DIR;
function anchor_link($url)
{
    if ($url == "") {
        return "none";
    }
    $url = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED);
    $url_string = htmlentities($url);
    $url_link = "\n<a href=\"{$url}\" target=\"_blank\">{$url_string}</a>\n";
    return $url_link;
}
if (!preg_match("/freetaleform.sqlite/", $_GET['db'])) {
    echo "BAD DATABSE";
    exit;
}
$db = new DBx(DB_DIR . $_GET['db']);
$prepare_vars = array(':id' => $_GET['id'], ':url' => $_GET['url']);
$sql = "\nSELECT * FROM \n  actions \nWHERE\n  id = :id\n   AND\n  url = :url\nORDER BY\n  unixtime\n";
$db->p($sql . " LIMIT 1");
$db->exec($prepare_vars);
$meta_row = $db->f();
$url_link = anchor_link($meta_row['url']);
$referer_link = anchor_link($meta_row['referer']);
$db->p($sql);
$db->exec($prepare_vars);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
@description:

  This file is great.
*/
require "./login_is.php";
require "../includes/db.inc.php";
$_SESSION['url'] = $_GET['url'];
$_SESSION['db'] = $_GET['db'];
$_SESSION['replay_motion'] = 0;
$_SESSION['replay_summary'] = 1;
if (!preg_match("/[0-9]{6}-site-freetale.sqlite/", $_GET['db'])) {
    echo "BAD DATABSE";
    exit;
}
$db_dir = DB_DIR;
$db = new DBx(DB_DIR . $_GET['db']);
$sql = "\nSELECT\n  id,\n  scroll,\n  time_elapsed\nFROM  tics\n";
$db->q($sql);
function last_scroll($scroll)
{
    if ($scroll == "") {
        return False;
    }
    $bits = explode("|", $scroll);
    return $bits[count($bits) - 1];
}
$motions = array();
$this_id = False;
while ($row = $db->f()) {
    if ($this_id != $row['id']) {
        $this_id = $row['id'];
Beispiel #6
0
 function __construct($db_name = DB_NAME)
 {
     parent::__construct();
 }
}
function anchor_link($url)
{
    if ($url == "") {
        return "none";
    }
    $url = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED);
    $url_string = htmlentities($url);
    $url_link = "\n<a href=\"{$url}\" target=\"_blank\">{$url_string}</a>\n";
    return $url_link;
}
if (!preg_match("/freetaleform.sqlite/", $_GET['db'])) {
    echo "BAD DATABSE";
    exit;
}
$db = new DBx(DB_DIR . $_GET['db']);
$prepare_vars = array(':url' => $_GET['url']);
$sql = "\nSELECT \n  *\nFROM \n  actions\nWHERE\n  url = :url \n    AND\n  input_type != 'landing'\nGROUP BY\n  input_name\nORDER BY\n  unixtime\n";
$db->p($sql . " LIMIT 1");
$db->exec($prepare_vars);
$meta_row = $db->f();
$url_link = anchor_link($meta_row['url']);
$referer_link = anchor_link($meta_row['referer']);
$db->p($sql);
$db->exec($prepare_vars);
$input_names = array();
while ($row = $db->f()) {
    $input_names[] = $row['input_name'];
}
$sql = "\nSELECT\n  input_type,\n  input_name,\n  key_ups,\n  form_id,\n  COUNT(*) AS count,\n  SUM(time_elapsed) AS total_time\nFROM \n  actions\nWHERE\n  input_name = :input_name\n";
$db->p($sql);
Beispiel #8
0
/*
@author: Victory
@site: http://dfhu.org
@copyright: dfhu.org
@report_bugs: bugs(at)dfhu.org
@feature_request: features(at)dfhu.org
@file:
@license: BSD
@description:
  This file is great.
*/
require "./login_is.php";
require "../includes/db.inc.php";
$db_dir = DB_DIR;
if (!preg_match("/freetale(form)?.sqlite\$/", $_GET['db'])) {
    echo "BAD DATABSE";
    exit;
}
$db = new DBx(DB_DIR . $_GET['db']);
if (preg_match("/freetale.sqlite\$/", $_GET['db'])) {
    $sql = "\nSELECT id,url FROM tics \n GROUP BY id\n";
    $stats_type = "replay";
} else {
    $sql = "\nSELECT id,url FROM actions\n GROUP BY id\n";
    $stats_type = "form_view";
}
$db->q($sql);
// TODO: Really need to make this stop sucking so bad
$template = "\n<a \n href=\"admin_{$stats_type}.php?id=%id%&url=%url%&db={$_GET['db']}\"\n >%id% %url%</a>\n<a \n  href=\"admin_{$stats_type}_summary.php?url=%url%&db={$_GET['db']}\"\n >Summary</a>\n<br>";
$db->while_row($template);
Beispiel #9
0
<?php

echo '
var freeTale_replay=0;
';
require './includes/db.inc.php';
if (!isset($_SESSION['db']) or !file_exists("./db/{$_SESSION['db']}")) {
    exit;
}
$db = new DBx("./db/{$_SESSION['db']}", 'sqlite');
$sql = "\nSELECT * FROM tics \n  WHERE\n    id=:id and url=:url \n";
$db->p($sql);
$db->exec(array(":id" => $_SESSION['id'], ":url" => $_SESSION['url']));
function quote_extend(&$vals, $extend)
{
    foreach ($extend as $e) {
        $vals[] = "'{$e}'";
    }
}
function quote_dimensions($dim)
{
    $bits = explode("x", $dim);
    return "Array('{$bits[0]}','{$bits[1]}')";
}
function quote_dim($dim)
{
    return "'{$dim}'";
}
function print_js_array($array_name, $vals)
{
    echo "  var {$array_name} = Array(";