summaryrefslogtreecommitdiffstats
path: root/modules-available/remoteaccess/api.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/remoteaccess/api.inc.php')
-rw-r--r--modules-available/remoteaccess/api.inc.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules-available/remoteaccess/api.inc.php b/modules-available/remoteaccess/api.inc.php
index 859f5cfe..ec5fe7ad 100644
--- a/modules-available/remoteaccess/api.inc.php
+++ b/modules-available/remoteaccess/api.inc.php
@@ -5,7 +5,10 @@ if (substr($ip, 0, 7) === '::ffff:') $ip = substr($ip, 7);
$password = Request::post('password', false, 'string');
if ($password !== false) {
- $c = Database::queryFirst("SELECT machineuuid FROM machine WHERE clientip = :ip", ['ip' => $ip]);
+ $c = Database::queryFirst("SELECT machineuuid FROM machine
+ WHERE clientip = :ip
+ ORDER BY lastseen DESC
+ LIMIT 1", ['ip' => $ip]);
if ($c !== false) {
$vncport = Request::post('vncport', 5900, 'int');
Database::exec("INSERT INTO remoteaccess_machine (machineuuid, password, vncport)