I've done this in the past with Windows task scheduler and a php+mysqllite script.
The php+mysqllite script just checked to see if it could reach google, if it got redirected, it checked to see if it had a routine for the domain it got redirected to, if so, it ran it. The mysqllite was to keep the cookies for the headless browser I implemented in php. It would probably be a lot less work to just use a greasemonkey equivalent to do the log-in. (with the down side being the browser would pop up and do things every time your scheduler gets tripped.)
The task scheduler trigger will vary from machine to machine. I had one laptop that would log wifi connections as events and they included the ssid so I could filter to only trigger on the ones I cared about.
On my current laptop, it seems the only event that reliably gets fired is the DHCP client connect. Of course, this fries every time I get an IP address and doesn't tell me an SSID.
You can check what events are available for you to trigger off of with the windows event viewer. I just turned on and off my wifi 3 times and checked what events were triggered 3 times in the last hour.
@JessRiedel I've posted a new answer that works now and includes a link to a complete guide.
– Menasheh – 2016-11-28T20:19:16.163Has anyone released a program to solve this problem in the intervening two years? There exist reasonable solutions for Android (https://play.google.com/store/apps/details?id=co.uk.syslynx.wifiwebloginapp&hl=en) and iOS).
– Jess Riedel – 2014-04-24T19:35:52.787Also, Meta: how do I draw attention to this question? I can't ask my own version since it would be a duplicate, but the answer here is completely out of date and I would like fresh eyes to take a look. – Jess Riedel – 2014-04-24T19:36:52.237