۱۳۹۱/۵/۱، ۰۸:۱۴:۴۷ صبح
در اين مقاله سعى داريم كه طراحى يك فرم تماس با ما به صورت خيلى ساده را آموزش بدهيم .
صفحه تماس با مديريت سايت به بازديدكننده گان اين امكان را فراهم ميكند كه بتوانند راحت تر و خيلي سريعتر ايده ها و نظرات خودشان را به ايميل مديريت ارسال كنند . پس مي بينيد كه داشتن يك صفحه تماس با ما خيلي امر حياتي هست . اين اسكريپت تست شده و ايميلها را به inbox ارسال ميكند .
در گام نخست ابتدا يك پوشه به نام img مي سازيم و دو تا عكس با نام iMsgSent.gif و thanx.gif را درون آن قرار مي دهيم .
تصوير iMsgSent.gif
تصوير thanx.gif
يك فايل با پسوند index.htm ايجاد كرده و كدهاى زير را درون آن قرار مي دهيم . اين فايل فرم ها را نمايش مى دهد . كه شامل نام و نام خانوادگى و آدرس ايميل و متن پيام به همراه نمايش پيام هاى خطا ( در صورتى كه كاربر يكى از فيلدها را خالى بگذارد ) و همچنين دكمه هاى پاك كردن و ارسال اطلاعات ميباشد .
يك فايل با نام email.php ايجاد كرده و كدهاى زير را در آن قرار مى دهيم . اين فايل محتويات ايميل ارسال شده توسط كاربر را درون ايميل شما نشان ميدهد .
يك فايل جديد ديگر با نام mail.conf.php ايجاد كرده و كدهاى زير را در آن قرار مي دهيم . اين صفحه تنظيمات مربوط به ايميل شما هست كه بايد ايميل آدرس خودتان را به همراه متن موضوع ارسال شده و آدرس صفحه ى تشكر از پيام ارسال شده توسط كاربر را تعيين كنيد .
تنظيمات اصلي فايل در اين قسمت صورت ميگيرد . آدرس ايميل در to و موضوع نامه در subject و آدرس پيغام نامه فرستاده شد در redirect
و در نهايت فايل آخر را با نام success.htm ايجاد كرده و كدهاى زير را در آن قرار ميدهيم . اين صفحه در صورتى كه ايميل شما با موفقيت ارسال شود نمايش داده ميشود . تصاوير درون پوشه img در اين صفحه نمايش داده ميشوند .
منبع : http://www.sepna.com/thread-149.html
شما ميتوانيد صفحه تماس با ما را در كنترل پنل كاربر يا صفحه اصلي نمايش بدهيد . با اضافه كردن لينك و كدهاي زير .
وارد مسير زير بشويد :
كنترل پنل مديريت >> قالب ها و پوسته ها >> انتخاب قالب >> User Control Panel Templates
كليك كنيد و usercp_nav را كليك كرده و كدهاى زير را پيدا كنيد
و در زير آن اين كدها را قرار بدهيد .
شما ميتوانيد صفحه تماس با ما را در كنترل پنل كاربر يا صفحه اصلي نمايش بدهيد . با اضافه كردن لينك و كدهاي زير .
وارد مسير زير بشويد :
كنترل پنل مديريت >> قالب ها و پوسته ها >> انتخاب قالب >> User Control Panel Templates
كليك كنيد و usercp_nav را كليك كرده و كدهاى زير را پيدا كنيد
و در زير آن اين كدها را قرار بدهيد .
صفحه تماس با مديريت سايت به بازديدكننده گان اين امكان را فراهم ميكند كه بتوانند راحت تر و خيلي سريعتر ايده ها و نظرات خودشان را به ايميل مديريت ارسال كنند . پس مي بينيد كه داشتن يك صفحه تماس با ما خيلي امر حياتي هست . اين اسكريپت تست شده و ايميلها را به inbox ارسال ميكند .
در گام نخست ابتدا يك پوشه به نام img مي سازيم و دو تا عكس با نام iMsgSent.gif و thanx.gif را درون آن قرار مي دهيم .
تصوير iMsgSent.gif
تصوير thanx.gif
يك فايل با پسوند index.htm ايجاد كرده و كدهاى زير را درون آن قرار مي دهيم . اين فايل فرم ها را نمايش مى دهد . كه شامل نام و نام خانوادگى و آدرس ايميل و متن پيام به همراه نمايش پيام هاى خطا ( در صورتى كه كاربر يكى از فيلدها را خالى بگذارد ) و همچنين دكمه هاى پاك كردن و ارسال اطلاعات ميباشد .
کد php:
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title > تماس با ما </title>
<style>
td { font-family: Tahoma; font-size: 9pt }
textarea { font-family: Tahoma; font-size: 8pt }
input { font-family: Tahoma; font-size: 8pt }
</style>
<script language="JavaScript" type="text/javascript">
var brw_name="MSIE";
var brw_version="7.0";
var brw_platform="Windows";
<!--
function validate1(){
errors=''
if ( document.order_form.email.value =="" ){
errors+=' -' +'ايميل را وارد نماييد '+ '\n';
}
if ( document.order_form.name.value =="" ){
errors+=' -' +'نام و نام خانوادگي را وارد نماييد '+ '\n';
}
if ( document.order_form.Comments.value =="" ){
errors+=' -' +'شما هيچ مطلبي ننوشته ايد '+ '\n';
}
if (errors!=""){
alert('خطاهاي ذيل را تصحيح کنيد : \n'+errors);
return false;
}
else {
return true;
}
}
//-->
</script>
</head>
<form name="order_form" method="POST" o<strong></strong>nsubmit="return validate1();" action="email.php">
<div align="center">
<table border="0" cellpadding="0" style="border-collapse: collapse" width="323" height="20" bordercolor="#000000" id="table1">
<tr>
<td style="border-style: solid; border-width: 0px">
<div align="center">
<p style="margin-top: 0; margin-bottom: 0">
<input type=button value="X" o<strong></strong>nClick="j<strong></strong>window.close();" style="float: right; font-family:Tahoma; color:#FF0000; font-size:8pt; font-weight:bold"></p>
<p>
<b> </b></p>
<table border="0" cellpadding="0" style="border-collapse: collapse" width="42%" height="20" bordercolor="#000000" id="table2" dir="rtl">
<tr>
<td height="23" width="36%">
<p style="margin-top: 0; margin-bottom: 0" align="right">
<span style="font-size: 8pt">نام و نام خانوادگی</span></td>
<td height="23" width="64%">
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="name" size="31" id="name" style="border-style: solid;
border-width: 1px; float: right; color: #000000; font-family: Tahoma;
font-size: 9pt" dir="rtl" size="31" type="text">
</td>
</tr>
<tr>
<td height="23" width="36%">
<p style="margin-top: 0; margin-bottom: 0" align="right">
<span style="font-size: 8pt">آدرس ایمیل</span></td>
<td height="23" width="64%">
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="email" size="31" dir="ltr" id="email" style="border-style: solid;
border-width: 1px; float: right; color: #FF0000; font-family: Tahoma;
font-size: 9pt" dir="rtl" size="31" type="text"> </td>
</tr>
<tr>
<td height="23" colspan="2">
<p style="margin-top: 0; margin-bottom: 0" align="right">
<span> متن پيام شما</span></td>
</tr>
<tr>
<td height="23" colspan="2">
<p align="center">
<textarea rows="15" name="Comments" cols="49" id="Comments" style="border-style: solid;
border-width: 1px; float: right; color: #000080; font-family: Tahoma;
font-size: 9pt" dir="rtl" size="31" type="text"></textarea></td>
</tr>
</table>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="submit" value="ارسال اطلاعات">
<input type="reset" value="پاک کردن "> </p>
</div>
</td>
</tr>
</table>
</div>
</form>
</html>
يك فايل با نام email.php ايجاد كرده و كدهاى زير را در آن قرار مى دهيم . اين فايل محتويات ايميل ارسال شده توسط كاربر را درون ايميل شما نشان ميدهد .
کد php:
<?
#be name Khoda
#Lotfan Code zir ra taghyeer nadahid ,
#baraye tanzimat az File "mail.conf.php" ra virayesh konid
############################
include 'mail.conf.php';
############################
$top='<html dir="rtl">
<head>
<meta http-equiv="Content-Language" content="fa">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div align="center">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Tahoma" size="1" color="#003366">به نام خدا</font></p>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Tahoma" size="1" color="#003366">محتویات فرم ارسال شده</font></b></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="1"> </font></p>
<table border="0" cellpadding="0" style="border-collapse: collapse" width="500" height="20" bordercolor="#000000" id="table1">
<tr>
<td width="161" height="24" style="border-style: solid; border-width: 1px" bgcolor="#F4F4F4" bordercolor="#333333">
<p align="center" style="margin: 2px 5px"><b>
<font face="Tahoma" style="font-size: 9pt">نام گزینه</font></b></td>
<td height="24" style="border-style: solid; border-width: 1px" bgcolor="#F4F4F4" bordercolor="#333333">
<p align="center" style="margin: 2px 5px"><b>
<font face="Tahoma" style="font-size: 9pt"> اطلاعات وارد شده توسط
کاربر</font></b></td>
</tr>';
##############################
$body=' <tr>
<td width="161" style="border-style: solid; border-width: 1px" height="24" bordercolor="#333333">
<p align="center" style="margin: 2px 5px"><span>
<font face="Tahoma" style="font-size: 9pt">%field</font></span></td>
<td style="border-style: solid; border-width: 1px" height="24" bordercolor="#333333">
<p align="justify" style="margin: 2px 10px; "><span>
<font face="Tahoma" style="font-size: 9pt">%info</font></span></td>
</tr>';
##############################
$footer=' </table>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"><b><font face="Tahoma" size="1"> </font></b></div>
<div align="center">
<table border="0" cellpadding="0" style="border-collapse: collapse" width="500" height="20" bordercolor="#000000" id="table2">
<tr>
<td height="25" style="border-style: solid; border-width: 1px" bgcolor="#F2CC84" colspan="2" bordercolor="#333333">
<p style="margin-top: 0; margin-bottom: 0" align="center"><b>
<font face="Tahoma" size="1" color="#800000">مشخصات کاربر</font></b></p>
</td>
</tr>
<tr>
<td width="161" height="25" style="border-style: solid; border-width: 1px" bordercolor="#333333">
<p align="center" style="margin: 2px 5px">
<font face="Tahoma" style="font-size: 9pt">آدرس آی پی</font></td>
<td height="25" style="border-style: solid; border-width: 1px" bordercolor="#333333">
<p align="center" style="margin: 2px 5px"><span>
<font face="Tahoma" style="font-size: 9pt">%ip</font></span></td>
</tr>
<tr>
<td width="161" style="border-style: solid; border-width: 1px" height="25" bordercolor="#333333">
<p align="center" style="margin: 2px 5px">
<font face="Tahoma" style="font-size: 9pt">لینک معرف</font></td>
<td style="border-style: solid; border-width: 1px" height="25" bordercolor="#333333">
<p align="center" style="margin: 2px 5px"><span>
<font face="Tahoma" style="font-size: 9pt">%link</font></span></td>
</tr>
</table>
<p align="center" style="margin: 2px 5px"> <p align="center" style="margin: 2px 5px"> </div>
<p align="center"> </p>
</body>
</html>';
##############################
if (isset($_POST['email']))
$email=$_POST['email'];
else
$email=$from;
if (isset($_POST['subject']))
$subject=$_POST['subject'];
##############################
$header='From: "'.$email.'" <'.$email.">\r\n"
.'Reply-To: "'.$email.'" <'.$email.">\r\n"
.'To:<'.$to.">\r\n"
."Mime-Version: 1.0\r\n"
."Content-type: text/html; charset=utf-8\r\n"
."Content-Transfer-Encoding: 7bit\r\n";
##############################
$main='';
foreach($_POST as $k => $v)
{
$lists=$body;
$lists=ereg_replace('%field',$k,$body);
$lists=ereg_replace('%info',$v,$lists);
$main .=$lists;
}
#############################
$ip= $_SERVER['REMOTE_ADDR'];
$link=$_SERVER['HTTP_REFERER'];
$footer=ereg_replace('%ip',$ip,$footer);
$footer=ereg_replace('%link',$link,$footer);
$body=$top.$main.$footer;
mail($to,$subject,$body, $header);
header("location: $redirect")
?>
يك فايل جديد ديگر با نام mail.conf.php ايجاد كرده و كدهاى زير را در آن قرار مي دهيم . اين صفحه تنظيمات مربوط به ايميل شما هست كه بايد ايميل آدرس خودتان را به همراه متن موضوع ارسال شده و آدرس صفحه ى تشكر از پيام ارسال شده توسط كاربر را تعيين كنيد .
کد php:
<?
#####################################################
# ghabl az estefadeh etellat zir ra tanzim nemayeed.#
# Chenancheh dar Form khod fiedhayee ba name #
#"email" , "subject" dashete bashid, bejaye #
# meghdar haye zir az meghdare vared shode dar form #
# estefadeh khahad shod. #
######## Copyright 2005.ww.siqma.com ################
$to='your-email@gmail.com';
$subject='contact';
$redirect='/contact/success.htm';
$from='From Email';
#####################################################
?>
تنظيمات اصلي فايل در اين قسمت صورت ميگيرد . آدرس ايميل در to و موضوع نامه در subject و آدرس پيغام نامه فرستاده شد در redirect
کد php:
$to='your-email@gmail.com';
$subject='contact';
$redirect='/contact/success.htm';
$from='From Email';
کد php:
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ارسال پيام</title>
<style>
td { font-family: Tahoma; font-size: 9pt }
textarea { font-family: Tahoma; font-size: 8pt }
input { font-family: Tahoma; font-size: 8pt }
</style>
</head>
<style fprolloverstyle>A:hover {color: #FF0000; font-family: Tahoma; font-size: 9pt}
</style>
<div align="center">
<table border="0" cellpadding="0" style="border-collapse: collapse" width="220" height="20" bordercolor="#000000" id="table1">
<tr>
<td style="border-style: solid; border-width: 0px">
<div align="center">
<p style="margin-top: 0; margin-bottom: 0">
<img border="0" src="/contact/img/MsgSent.gif" width="128" height="105"></p>
<p style="margin-top: 0; margin-bottom: 0" dir="rtl">
<font color="#0000FF"><b> پيام شما با موفقيت ارسال
گرديد . بزودي با شما تماس ميگيريم .</b></font></p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0">
<img border="0" src="/contact/img/thanx.gif" width="50" height="37"></p>
<p style="margin-top: 0; margin-bottom: 0">
</p>
<p style="margin-top: 0; margin-bottom: 0">
</p>
<p style="margin-top: 0; margin-bottom: 0">
<BODY>
<p>
<a href="javascript:window.close();">
<span style="text-decoration: none">بستن صفحه</span></a>
<!-- END Script Size: 0.50 KB -->
</p>
<p style="margin-top: 0; margin-bottom: 0"> </div>
</td>
</tr>
</table>
</div>
</html>
منبع : http://www.sepna.com/thread-149.html
شما ميتوانيد صفحه تماس با ما را در كنترل پنل كاربر يا صفحه اصلي نمايش بدهيد . با اضافه كردن لينك و كدهاي زير .
وارد مسير زير بشويد :
كنترل پنل مديريت >> قالب ها و پوسته ها >> انتخاب قالب >> User Control Panel Templates
كليك كنيد و usercp_nav را كليك كرده و كدهاى زير را پيدا كنيد
کد php:
<tr>
<td class="trow1 smalltext"><a href="usercp.php" class="usercp_nav_item usercp_nav_home"><b>{$lang->ucp_nav_home}</b></a></td>
</tr>
کد php:
<tr>
<td class="trow1 smalltext"> <img border="0" src="Your-image.gif" > <a onclick="window.open ('http://www.your-site.com/contact/',null,'width=420, height=450, scrollbars=no, resizable=no');" href="javascript:void(0)" >
<b> تماس سريع با مديريت </b> </a></td>
</tr>
شما ميتوانيد صفحه تماس با ما را در كنترل پنل كاربر يا صفحه اصلي نمايش بدهيد . با اضافه كردن لينك و كدهاي زير .
وارد مسير زير بشويد :
كنترل پنل مديريت >> قالب ها و پوسته ها >> انتخاب قالب >> User Control Panel Templates
كليك كنيد و usercp_nav را كليك كرده و كدهاى زير را پيدا كنيد
کد php:
<tr>
<td class="trow1 smalltext"><a href="usercp.php" class="usercp_nav_item usercp_nav_home"><b>{$lang->ucp_nav_home}</b></a></td>
</tr>
کد php:
<tr>
<td class="trow1 smalltext"> <img border="0" src="Your-image.gif" > <a onclick="window.open ('http://www.your-site.com/contact/',null,'width=420, height=450, scrollbars=no, resizable=no');" href="javascript:void(0)" >
<b> تماس سريع با مديريت </b> </a></td>
</tr>