mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-25 01:53:48 +01:00
Fixed json responses making signin work from firmware lua
This commit is contained in:
parent
f5a09e7c0f
commit
5d5283c254
@ -12,6 +12,6 @@
|
|||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$response = array( "status" => "error",
|
$response = array( "status" => "error",
|
||||||
"msg" => $e->getMessage()." (".$e->getCode().")");
|
"msg" => $e->getMessage()." (".$e->getCode().")");
|
||||||
exit(json_encode($response));
|
exit(json_encode($response)."\r\n");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
4
list.php
4
list.php
@ -12,10 +12,10 @@
|
|||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$response = array( "status" => "error",
|
$response = array( "status" => "error",
|
||||||
"msg" => $e->getMessage()." (".$e->getCode().")");
|
"msg" => $e->getMessage()." (".$e->getCode().")");
|
||||||
exit(json_encode($response));
|
exit(json_encode($response)."\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = array( "status" => "success",
|
$response = array( "status" => "success",
|
||||||
"data" => $boxes);
|
"data" => $boxes);
|
||||||
exit(json_encode($response));
|
exit(json_encode($response)."\r\n");
|
||||||
?>
|
?>
|
31
signin.php
31
signin.php
@ -1,18 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*if ($_SERVER['REQUEST_METHOD'] != "POST") {
|
||||||
if ($_SERVER['REQUEST_METHOD'] != "POST") {
|
|
||||||
$response = array( "status" => "error",
|
$response = array( "status" => "error",
|
||||||
"msg" => "'signin' can only be accessed with the POST method");
|
"msg" => "'signin' can only be accessed with the POST method");
|
||||||
exit(json_encode($response));
|
|
||||||
}
|
|
||||||
|
exit(json_encode($response)."\r\n");
|
||||||
|
}*/
|
||||||
|
|
||||||
require 'connect.php';
|
require 'connect.php';
|
||||||
|
|
||||||
if(!isset($_POST['localip'])) echo "missing localip </br>";
|
if(!isset($_GET['localip'])) {
|
||||||
$localip = $_POST['localip'];
|
$response = array( "status" => "error",
|
||||||
|
"msg" => "missing localip");
|
||||||
|
exit(json_encode($response)."\r\n");
|
||||||
|
}
|
||||||
|
$localip = $_GET['localip'];
|
||||||
|
|
||||||
if(!isset($_POST['wifiboxid'])) echo "missing wifiboxid </br>";
|
if(!isset($_GET['wifiboxid'])) {
|
||||||
$wifiboxid = $_POST['wifiboxid'];
|
$response = array( "status" => "error",
|
||||||
|
"msg" => "missing wifiboxid");
|
||||||
|
exit(json_encode($response)."\r\n");
|
||||||
|
}
|
||||||
|
$wifiboxid = $_GET['wifiboxid'];
|
||||||
|
|
||||||
$remoteip = getenv('REMOTE_ADDR');
|
$remoteip = getenv('REMOTE_ADDR');
|
||||||
|
|
||||||
@ -35,7 +44,7 @@
|
|||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$response = array( "status" => "error",
|
$response = array( "status" => "error",
|
||||||
"msg" => $e->getMessage()." (".$e->getCode().")");
|
"msg" => $e->getMessage()." (".$e->getCode().")");
|
||||||
exit(json_encode($response));
|
exit(json_encode($response)."\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$responseData = array( "remoteip" => $remoteip,
|
$responseData = array( "remoteip" => $remoteip,
|
||||||
@ -44,7 +53,7 @@
|
|||||||
"timestamp" => $timestamp);
|
"timestamp" => $timestamp);
|
||||||
$response = array( "status" => "success",
|
$response = array( "status" => "success",
|
||||||
"data" => $responseData);
|
"data" => $responseData);
|
||||||
exit(json_encode($response));
|
exit(json_encode($response)."\r\n");
|
||||||
|
|
||||||
// Remove old signins
|
// Remove old signins
|
||||||
$hourago = time() - 60*60;
|
$hourago = time() - 60*60;
|
||||||
@ -54,6 +63,6 @@
|
|||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$response = array( "status" => "error",
|
$response = array( "status" => "error",
|
||||||
"msg" => $e->getMessage()." (".$e->getCode().")");
|
"msg" => $e->getMessage()." (".$e->getCode().")");
|
||||||
exit(json_encode($response));
|
exit(json_encode($response)."\r\n");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user