[an error occurred while processing this directive]
#!/usr/bin/perl -w
use strict;
use CGI;
use lib 'lib';
use HTML::Template;
use MylibML;
use TreePagesML;
use vars qw($q $dbh $sth $t $onlydate $error %CFGVAR);
my ($i,$page,$name,$content,$short,$main,$menu,$mainmenu,$imgok);
$q = new CGI;
$t = HTML::Template->new(filename => MylibML::get_tmpl($ENV{SCRIPT_NAME}), associate => $q,die_on_bad_params=>0);
$dbh = MylibML::dbi_connect(); # MySQL connecting
%CFGVAR=%{MylibML::PageSupport($dbh,$q,$t)};
$t->param(pagename=>$CFGVAR{cfg_sendmsg});
$t->param('iam_message'=>1);
# определяем страницу для вывода
$page=$q->param('page') || '1';
$short=$q->param('short') || '';
my $what=$q->param('what') || '';
my ($descr)=$dbh->selectrow_array("SELECT descr FROM tree_tab$CFGVAR{var_lang} WHERE treeid='$CFGVAR{cfg_msgpage}'");
$t->param(descr=>$descr);
# Authentification
my ($id,$fio)=MylibML::AuthUser($q,$t);
#-------------------------------
# вывод дерева
#-------------------------------
#my ($tree,$treepath);
#my $step=$q->param('step') || '';
#($tree,$treepath)=TreePagesML::show_tree($dbh,$path,$CFGVAR{var_lang},"step=$step&","/page/",'');
#$t->param(tree=>$tree);
#$t->param(treepath=>$treepath);
$t->param(treepath=>"/ ".$CFGVAR{'cfg_sendmsg'}."");
my $family1 = $q->param('family1') || '';
my $family2 = $q->param('family2') || '';
my $family3 = $q->param('family3') || '';
my $family4 = $q->param('family4') || '';
my $photo = $q->param('photo') || '';
my $email = $q->param('email') || '';
my $message = $q->param('message') || '';
if ($family1 && $email && $message) {
postmail($CFGVAR{cfg_adminemail},$email,"New message from ".$ENV{HTTP_HOST},
"\nEmail/Phone: $email\n".
"FIO: $family1\n".
"Message:\n==========\n$message\n==========\n"
);
$t->param(sended=>1);
} else {$error.=$CFGVAR{cfg_bindingfield} if $q->param('save_btn');}
$t->param(error=>$error);
#выводим все, что накопили
print $q->header(-type => 'text/html; charset=windows-1251');
print $t->output();
sub postmail
{
my ($to, $from, $subject, $msg, $posttext);
($to, $from, $subject, $msg)=@_;
$posttext = <
Subject: $subject
Content-Type: text/plain; charset=windows-1251
$msg
QQ
my $emailprogram = '/usr/sbin/sendmail' ;
open (MESSAGE,"|$emailprogram -t") ;
print MESSAGE $posttext;
close (MESSAGE) ;
# return "".$posttext."
\n";
}