| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: May 2005 Location: PA
Posts: 216
![]() | Passing Variables to Perl Ok, wierd problem here. I have a perlscript for my email which has been either written with such poor organization that I can't even read it, or has been encoded for one reason or another so that I can't edit. Either way, I have an interesting problem. ????: NamePros.com http://www.namepros.com/programming/105136-passing-variables-to-perl.html The program allows you to edit the templates for every section, including the login page. I want to make it so that if the javascript can read the cookie from the rest of the site, pass the variable to the perl script via the POST method automatically. That way it is nice and integrated to the rest of the site. I know a little about cookies, but I have a tutorial which I will read. The question here deals with how I should go about redirecting to another page if it sees the user is logged in and then passing the user info into it. Thanks.
__________________ The Kevin Dolan Design By Dolan Genetic Programming Source EuroToDollar: Forex Basics |
| |
| | #2 (permalink) | ||||
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() |
| ||||
| |
| | THREAD STARTER #3 (permalink) |
| NamePros Regular Join Date: May 2005 Location: PA
Posts: 216
![]() | I'm going to show you a couple lines of the code from the perlscript to show you all that it would be virtually impossible for me to sort through this. Code: use Socket; use FileHandle; my($mma) = new FileHandle(); &ReadParse; { my($mmb) = 0;
my($mmc); foreach $mmc (keys(%mailman::in)) { if($mmc =~ /^(.+)\.[xy]$/) {
my($mmd) = $1; if($mmc =~ /^([^\#]+)\#(.*)\.[xy]$/) { $mmd = $1;
$mailman::in{$mmd} = mmuc($2); } else {
$mailman::in{$mmd} = 'MAILMANSPECIALTRUE'; } delete($mailman::in{$mmc}); } else {
if($mmc =~ /^([^\#]+)\#(.*)$/) { $mailman::in{$1} = mmuc($2); } } } }
if($mailman::in{'INTERFACE'}) { my(@mme) = split(/\&/,$mailman::in{'INTERFACE'});
my($mmf) = ''; foreach $mmf (@mme) { if($mmf =~ /^([^\=]+)\=(.*)$/) {
$mailman::in{$1} = mmuc($2); } }
unless($mailman::in{'INTERFACE'} =~ /ALTERNATE_TEMPLATES/) {
$mailman::in{'ALTERNATE_TEMPLATES'} = ''; } } {
@mailman::mmg = split(/\;/,$ENV{'HTTP_COOKIE'}); my($mmh) = '';
foreach $mailman::mmh (@mailman::mmg) { $mailman::mmi = 1;
if($mailman::mmh =~ /MailManAuth\=(\S+)/) { my(@mmj) = split(/\&/,$1);
my($mmk) = ''; foreach $mmk (@mmj) { $mmk =~ /^(.+)\#(.+)$/;
unless($mailman::in{$1}) { $mailman::in{$1} = $2; } } }
if($mailman::mmh =~ /MailManDir\=(\S+)/) { $mailman::mml = mmuc($1); } } }
$mailman::mmm = mmug($mailman::in{'USERNAME'});
$mailman::mmm =~ s/^\s*([^\s]+)\s*$/$1/; if($mailman::bCaseInsensitiveAccounts); ????: NamePros.com http://www.namepros.com/showthread.php?t=105136 I know that would be best, but I am wondering if anyone knows a way to pass variables through POST via javascript.
__________________ The Kevin Dolan Design By Dolan Genetic Programming Source EuroToDollar: Forex Basics |
| |
| | #4 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | It looks like they just squished all the lines together, probably to make the file smaller. Here's the same code a bit more readable. Code: use Socket;
use FileHandle;
my ($mma) = new FileHandle();
&ReadParse;
{
my ($mmb) = 0;
my ($mmc);
foreach $mmc ( keys(%mailman::in) ) {
if ( $mmc =~ /^(.+)\.[xy]$/ ) {
my ($mmd) = $1;
if ( $mmc =~ /^([^\#]+)\#(.*)\.[xy]$/ ) {
$mmd = $1;
$mailman::in{$mmd} = mmuc($2);
}
else {
$mailman::in{$mmd} = 'MAILMANSPECIALTRUE';
}
delete( $mailman::in{$mmc} );
}
else {
if ( $mmc =~ /^([^\#]+)\#(.*)$/ ) { $mailman::in{$1} = mmuc($2); }
}
}
}
if ( $mailman::in{'INTERFACE'} ) {
my (@mme) = split( /\&/, $mailman::in{'INTERFACE'} );
my ($mmf) = '';
foreach $mmf (@mme) {
if ( $mmf =~ /^([^\=]+)\=(.*)$/ ) {
$mailman::in{$1} = mmuc($2);
}
}
unless ( $mailman::in{'INTERFACE'} =~ /ALTERNATE_TEMPLATES/ ) {
$mailman::in{'ALTERNATE_TEMPLATES'} = '';
}
}
{
@mailman::mmg = split( /\;/, $ENV{'HTTP_COOKIE'} );
my ($mmh) = '';
foreach $mailman::mmh (@mailman::mmg) {
$mailman::mmi = 1;
if ( $mailman::mmh =~ /MailManAuth\=(\S+)/ ) {
my (@mmj) = split( /\&/, $1 );
my ($mmk) = '';
foreach $mmk (@mmj) {
$mmk =~ /^(.+)\#(.+)$/;
unless ( $mailman::in{$1} ) { $mailman::in{$1} = $2; }
}
}
if ( $mailman::mmh =~ /MailManDir\=(\S+)/ ) {
$mailman::mml = mmuc($1);
}
}
}
$mailman::mmm = mmug( $mailman::in{'USERNAME'} );
$mailman::mmm =~ s/^\s*([^\s]+)\s*$/$1/;
if ($mailman::bCaseInsensitiveAccounts); |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HOWTO: Install the Apache Web Server, Perl, PHP, and MySQL on Windows | deadserious | Webmaster Tutorials | 96 | 05-27-2007 02:24 PM |
| String and variables | lovelinuxlove | Programming | 2 | 10-31-2004 05:26 AM |
| Tutorial: Creating a simple cgi hit counter for your site using Perl | deadserious | Webmaster Tutorials | 3 | 05-29-2004 02:31 AM |
| How I fill javascript array with php variables? | wiedzim | CODE | 0 | 03-31-2004 03:45 AM |
| A simple cgi hit counter for your site using Perl | deadserious | CODE | 2 | 11-07-2003 09:23 AM |