Is it possible to stop the download of a page by executing a CGI from a SSI page? For example, let's say there is a script called LOADFILE.CGI which will check if an user has already logged in. In all SHTML files there will be a line at the start of the page like this: <!--#exec cgi="../cgi-bin/loadfile.cgi" --> <html> <head> . . . So everytime a page is called, the server will execute LOADFILE.CGI and check the status of the user. The problem is this: If the user is logged, the script has only to end so that the server will continue the process of sending the page but if the user is not logged, the script has to do something otherwise the server will also continue to send the page after the end of the script. Possibilities: - Finish the connection (I don't know how to do it); - Stop the process of sending the page (I only know how to finish the server - not so useful - ); Any ideias?
Normal process would be that if the user is not logged in the serverside scripts redirects the user to another page (normally the log in page) either on the server (ie user asks for page X.aspx but actually receives login.aspx) or client side so the browser is given a redirection to another page and the url in the browser bar changes. We have never programmed using CGI so cannot give you an example script but would find it highly surprising if this isnt possible
LOADFILE.CGI was developed by me. It is called from every inside page and it does exactly what you said except that what the user receives is a combination of a redirection page and the rest of the code from the page called. Something like this: <html> <head> <title>Redirecting</title> <meta http-equiv=refresh content="1;url=http://www.location.com/"> <script LANGUAGE="JavaScript" src="http://www.location.com/cookie.js"></script> <script Language="Javascript"> DeleteCookie('access); DeleteCookie('userlogin'); cookieCreater('error','$message','17'); </script> </head> <body> <p>Redirecting...</p> </body> </html> <noframes> <html> <head> <title>Internal Page</title> . . . As you can see, I had to use <noframes> to hide the page requested from browsing. This is happenning because LOADFILE.CGI is executed during the page's download, not before, so that the header was already sent to the user. In this case it´s not possible to use something like print "Location: http://www.location.com/redirect.shtml\n\n"; After the execution of LOADFILE.CGI, the server continues to send the page requested. I think that maybe it's possible to use a IO function after sending the redirection page so that the connection can be closed but after so long I'm starting to think that I'll have to change the structure of the security system. Any ideas? thx