- ชื่อ: Contact Page
- ผู้เขียน: vbgamer45
- นำเสนอโดย: ไม่พบสมาชิก ID:27!
- ประเภท: New Feature
- รองรับ: SMF 1.1.xx, 2.0.xx
- ปรับปรุงล่าสุด: 2 เมษายน 2553
- ต้นฉบับ: Contact Page
รายละเอียด ฟอร์มติดต่อผู้ดำเนินการฟอรั่มเพิ่มความสะดวกให้กับผู้ใช้งานอีกช่องทางหนึ่งที่จะส่ง e-mail ถึงผู้ดำเนินการฟอรั่ม และทั้งยังสามารถสนทนาตอบโต้กับผู้ดำเนินการฟอรั่มโดยตรงด้วย MSN
ตัวอย่าง
แก้ไขไฟล์:file $board/index.php
ค้นหา -->>
'coppa' => array('Register.php', 'CoppaForm'),
เพิ่มไว้หลัง -->>
'contact' => array('Contact.php', 'Contact'),
file Sources/ManagePermissions.php
ค้นหา -->>
'karma_edit' => false,
เพิ่มไว้ก่อน -->>
'view_contact' => false,
ค้นหา -->>
'who_view',
เพิ่มไว้ก่อน -->>
'view_contact',
file Sources/Subs.php
ค้นหา -->>
$context['allow_calendar'] = allowedTo('calendar_view') && !empty($modSettings['cal_enabled']);
เพิ่มไว้ก่อน -->>
$context['allow_view_contact'] = allowedTo('view_contact');
file Themes/default/index.template.php
ค้นหา -->>
$current_action = 'admin';
if (in_array($context['current_action'], array(
เพิ่มไว้หลัง -->>
'contact',
ค้นหา -->>
// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
</td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
เพิ่มไว้หลัง -->>
// the [contact] button
if ($context['allow_view_contact'])
echo ($current_action == 'contact' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'contact' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=contact">' , $txt['smfcontact_contact'] , '</a>
</td>' , $current_action == 'contact' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
file Themes/default/languages/Modifications.thai.php หรือ Themes/default/languages/Modifications.thai-utf8.php
ค้นหา -->>
?>
เพิ่มไว้ก่อน -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Comสร้างไฟล์ Contact.php ใส่ code ด้านล่างนี้ แล้วนำไปไว้ที่โฟลเดอร์ Sources
<?php
/*
Contact Page
Version 2.0
by:vbgamer45
http://www.smfhacks.com
*/
if (!defined('SMF'))
die('Hacking attempt...');
function Contact()
{
global $context, $mbname, $webmaster_email, $txt, $sourcedir, $modSettings, $scripturl;
// Check if the current user can send a message
isAllowedTo('view_contact');
if (isset($_GET['sa']))
{
if ($_GET['sa'] == 'save')
{
// Check whether the visual verification code was entered correctly.
if ((empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1) && (empty($_REQUEST['visual_verification_code']) || strtoupper($_REQUEST['visual_verification_code']) !== $_SESSION['visual_verification_code']))
{
$_SESSION['visual_errors'] = isset($_SESSION['visual_errors']) ? $_SESSION['visual_errors'] + 1 : 1;
if ($_SESSION['visual_errors'] > 3 && isset($_SESSION['visual_verification_code']))
unset($_SESSION['visual_verification_code']);
fatal_lang_error('visual_verification_failed', false);
}
elseif (isset($_SESSION['visual_errors']))
unset($_SESSION['visual_errors']);
$from = $_POST['from'];
if ($from == '')
fatal_error($txt['smfcontact_errname'], false);
$subject = $_POST['subject'];
if ($subject == '')
fatal_error($txt['smfcontact_errsubject'], false);
$message = $_POST['message'];
if ($message == '')
fatal_error($txt['smfcontact_errmessage'], false);
$email = $_POST['email'];
if ($email == '')
fatal_error($txt['smfcontact_erremail'], false);
$subject = htmlspecialchars($subject, ENT_QUOTES);
$message = htmlspecialchars($message, ENT_QUOTES);
$from = htmlspecialchars($from, ENT_QUOTES);
$email = htmlspecialchars($email, ENT_QUOTES);
$m = $txt['smfcontact_form'] . $mbname . " \n";
$m .= $txt['smfcontact_formname'] . $from . "\n";
$m .= $txt['smfcontact_formemail'] . $email . "\n";
$m .= $txt['smfcontact_ip'] . $_SERVER['REMOTE_ADDR'] . "\n";
$m .= $txt['smfcontact_formmessage'];
$m .= $message;
$m .= "\n";
// For send mail function
require_once($sourcedir . '/Subs-Post.php');
// Send email to webmaster
sendmail($webmaster_email, $subject, $m,$email);
// Show template that mail was sent
loadtemplate('Contact');
// Load the main contact template
$context['sub_template'] = 'send';
// Set the page title
$context['page_title'] = $mbname . $txt['smfcontact_titlesent'];
}
}
else
{
// Load the main Contact template
loadtemplate('Contact');
// Language strings
loadLanguage('Login');
// Load the main Contact template
$context['sub_template'] = 'main';
// Set the page title
$context['page_title'] = $mbname . ' - ' . $txt['smfcontact_contact'];
// Generate a visual verification code to make sure the user is no bot.
$context['visual_verification'] = empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1;
if ($context['visual_verification'])
{
$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand());
// Only generate a new code if one hasn't been set yet
if (!isset($_SESSION['visual_verification_code']))
{
// Skip I, J, L, O and Q.
$character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P'), range('R', 'Z'));
// Generate a new code.
$_SESSION['visual_verification_code'] = '';
for ($i = 0; $i < 5; $i++)
$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
}
}
}
}
?>
สร้างไฟล์ Contact.template.php ใส่ code ด้านล่างนี้ แล้วนำไปไว้ที่ Themes/default อย่าลืม Encoding เป็น UTF-8
<?php
/*
Contact Page Version 1.1
by: vbgamer45 http://www.smfhacks.com
Edit by: ~๏ Sάιח† ๏~
*/
function template_main()
{
global $scripturl, $txt, $context;
// MSN Live Chat
echo '
<table width="100%" align="center">
<tr>
<td align="center">';
echo '
</td>
</tr>
</table><br />';
// Send e-mail to Admin
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
';
if ($context['visual_verification'])
{
echo '
function refreshImages()
{
// Make sure we are using a new rand code.
var new_url = new String("', $context['verificiation_image_href'], '");
new_url = new_url.substr(0, new_url.indexOf("rand=") + 5);
// Quick and dirty way of converting decimal to hex
var hexstr = "0123456789abcdef";
for(var i=0; i < 32; i++)
new_url = new_url + hexstr.substr(Math.floor(Math.random() * 16), 1);';
if ($context['use_graphic_library'])
echo '
document.getElementById("verificiation_image").src = new_url;';
else
echo '
document.getElementById("verificiation_image_1").src = new_url + ";letter=1";
document.getElementById("verificiation_image_2").src = new_url + ";letter=2";
document.getElementById("verificiation_image_3").src = new_url + ";letter=3";
document.getElementById("verificiation_image_4").src = new_url + ";letter=4";
document.getElementById("verificiation_image_5").src = new_url + ";letter=5";';
echo '
}';
}
echo '
// ]]></script>
<form method="POST" action="', $scripturl, '?action=contact&sa=save">
<table border="0" cellpadding="0" cellspacing="0" width="60%" height="129" align="center" class="tborder">
<tr>
<td width="50%" colspan="2" height="19" align="center" class="catbg">
<b>',$txt['smfcontact_contact'],'</b></td>
</tr>
<tr>
<td width="28%" height="19" class="windowbg2"><span class="gen"><b>',$txt['smfcontact_name'],'</b></span></td>
<td width="72%" height="19" class="windowbg2"><input type="text" name="from" size="64" /></td>
</tr>
<tr>
<td width="28%" height="22" class="windowbg2"><span class="gen"><b>',$txt['smfcontact_subject'],'</b></span></td>
<td width="72%" height="22" class="windowbg2"><input type="text" name="subject" size="64" /></td>
</tr>
<tr>
<td width="28%" height="19" valign="top" class="windowbg2"><span class="gen"><b>',$txt['smfcontact_body'],'</b></span></td>
<td width="72%" height="19" class="windowbg2"><textarea rows="6" name="message" cols="54"></textarea></td>
</tr>';
if ($context['visual_verification'])
{
echo '
<tr>
<td width="40%" align="top" class="windowbg2">
<b>', $txt['visual_verification_label'], ':</b>
<div class="smalltext">', $txt['visual_verification_description'], '</div>
</td>
<td class="windowbg2">';
if ($context['use_graphic_library'])
echo '
<img src="', $context['verificiation_image_href'], '" alt="', $txt['visual_verification_description'], '" id="verificiation_image" /><br />';
else
echo '
<img src="', $context['verificiation_image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verificiation_image_1" />
<img src="', $context['verificiation_image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verificiation_image_2" />
<img src="', $context['verificiation_image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verificiation_image_3" />
<img src="', $context['verificiation_image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verificiation_image_4" />
<img src="', $context['verificiation_image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verificiation_image_5" />';
echo '
<input type="text" name="visual_verification_code" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';
}
echo '
<tr>
<td width="28%" height="22" class="windowbg2"><span class="gen"><b>',$txt['smfcontact_emailaddress'],'</b></span></td>
<td width="72%" height="22" class="windowbg2"><input type="text" name="email" size="64" /></td>
</tr>
<tr>
<td width="28%" colspan="2" height="26" align="center" class="windowbg2">
<input type="submit" value="',$txt['smfcontact_sendemail'],'" name="submit" /></td>
</tr>
</table>
</form>
';
//Copryright keep it please. Helps support the mod making for SMF
echo '<br /><div align="center"><a href="http://www.smfhacks.com" target="blank">Contact Page</a></div>';
}
function template_send()
{
global $scripturl, $txt;
echo '
<div>
<table border="0" width="80%" cellspacing="0" align="center" cellpadding="4" class="tborder">
<tr class="titlebg">
<td>',$txt['smfcontact_messagesent'],'</td>
</tr>
<tr class="windowbg">
<td style="padding: 3ex;">
',$txt['smfcontact_messagesent_click'],'<a href="', $scripturl, '">',$txt['smfcontact_messagesent_return'] ,'
</td>
</tr>
</table>
</div>';
}
?>
เพิ่ม MSN Live Chat1. คุณต้องมี MSN Account ก่อน.. ถ้าไม่มี =>
สมัครสมาชิก MSN ที่นี่2. ไปที่ --> http://settings.messenger.live.com/Applications/Default.aspx
3. คลิกเมนู Web Settings
- เลือก Allow websites to see your Messenger status and send you messages
- กด Save
4. คลิกเมนู Create HTML
- เลือก Display ที่คุณต้องการ
- IM Window = สร้างหน้าต่าง MSN Live Chat สำหรับคุยหน้าเว็บ
- Button = ปุ่มเพื่อแสดงหน้าต่าง POP UP ของ MSN ขึ้นมา
- Status icon = แสดงสถานะออนไลน์ MSN
- เลือกขนาดและสีตามใจชอบ
file Themes/default/Contact.template.php
ค้นหา -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Comแล้วนำ code ที่ได้
เพิ่มหลัง code ด้านบน
** หากต้องการให้ MSN เป็นภาษาไทย **ค้นหา-->>
messenger.live.com&mkt=en-US
แก้เป็น -->>
messenger.live.com&mkt=th-TH
ตั้งค่าการใช้งานผู้ดูแล --> แก้ไขการอนุญาต --> เลือกกลุ่มสมาชิกที่คุณต้องการ --> ในหมวดทั่วไป เลือก ให้ใช้งานเมนูติดต่อผู้ดูแล
ขอขอบคุณคุณ
tongengคุณ
มีนลิงค์หัวข้อ:
http://dexmore.com/topic/378