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

passing a query string twice and adding onto it 1

Status
Not open for further replies.

SPrelewicz

Programmer
Joined
Jul 16, 2001
Messages
124
Location
US
Here is my problem.
I have a link that will pass a query string like follows.


Script 1 checks to see if a user can authenticate by IP, and if so passes them on where they want to go with the arguments helping get them to a specific location. However, if they cannot IP authenticate, they must go to a page to enter a username and password. After entering, they are taken to a script which checks if they are okay. What I want to do is have the first query string remembered so when they authenticate they are immediately taken to the specific page requested. I guess what I need to do is append the first query string to the form that has the username and password fields. Any suggestions or snippets? Thanks in advance for the help.
 
You're on the right track - save the first query string as something like $dest, and if they cannot IP authenticate, then pass "dest=$dest" on the URL line of your redirection to the user/password script -once they properly sign in, that script can pass "dest=$dest" to the script that checks if they are OK.

script that checks if they are OK:
------------------------
- if they check out OK, then if "dest" was passed in, then redirect to $dest.

Does this make sense? You basically had this already.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
hmerrill,

Thank you for the fast reply. It has helped. The problem I am having now is generating the html to process the username login. It is a text file database that we check against (paswords are encrypted :) I am having trouble calling a function to get their info and check it, and then redirecting to the new dest ($dest). Is there a way to use the action attribute to call a function within the same script, or any other way to do what I need. I hope this is clear, I am having a hard time putting this into words.
Thanks again for the help.
 
To get cgi form variables, I use CGI.pm's "param" method - it makes getting the values of form variables very easy.

To look at the perldocs for CGI.pm on *nix, I do

perldoc CGI

I don't know what platform you're on.

I generally don't use CGI.pm's methods to print html - I prefer to print my own HTML, mostly using here- documents. But I do use CGI.pm to process form fields, and to do file uploads.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top