public function processAPI() { if ($this->sqlInjection($_SERVER['REQUEST_URI'])) { $log = new Logging(); $log->lfile('/var/www/web1162/html/tankUp/log_error.txt'); $log->lwrite("SQL_Injection?: " . $_SERVER['REQUEST_URI']); $log->lclose(); return $this->_response("Unexpected Parameters", 400); } if ((int) method_exists($this, $this->endpoint) > 0) { return $this->_response($this->{$this->endpoint}($this->args)); } return $this->_response("No Endpoint: {$this->endpoint}", 404); }
public function GetDataByCoords($article, $distance, $sortBy, location $coords) { try { $log = new Logging(); $log->lfile('/var/www/web1162/html/tankUp/log_debug.txt'); $log->lwrite($article . $distance . $sortBy . $coords->latitude . $coords->longitude); $log->lclose(); $param = new GetDataByCoordsRequest($article, $distance, $coords, $sortBy); $response = $this->__construct()->__soapCall("getDataByCoords", array($param)); return $response->petrolStation; } catch (Exception $e) { // Umwandlung Soap-Exception zu HTTP return $e; } }
public function __toString() { //if show error or save in logfile $msg = "[{$this->code}]: {$this->message}\n"; return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; $config = new Config(); if ($config->logfile == true) { $logfile = new Logging(); $logfile->lwrite($msg); return ""; } if ($config->showerror == true) { return $msg; } }
public function run() { $log = new Logging(); // $parenClass = new ParentClass(); // set path and name of log file (optional) $log->lfile('log.txt'); $json = file_get_contents('php://input'); $log->lwrite("post: " . $json); $update = new Update($json); $message = $update->getMessage(); $chat = $message->getChat(); $chat_id = $chat->getId(); $text = $message->getText(); $client = new Client(); $client->sendMessage($chat_id, $text, null, null, null); $client->sendLocation($chat_id, 53.480759, -2.242631, null, null); $client->sendPhoto($chat_id, 'pic.jpg', 'sweety', null, null); $log->lclose(); }
die('Could not connect: ' . mysql_error()); } $db = mysql_select_db("magento", $con); if (!$db) { echo "cant select database"; } //************************ SET STATUS for API ***********************************// // $apiMode = "live" or "test" $apiMode = "test"; //******************************************************************************// $config_info = parse_ini_file('/var/www/html/magento/paGateway/paGateway.ini', true); include "/var/etl/bin/includes/logging.php"; // Logging class initialization $log = new Logging(); $log->lfile('/var/log/paGateway/paGateway_test.log'); $log->lwrite("Script STARTED.\r\n"); //External script - Load magento framework require_once "/var/www/html/magento/app/Mage.php"; Mage::app(); //construct paAPI class require_once '/var/www/html/magento/paGateway/paAPI.php'; $paOrder = new paAPI(); $myOrder = Mage::getModel('sales/order'); // print_r($myOrder); $orders = Mage::getModel('sales/mysql4_order_collection'); // print_r($orders); $now = date('Y.m.d \\: h:m:s'); $to = $config_info['email']['to']; $uid = $config_info['login']['uid']; $pass = $config_info['login']['pass']; function getPaShipCode($text)
public function getAllTowns() { require_once 'Logging.php'; include 'db_connect.php'; date_default_timezone_set('GMT'); $query = "SELECT town_name, country from town ORDER BY town_name"; $date = date('Y-m-d H:i:s'); /* Create Log file */ fopen("c:\nmpp\\htdocs\\weather\\automated\\log\\yahoo-api-download.txt", "w"); // Logging class initialization $log = new Logging(); // set path and name of log file (optional) $log->lfile('c:\\xampp\\htdocs\\weather\\automated\\log\\yahoo-api-download.txt'); $log->lwrite('Script Started at: ' . $date); if ($result = $dbcon->query($query)) { /* fetch associative array */ while ($row = $result->fetch_assoc()) { $town = $row['town_name']; $country = 'UK'; echo $town . "\n"; $query = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22" . rawurlencode($town) . "%2C%20" . $country . "%22)%20and%20u%20%3D%27c%27&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"; $weatherfeed = file_get_contents($query); $weatherfeed = json_decode($weatherfeed); if ($weatherfeed->query->results == null || $weatherfeed->query->results->channel->location->city == "United Kingdom") { $weatherfeed = null; // write message to the log file $log->lwrite('API Fail for Town: ' . $row['town_name']); } else { $request_date = new Datetime($weatherfeed->query->created); $request_date = $request_date->format('Y-m-d H:i:s'); $fdate = new Datetime($weatherfeed->query->results->channel->item->forecast[0]->date); $forecast_date = $fdate->format('Y-m-d'); $feed_url = $weatherfeed->query->results->channel->link; $town = $weatherfeed->query->results->channel->location->city; $postcode = null; $min_temp = $weatherfeed->query->results->channel->item->forecast[0]->low; $max_temp = $weatherfeed->query->results->channel->item->forecast[0]->high; $avg_temp = $weatherfeed->query->results->channel->item->condition->temp; $wind_dir = $weatherfeed->query->results->channel->wind->direction; $conditions = $weatherfeed->query->results->channel->item->condition->text; $source_id = 1; $second_date = new Datetime($weatherfeed->query->results->channel->item->forecast[1]->date); $second_date = $second_date->format('Y-m-d'); $second_mintemp = $weatherfeed->query->results->channel->item->forecast[1]->low; $second_maxtemp = $weatherfeed->query->results->channel->item->forecast[1]->high; $second_conditions = $weatherfeed->query->results->channel->item->forecast[1]->text; $second_avg = $second_maxtemp / 2 + $second_mintemp / 2; } $presentforecast = "INSERT INTO weather_forecast (request_date, forecast_date, feed_url, town, postcode_prefix, min_temp, max_temp, avg_temp, wind_dir, conditions, source_id)\n\t\t\tVALUES ('{$request_date}', '{$forecast_date}', '{$feed_url}', '{$town}', '{$postcode}', '{$min_temp}', '{$max_temp}', '{$avg_temp}', '{$wind_dir}', '{$conditions}', '{$source_id}')"; $secondforecast = "INSERT INTO weather_forecast (request_date, forecast_date, feed_url, town, postcode_prefix, min_temp, max_temp, avg_temp, wind_dir, conditions, source_id)\n\t\t\tVALUES ('{$request_date}', '{$second_date}', '{$feed_url}', '{$town}', '{$postcode}', '{$second_mintemp}', '{$second_maxtemp}', '{$second_avg}', null, 'second_conditions', '{$source_id}')"; if ($dbcon->query($presentforecast) === TRUE) { echo "New first created successfully \n"; if ($dbcon->query($secondforecast) === TRUE) { echo "New second forecast created successfully \n\n"; } else { echo "Error: \n" . $dbcon->error; } } else { echo "Error: \n" . $dbcon->error; } } $log->lwrite('Script Run on: ' . $date); // close log file $log->lclose(); $dbcon->close(); } }
$content .= date_format($date, "m/d/Y") . ','; $content .= 'true,'; $content .= '"READ: ' . ucfirst($arr['read']) . ' PRAY: ' . ucfirst($arr['meditation']); if (array_key_exists('video', $arr)) { $content .= ' WATCH: ' . ucfirst($arr['video']); } $content .= ' http://bible.sograce.org/#/' . $arr['day'] . '/1"'; return $content; } $jsonLocation = "../js/plan_tbp.json"; $milliseconds = round(microtime(true) * 1000); $fileName = 'calendar_' . $milliseconds . '.csv'; //we'll just use the logging class, since i have it handy $log = new Logging(); $log->lfile($fileName); //read in the json $string = file_get_contents($jsonLocation); $json_a = json_decode($string, true); //lets create th initial start date $seedDate = date_create("2016-01-01"); //create the initial header file $log->lwrite('Subject,Start Date,All Day Event,Description'); foreach ($json_a as $v) { if (!empty($v)) { $cLine = createCalendarLine($v, $seedDate); $log->lwrite($cLine, false); //increase date date_add($seedDate, date_interval_create_from_date_string("1 day")); } } echo '<a href="' . $fileName . '">Download</a>';
// XXX We should make this dynamic. IP of our LamPI-daemon $noError = true; $curl_errs = 0; // Count the number of curl errors $curl_msgs = 0; $time_now = time(); // Time NOW at this moment of calling // ---------------------------------------------------------------------------------------- // ZWAY CONFIGURATIONS // $zway_dev = array(); $zway_rules = array('id' => 1, 'dev' => 9, 'gui_inValid' => 3, 'rules' => ""); $zway_val = ""; $log = new Logging(); $log->lfile($log_dir . '/LamPI-gate.log'); $log->lwrite("\n\n---------------------------------- STARTING ZWAVE DAEMON -----------------------------------"); $apperr = ""; // Global Error. Just append something and it will be sent back $appmsg = ""; // Application Message (from backend to Client) // ---------------------------------------------------------------------------------------- // ZWAY_DUMP // // Default is to dump all devices. $tim is for later optional use // function zway_dump($ch, $tim) { // global $time_start; global $razberry; global $debug; global $log;
require_once "Staypoint.php"; require_once "request_tools.php"; require_once "Logging.php"; if (isset($_POST['createTrajectory'])) { $min_time = $_POST["minTime"]; // In milliseconds $max_time = $_POST["maxTime"]; // In milliseconds $min_distance = $_POST["minDistance"]; // In meters $time_zone = new DateTimeZone("America/Mexico_City"); $date_now = new DateTime("now", $time_zone); $converted_date = $date_now->format('Y-m-d H:i:s'); $log = new Logging(); $log->lfile('logs/mylogTrajectory.txt'); $log->lwrite("fecha es: " . $converted_date); insert_new_trajectory($converted_date, $converted_date, $min_distance, $min_time, $max_time); echo "trajOk"; } else { $last_trajectory = get_last_trajectory(); $min_time = $last_trajectory["minTime"]; $max_time = $last_trajectory["maxTime"]; $min_distance = $last_trajectory["minDistance"]; $ml = new MontoliouLive($min_time, $max_time, $min_distance); if (!isset($_POST['lastPart'])) { if (validate_fix_input()) { $fix = GpsFix::create_fix_from_parameters(); $stay_point = $ml->process_fix($fix); if ($stay_point != null) { echo $stay_point; } else {
// $transport->setUsername('bounce.oktick-beta'); // $transport->setPassword('30c6f2fb4d2f9fdc1650cbfe8d38'); $massmailer = new Swift_Mailer($transport); try { $err = false; $result = $massmailer->send($message); if ($result) { $errcode = $errmsg = false; } } catch (Exception $e) { $errcode = $e->getCode(); $errmsg = $e->getMessage(); } } if ($result) { $log->lwrite("OK {$setTo} ({$setId}) sent"); echo "OK"; } else { $log->lwrite("FAIL {$setTo} ({$setId}) {$errmsg} {$errcode}"); if ($errmsg) { echo "FAIL {$errcode} {$errmsg}"; } else { echo "FAIL"; } } // close log file $log->lclose(); exit; function sent404() { header('HTTP/1.0 404 not found');
$html = file_get_html($autores); // inicializar archivo de logging $log = new Logging(); //sacar Nombre,Cargo,Periodos $i = 0; foreach ($html->find('td[class="azu"]') as $e) { if ($i == 0) { //Nombre $nombre = explode(", ", $e->plaintext); $nombres = trim($nombre[1]); $apellidos = trim($nombre[0]); } else { if ($i == 1) { //Cargo $cargo = trim($e->plaintext); } else { if ($i == 2) { //Periodos $periodos = trim($e->plaintext); $i = -1; //guardar datos en BBDD $sql = "INSERT INTO Autor (nombre, apellidos, cargo, periodos, created_at, updated_at) VALUES ('" . $nombres . "', '" . $apellidos . "', '" . $cargo . "', '" . $periodos . "', '" . date("Y-m-d H:m:s") . "', '" . date("Y-m-d H:m:s") . "')"; mysql_query($sql, $cn); $idAutor = mysql_insert_id($cn); echo $idAutor . '|' . $nombres . ' ' . $apellidos . '|' . $cargo . '|' . $periodo . '<br>'; $log->lwrite($idAutor . '|' . $nombres . ' ' . $apellidos . '|' . $cargo . '|' . $periodo); } } } $i++; }
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // You should have received a copy of the GNU General Public License // along with LamPI. If not, see <http://www.gnu.org/licenses/>. // // //$log->lwrite("Starting graph.php script. __ROOT__ is ".__ROOT__); define('__ROOT__', dirname(dirname(__FILE__))); $log = new Logging(); $logfile = '/home/pi/log/TemPI.log'; $log->lfile($logfile); $log->lwrite("Starting graph.php script. __ROOT__ is " . __ROOT__); $log->lwrite("Starting graph.php script. dirname(__FILE__) is " . dirname(__FILE__)); $apperr = ""; // Global Error. Just append something and it will be sent back $appmsg = ""; // Application Message (returned from backend to Client) $graphAction = ""; // Must be "graph" only initially $graphType = ""; // T emperature, H umidity, P airPressure $graphPeriod = ""; // 1d 1w 1m 1y $graphSensors = array(); // List of sensor values we like to graph // ---------------------------------------------------------------------------- // MAKE GRAPH
$maxSize = 2; // where to upload the files //$upload_dir = 'images/dragndrop'; // save user's files (images) inside the course (it is a safe place, especially... because it gets backed up) $uploads_dir = $_GET['courseid'] . "/users/" . $_GET['userid']; //$uploads_dir = "{$COURSE->id}/users/{$USER->id}"; $upload_dir = make_upload_directory($uploads_dir, false); // error messages $error_message[0] = "Unknown problem with upload."; $error_message[1] = "Uploaded file too large."; $error_message[2] = "Uploaded file too large."; $error_message[3] = "File was only partially uploaded."; $error_message[4] = "Choose a file to upload."; if ($logIt) { $log = new Logging(); $log->lwrite("upload script started"); } //print( "_FILES: " ); print_r( $_FILES ); print( "\n" ); //print( "_POST: " ); print_r( $_POST ); print( "\n" ); function uploadFinished($status, $fileList) { $fileListJSON = ''; if (!empty($fileList)) { foreach ($fileList as $fileInfo) { $fileListJSON .= "[\"" . implode('", "', $fileInfo) . "\"],"; } $fileListJSON = substr_replace($fileListJSON, "", -1); } die("{\"status\":\"{$status}\", \"fileList\":[{$fileListJSON}]}"); } $num_files = count($_FILES);
public function __construct($loggingOn = false) { if ($loggingOn) { $log = new Logging(); } if ($loggingOn) { $log->lwrite('_____ BEGIN iEMSLoader Initialization _____'); } require_once 'mdr/CAO.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/CAO.php'); } require_once 'mdr/User.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/User.php'); } require_once 'mdr/Domain.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/Domain.php'); } require_once 'mdr/Privileges.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/Privileges.php'); } require_once 'mdr/UnitOfMeasure.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/UnitOfMeasure.php'); } require_once 'mdr/CRSDate.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/CRSDate.php'); } require_once 'mdr/PointChannels.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/PointChannels.php'); } require_once 'mdr/PointChannel.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/PointChannel.php'); } require_once 'mdr/PointType.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/PointType.php'); } require_once 'mdr/MeterPoint.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/MeterPoint.php'); } require_once 'mdr/TimeZone.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/TimeZone.php'); } require_once 'mdr/Preferences.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/Preferences.php'); } require_once 'mdr/TimeSpan.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/TimeSpan.php'); } require_once 'mdr/IntervalValueSets.php'; if ($loggingOn) { $log->lwrite('loaded: mdr/IntervalValueSets.php'); } /* in iEMS3 the following are loaded as needed and not on initialization */ $this->includePricing(); if ($loggingOn) { $log->lwrite('loaded: includePricing()'); } $this->includeContactManager(); if ($loggingOn) { $log->lwrite('loaded: includeContactManager()'); } $this->includeContactManager(); if ($loggingOn) { $log->lwrite('loaded: includeContactManager()'); } $this->includeReports(); if ($loggingOn) { $log->lwrite('loaded: includeReports()'); } $this->includeStatistics(); if ($loggingOn) { $log->lwrite('loaded: includeStatistics();'); } $this->includeEventPerformance(); if ($loggingOn) { $log->lwrite('loaded: includeEventPerformance();'); } $this->includeObject(); // contactmanager uses this if ($loggingOn) { $log->lwrite('loaded: includeObject()'); } $this->includeContactUse(); if ($loggingOn) { $log->lwrite('loaded: includeContactUse()'); } $this->includePriority(); if ($loggingOn) { $log->lwrite('loaded: includePriority()'); } $this->includeType(); if ($loggingOn) { $log->lwrite('loaded: includeType()'); } $this->includeContactOwner(); if ($loggingOn) { $log->lwrite('loaded: includeContactOwner()'); } $this->includeContactProfile(); if ($loggingOn) { $log->lwrite('loaded: includeContactProfile()'); } $this->includeContactValue(); if ($loggingOn) { $log->lwrite('loaded: includeContactValue()'); } $this->includeContactValueSubType(); if ($loggingOn) { $log->lwrite('loaded: includeContactValueSubType()'); } $this->includeContactValueType(); if ($loggingOn) { $log->lwrite('loaded: includeContactValueType()'); } $this->includeEmailQueue(); if ($loggingOn) { $log->lwrite('loaded: includeEmailQueue()'); } session_start(); //this has to be started after the above includes (has to do with serialization and passing the object via $_SESSION) $_SESSION['SYSTEM_ALERT'] = false; define('iEMS_VERSION', '2.2'); if ($loggingOn) { $log->lwrite('END iEMSLoader Initialization ==================='); } }
<?php //Error reporting ini_set('display_errors', 1); error_reporting(E_ALL); include "/var/www/html/magento/paGateway/includes/conn.php"; include "/var/etl/bin/includes/logging.php"; include "/var/etl/bin/includes/database_functions.php"; include "/var/etl/bin/includes/functions.php"; // Logging class initialization $log = new Logging(); $log->lfile('/var/log/paGateway/pag_update_shipping.log'); $log->lwrite("starting file. \r\n"); // **************************************** SCRIPT MODE ***************************************************************/ // set to test so that magento status is not set to complete. no way to move from complete back to processing */ $scriptMode = "live"; $config_info = parse_ini_file('/var/www/html/magento/paGateway/paGateway.ini', true); $now = date('Y.m.d \\: h:m:s'); $to = $config_info['email']['to']; $db = mysql_select_db($config_info['db_info']['db_selected'], $con); if (!$db) { echo "cant select database"; } //load paAPI require_once "/var/www/html/magento/paGateway/paOrder.php"; function getStatus($orderId) { $config_info = parse_ini_file('/var/www/html/magento/paGateway/paGateway.ini', true); $uid = $config_info['login']['uid']; $pass = $config_info['login']['pass']; // PO Number entered via API. Use Magento Invoice ID.
<?php $currency = @$_GET['currency'] ? htmlspecialchars($_GET['currency']) : 'usd'; include_once "./config-{$currency}.php"; include_once './functions.php'; include_once './bitfinex.php'; include_once './logging.php'; // Logging class initialization $log = new Logging(); // set path and name of log file (optional) // $log->lfile('./output.log'); // write message to the log file $bfx = new Bitfinex($config['api_key'], $config['api_secret']); $log->lwrite('Getting credits'); $credits = $bfx->get_credits(); // Something is wrong most likely API key if (array_key_exists('message', $credits)) { die($credits['message']); } $amount_total = 0; $rate_total = 0; $count = count($credits); foreach ($credits as $credit) { $rate = $credit['rate']; $amount = $credit['amount']; $amount_total = $amount_total + $amount; $rate_total = $rate_total + $rate; } $rate_total = $rate_total / $count; //not weighted $log->lwrite("Total {$count} loans for {$amount_total}");
die('Could not connect: ' . mysql_error()); } $db = mysql_select_db("magento", $con); if (!$db) { echo "cant select database"; } //************************ SET STATUS for API ***********************************// // $apiMode = "live" or "test" $apiMode = "test"; //******************************************************************************// $config_info = parse_ini_file('/var/www/html/magento/paGateway/paGateway.ini', true); include "/var/etl/bin/includes/logging.php"; // Logging class initialization $log = new Logging(); $log->lfile('/var/log/paGateway/paGateway.log'); $log->lwrite("Script STARTED.\r\n"); //External script - Load magento framework require_once "/var/www/html/magento/app/Mage.php"; Mage::app(); $myOrder = Mage::getModel('sales/order'); // print_r($myOrder); $orders = Mage::getModel('sales/mysql4_order_collection'); // print_r($orders); //FILTER to only orders in processing status $orders->addFieldToFilter('status', array('eq' => "processing")); //Status is "processing" $allIds = $orders->getAllIds(); // print_r($allIds); foreach ($allIds as $thisId) { $myOrder->reset()->load($thisId); $InvoiceId = $myOrder->getIncrementId();
<?php ini_set('display_errors', 1); error_reporting(E_ALL); include "/var/etl/bin/includes/logging.php"; include "/var/etl/bin/includes/functions.php"; // Logging class initialization $log = new Logging(); $log->lfile('test.txt'); $log->lwrite("Script STARTED.\r\n"); $unwanted_array = array('Š' => 'S', 'š' => 's', 'Ş' => 'S', 'ş' => 's', 'Ž' => 'Z', 'ž' => 'z', 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Å' => 'A', 'Æ' => 'A', 'Ç' => 'C', 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ø' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ű' => 'U', 'Ý' => 'Y', 'Þ' => 'B', 'ß' => 'Ss', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'a', 'ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ı' => 'i', 'ð' => 'o', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ű' => 'u', 'ü' => 'u', 'ý' => 'y', 'ý' => 'y', 'þ' => 'b', 'ÿ' => 'y', 'º' => '*', 'ż' => 'z'); $log->lwrite(print_r($unwanted_array)); // comment
2. Store a configuration to file 3. List the skin files in config NOTE: Start initiating the database by executing: http://localhost/kaku/backend_sql.php?init=1 this will initialize the MySQL database as defined below in init_dbase() ====================================================================================== */ $debug = 1; $time_now = time(); // Time NOW at this moment of calling $time_start = $time_now - 24 * 60 * 60; // Time a day ago $log = new Logging(); $log->lfile($log_dir . '/zway_daemon.log'); $log->lwrite("\n\n---------------------------------- STARTING ZWAVE DAEMON -----------------------------------"); $apperr = ""; $appmsg = ""; // ---------------------------------------------------------------------------------------- // ZWAY_DUMP // // Default is to dump all devices. $dev is for later optional use function zway_dump($ch, $dev) { global $time_start; global $debug; curl_setopt_array($ch, array(CURLOPT_URL => 'http://192.168.2.52:8083/ZWaveAPI/Data/' . $time_start, CURLOPT_RETURNTRANSFER => true)); $output = curl_exec($ch); if ($output === false) { if ($debug >= 2) { echo "curl_exec returned false";
set_time_limit(0); // NO execution time limit imposed ob_implicit_flush(); $log = new Logging(); // Logging class initialization, maybe init at declaration $sensor = new Sensor(); // Weather Log $queue = new Queue(); $sock = new Sock(); $dlist = new Device(); // Class for handling of device specific commands $wthr = new Weather(); // Class for Weather handling in database // set path and name of log file (optional) $log->lfile($log_dir . '/LamPI-daemon.log'); $log->lwrite("-------------- STARTING DAEMON ----------------------"); sleep(2); // Open the SQL handler to the mysql daemon $pisql = new mysqli($dbhost, $dbuser, $dbpass, $dbname); if ($pisql->connect_errno) { $log->lwrite("LamPI-daemon:: Failed to connect to MySQL: (" . $pisql->connect_errno . ") " . $pisql->connect_error, 1); exit(1); } // Some variables that are probably (re)set by get_parse(); $doinit = false; $doreset = false; $dofile = ""; // Parse the comamndline (starting) for commandparameters // 1. Parse the URL sent by client (not working, but could restart itself later version) // XXX Need to adapt get_parse to also read URL-like (should that be necessary) if (get_parse()) {
require "class/cnx.php"; require "class/controlador.php"; $coneccion = coneccion(); $o = new Controlador(); $log = new Logging(); $arrayMeses = array("", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); $debug = true; $write = false; $sil_url = 'http://sil.senado.cl/cgi-bin/'; $fechas_url = $sil_url . 'sil_ultproy.pl'; $proyectos_url = $sil_url . 'sil_proyectos.pl?'; $autores_url = $sil_url . 'sil_autores.pl?'; $desde = "30/04/2010"; $hasta = "09/05/2010"; $log->lwrite_ln(); $log->lwrite("Periodo: " . $desde . "-" . $hasta); $log->lwrite_ln(); if ($debug) { echo "<br>----------------Periodo: " . $desde . "-" . $hasta . "-------------------<br>"; } $fechas_post = file_get_contents_curl($fechas_url, $desde, $hasta); $fechas_html = str_get_html($fechas_post); $num = 0; foreach ($fechas_html->find('td[class="TEXTpais"]') as $nro) { $nro_boletin = trim(str_replace(" ", "", $nro->plaintext)); if ($debug) { echo "<h1>" . $nro_boletin . "</h1>"; } //FALTA: controlar si ya existe proyectoLey -> 2010-05-09 se incorporó validación Carlos Martínez //get proyectoLey $proyectos_html = file_get_html($proyectos_url . $nro_boletin);
<?php /* Includes */ include 'engine/genericFTPEngine.php'; include 'adapters/genericProductsAdapter.php'; include 'core/logging.php'; /* turn off the maximum execution time */ ini_set('MAX_EXECUTION_TIME', -1); /* file name construction preamble */ $priceFile = 'pricefile.xml'; $remotePriceFile = $priceFile . '.zip'; $localPriceFile = 'downloads/' . $priceFile; /* instantiate logger */ $logger = new Logging(); $logger->lwrite('Integration Job at ' . date("Ymd") . ' BEGIN'); /* connect and fetch file logic */ $engine = new GenericFTPEngine($logger); $engine->connect(); $engine->fetch($remotePriceFile, null); $xml = $engine->load($localPriceFile); $integration = new GenericProductsAdapter($logger); $integration->process($xml); /* clean up */ $logger->lwrite('Integration Job END'); $logger->lclose();
<?php require "logclass.php"; // Logging class initialization $log = new Logging(); // set path and name of log file (optional) $log->lfile('mylog.txt'); // write message to the log file $log->lwrite('cron executed'); // close log file $log->lclose(); mail("*****@*****.**", "testing cron", date("y-m-d h:i:s"));
function getDataByCoordsRPC(GetDataByCoordsRequest $reqt) { $response = null; $lat; $lon; $art; $umkreis; $sortieren; try { $loc = $reqt->location; $lat = $loc->latitude; $lon = $loc->longitude; $art = $reqt->article; $umkreis = $reqt->distance; $sortieren = $reqt->sortBy; } catch (SoapFault $fault) { return new SoapFault("Server", "Error converting GetDataByCoordsRequest : " . $fault); } if ($log == null) { $log = new Logging(); } $log->lfile('/var/www/web1162/html/tankUp/log_debug.txt'); $log->lwrite("Aufruf getDataByCoord mit Artikel " . $reqt->article . " , Umkreis: " . $reqt->distance . " , Sortieren nach: " . $reqt->sortBy . " , Long: " . $lon . " , Lat: " . $lat . "."); $log->lclose(); $db_id = mysql_connect("localhost", "web1162", "bX2KARTc"); if (!$db_id) { die("Verbindungsaufbau ist gescheitert"); } // mysql_query("use usr_web_1162_3"); $db_sel = mysql_select_db("usr_web1162_3", $db_id); if (!$db_sel) { // close log file $log->lclose(); die('Kann Datenbank nicht benutzen : ' . mysql_error()); } mysql_query("SET names 'utf8'"); mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $db_id); try { $priceRecords = null; $basequery = "select distinct TIME_FORMAT(ot.startTimeOfPeriod,'%H:%i') as ab, TIME_FORMAT(ot.endTimeOfPeriod,'%H:%i') as bis,\n \t\t\t\t\t\t\t\t\t\t\t\t\t(select CASE WHEN CURRENT_TIME BETWEEN ot.startTimeOfPeriod\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ot.endTimeOfPeriod\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tthen 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) as open,\n \t\t\t\t\t\t\t\t\t\t\t\t\t" . $art . " , a.id, a.petrolStationBrand, a.petrolStationStreet, a.petrolStationHouseNumber, a.petrolStationPostcode, a.petrolStationPlace, a.petrolStationVersionTime, a.longitude as AnbietGPSLaenge, a.latitude as AnbietGPSBreite, ACOS( SIN( RADIANS( a.latitude ) ) * SIN( RADIANS( '{$lat}' ) ) + COS( RADIANS( a.latitude ) ) * COS( RADIANS( '{$lat}' ) ) * COS( RADIANS( a.longitude ) - RADIANS( '{$lon}' ) ) ) *6380 AS 'distance'\n\t\t\t\t\t\t\t\t\t\t \n\t \t\t\t\t\t\t\t\t\t\t\t\t\tfrom ( select Max(`version`) as newest \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom `fuelPrice` \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroup by `id` ) plNewest, \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t`fuelPrice` pl, `petrolStation` a, `openingTimes` ot\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere a.latitude > '{$lat}' - 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.latitude < '{$lat}' + 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.longitude > '{$lon}' - 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.longitude < '{$lon}' + 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tand pl.`version` = plNewest.newest\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand a.`id` = pl.`id` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand ot.applicableDay = (SELECT DAYNAME( CURDATE( ) ) )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand ot.fid = a.id\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand " . $art . " > 0 \t\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\thaving distance < '{$umkreis}' "; if (strpos($sortieren, 'preis') !== false) { $priceRecords = mysql_query($basequery . " order by {$art}, distance limit 7"); } else { if (strpos($sortieren, 'distanz') !== false) { $priceRecords = mysql_query($basequery . " order by distance limit 7"); } else { $priceRecords = mysql_query($basequery . " order by distance limit 7"); } } $petrolStationList = array(); if (mysql_num_rows($priceRecords) >= 1) { /* Tankstelle ermitteln */ while ($aktZeile = mysql_fetch_assoc($priceRecords)) { $location = new location($aktZeile['AnbietGPSBreite'], $aktZeile['AnbietGPSLaenge']); $address = new address($aktZeile['petrolStationStreet'], $aktZeile['petrolStationHouseNumber'], $aktZeile['petrolStationPostcode'], $aktZeile['petrolStationPlace']); $petrolStation = new petrolStation($aktZeile['id'], $aktZeile['petrolStationBrand'], $aktZeile['open'], $aktZeile['ab'], $aktZeile['bis'], $location, $aktZeile[$art], $address, $aktZeile['petrolStationVersionTime'], $aktZeile['distance']); array_push($petrolStationList, $petrolStation); } } } catch (SoapFault $fault) { return new SoapFault("Server", "Error reading town by coord. " . $fault); } return new GetDataByCoordsResponse($petrolStationList); }
function getDataByCoord($params) { $lat; $lon; $art; $umkreis; $sortieren; try { $lat = $params->getParam(0)->scalarval(); $lon = $params->getParam(1)->scalarval(); $art = $params->getParam(2)->scalarval(); $umkreis = $params->getParam(3)->scalarval(); $sortieren = $params->getParam(4)->scalarval(); } catch (Exception $fault) { return new Exception("Server", "Error converting params getDataByCoords : " . $fault); } if ($log == null) { $log = new Logging(); } $log->lfile('log_info.txt'); $log->lwrite("Aufruf getDataByCoord mit Artikel " . $art . " , Umkreis: " . $umkreis . " , Sortieren nach: " . $sortieren . " , Long: " . $lon . " , Lat: " . $lat . "."); $log->lclose(); $db_id = mysql_connect("localhost", "web1162", "bX2KARTc"); if (!$db_id) { die("Verbindungsaufbau ist gescheitert"); } $db_sel = mysql_select_db("usr_web1162_3", $db_id); if (!$db_sel) { die('Kann Datenbank nicht benutzen : ' . mysql_error()); } mysql_query("SET names 'utf8'"); mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $db_id); try { $priceRecords = null; $basequery = "select distinct TIME_FORMAT(ot.startTimeOfPeriod,'%H:%i') as ab, TIME_FORMAT(ot.endTimeOfPeriod,'%H:%i') as bis,\n \t\t\t\t\t\t\t\t\t\t\t\t\t(select CASE WHEN CURRENT_TIME BETWEEN ot.startTimeOfPeriod\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ot.endTimeOfPeriod\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tthen 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) as open,\n \t\t\t\t\t\t\t\t\t\t\t\t\t" . $art . " , a.id, a.petrolStationBrand, a.petrolStationStreet, a.petrolStationHouseNumber, a.petrolStationPostcode, a.petrolStationPlace, a.petrolStationVersionTime, a.longitude as AnbietGPSLaenge, a.latitude as AnbietGPSBreite, ACOS( SIN( RADIANS( a.latitude ) ) * SIN( RADIANS( '{$lat}' ) ) + COS( RADIANS( a.latitude ) ) * COS( RADIANS( '{$lat}' ) ) * COS( RADIANS( a.longitude ) - RADIANS( '{$lon}' ) ) ) *6380 AS 'distance'\n\t\t\t\t\t\t\t\t\t\t \n\t \t\t\t\t\t\t\t\t\t\t\t\t\tfrom ( select Max(`version`) as newest \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom `fuelPrice` \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroup by `id` ) plNewest, \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t`fuelPrice` pl, `petrolStation` a, `openingTimes` ot\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere a.latitude > '{$lat}' - 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.latitude < '{$lat}' + 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.longitude > '{$lon}' - 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.longitude < '{$lon}' + 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tand pl.`version` = plNewest.newest\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand a.`id` = pl.`id` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand ot.applicableDay = (SELECT DAYNAME( CURDATE( ) ) )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand ot.fid = a.id\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand " . $art . " > 0 \t\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\thaving distance < '{$umkreis}' "; if (strpos($sortieren, 'preis') !== false) { $priceRecords = mysql_query($basequery . " order by {$art}, distance limit 7"); } else { if (strpos($sortieren, 'distanz') !== false) { $priceRecords = mysql_query($basequery . " order by distance limit 7"); } } if (mysql_num_rows($priceRecords) >= 1) { $petrolStationList = array(); /* Tankstelle ermitteln */ while ($aktZeile = mysql_fetch_assoc($priceRecords)) { $location = new location($aktZeile['AnbietGPSBreite'], $aktZeile['AnbietGPSLaenge']); $address = new address($aktZeile['petrolStationStreet'], $aktZeile['petrolStationHouseNumber'], $aktZeile['petrolStationPostcode'], $aktZeile['petrolStationPlace']); $petrolStation = new petrolStation($aktZeile['id'], $aktZeile['petrolStationBrand'], $aktZeile['open'], $aktZeile['ab'], $aktZeile['bis'], $location, $aktZeile[$art], $address, $aktZeile['petrolStationVersionTime'], $aktZeile['distance']); array_push($petrolStationList, $petrolStation); } } else { echo "Keine Ergebnisse"; } } catch (SoapFault $fault) { return new SoapFault("Server", "Error reading town by coord. " . $fault); } $petrolStationArray = array(); // $petrolStationList.count $count = 0; $resp = new jsonrpcresp(new jsonrpcval("no data", 'string')); if ($petrolStationList != null) { foreach ($petrolStationList as $station) { $petrolStation = array('owner' => new jsonrpcval(umlaute_ersetzen($station->owner), 'string'), 'isOpen' => new jsonrpcval($station->isOpen, 'boolean'), 'openFrom' => new jsonrpcval($station->openFrom . "", 'string'), 'openTo' => new jsonrpcval($station->openTo . "", 'string'), 'longitude' => new jsonrpcval($station->location->longitude, 'double'), 'latitude' => new jsonrpcval($station->location->latitude, 'double'), 'price' => new jsonrpcval($station->price, 'string'), 'street' => new jsonrpcval(umlaute_ersetzen($station->address->street), 'string'), 'housenumber' => new jsonrpcval($station->address->housenumber, 'string'), 'postal' => new jsonrpcval($station->address->postal, 'string'), 'place' => new jsonrpcval(umlaute_ersetzen($station->address->place), 'string'), 'reporttime' => new jsonrpcval($station->reporttime . "", 'string'), 'distance' => new jsonrpcval($station->distance, 'double'), 'id' => new jsonrpcval($station->id, 'double')); array_push($petrolStationArray, new jsonrpcval($petrolStation, 'struct')); $count += 1; } $resp = new jsonrpcresp(new jsonrpcval($petrolStationArray, 'struct')); $resp->content_type = "text/json; charset=iso-8859-1"; //$resp->serialize('UTF-8'); } return $resp; }
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // You should have received a copy of the GNU General Public License // along with LamPI. If not, see <http://www.gnu.org/licenses/>. // // $log = new Logging(); $logfile = '/home/pi/log/EnerPI.log'; $log->lfile($logfile); $log->lwrite("Starting energy.php script. __ROOT__ is " . __ROOT__); $apperr = ""; // Global Error. Just append something and it will be sent back $appmsg = ""; // Application Message (returned from backend to Client) $graphAction = ""; // Must be "graph" only initially $graphType = ""; // T emperature, H umidity, P airPressure $graphPeriod = ""; // 1d 1w 1m 1y $graphSensors = array(); // List of sensor values we like to graph // ---------------------------------------------------------------------------- // MAKE GRAPH // Ajax function for generating a graph .png file
private function GetTownByCoords(location $loc) { $town = null; // TODO Fehler $db_id = mysql_connect("localhost", "web1162", "bX2KARTc"); if (!$db_id) { die("Verbindungsaufbau ist gescheitert"); } try { $arg2 = $loc->latitude; $arg1 = $loc->longitude; $log = new Logging(); $log->lfile('/var/www/web1162/html/tankUp/log_debug.txt'); $log->lwrite("FuelApi_v2: " . $arg2); $log->lclose(); } catch (Exception $ex) { return new Exception("Server", "Error converting location : " . $ex); } // mysql_query("use usr_web_1162_4"); $db_sel = mysql_select_db("usr_web1162_4", $db_id); if (!$db_sel) { die('Kann Datenbank nicht benutzen : ' . mysql_error()); } mysql_query("SET names 'utf8'"); mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $db_id); $locRecords = mysql_query("SELECT data.loc_id as id, data.text_val as ort, ACOS( SIN( RADIANS( src.lat ) ) * SIN( RADIANS( '{$arg2}' ) ) + COS( RADIANS( src.lat ) ) * COS( RADIANS( '{$arg2}' ) ) * COS( RADIANS( src.lon ) - RADIANS( '{$arg1}' ) ) ) *6380 AS distance\n\t\t\t\t\t\t\t\t\t\t\t FROM geodb_coordinates src, geodb_textdata data\n\t\t\t\t\t\t\t\t\t\t\t WHERE src.lat > '{$arg2}' - 0.4\n\t\t\t\t\t\t\t\t\t\t\t AND src.lat < '{$arg2}' + 0.4\n\t\t\t\t\t\t\t\t\t\t\t AND src.lon > '{$arg1}' - 0.4\n\t\t\t\t\t\t\t\t\t\t\t AND src.lon < '{$arg1}' + 0.4\n\t\t\t\t\t\t\t\t\t\t\t AND data.loc_id = src.loc_id\n\t\t\t\t\t\t\t\t\t\t\t AND data.text_type = 500100000\n\t\t\t\t\t\t\t\t\t\t\t HAVING distance <5\n\t\t\t\t\t\t\t\t\t\t\t ORDER BY distance asc\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 1"); if (mysql_num_rows($locRecords) >= 1) { while ($aktZeile = mysql_fetch_assoc($locRecords)) { $town = $aktZeile['ort']; break; } } return $town; }
<?php $currency = @$_GET['currency'] ? htmlspecialchars($_GET['currency']) : 'usd'; include_once "./config-{$currency}.php"; include_once './functions.php'; include_once './bitfinex.php'; include_once './logging.php'; // Logging class initialization $log = new Logging(); // set path and name of log file (optional) // $log->lfile('./output.log'); // write message to the log file $log->lwrite('Startup--------------------------'); $bfx = new Bitfinex($config['api_key'], $config['api_secret']); //var_dump( $bfx); // // Get list of offers // $log->lwrite('Getting offers'); $current_offers = $bfx->get_offers(); var_dump($current_offers); // Something is wrong most likely API key if (array_key_exists('message', $current_offers)) { die($current_offers['message']); } // Remove offers that weren't executed for too long $log->lwrite('Checking for offers older than ' . $config['remove_after'] . ' mins'); foreach ($current_offers as $item) { $id = $item['id']; $timestamp = (int) $item['timestamp']; $current_timestamp = time();