I have connected to wire less . Then When I try to open any page "ex:http://www.google.com" , It redirects to another page for authentication to enter userName and password . if the data valid , it connected to internet

I want to implement an application that when the user try to open any page "ex:http://www.google.com" , it redirects to my custom page to enter some data . if the data is valid , it connected to the internet .

How Can I Implement that?