0
0
mirror of https://github.com/Doodle3D/doodle3d-connect.git synced 2024-06-29 10:21:21 +02:00

Use localip in database index, changed order so old signins are removed

This commit is contained in:
peteruithoven 2013-10-02 14:40:11 +02:00
parent c0ed48b359
commit 28108b2004
2 changed files with 11 additions and 10 deletions

View File

@ -5,7 +5,7 @@
try {
// exported structure using phpMyAdmin
$createsql = $db->prepare("CREATE TABLE IF NOT EXISTS $table (" .
"`id` varchar(151) NOT NULL," .
"`id` varchar(31) NOT NULL," .
"`remoteip` varchar(15) NOT NULL," .
"`localip` varchar(15) NOT NULL," .
"`wifiboxid` varchar(140) NOT NULL," .

View File

@ -27,7 +27,7 @@
$timestamp = time();
$id = $remoteip.'/'.$wifiboxid;
$id = $remoteip.'/'.$localip; //TODO: column length: 31
try {
$statement = $db->prepare( "REPLACE INTO $table " .
@ -47,14 +47,6 @@
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
$hourago = time() - 60*60;
try {
@ -65,4 +57,13 @@
"msg" => $e->getMessage()." (".$e->getCode().")");
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");
?>