Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can CGI prog activate a pre-built web page 1

Status
Not open for further replies.

turnbui

Programmer
Jul 23, 2005
60
GB
Hello everyone,
I'm sorry to be a pain AND a newbie but rather than create a webpage from the CGI program [dynamic content - as I understand it the reason for CGI] could the program just return a pre-built page. e.g. if the IP of the client HAS previously logged in then the CGI could check his log-in status and if OK point them to a page?

Hmmm! I think I might be missing something here???

Thanks
Ian t
 
While the content may be static, what you are doing is still dynamic because it's event driven. Yes, a cgi script could check some type of a status, a login status if you will, and then do something based on the status.

The simplest script would check if a user is logged in and allow them access to the site/content if they are, and redirect to a login screen if they are not.

- Kevin, perl coder unexceptional!
 
Thanks for your speedy reply. Being new to this area may I ask how to accomplish this. i.e. what would the CGI do to send the client to another page?
cheers
 
There are a few ways to redirect users, the simplest being a meta refresh tag.

Code:
<meta http-equiv="refresh" content="2;url=http://www.example.com">


But this does not restrict access, only redirects the user to another site/page.

If you need to restrict access you really need to use some type of authentication, generally a username and a password.

- Kevin, perl coder unexceptional!
 
turnbui and Kevin

if I understand the question correctly

(I often get confused)

I have a script I downloaded from some free script archive

That allows storage on my site but it makes a pre-set index page for each user

And checks the ip of user to the logged ip but it has a setting to turn this off. Now in my use I did for some people are still on dialup and ip’s change


MA WarGod

I believe if someone can think it, it can be programmed
 
Again, thanks for a speedy reply and the good info.

As you've probably guessed I am looking at authentication.
Initially the user coming to my site is presented with index.html that is a form for username/password. If nothing is entered or invalid user [checked against a MySQL DB tey get no further.All's well with the universe.

From your prevous answer you've guessed I'm having probs at this point, ie when a valid user comes in. Your first answer mentioned "allow them access to the site/content if they are"
a. how does ths happen and
b. wouldn't I have to force a CGI that checks them on every page they may then visit?

As I'm using Apache I could simply use the built in .htaccess but for purposes of learning I'd rather carry on with my CGI stuff with a lot of help from people like yourself if you don't mind.
Besides I don't like the Log-on screen that .htaccess throws up?!?
hoe you don't mind sharing your knowledge?

Thanks
 
Thanks for the info MAWarGod.
I'm using C and I think you're talking Perl or PHP?
 
Unfortunately I do not know C pogramming at all. You are to the point where you need nuts and bolts examples of code I believe. You may want to ask in the C forum if nobody can offer more assistance here. Most of the CGI programmers are perl people, but there are a few python, C/C++, ruby, etc people too. But I think your best bet is to ask in the C forum even though you will be running in a CGI environment. The CGI part is really simple (a form on a webpage), it's the backend C stuff that I can't help with.

- Kevin, perl coder unexceptional!
 
Exceptional KevinADC, many thanks for taking time to give me info and the links. Totally appreciated.
Cheers, I'll go have a look.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top