Hi dude! I have an orrible trouble with this poor cgi: is a client pop3 web based gateway.The function "connetti()" never been called and i don't know why!!The functions in the bottom of the script load,save,restore the state of the session by save the user,pass,host,id in a file.if you try to execute the script all stop when you click on the submit button.I'm italian so i apologize for the bad english. I hope there is a good soul who help me.
There is the code:
#!/usr/bin/perl -w
use Mail::POP3Client; use CGI qwall); #use CGIBook::Error; #use HTML::Template;
local $MAX_FILES = 1000; local $DATA_DIR = 'usr/lib/cgi-bin';
my $q = new CGI; my $this_script_name = 'popGem.cgi'; my $id = get_id($q); my $action = ( $q->param("action") ) || 'start';
my ($q,$id) = @_; my $user_name = param('user_name'); my $password = param('password'); my $domain_name = param('domani_name'); #per ogni messaggio che presente nella mailbox stampo una riga di una tabella #con le informazioni utili: mittente,oggetto,ecc...
my $pop = new Mail::POP3Client ( USER => $user_name, PASSWORD => $password, HOST => $domain_name, AUTH_MODE => 'PASS' );
# Reads a saved CGI object from disk and returns its params as a hash ref sub get_state { my $id = shift; my $session = session_filename( $id ); local *FILE;
-e $session or return; open FILE, $session or die "Cannot open $session: $!"; my $q_saved = new CGI( \*FILE ) or error( $q, "Unable to restore saved state." ); close FILE;
return $q_saved;
}
# Saves the current CGI object to disk sub save_state { my $q = shift; my $session = session_filename( $id ); local( *FILE, *DIR );
# Avoid DoS attacks by limiting the number of data files my $num_files = 0; opendir DIR, $DATA_DIR; $num_files++ while readdir DIR; closedir DIR;
# Compare the file count against the max if ( $num_files > $MAX_FILES ) { error( $q, "We cannot save your request because the directory " . "is full. Please try again later" ); }
# Save the current CGI object to disk open FILE, ">> $session" or return die "Cannot write to $session: $!"; $q->save( \*FILE ); close FILE;
}
# Separated from other code in case this changes in the future sub session_filename { my $id = shift; return "/$DATA_DIR/$id";
}
sub unique_id { # Use Apache's mod_unique_id if available return $ENV{UNIQUE_ID} if exists $ENV{UNIQUE_ID};
require Digest::MD5;
my $md5 = new Digest::MD5; my $remote = $ENV{REMOTE_ADDR} . $ENV{REMOTE_PORT};
# Note this is intended to be unique, and not unguessable # It should not be used for generating keys to sensitive data my $id = $md5->md5_base64( time, $$, $remote ); $id =~ tr|+/=|-_.|; # Make non-word chars URL-friendly return $id;
If you would like to report an abuse of our service, such as a spam message, please . Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .