Your IP : 216.73.217.126


Current Path : /home/semix18/public_html/filmowiec123/nowastrona/
Upload File :
Current File : /home/semix18/public_html/filmowiec123/nowastrona/html-contact-form.php

<?php 
$your_email ='tomaszkret@os.pl';// <<=== update to your email address

session_start();
$errors = '';
$name = '';
$visitor_email = '';
$user_message = '';

if(isset($_POST['submit']))
{
	
	$name = $_POST['name'];
	$visitor_email = $_POST['email'];
	$user_message = $_POST['message'];
	///------------Do Validations-------------
	if(empty($name)||empty($visitor_email))
	{
		$errors .= "\n Imię i Nazwisko oraz adres e-mail są wymagane. ";	
	}
	if(IsInjected($visitor_email))
	{
		$errors .= "\n niepoprawny adres e-mail!";
	}
	if(empty($_SESSION['6_letters_code'] ) ||
	  strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
	{
	//Note: the captcha code is compared case insensitively.
	//if you want case sensitive match, update the check above to
	// strcmp()
		$errors .= "\n Tekst z obrazka jest niepoprawny!";
	}
	
	if(empty($errors))
	{
		//send the email
		$to = $your_email;
		$subject="$name - Formularz kontaktowy wycenakajda.pl";
		$from = $your_email;
		$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
		
		$body = "<b>Imię i Nazwisko:</b> $name<br>".
		"<b>e-mail:</b> $visitor_email <br><br>".
		"<b>Wiadomość:</b> <br> ".
		"$user_message<br><br>".
		"<b>IP:</b> $ip<br>";	
		
		$headers = 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
		$headers .= "From: $from \r\n";
		$headers .= "Reply-To: $visitor_email \r\n";
		
		mail($to, $subject, $body,$headers);
		
		print("<div id='msgsent' style='display:block; color:green; font-weight:bold; margin: 20px 0;'>
					Wiadomość wysłana!
			</div>");
	}
}

// Function to validate against any email injection attempts
function IsInjected($str)
{
  $injections = array('(\n+)',
              '(\r+)',
              '(\t+)',
              '(%0A+)',
              '(%0D+)',
              '(%08+)',
              '(%09+)'
              );
  $inject = join('|', $injections);
  $inject = "/$inject/i";
  if(preg_match($inject,$str))
    {
    return true;
  }
  else
    {
    return false;
  }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head>
	<title>Contact Us</title>
<!-- define some style elements-->
<style>
.err
{
	font-family : Verdana, Helvetica, sans-serif;
	font-size : 12px;
	color: red;
}
</style>	
<!-- a helper script for vaidating the form-->
<script language="JavaScript" src="scripts/gen_validatorv31.js" type="text/javascript"></script>
</head>

<body>
<?php
if(!empty($errors)){
echo "<p class='err'>".nl2br($errors)."</p>";
}
?>
<div id='contact_form_errorloc' class='err'></div>
<form method="POST" name="contact_form" 
action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"> 
<p>
<label for='name'>Imię i nazwisko: </label><br>
<input type="text" name="name" value='<?php echo htmlentities($name) ?>'>
</p>
<p>
<label for='email'>e-mail: </label><br>
<input type="text" name="email" value='<?php echo htmlentities($visitor_email) ?>'>
</p>
<p>
<label for='message'>Wiadomość:</label> <br>
<textarea name="message" rows=8 cols=30><?php echo htmlentities($user_message) ?></textarea>
</p>
<p>
<img src="captcha_code_file.php?rand=<?php echo rand(); ?>" id='captchaimg' ><br>
<label for='message'>Przepisz kod z obrazka :</label><br>
<input id="6_letters_code" name="6_letters_code" type="text"><br>
<small>Nie potrafisz odczytać? Klliknij <a href='javascript: refreshCaptcha();'>tutaj</a> aby odświeżyć</small>
</p>
<input type="submit" value="Wyślij wiadomość" name='submit'>
</form>
<script language="JavaScript">
// Code for validating the form
// Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml
// for details
var frmvalidator  = new Validator("contact_form");
//remove the following two lines if you like error message box popups
frmvalidator.EnableOnPageErrorDisplaySingleBox();
frmvalidator.EnableMsgsTogether();

frmvalidator.addValidation("name","req","Wpisz swoje imię"); 
frmvalidator.addValidation("email","req","Podaj adres e-mail"); 
frmvalidator.addValidation("email","email","Podaj poprawny adres e-mail"); 
</script>
<script language='JavaScript' type='text/javascript'>
function refreshCaptcha()
{
	var img = document.images['captchaimg'];
	img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000;
}
</script>
<script type="text/javascript">
// close the div in 5 secs
window.setTimeout("closeMsgSent();", 5000);

function closeMsgSent(){
document.getElementById("msgsent").style.display=" none";
}
</script>
</body>
</html>