예제 #1
0
 static function getMem()
 {
     if (self::$m_objMem == NULL) {
         self::$m_objMem = new Memcache();
         self::$m_objMem->connect('localhost', '11211') or die(showniceerror("We failed to contact the memcache server! Please check the configuration."));
     }
     return self::$m_objMem;
 }
예제 #2
0
<?php

// Functions needed to connect to mysql
// Connect to the database, or fail
if (!($connection = @mysql_connect($dbhost, $dbuser, $dbpass))) {
    showniceerror("These was a problem reaching the database:<br>" . mysql_errno() . ' ' . mysql_error());
}
// Select the database, or fail
if (!mysql_select_db($db, $connection)) {
    showniceerror("These was a problem reading from the database:<br>" . mysql_errno() . ' ' . mysql_error());
}
예제 #3
0
include 'includes/includes.php';
// Check what tag is being requested. If there is no tag defined, or it's blank show everything
if (isset($_GET['tag']) && $_GET['tag'] != "" && $_GET['tag'] != "All") {
    $tag = $_GET['tag'];
    $plotline = "1";
} else {
    $tag = "%";
    $plotline = "0";
}
// Main query to return all points for a given tag (in time ascending order)
$result = cachedSQL("SELECT * FROM `" . $unitname . "` WHERE tag LIKE \"" . $tag . "\" order BY time ASC");
// Get the total number of points - used to various things
$num_rows = mysql_num_rows($result);
// Bail out if there is nothing to plot! (This shouldn't happen now as the default is "All").
if (!mysql_num_rows($result)) {
    showniceerror("No data returned from the database!");
}
// Colour gradient settings. (start_hex_colour, finish_hex_colour, number_of_points)
$gradient = gradient($gradstart, $gradend, $num_rows);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" style="height:100%">
      
	<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<link rel="stylesheet" href="style/map.css" type="text/css" media="screen" />

	<title><?php 
echo $sitetitle;
예제 #4
0
<?php

// includes.php
// Hereward Cooper
// This file is now split into sub-files each with specific functions
// The human customizable per-site bits
include_once 'includes/site_config.php';
// Error handling functions
include_once 'includes/errors.php';
// Database caching functions
include_once 'includes/memcache.php';
// Database variables
if (is_file('database_config.php')) {
    include 'database_config.php';
} else {
    showniceerror("No database settings file found. Please create a file called " . "<i>database_config.php</i> with the mysql connections strings.");
    exit;
}
// Database functions
include_once 'includes/database_functions.php';
// Colour Gradient Functions
include_once 'includes/grad.php';
// Currently unsed functions
//include_once('includes/unused.php');