mirror of
https://github.com/dawidolko/Website-Templates.git
synced 2025-10-27 16:03:10 +01:00
114 lines
5.7 KiB
PHP
114 lines
5.7 KiB
PHP
<!DOCTYPE HTML>
|
|
<html>
|
|
|
|
<head>
|
|
<title>my portfolio two</title>
|
|
<meta name="description" content="website description" />
|
|
<meta name="keywords" content="website keywords, website keywords" />
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
|
<!-- modernizr enables HTML5 elements and feature detects -->
|
|
<script type="text/javascript" src="js/modernizr-1.5.min.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="main">
|
|
<header>
|
|
<div id="logo"><h1>MY<a href="#">PORTFOLIO</a>TWO</h1></div>
|
|
<nav>
|
|
<ul class="lavaLampWithImage" id="lava_menu">
|
|
<li><a href="index.html">home</a></li>
|
|
<li><a href="about.html">about me</a></li>
|
|
<li><a href="portfolio.html">my portfolio</a></li>
|
|
<li><a href="blog.html">blog</a></li>
|
|
<li class="current"><a href="contact.php">contact</a></li>
|
|
</ul>
|
|
</nav>
|
|
</header>
|
|
<div id="site_content">
|
|
<div id="sidebar_container">
|
|
<div id="gallery">
|
|
<ul class="images">
|
|
<li class="show"><img width="450" height="450" src="images/1.jpg" alt="photo_one" /></li>
|
|
<li><img width="450" height="450" src="images/2.jpg" alt="photo_two" /></li>
|
|
<li><img width="450" height="450" src="images/3.jpg" alt="photo_three" /></li>
|
|
<li><img width="450" height="450" src="images/4.jpg" alt="photo_four" /></li>
|
|
<li><img width="450" height="450" src="images/5.jpg" alt="photo_five" /></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div id="content">
|
|
<h1>Contact</h1>
|
|
<?php
|
|
// Set-up these 3 parameters
|
|
// 1. Enter the email address you would like the enquiry sent to
|
|
// 2. Enter the subject of the email you will receive, when someone contacts you
|
|
// 3. Enter the text that you would like the user to see once they submit the contact form
|
|
$to = 'email@emailaddress.com';
|
|
$subject = 'Enquiry from the website';
|
|
$contact_submitted = 'Your message has been sent.';
|
|
|
|
// Do not amend anything below here, unless you know PHP
|
|
function email_is_valid($email) {
|
|
return preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',$email);
|
|
}
|
|
if (!email_is_valid($to)) {
|
|
echo '<p style="color: red;">You must set-up a valid (to) email address before this contact page will work.</p>';
|
|
}
|
|
if (isset($_POST['contact_submitted'])) {
|
|
$return = "\r";
|
|
$youremail = trim(htmlspecialchars($_POST['your_email']));
|
|
$yourname = stripslashes(strip_tags($_POST['your_name']));
|
|
$yourmessage = stripslashes(strip_tags($_POST['your_message']));
|
|
$contact_name = "Name: ".$yourname;
|
|
$message_text = "Message: ".$yourmessage;
|
|
$user_answer = trim(htmlspecialchars($_POST['user_answer']));
|
|
$answer = trim(htmlspecialchars($_POST['answer']));
|
|
$message = $contact_name . $return . $message_text;
|
|
$headers = "From: ".$youremail;
|
|
if (email_is_valid($youremail) && !eregi("\r",$youremail) && !eregi("\n",$youremail) && $yourname != "" && $yourmessage != "" && substr(md5($user_answer),5,10) === $answer) {
|
|
mail($to,$subject,$message,$headers);
|
|
$yourname = '';
|
|
$youremail = '';
|
|
$yourmessage = '';
|
|
echo '<p style="color: blue;">'.$contact_submitted.'</p>';
|
|
}
|
|
else echo '<p style="color: red;">Please enter your name, a valid email address, your message and the answer to the simple maths question before sending your message.</p>';
|
|
}
|
|
$number_1 = rand(1, 9);
|
|
$number_2 = rand(1, 9);
|
|
$answer = substr(md5($number_1+$number_2),5,10);
|
|
?>
|
|
<form id="contact" action="contact.php" method="post">
|
|
<div class="form_settings">
|
|
<p><span>Name</span><input class="contact" type="text" name="your_name" value="<?php echo $yourname; ?>" /></p>
|
|
<p><span>Email Address</span><input class="contact" type="text" name="your_email" value="<?php echo $youremail; ?>" /></p>
|
|
<p><span>Message</span><textarea class="contact textarea" rows="5" cols="50" name="your_message"><?php echo $yourmessage; ?></textarea></p>
|
|
<p style="padding: 10px 0; line-height: 2em;">To help prevent spam, please enter the answer to this question:</p>
|
|
<p><span><?php echo $number_1; ?> + <?php echo $number_2; ?> = ?</span><input type="text" name="user_answer" /><input type="hidden" name="answer" value="<?php echo $answer; ?>" /></p>
|
|
<p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="contact_submitted" value="send" /></p>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
<p><a href="index.html">home</a> | <a href="about.html">about me</a> | <a href="portfolio.html">my portfolio</a> | <a href="blog.html">blog</a> | <a href="contact.php">contact</a></p>
|
|
<p>© 2012 my portfolio two. All Rights Reserved. | <a href="http://www.css3templates.co.uk">design from css3templates.co.uk</a></p>
|
|
</footer>
|
|
</div>
|
|
<!-- javascript at the bottom for fast page loading -->
|
|
<script type="text/javascript" src="js/jquery.min.js"></script>
|
|
<script type="text/javascript" src="js/jquery.easing.min.js"></script>
|
|
<script type="text/javascript" src="js/jquery.lavalamp.min.js"></script>
|
|
<script type="text/javascript" src="js/image_fade.js"></script>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
$("#lava_menu").lavaLamp({
|
|
fx: "backout",
|
|
speed: 700
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|