Wireless restrictions same to hotels

I do have a linux router with a wireless NIC installed and serving wireless using hostapd. I want to restrict access similar to the way hotels do it in that you cannot get anywhere until you put in a PIN on a webpage. Web traffic would get redirected to this webpage with a place to put in a PIN and this would grant you access for N hours. How can this be done?

<snip/>