Hi I am having trouble with my variables holding the information from a file that I opened. It seems that it will only hold the information for 1 time. This is what i have for the code.
$username = "$input{'username'}";
if (-e("$memberdir/$username.txt") ){
open(FILE,"$memberdir/$username.txt");
@settings = <FILE>;
close(FILE);
$settings[0] =~ s/[\n\r]//g;
$settings[1] =~ s/[\n\r]//g;
$gotpos = "$settings[1]"; #what position the user is
if ( $settings[0] eq "$input{'password'}") { &redirect; }
else { print "$txt{'2'}"; }
}else{ print "$txt{1}"; }
}
sub redirect {
if ( $gotpos eq "Leader" ) { &ldrindex; }
elsif ( $gotpos eq "Clan Recruiter" ) { &crindex; }
elsif ( $gotpos eq "Squad Leader" ) { &slindex; }
elsif ( $gotpos eq "Squad Recruiter" ) { &srindex; }
elsif ( $gotpos eq "Private" ) { &prindex; }
else { print "$txt{3}"; }
}
It will read the $gotpos that i have there perfectly and it works but when i try using $gotpos after I logged in the information that $gotpos held is no longer there. So when I try to verify a person position from $gotpos it will just put a blank spot so no one can go to any of the other pages in my script. I am calling the variable $gotpos on a different sub routine within a different file if that has anything to do with it.
Thanks
Kurt
Code:
sub login2 { $username = "$input{'username'}";
if (-e("$memberdir/$username.txt") ){
open(FILE,"$memberdir/$username.txt");
@settings = <FILE>;
close(FILE);
$settings[0] =~ s/[\n\r]//g;
$settings[1] =~ s/[\n\r]//g;
$gotpos = "$settings[1]"; #what position the user is
if ( $settings[0] eq "$input{'password'}") { &redirect; }
else { print "$txt{'2'}"; }
}else{ print "$txt{1}"; }
}
sub redirect {
if ( $gotpos eq "Leader" ) { &ldrindex; }
elsif ( $gotpos eq "Clan Recruiter" ) { &crindex; }
elsif ( $gotpos eq "Squad Leader" ) { &slindex; }
elsif ( $gotpos eq "Squad Recruiter" ) { &srindex; }
elsif ( $gotpos eq "Private" ) { &prindex; }
else { print "$txt{3}"; }
}
It will read the $gotpos that i have there perfectly and it works but when i try using $gotpos after I logged in the information that $gotpos held is no longer there. So when I try to verify a person position from $gotpos it will just put a blank spot so no one can go to any of the other pages in my script. I am calling the variable $gotpos on a different sub routine within a different file if that has anything to do with it.
Thanks
Kurt