diff --git a/create_table.php b/create_table.php index ae57f4c..5b68a6a 100644 --- a/create_table.php +++ b/create_table.php @@ -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," . diff --git a/signin.php b/signin.php index 0c50ca2..8304bde 100644 --- a/signin.php +++ b/signin.php @@ -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"); ?>