X-Git-Url: http://aymargeddon.de/gitweb/?p=aymargeddon%2Fcurrent.git;a=blobdiff_plain;f=src%2FFROGS%2FDataBase.pm;h=7bc8de11d202da1bbe39814b6c2177290aee97e3;hp=b3b721bb851e2b5b0c2f4675bae304efeb9aa1ed;hb=4ee43fcd2fbe7c33bfe7fa4f32a1eee7b6d46357;hpb=d546361806d5b7245e063c050eb0347b84bc7880 diff --git a/src/FROGS/DataBase.pm b/src/FROGS/DataBase.pm index b3b721b..7bc8de1 100644 --- a/src/FROGS/DataBase.pm +++ b/src/FROGS/DataBase.pm @@ -397,16 +397,28 @@ sub new_account{ }); $self->commit(); - my $mail = "From: registration\@aymargeddon.de\nTo: $name <$email>\n" - . "Subject: ".$self->loc('REGISTER_MAIL_SUBJECT')."\n\n" - . $self->loc('REGISTER_MAIL_TEXT', $name, $login, $pwd)."\n"; + # my $mail = "From: registration\@aymargeddon.de\nTo: $name <$email>\n" + # . "Subject: ".$self->loc('REGISTER_MAIL_SUBJECT')."\n\n" + # . $self->loc('REGISTER_MAIL_TEXT', $name, $login, $pwd)."\n"; # print $mail; - open(SENDMAIL, "|mail $email") or Util::log("Can't fork for sendmail: $!",0); - print SENDMAIL $mail; - close(SENDMAIL) or Util::log("sendmail didn't close nicely",0); + # open(SENDMAIL, "|mail $email") or Util::log("Can't fork for sendmail: $!",0); + # print SENDMAIL $mail; + # close(SENDMAIL) or Util::log("sendmail didn't close nicely",0); + use Mail::Mailer; + + my $mailer = Mail::Mailer->new(); + + $mailer->open({ From => 'benni@aymargeddon.de', + To => "$name <$email>", + Subject => $self->loc('REGISTER_MAIL_SUBJECT'), + }) + or Util::log("can't send registration mail to $email: $!\n"); + print $mailer $self->loc('REGISTER_MAIL_TEXT', $name, $login, $pwd); + $mailer->close(); + return $pwd; } @@ -420,7 +432,7 @@ sub authenticate{ ($user,$pwd,$adminpwd) = $self->quote_all($user,$pwd,$adminpwd); - Util::log("Adminpassword: $adminpwd, password: $pwd",2); + # Util::log("Adminpassword: $adminpwd, password: $pwd",2); my ($player, $sec); if($adminpwd eq $pwd){ @@ -530,18 +542,20 @@ sub games_of_player{ sub open_games{ my ($self,$cond) = @_; my $games = $self->select_array('GAME','GAME'); - # return $games; my @log; for my $game (@$games){ - my $c = "GAME=$game"; - $c .= "AND $cond" if $cond; - + Util::log( Dumper($game)."\n",1); + my $c = "GAME=". $game->[0]; + $c .= " AND $cond" if $cond; + Util::log($c."\n",1); my $unused = $self->select_array('MAP','LOCATION','',$c); print $unused; - push @log, $game if $#{@$unused} + 1; + Util::log(Dumper(@$unused),1); + + push @log, $game->[0] if @$unused + 1; } return \@log; }