mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-25 10:03:48 +01:00
Use localip in database index, changed order so old signins are removed
This commit is contained in:
parent
c0ed48b359
commit
28108b2004
@ -5,7 +5,7 @@
|
|||||||
try {
|
try {
|
||||||
// exported structure using phpMyAdmin
|
// exported structure using phpMyAdmin
|
||||||
$createsql = $db->prepare("CREATE TABLE IF NOT EXISTS $table (" .
|
$createsql = $db->prepare("CREATE TABLE IF NOT EXISTS $table (" .
|
||||||
"`id` varchar(151) NOT NULL," .
|
"`id` varchar(31) NOT NULL," .
|
||||||
"`remoteip` varchar(15) NOT NULL," .
|
"`remoteip` varchar(15) NOT NULL," .
|
||||||
"`localip` varchar(15) NOT NULL," .
|
"`localip` varchar(15) NOT NULL," .
|
||||||
"`wifiboxid` varchar(140) NOT NULL," .
|
"`wifiboxid` varchar(140) NOT NULL," .
|
||||||
|
19
signin.php
19
signin.php
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
$timestamp = time();
|
$timestamp = time();
|
||||||
|
|
||||||
$id = $remoteip.'/'.$wifiboxid;
|
$id = $remoteip.'/'.$localip; //TODO: column length: 31
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$statement = $db->prepare( "REPLACE INTO $table " .
|
$statement = $db->prepare( "REPLACE INTO $table " .
|
||||||
@ -47,14 +47,6 @@
|
|||||||
exit(json_encode($response)."\r\n");
|
exit(json_encode($response)."\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$responseData = array( "remoteip" => $remoteip,
|
|
||||||
"localip" => $localip,
|
|
||||||
"wifiboxid" => $wifiboxid,
|
|
||||||
"timestamp" => $timestamp);
|
|
||||||
$response = array( "status" => "success",
|
|
||||||
"data" => $responseData);
|
|
||||||
exit(json_encode($response)."\r\n");
|
|
||||||
|
|
||||||
// Remove old signins
|
// Remove old signins
|
||||||
$hourago = time() - 60*60;
|
$hourago = time() - 60*60;
|
||||||
try {
|
try {
|
||||||
@ -65,4 +57,13 @@
|
|||||||
"msg" => $e->getMessage()." (".$e->getCode().")");
|
"msg" => $e->getMessage()." (".$e->getCode().")");
|
||||||
exit(json_encode($response)."\r\n");
|
exit(json_encode($response)."\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$responseData = array( "remoteip" => $remoteip,
|
||||||
|
"localip" => $localip,
|
||||||
|
"wifiboxid" => $wifiboxid,
|
||||||
|
"timestamp" => $timestamp);
|
||||||
|
$response = array( "status" => "success",
|
||||||
|
"data" => $responseData);
|
||||||
|
exit(json_encode($response)."\r\n");
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user