<?php
//**********************************************************************************************
//***** CHECK CONFIGURATION ******
//**********************************************************************************************
//Be positive, assume no erros
$failure = false;
//Prepare a simple html possible error document
$error = "<html>
<head>
<title>GG-Tracker (GSM and GPS location combined)</title>
</head>
<body>
<font face=\"Verdana\">
<h1>GG-Tracker has errors!</h1>\r\n\r\n";
//Check Google Maps key
if (empty($gmaps)) {
$error .= " Please enter your Google Maps key in config.php<p>\r\n";
$failure = true;
}
//Check when period is filled if there is a history file present as well
if (!empty($gearthperiod) && empty($gearthfile)) {
$error .= " If you set a period to calculate the history, "
."please also define a history file in config.php<p>\r\n";
$failure = true;
}
//Check when history is required, check if period is valid
if (!empty($gearthfile)) {
if (($gearthperiod <> "today") && ($gearthperiod <> "yesterday") && ($gearthperiod <> "week") &&
($gearthperiod <> "month") && ($gearthperiod <> "year")) {
$error .= " Please enter the correct period for calculating the history in config.php<p>\r\n";
$failure = true;
}
}
//Check if a phone is set for authentication
if (empty($cphone)) {
$error .= " Please enter the IMEI of your phone in config.php<p>\r\n";
$failure = true;
}
//Check if threshold has a normal value
if (($ant_threshold < 1) || ($ant_threshold > 10)) {
$error .= " Please check the antenna threshold in config.php<p>\r\n";
$failure = true;
}
//Check MySQL credentials
if ((empty($dbhost)) || (empty($dbname)) || (empty($dbpass)) || (empty($dbuser))) {
$error .= " Please set your MySQL credentials in config.php<p>\r\n";
$failure = true;
}
//Check CellDB credentials if appropriate
if ($celldb) {
if ((empty($cduser)) || (empty($cdhash))) {
$error .= " Please set your CellDB credentials in config.php<p>\r\n";
$failure = true;
}
}
if ($failure) {
$error .= " <font color=red>GG-Tracker terminated abnormally!</font>\r\n";
$error .= " </font>\r\n\r\n";
$error .= " </body>\r\n";
$error .= "</html>";
echo $error;
exit;
};
?>