As a learning exercise I'm looking to use CGI to password protect my web pages. Once I ahve got a user to logon properly I'm wondering how I should go about authenticating them for each page they visit?
That is to say does each possible web page they can go to [and indeed others they might hazard a guess at the name of] need to have a validation that their IP is in fact logged-on or does this authentication work on their IP having access to the firectory where all the web pages are. If this is the case how can one ensure this. I mean how wouuld a program give access to a directory on an IP by IP address?

Any help on this subject would be appreciated.

Thanks
Ian t

Recommended Answers

All 3 Replies

Don't bother. IPs are not necessarily unique to one machine.

Use sessions and cookies for login, they're browser on the machine specific.

Is this difficult to do from a C program? Do you know of any examples I can learn from?
Thanks for the info.

I've never used compiled CGI, so I can't say. Surely there's libraries you can use/install to handle sessions and cookies.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.