UBB.Dev
Posted By: Wartortle Please help! - 10/10/2000 11:24 PM
Heres my problem:
I click on the link to go to the
register page at RPG.pl?action=Login
It brings me there and when I click
submit it should go to
RPG.pl?action=Login2 but it just goes
to RPG.pl and does not open the Login2
sub I have the thing specifing the
action of Login2 setup the same as the
rest but it wont log from the pages
that are at RPG.pl?action=wahtever
already.
Please tell me what to do

Also I would like the code used to read forms
used in a program like whatever it does to
read this form to post a message

------------------

Wartortle

I'm supposed to put somthin here? wink

Posted By: Mark Badolato Re: Please help! - 10/11/2000 12:54 AM
Quote
quote:
Well gee, let's try this:

#!/usr/bin/perl -wT

use strict;
use Perl::ESP;

my $problem = Perl::ESP->new();

print $problem->get_error('RPG.pl?action=Login2');

__END__

Output:
You have a problem in your script.

--mark

This message has been edited by Mark Badolato on October 10, 2000 at 05:57 PM
Posted By: Twenty7 Re: Please help! - 10/11/2000 1:14 AM
Well first off here is the code I use to parse forms in all the scripts I write.

#######################################
read(STDIN, $input, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $input);
foreach $pair (@pairs) {

($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s///g;
$FORM{$name} = $value;}

@vars = split(/&/, $ENV{QUERY_STRING});
foreach $var (@vars) {
($v,$i) = split(/=/, $var);
$v =~ tr/+/ /;
$v =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$i =~ tr/+/ /;
$i =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$i =~ s///g;
$INFO{$v} = $i; }

##################################

with that code to parse what I get from a form I use $FORM{$variablename} and for strings (scriptname.pl?variablename=blah) You would use $INFO{$variablename}

in your script (if you used my parsing code) you should have somthing like this telling it to go to the second sub
if ($INFO{'action'} eq 'Login2') {&LoginTwo;}

Don't forget it is case sensitive. so if you have login2 instead of Login2 it will return a false value.


------------------
-Twenty7
http://www.englishhouse.com/twenty7/

That game called Infantry
http://infantry.nmebase.com/
Posted By: Mark Badolato Re: Please help! - 10/11/2000 1:26 AM
However keep in mind that NO ONE should use that parse routine. It's old, it's unsupported, and it's insecure.

The perl community dislikes cargo culted code, and that particular one is one of the big peeves.

use this instead:

use CGI qw/:standard/;

my $username = param('username');

Simpler, clearner, more secure, and supported.

--mark
Posted By: Greg Hard Re: Please help! - 10/11/2000 8:11 PM
Quote
quote:
No, no no. Thats all...no no no...

Is their a typo in your script? Typo's can easily be overlooked. ::cough:: ubb 5.44a ::cough::

Like mark said, check the script.

------------------
UBBDEV Moderator
OCCUPATION: Programmer, webmaster.
Read my BIO in the team link!
Posted By: Wartortle Re: Please help! - 10/12/2000 1:56 AM
Quote
quote:
I use that... Heres how its set up...

use CGI qw/:standard/;

$action = param('action');

if($action eq "Login") { require "link here" &Login; }
if($action eq "Login2") { require "link here" &Login2; }


Login brings me to the login page @
RPG.pl?action=Login
The login form should load Login2 the link
I used for theform is
RPG.pl?action=Login2
but it just brings me to the main page and
doesnt load Login2
should I make it say RPG.plaction=Login&other=Login2
or somthin else?

Also I still need somthin that will read the
forms.

------------------

Wartortle

I'm supposed to put somthin here? wink

Posted By: Wartortle Re: Please help! - 10/12/2000 1:59 AM
Quote
quote:
I dont get an error it just skips it.


------------------

Wartortle

I'm supposed to put somthin here? wink

Posted By: Mark Badolato Re: Please help! - 10/12/2000 2:25 AM
*sigh*

The point was that we don't have ESP and have not a clue what you are doing wrong in your script until you actually bother to show us the code.

--mark
Posted By: Wartortle Re: Please help! - 10/12/2000 11:32 PM
I just did...

------------------

Wartortle

I'm supposed to put somthin here? wink

Posted By: Mark Badolato Re: Please help! - 10/12/2000 11:38 PM
1) That snippet wasn't with your original question

2) No you didn't just post it... you posted a code snippet sort of LIKE what you're using. That isn't your real snippet, and if it is, it wouldn't compile due to syntax errors.

Now try posting the REAL code.

--mark
Posted By: Wartortle Re: Please help! - 10/12/2000 11:50 PM
This the the part of code that calls the
functions:

use CGI qw/:standard/;
$action = param('action');
if ($action eq 'Login') { require "$SF/LoginLogout.pl"; &Login; }
if ($action eq 'Login2') { require "$SF/LoginLogout.pl"; &Login2; }


And heres the form tag:




The form tags at RPG.pl?action=Login so you
see what it should be calling but it ain't.


------------------

Wartortle

I'm supposed to put somthin here? wink

Posted By: Wartortle Re: Please help! - 10/12/2000 11:57 PM
Nevermind I got it to work, I used this:

Quote
quote:


------------------

Wartortle

I'm supposed to put somthin here? wink

Posted By: Mark Badolato Re: Please help! - 10/13/2000 12:42 AM
*sigh*

DON'T USE THAT CODE. Read my above explanation.

Now, on to your problem, your snippet looks fine. This doesn't:



Change it to:




and that should work for you.

--mark

This message has been edited by Mark Badolato on October 12, 2000 at 05:45 PM
Posted By: Wartortle Re: Please help! - 10/13/2000 2:41 AM
That code works fine for me, I don't know
why I shouldn't use it cause it works good.

And also if I used the other thing how can
I get it to read forms?

------------------

Wartortle

I'm supposed to put somthin here? wink

Posted By: Wartortle Re: Please help! - 10/13/2000 2:42 AM
Never mind I figured it out. And thanks!

------------------

Wartortle

I'm supposed to put somthin here? wink

Posted By: The Team Re: Please help! - 10/13/2000 2:07 PM
Quote
quote:
Mark told you why you shouldn't do it. It is insecure, outdated, and unsupported. Use CGI.pm. MUCH better in every way!



------------------
Da Wannabe Cannuck

:: Who is Andy?
© UBB.Developers