Skip to content

Referer spammers: New scourge of the web

When someone creates a link to a webpage you have, and someone clicks on that link, the standard browsers include code that carries over information that tells you what server "referred" you. This information shows up in your standard webserver log, and can also be grabbed by cgi and serverside scripts. For example in PHP that information can be gotten using the $_SERVER superglobal array:


echo $_SERVER['HTTP_REFERER'];
 


As an aside, yes they did spell that REFERER, and I assume that the history of that misspelling goes back to the folks who created the CGI-BIN API.

The referrer comes in as part of the http header sent by the browser with its request, and it has always been possible to suppress or change the referer information, so most folks consider "referer" information as a useful indication of sites that have linked to you, but nothing you can depend on.

Lately, there seem to be more and more unscrupolous people marketing software to others which does nothing but waste bandwidth hitting long lists of sites and generating referrer entries in your web logs. Their reasoning is that you will check your logs (and every website reporting package includes information about the refers you get) and very possibly click on them to see how you're being linked, or what their site is about. Continue reading "Referer spammers: New scourge of the web"

Exploring Mysql CURDATE and NOW. The same but different.

Sometimes I see people attempting to use VARCHARS or CHARS to store dates in their MySQL database application. This is really fighting against MySQL, which has a variety of interchangeable date types. Internally MySQL is storing dates as numbers, which allows it to do all sorts of nice arithmetic and comparisons with very little effort on your part. For example, when you use a mysql DATE column to store a date, you don't have to worry about sortation, or comparing that date to another DATE, because MySQL already understands how to do those things internally. A lot of people also don't realize that they can output a DATE column in just about any way they choose using the DATE_FORMAT function. This causes people to shy away from using DATE, DATETIME, TIME, or TIMESTAMP columns, when they really should.

Continue reading "Exploring Mysql CURDATE and NOW. The same but different."