Formularz kontaktowy PDF Drukuj Email


// funkcja wysyłająca wiadomość

function send_mail()
{
$name = $_POST['first_name'].' '.$_POST['last_name'];
$phone = $_POST['phone'];
$email = str_replace('#','@',$_POST['email']);
$comment = $_POST['comment'];
$send_me_copy = $_POST['send_me_copy'];

$to = ' Adres poczty elektronicznej jest chroniony przed robotami spamującymi. W przeglądarce musi być włączona obsługa JavaScript, żeby go zobaczyć. ';

if($send_me_copy)
$to2 = $email;

// temat
$subject = 'Wiadomość z serwisu Edu4U - '.$name;

$subject = "=?UTF-8?B?".base64_encode($subject)."?=";

// wiadomość
$message = '


'.$subject.'


Imię i nazwisko: '.$name.'


Adres e-mail: '.$email.'


Telefon: '.$phone.'


Wiadomość: '.$comment.'


Zgłoszenie wysłane: '.date('Y-m-d, H:i:s').', z komputera o IP: '.$_SERVER['REMOTE_ADDR'].'.




';

// Aby wysłać e-mail HTML, musi być ustawiony nagłówek Content-type
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: Serwis Edu4U ' . "\r\n";
//$headers .= 'To: '."=?UTF-8?B?".base64_encode($name)."?=".' \r\n';

// Wysłanie e-maila
if( mail($to, $subject, $message, $headers) )
{
if( isset($to2) )
{
// Aby wysłać e-mail HTML, musi być ustawiony nagłówek Content-type
$headers2 = 'MIME-Version: 1.0' . "\r\n";
$headers2 .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers2 .= 'From: Serwis EDU4U ' . "\r\n";
//$headers2 .= 'To: '."=?UTF-8?B?".base64_encode($name)."?=".' \r\n';
mail($to2, $subject, $message, $headers2);
}
echo '

Zgłoszenie zostało wysłane. Dziękujemy!';
echo '


Wysłane dane:'.$message.'

';
}
else
{
echo '

Wystąpił błąd przy wysyłaniu zgłoszenia. Przepraszamy!

';
echo '

Prosimy o kontakt telefoniczny.

';
}
}

// --------------------------------------------------------------------------------------------------------------------------------------------------------

 

$user =& JFactory::getUser();


// jeśli wciśnięto wyślij

if( isset($_POST['btnSend']) )
{
// tincaptcha-

if( $user->id == 0 )
{
$captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
if ($captchk !== true)
{
echo '

'.$captchk.'

';
PrintForm(true);
return false;
}
}
send_mail();
}

// --------------------------------------------------------------------------------------------------------------------------------------------------------

// jeżeli nie, to wyświetl formularz

else
{
PrintForm(false);
}

 

// --------------------------------------------------------------------------------------------------------------------------------------------------------

function PrintForm($val)
{

echo '



';


echo '

























';

$user =& JFactory::getUser();

if( $user->id == 0 )

{

echo '




';

}

 

echo '





Imię*:



Nazwisko*:



Adres e-mail*:



Telefon:



Wiadomość:



Prześlij kopię tej wiadomości na swój e-mail







.JText::_( 'TIN_CAPTCHA' ).

'.JText::_('TIN_REFRESH').'



 


';

 

echo '

';


}


?>