Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
How do auction sites get nearby postcodes?, For instance: 50km of X
mb0742
post May 26 2012, 11:46 AM
Post #1
Quark
Initiate




Hey ATMPC,

Looking for a solution for a web based project. Basically like every auction website ever; I want to track down local areas for the customers. Ie. post code is 3000 and user sets searchable distance to 50KM.

Cheers guys

This post has been edited by mb0742: May 26 2012, 11:46 AM


--------------------
Things that annoy me:
>Current size of Cat
>Useless complexity in Tail
>That feeling when you have laid over 600lines of code but then got tired of the project.
Go to the top of the page
 
+Quote Post
SledgY
post May 26 2012, 06:26 PM
Post #2
Atomican
Master




Usually have a list of lat/lng coordinates of the centre of each postcode.

Here is an example listing: http://blog.datalicious.com/free-download-...ostcodes-geocod


--------------------
poweredbypenguins.org - SledgY lives in the cloud...
Go to the top of the page
 
+Quote Post
mb0742
post May 26 2012, 11:50 PM
Post #3
Quark
Initiate




QUOTE (SledgY @ May 26 2012, 06:26 PM) *
Usually have a list of lat/lng coordinates of the centre of each postcode.

Here is an example listing: http://blog.datalicious.com/free-download-...ostcodes-geocod


The BSPno. works like a champ as long as you query ± 1. But then do I have to break out the heavy calculations for each resulting suburb long and lat?

EDIT: Fantastic guide here https://www.dougv.com/2009/03/27/getting-al...-php-and-mysql/

This post has been edited by mb0742: May 27 2012, 02:36 PM
Go to the top of the page
 
+Quote Post
SledgY
post May 30 2012, 02:17 PM
Post #4
Atomican
Master




QUOTE (mb0742 @ May 26 2012, 11:50 PM) *
QUOTE (SledgY @ May 26 2012, 06:26 PM) *
Usually have a list of lat/lng coordinates of the centre of each postcode.

Here is an example listing: http://blog.datalicious.com/free-download-...ostcodes-geocod


The BSPno. works like a champ as long as you query ± 1. But then do I have to break out the heavy calculations for each resulting suburb long and lat?

EDIT: Fantastic guide here https://www.dougv.com/2009/03/27/getting-al...-php-and-mysql/


This linked example is implementing the correct way get surrounding postcodes (limiting to a square to query data and then filtering down the more complex calculation on the resulting set), it also includes an example that you should never use in a production system.

ANY developer who generates SQL expressions by concatenating strings (especially from a POST or GET dictionary) is an incompetent fool, always use parametrised queries. In this case it may seem safe, they do some simple validation first but what happens when somebody refractors this code and misses a validation step? You now have a SQL injection vulnerability and the dishonour of getting yourself the #1 badge from the OWASP top 10.

/end rant


--------------------
poweredbypenguins.org - SledgY lives in the cloud...
Go to the top of the page
 
+Quote Post
Zzozzach
post May 31 2012, 08:16 PM
Post #5
Atomican
Overlord




QUOTE (SledgY @ May 30 2012, 03:17 PM) *
ANY developer who generates SQL expressions by concatenating strings (especially from a POST or GET dictionary) is an incompetent fool, always use parametrised queries. In this case it may seem safe, they do some simple validation first but what happens when somebody refractors this code and misses a validation step? You now have a SQL injection vulnerability and the dishonour of getting yourself the #1 badge from the OWASP top 10.

/end rant

Ahem....for a site that is supposedly an 'authority' on web security you'd think they'd at least be able to avoid a simple mistake such as ensuring their server's certificate matches the hostname. My browser just popped up a window warning me that the server's hostname is owasp.com but the certificate is only valid for owasp.org or *.owasp.org. Blindly accepting the certificate will set you up for a redirection or man-in-the-middle attack.


--------------------
The poster formerly known as Chazzozz.
*
Still an enthusiastic Opera user. Try it, you'll like it: http://www.opera.com/download/
*
I love torrenting MAME and Pinball emulators. One day I may even use the software.
Go to the top of the page
 
+Quote Post
SledgY
post Jun 1 2012, 12:12 PM
Post #6
Atomican
Master




QUOTE (Zzozzach @ May 31 2012, 08:16 PM) *
QUOTE (SledgY @ May 30 2012, 03:17 PM) *
ANY developer who generates SQL expressions by concatenating strings (especially from a POST or GET dictionary) is an incompetent fool, always use parametrised queries. In this case it may seem safe, they do some simple validation first but what happens when somebody refractors this code and misses a validation step? You now have a SQL injection vulnerability and the dishonour of getting yourself the #1 badge from the OWASP top 10.

/end rant

Ahem....for a site that is supposedly an 'authority' on web security you'd think they'd at least be able to avoid a simple mistake such as ensuring their server's certificate matches the hostname. My browser just popped up a window warning me that the server's hostname is owasp.com but the certificate is only valid for owasp.org or *.owasp.org. Blindly accepting the certificate will set you up for a redirection or man-in-the-middle attack.

The link is to owasp.org...

Either way, that would be a #9 on the top 10 the difference being:

#1 is Easily exploitable, not that easy to detect (aside from extensive code reviews and security testing) and has a severe impact rating
vs
#9 that is difficult to exploit, easy to detect and has only a moderate impact rating (especially for a site that does not collect any personal information)

I might also add that #1 is trivial to avoid in any web application framework. ORM and parametrised queries are commonplace and effectively mitigate this risk for databases.

This post has been edited by SledgY: Jun 1 2012, 12:24 PM


--------------------
poweredbypenguins.org - SledgY lives in the cloud...
Go to the top of the page
 
+Quote Post
mb0742
post Jun 1 2012, 10:18 PM
Post #7
Quark
Initiate




QUOTE (SledgY @ May 30 2012, 02:17 PM) *
QUOTE (mb0742 @ May 26 2012, 11:50 PM) *
QUOTE (SledgY @ May 26 2012, 06:26 PM) *
Usually have a list of lat/lng coordinates of the centre of each postcode.

Here is an example listing: http://blog.datalicious.com/free-download-...ostcodes-geocod


The BSPno. works like a champ as long as you query ± 1. But then do I have to break out the heavy calculations for each resulting suburb long and lat?

EDIT: Fantastic guide here https://www.dougv.com/2009/03/27/getting-al...-php-and-mysql/


This linked example is implementing the correct way get surrounding postcodes (limiting to a square to query data and then filtering down the more complex calculation on the resulting set), it also includes an example that you should never use in a production system.

ANY developer who generates SQL expressions by concatenating strings (especially from a POST or GET dictionary) is an incompetent fool, always use parametrised queries. In this case it may seem safe, they do some simple validation first but what happens when somebody refractors this code and misses a validation step? You now have a SQL injection vulnerability and the dishonour of getting yourself the #1 badge from the OWASP top 10.

/end rant


Well to be fair the post wasn't written for the tech illiterate. If you were writing an example would you include a large amount of variable checking?


--------------------
Things that annoy me:
>Current size of Cat
>Useless complexity in Tail
>That feeling when you have laid over 600lines of code but then got tired of the project.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 23rd May 2013 - 12:38 PM