This is the following of the code that i have and it seems to have an error and no debuggers could get anything wrong and neither could I. Could u take a look at it?
Code:
#!/usr/bin/perl
print( "Content-type: text/html\n\n" ) ;
#####
# CGILIB
require "cgi-lib.pl";
&ReadParse(*input);
#####
# Form Parsing
@pairs = split( /&/, $ENV{ 'QUERY_STRING' } ) ;
foreach $pair ( @pairs ){
( $name, $value ) = split( /=/, $pair ) ;
$value =~ tr/+/ / ;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack( "C", hex( $1 ) )/eg ;
$QS{ $name } = $value ;
}
#####
# Variables
$pass= $input{'password'};
$adminpass="crazyboy";
@members = ($pass);
$SecretNum = 45 ;
$QueryStringAddition ="" ; #this must be appended to the end of every link
#####
# Requires
#####
# Calling Subs
#####
# Subs
sub login {
if($members[0] eq $adminpass){
&pageone;
$QueryStringAddition = "&user=" . $input{ 'username' } . "&key=" . crypt( $input{ 'username' }, $SecretNum ) ;
}else{
print "password incorrect!";
}
}
sub checkAuth{
my( $UserName, $SecretKey ) ;
$UserName = $QS{ 'user' } ;
$SecretKey = $QS{ 'key' } ;
if( crypt( $UserName, $SecretNum ) == $SecretKey ){
$QueryStringAddition = "&user=" . $UserName . "&key=" . $SecretKey ;
return( 1 ) ;
}else{
return( 0 ) ;
}
}
sub pageone {
html = qq|
<a href="clan.cgi?admin=index$QueryStringAddition">Link 1</a><br>
<a href="clan.cgi?admin=addlink$QueryStringAddition">Link 2</a><br>
<a href="clan.cgi?admin=two$QueryStringAddition">Link 3</a><br>
| ;
}
#####
# Main
if( $QS{ 'login' } eq "index" ){
&login;
}elsif( &chechAuth() ){
if( $QS{ 'admin' } eq "index" ){
}elsif( $QS{ 'admin' } eq "addlink" ){
}elsif( $QS{ 'admin' } eq "two" ){
}elsif( $QS{ 'admin' } eq "two" ){
}elsif( $QS{ 'admin' } eq "two" ){
}else{ $html = "I dont know"; )
}else{
$html = qq|
<form method="post" action="clan.cgi?login=index">
<input type="text" name="password">
<input type="submit" name="Submit" value="Submit">
</form>
| ;
}
print( $html ) ;
Thanks,
Kurt