Skip to content

Commit

Permalink
Fixed bug relating to data sanitising
Browse files Browse the repository at this point in the history
I’m a fool and forgot sanitisation of floats, by default, removes the
decimal point
  • Loading branch information
PatrickOBoyle committed Feb 28, 2016
1 parent 8277d1a commit 46efdeb
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions getData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
);

// set variables from POST data
// input validation coming soon(TM)
$lat = $_POST['lat'];
$lat = filter_var($lat, FILTER_SANITIZE_NUMBER_FLOAT);

$long = $_POST['long'];
$long = filter_var($long, FILTER_SANITIZE_NUMBER_FLOAT);
$lat = filter_input(INPUT_POST, 'lat', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$long = filter_input(INPUT_POST, 'long', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);

$radius = $_POST['radius'];
$radius = filter_var($radius, FILTER_SANITIZE_NUMBER_INT);
Expand All @@ -46,7 +42,7 @@
->performRequest();

}else{
echo "No user input provided.";
echo "\n\n\n<br><br>No user input provided.";
}
?>

Expand Down Expand Up @@ -77,6 +73,8 @@
var data = (<?php echo $response ?>).statuses;
var top10 = data.sort(function(a, b) { return a.favorite_count < b.favorite_count ? 1 : -1; }).slice(0, 10);

console.log(top10);

$.each(top10, function(data, tweet){
var profile = "https://twitter.com/" + tweet.user.screen_name + "/status/" + tweet.id_str;

Expand Down

0 comments on commit 46efdeb

Please sign in to comment.