Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 8th, 2001, 12:34 PM
Emmitt Emmitt is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 1 Emmitt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Emmitt
OO Perl Question

Hey,

I made a log in script and when someone hits a form I want them to goto another script. The problem is how do I pass the name varaible from the login script onto the new script? Do I have to use a hidden form?
Does the only way to do this require cookies? I'd prefer another method.

Thanks a lot.

Reply With Quote
  #2  
Old August 8th, 2001, 03:44 PM
dkode dkode is offline
PHP/PERL/.NET Coder
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Daytona Beach, Florida
Posts: 36 dkode User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 sec
Reputation Power: 8
Send a message via AIM to dkode
You need to expand on exactly what it is you are trying to do.

If you just want to send them to another script once they are logged in them simply do something like this:

print "Location: http://www.yourserver.com/cgi-bin/2ndscript.pl?var=$varvalue\n\n";

What that will do is once your first script is done it will redirect them to a second script and pass whatever $varvalue is equal to in the query string.

In your 2nd script to grab the value of $varvalue you would do this:

Code:
if ($ENV{QUERY_STRING}) {
   $qstring = $ENV{QUERY_STRING};
   ($var, $varvalue) = split(/=/, $qstring);
}
else {
   print "Content-Type: text/html\n\n";
   print "Invalid request.\n You must Login first.\n";
   exit();
}


I'm not sure if this is what you are trying to do since you were very vague, and why does your subject say OO perl question? You are not asking a question about object oriented programming.

Hope this helps!
__________________
"Mankind cannot define memory, yet it defines mankind"

Reply With Quote
  #3  
Old August 8th, 2001, 03:55 PM
Emmitt Emmitt is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 1 Emmitt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Emmitt
Well, I want someone to login first (login script) and then it'll print out some information from a database and they can edit it. If they hit the edit button, the program needs to know from what table (the login name) and make sure they are logged in. But I don't want it to show the password in the query string. So I prefer post.

Is that enough info.
oh and I said OO because I thought you'd have to do it by creating a module or something along those lines...

Reply With Quote
  #4  
Old August 9th, 2001, 01:25 PM
dkode dkode is offline
PHP/PERL/.NET Coder
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Daytona Beach, Florida
Posts: 36 dkode User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 sec
Reputation Power: 8
Send a message via AIM to dkode
Ok

I think I understand a little better now.

So basically you need to pass sensitive information from one script to another.

There is no real secure way to do this but if you wish to pass it in POST you can do the following.

Click the link below to go and read up on LWP.

http://www.perldoc.com/perl5.6/lib/lwpcook.html

LWP allows perl to act like a web browser and send a request to a web page or perl script and then it gets a response back.

I have used it to do some pretty cool stuff before. What you would do is let them login and view their information to edit. Then once they hit the submit button to make changes you would do the following:

Code:
use LWP::UserAgent;
  $ua = new LWP::UserAgent;
  my $req = new HTTP::Request 'POST','http://www.yourserver.com/cgi-bin/perlscript.pl';
  $req->content_type('application/x-www-form-urlencoded');
  $req->content('username=$username&password=$password&addtionalinfo=1');
  my $res = $ua->request($req);
  print $res->as_string;



You would change the url of the perl script along with the line that has $req->content('username=$username..... with whatever you want to pass to the 2nd script.

Note: This would not be very good at all with a high traffic site. If it is high traffic you might be better off making your own php authentication script or something along those lines.

hope that helps.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > OO Perl Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT