ordersprinter/webapp/php/debug.php

56 lines
1.2 KiB
PHP
Raw Normal View History

2020-11-19 23:03:51 +01:00
<?php
// forward of message to server
require_once ('dbutils.php');
if (isset($_POST["cmd"])) {
// error message as it was sent from client
$cmd = $_POST["cmd"];
$fct = $_POST["fct"];
$xhr = $_POST["xhr"];
$errormsg = $_POST["errormsg"];
$status = $_POST["status"];
2020-11-19 23:03:59 +01:00
$phpversion = phpversion();
2020-11-19 23:03:51 +01:00
if (strlen($cmd) > 150) {
$cmd = substr($cmd, 0,149);
}
2020-11-19 23:10:09 +01:00
if (strlen($xhr) > 900) {
$xhr = substr($xhr, 0,899);
2020-11-19 23:03:51 +01:00
}
if (strlen($fct) > 100) {
$fct = substr($fct, 0,99);
}
if (strlen($errormsg) > 150) {
$errormsg = substr($errormsg, 0,149);
}
if (strlen($status) > 150) {
$status = substr($status, 0,149);
}
2020-11-19 23:14:51 +01:00
$version = "2.0.1";
2020-11-19 23:03:51 +01:00
2020-11-19 23:03:59 +01:00
$arr = array("cmd" => $cmd,"fct" => $fct, "xhr" => $xhr,"errormsg" => $errormsg,"status" => $status,"version" => $version,"phpversion" => $phpversion);
2020-11-19 23:03:51 +01:00
} else {
return;
}
$url = "http://www.ordersprinter.de/debug/save.php?cmd=save";
$query = http_build_query($arr);
$opts = array(
'http'=>array(
'header' => "Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: ".strlen($query)."\r\n".
"User-Agent:MyAgent/1.0\r\n",
'method' => 'POST',
'content' => $query
)
);
$context = stream_context_create($opts);
$ret = file_get_contents($url, false, $context);
echo $ret;