require '../../../system/config.php'; // nastaveni systemovych promennych pro admin sekci
require '../../../system/db_connect.php'; // pripojeni k databazi
require '../../../system/sessions.php'; // nastartovani session
require '../../../system/functions.php'; // nacteni nadefinovanych funkci
require '../../../system/functions_output.php'; // nacteni nadefinovanych funkci pro vystup
require '../../../system/var_check.php'; // oslashovani promennych v $_POST a $_GET
/* VYKONNA CAST SKRIPTU */
$lang = load_lng_terms($_SESSION['lng']);
$msg = array();
/* ZOBRAZOVACI CAST SKRIPTU */
$title = $lang['mt_06'] . ' | ' . $lang['cestovni_agentura'];
$out_body = text_show();
if ( $_POST['submit'] ) {
if ( strlen($_POST['mail_from']) < 3 ) {
$msg[] = $lang['mail_err_from'];
}
if ( !$_POST['mail_mobil'] && !$_POST['mail_telefon'] ) {
$msg[] = $lang['mail_err_no_tel'];
}
else {
if ( $_POST['mail_mobil'] && !check_phone_number($_POST['mail_mobil']) ) {
$msg[] = $lang['mail_err_mobil'];
}
if ( $_POST['mail_telefon'] && !check_phone_number($_POST['mail_telefon']) ) {
$msg[] = $lang['mail_err_tel'];
}
}
if ( !preg_match('/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/', $_POST['mail_mail']) ) {
$msg[] = $lang['mail_err_mail'];
}
if ( !$_POST['mail_name'] ) {
$msg[] = $lang['mail_err_name'];
}
if ( !$_POST['mail_text'] ) {
$msg[] = $lang['mail_err_text'];
}
$out = count($msg) > 0
? show_mail_form()
: send_mail_form();
}
else {
$out = show_mail_form();
}
$out_body .= content_box('product', false, $out).'
';
/* odeslani mailu */
function send_mail_form() {
global $lang, $msg;
$header = "MIME-Version: 1.0\n";
$header .= "Content-type: text/plain; charset=UTF-8\n";
$header .= "X-Priority: 1\n";
$header .= "X-MSMail-Priority: High\n";
$header .= "X-Mailer: php\n";
$header .= "From: {$_POST['mail_from']} <{$_POST['mail_mail']}>\n";
$pad = 18;
$subject = $_POST['mail_name'];
$body = str_pad('Předmět:', $pad + 2) . $_POST['mail_name']."\n";
$body .= str_pad('Odesilatel: ', $pad) . $_POST['mail_from'].' <'.$_POST['mail_mail'].">\n";
$body .= $_POST['mail_mobil']
? str_pad($lang['mail_mobil'] . ':', $pad) . $_POST['mail_mobil'] . "\n"
: '';
$body .= $_POST['mail_telefon']
? str_pad($lang['mail_telefon'] . ':', $pad) . $_POST['mail_telefon'] . "\n"
: '';
$body .= "\n" . $_POST['mail_text'];
# echo '
' . $header.''; return; if ( mail('info@active-holiday.cz', $subject, $body, $header) ) { $out .= '
-----------
'.$subject.'
-----------
'.$body.'
-----------
' . '
'
, $conf_basedir
, $row['c_photo']
, $row['p_x_big']
, $row['p_y_big']
, 0
, $row['p_alt']
)
: false
)
);
}
return $out_body;
}
/* mailovy formular */
function show_mail_form() {
global $lang, $msg, $conf_basedir;
if ( count($msg) > 0 ) {
$out = '