diff --git a/connect.php b/connect.php index cea46e1..292e8a6 100644 --- a/connect.php +++ b/connect.php @@ -6,7 +6,12 @@ $password = "mysql"; $table = "signins"; - $db = new PDO($dsn, $username, $password); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - + try { + $db = new PDO($dsn, $username, $password); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } catch (PDOException $e) { + $response = array( "status" => "error", + "msg" => $e->getMessage()." (".$e->getCode().")"); + exit(json_encode($response)); + } ?> diff --git a/index.php b/index.html similarity index 60% rename from index.php rename to index.html index ac78db3..0c9c2fc 100644 --- a/index.php +++ b/index.html @@ -1,15 +1,3 @@ -prepare("SELECT * FROM $table where date >= FROM_UNIXTIME(:hourago) AND remoteip = :remoteip"); - $statement->execute(array( ':hourago' => $hourago, - ':remoteip' => $remoteip)); - $boxes = $statement->fetchAll(); -?> @@ -24,15 +12,13 @@ + + +

Hi, we found the following Doodle3D WiFi boxes near you:

-