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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI Newbie + path_info

Status
Not open for further replies.

WebRic

Technical User
Sep 21, 2004
95
GB
Hi,

I was hoping for some insight into CGI. I have three main questions, with particular reference to cgi.PATH_INFO:

1. Is CGI universal i.e Do all internet users have the same results?
2. Do search engines have the same results as internet users?
3. Are there any limitations I should be aware of?

Thanks,

Richard
 
1) As long as the input is the same, and they're using the same script, theyre running the process as the webuser so yes, the same results can be assumed if all else is equal
2) Search Engines wouldn't input values to get results, so I'd say no, unless it's just generated output, in which case I'd say yes
3) Proper tight coding, to ensure minimal required use of resources, you can't assume security will look after itself, if you're storing information about persons on your website you have responsibilities under the data protection legislation for your state/nation to ensure that all reasonable attempts have been made to secure the data

what these have to do with cgi.PATH_INFO, I'm not sure ;-)

--Paul
 
Thanks for the reply...

Basically, I have different domains pointing to a my the same web folder. I would like different welcome messages displayed to users depending on what URL they cam through on.

I thought I could run an if statement with the programming language I normally use (CF), and check to see what URL the client came through on using cgi.path_info...

My concern was that perhaps not all users have cgi capability and that I didn't want anything weird to happen with the search engines.

Do you think the above would be fine?

Richard
 
CGI is not a client issue. CGI is executed on the server and only returned as HTML to the web browser. If a web browser is capeable of sending data (via forms) and receiving HTML you will have no compatability issues.

You will however have an issue relying on any kind of refferl based statement as many people have their refferl disabled (yes, cancell that affiliation with that company that only relies on the HTTP reffere).

The best way to handle this would be when someone comes to your site from another the other site could link to you with a variable such as:


Then you can do an if statement based on the ID and never have a problem.
 
Richard,

I'd probably create a different virtual host for each domain, and when they land on the holding page for that domain, set any variables you need and post them to the main web root with the variables selecting what they should see

You could simply use $ENV{'HTTP_REFERER'}, but as Rob says that can be disabled though the point of how many individuals actually have it switched off I'm not sure on.

A lot of that would depend on the type of content you're serving up, and whether potential clients are all that tech savvy

--Paul

cigless ...
 
Thanks that info is pretty useful.

I wasn't too clear on my previous response. Rather than which website they were refered from I was hoping to capture which website they are visiting by

i.e. did they type in:
or

As the domains are hosted by me would it OK to use path_info to see if which web address and therefore which extra content to provide (again both for clients and search engines)
 
If your sites are similar, and they are all yours, what is the point of making and maintaining many web sites? If someone goes to you could just re-direct them to So...

If someone types in or click on you could redirect to Then do an if statement for the domain.

Code:
use CGI;
my $GET new CGI;
my $reffer=$GET->param('reffer');

##Print the parts of the head/top of the page that are the same

if($reffer eq domain1){
 print "Thanks for coming from domain1";
 }
elseif($reffer eq domain2){
 print "Thanks for coming from domain2";
 }

##Print the parts of the body/bottom of the page that are the same
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top