Browse Source

changed server-side sync implementation

Mihai Plasoianu 8 years ago
parent
commit
b7d4ca35ed
2 changed files with 4 additions and 3 deletions
  1. 3 2
      phpsync/pull.php
  2. 1 1
      phpsync/push.php

+ 3 - 2
phpsync/pull.php

@@ -1,6 +1,5 @@
 <?php
 $bssid = $_POST ["bssid"];
-$timestamp = $_POST ["timestamp"];
 
 $username = "hostage";
 $password = "hostageDB";
@@ -8,7 +7,9 @@ $hostname = "localhost";
 
 $dbhandle = mysql_connect ( $hostname, $username, $password ) or die ( "Unable to connect to MySQL" );
 
-$result = mysql_query ( "SELECT * FROM `hostage`.`sync` WHERE `bssid` = " . $bssid . " AND `timestamp` > " . $timestamp );
+$query = "SELECT * FROM `hostage`.`sync` WHERE `bssid` = '" . $bssid . "'";
+
+$result = mysql_query ( $query );
 
 if (! $result) {
 	die ( 'Could not select record: ' . mysql_error () );

+ 1 - 1
phpsync/push.php

@@ -19,7 +19,7 @@ $hostname = "localhost";
 
 $dbhandle = mysql_connect ( $hostname, $username, $password ) or die ( "Unable to connect to MySQL" );
 
-$result = mysql_query ( "INSERT INTO `hostage`.`sync` (`bssid`, `ssid`, `longitude`, `latitude`, `timestamp`, `attacks`, `portscans`) VALUES " . $values );
+$result = mysql_query ( "INSERT INTO `hostage`.`sync` (`bssid`, `ssid`, `latitude`, `longitude`, `timestamp`, `attacks`, `portscans`) VALUES " . $values );
 
 if (! $result) {
 	die ( 'Could not insert record: ' . mysql_error () );