<?php
/*
This script was created by Bryan Helmig at midmodesign.com. It is licensed under http://creativecommons.org/licenses/by-nc-sa/3.0/us/.
1) A quick primer: place this on your server. Create a form like below:
--------------------------------------------------------------------------------------------------------
<form action="sendmail.php" method="post" id="contactForm">
<p>Name:</p> <input type="text" name="name" value="" id="name" />
<p>Email:</p> <input type="text" name="email" value="" id="email" />
<p>Telephone:</p> <input type="text" name="tele" value="" id="tele" />
<span style="display:none;"><p>Honeypot:</p> <input type="text" name="last" value="" id="last" /></span>
<p>Message:</p> <textarea rows="5" name="message"></textarea>
<input type="submit" value="Send Message" />
</form
--------------------------------------------------------------------------------------------------------
2) This will work fine for a standard form. If you want ajax power, add this div above or below and hide it with css.
--------------------------------------------------------------------------------------------------------
<div class="message"><div id="alert"></div></div>
--------------------------------------------------------------------------------------------------------
3) And add this to the head: Also download jquery-latest.pack.js and jquery.form.js and point to those appropriately.
--------------------------------------------------------------------------------------------------------
<script type="text/javascript" src="jquery-latest.pack.js"></script>
<script type="text/javascript" src="jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var options = {
target: '#alert',
beforeSubmit: showRequest,
success: showResponse
};
$('#contactForm').ajaxForm(options);
});
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
return true;
}
function showResponse(responseText, statusText) {
}
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
</script>
--------------------------------------------------------------------------------------------------------
Boom. There it is.
*/
// Who you want to recieve the emails from the form. (Hint: generally you.)
$sendto = 'PUT YOUR EMAIL HERE';
// The subject you'll see in your inbox
$subject = 'Contact from your website';
// Message for the user when he/she doesn't fill in the form correctly.
$errormessage = 'Oops! There seems to have been a problem. May we suggest...';
// Message for the user when he/she fills in the form correctly.
$thanks = '<li class="sent">Thanks for the email! We’ll get back to you as soon as possible!</li>';
// Message for the bot when it fills in in at all.
$honeypot = "You filled in the honeypot! If you're human, try again!";
// Various messages displayed when the fields are empty.
$emptyname = '<li class="error">Entering your name ?</li>';
$emptyemail = '<li class="error">Entering your email address ?</li>';
$emptytele = '<li class="error">Entering your telephone number ?</li>';
$emptymessage = '<li class="error">Entering a message ?</li>';
// Various messages displayed when the fields are incorrectly formatted.
$alertname = '<li class="error">Entering your name using only the standard alphabet ?</li>';
$alertemail = '<li class="error">Entering your email in this format: <i>name@example.com</i> ?</li>';
$alerttele = '<li class="error">Entering your telephone number in this format: <i>555-555-5555</i> ?</li>';
$alertmessage = '<li class="error">Making sure you aren’t using any parenthesis or other escaping characters in the message ? Most URLS are fine though !</li>';
// --------------------------- Thats it! don't mess with below unless you are really smart! ---------------------------------
//Setting used variables.
$alert = '';
$pass = 0;
// Sanitizing the data, kind of done via error messages first. Twice is better!
function clean_var($variable) {
$variable = strip_tags(stripslashes(trim(rtrim($variable))));
return $variable;
}
//The first if for honeypot.
if ( empty($_REQUEST['last']) ) {
// A bunch of if's for all the fields and the error messages.
if ( empty($_REQUEST['name']) ) {
$pass = 1;
$alert .= "<li>" . $emptyname . "</li>";
} elseif ( ereg( "[][{}()*+?.\\^$|]", $_REQUEST['name'] ) ) {
$pass = 1;
$alert .= "<li>" . $alertname . "</li>";
}
if ( empty($_REQUEST['email']) ) {
$pass = 1;
$alert .= "<li>" . $emptyemail . "</li>";
} elseif ( !eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $_REQUEST['email']) ) {
$pass = 1;
$alert .= "<li>" . $alertemail . "</li>";
}
if ( empty($_REQUEST['message']) ) {
$pass = 1;
$alert .= "<li>" . $emptymessage . "</li>";
} elseif ( ereg( "[][{}()*+?\\^$|]", $_REQUEST['message'] ) ) {
$pass = 1;
$alert .= "<li>" . $alertmessage . "</li>";
}
//If the user err'd, print the error messages.
if ( $pass==1 ) {
//This first line is for ajax/javascript, comment it or delete it if this isn't your cup o' tea.
echo "<script>$(\".message\").hide(\"slow\").show(\"slow\"); </script>";
echo "<ul>";
echo $alert;
echo "</ul>";
// If the user didn't err and there is in fact a message, time to email it.
} elseif (isset($_REQUEST['message'])) {
//Construct the message.
$message = "From: " . clean_var($_REQUEST['name']) . "\n";
$message .= "Email: " . clean_var($_REQUEST['email']) . "\n";
$message .= "Telephone: " . clean_var($_REQUEST['tele']) . "\n";
$message .= "Message: \n" . clean_var($_REQUEST['message']);
$header = 'From:'. clean_var($_REQUEST['email']);
//Mail the message - for production
mail($sendto, $subject, $message, $header);
//This is for javascript,
echo "<script>$(\".message\").hide(\"slow\").show(\"slow\").animate({opacity: 1.0}, 4000).hide(\"slow\"); $(':input').clearForm() </script>";
echo $thanks;
die();
//Echo the email message - for development
//echo "<br/><br/>" . $message;
}
//If honeypot is filled, trigger the message that bot likely won't see.
} else {
echo "<script>$(\".message\").hide(\"slow\").show(\"slow\"); </script>";
echo $honeypot;
}
?>
没有合适的资源?快使用搜索试试~ 我知道了~
简单jquery个人web简历网页模板_简单个人个性web简历简历迷你窄切换滑动.rar
共84个文件
jpg:29个
png:26个
css:12个
需积分: 0 0 下载量 95 浏览量
2023-09-12
08:48:07
上传
评论
收藏 1.29MB RAR 举报
温馨提示
html
资源推荐
资源详情
资源评论
收起资源包目录
简单jquery个人web简历网页模板_简单个人个性web简历简历迷你窄切换滑动.rar (84个子文件)
fancy_shadow_w.png 142B
fancy_shadow_n.png 144B
960grid.css 2KB
fancy_title_right.png 559B
fancy_shadow_se.png 393B
fancy_shadow_s.png 147B
pattern4.jpg 741B
index_purple.html 18KB
text_area.jpg 2KB
index_orange.html 18KB
fancy_right.png 2KB
index_green.html 18KB
input_field.jpg 1KB
layout_blue.css 7KB
pattern.gif 86B
fancy_shadow_e.png 146B
layout_purple.css 7KB
index_pink.html 18KB
menu.png 3KB
logo.png 8KB
index_red.html 18KB
fancy_shadow_nw.png 374B
portfolio_sample5.jpg 208KB
bullet_green.jpg 9KB
bullet_brown.jpg 10KB
ie7.css 524B
flickr.png 2KB
cufon-yui.js 18KB
portfolio.jpg 699B
fancy_shadow_ne.png 388B
bullet_pink.jpg 8KB
fancy_closebox.png 2KB
pattern3.jpg 698B
bullet_blue.jpg 8KB
fancybox.css 5KB
bullet_purple.jpg 9KB
portfolio_sample3.jpg 122KB
portfolio_sample_thumb3.jpg 12KB
reset.css 976B
layout_green.css 7KB
bgfix.jpg 797B
portfolio_sample2.jpg 149KB
jquery-1.4.min.js 68KB
portfolio_sample4.jpg 245KB
layout_brown.css 7KB
twitter.png 3KB
portfolio_sample_thumb2.jpg 14KB
portfolio_sample6.jpg 219KB
sendmail.php 7KB
scroller.js 6KB
menu.js 553B
layout_red.css 7KB
index_blue.html 18KB
bullet_orange.jpg 418B
fancy_title_main.png 149B
back.png 3KB
portfolio_sample_thumb5.jpg 14KB
jquery.form.js 21KB
facebook.png 2KB
ie6.css 2KB
top.png 11KB
layout_orange.css 7KB
portfolio_sample_thumb4.jpg 24KB
jquery.fancybox-1.2.6.js 18KB
image_holder.jpg 2KB
right.png 197B
fancy_progress.png 12KB
bullet_red.jpg 9KB
thumbnail.jpg 934B
DD_belatedPNG_0.0.8a-min.js 7KB
fancy_title_left.png 556B
pattern2.jpg 721B
index_brown.html 18KB
portfolio_sample.jpg 109KB
pattern5.jpg 531B
contact.js 566B
portfolio_sample_thumb6.jpg 16KB
fancy_shadow_sw.png 406B
digg.png 3KB
portfolio_sample_thumb.jpg 11KB
fancy_left.png 2KB
feed.png 3KB
netvibes.png 3KB
layout_pink.css 7KB
共 84 条
- 1
资源评论
Q_97095639
- 粉丝: 374
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功