This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This script does two things. | |
1) sends out the daily email report | |
2) archives old data | |
This script must be called by the cron daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('database_connection.php'); | |
$websiteID = 0; | |
if(isset($_GET['websiteID'])) { | |
$websiteID = intval($_GET['websiteID']); | |
} else if(isset($_POST['websiteID'])) { | |
$websiteID = intval($_POST['websiteID']); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('database_connection.php'); | |
$sensorID = 0; | |
if(isset($_GET['sensorID'])) { | |
$sensorID = intval($_GET['sensorID']); | |
} | |
if(isset($_POST['sensorID'])) { | |
$sensorID = intval($_POST['sensorID']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre class="prettyprint"><?php | |
require_once('database_connection.php'); | |
require_once('csv.php'); | |
$current_ID = array(); | |
$current_lag = array(); | |
$current_code = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('database_connection.php'); | |
require_once('csv.php'); | |
// We get the list of sensors from the spreadsheet | |
$spreadsheet_sensorID = array(); | |
$spreadsheet_name = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('database_connection.php'); | |
require_once('csv.php'); | |
function timestamp() { | |
$mytime = split(" ", microtime(true)); | |
$mytime = ($mytime[0] + $mytime[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('database_connection.php'); | |
require_once('csv.php'); | |
$handle = fopen("http://spreadsheets.google.com/pub?key=XXXXXXXXXXXXXXXX&output=csv&gid=2&range=B3:B6", "r"); | |
if(($results = readCSV($handle, 1000)) == FALSE) break; | |
$settings_recipients = str_replace("\n", "", $results[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define("CSV_Start", 0); | |
define("CSV_Quoted", 1); | |
define("CSV_Quoted2", 2); | |
define("CSV_Unquoted", 3); | |
function readCSV($fh, $len, $delimiter = ',', $enclosure = '"') { | |
$data = Array(); | |
$fildNr = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$database_hostname = "localhost"; | |
$database_username = "dbusername"; | |
$database_password = "dbpassword"; | |
$database_name = "dbname"; | |
$database_connection = mysql_pconnect($database_hostname, $database_username, $database_password) or trigger_error(mysql_error(),E_USER_ERROR); | |
mysql_select_db($database_name, $database_connection); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS `sensor_log`; | |
CREATE TABLE IF NOT EXISTS `sensor_log` ( | |
`ID` int(11) NOT NULL auto_increment, | |
`sensorID` smallint(2) NOT NULL, | |
`lag` smallint(2) NOT NULL, | |
`status_code` smallint(2) NOT NULL, | |
`created_date` timestamp NOT NULL default CURRENT_TIMESTAMP, | |
PRIMARY KEY (`ID`), | |
KEY `sensorID` (`sensorID`), |
NewerOlder