23 พฤษภาคม 2555, 12:23:00
ยินดีต้อนรับผู้เยี่ยมชม
  • noavata
  • ยินดีต้อนรับคุณ, ผู้เยี่ยมชม กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
    เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
Page Rank

ทำเว็บไซต์ | แต่งบอร์ด | ออกแบบ | SMF | Joomla | Drupal | WordPress | JQuery | CMS | ECommerce | Tel. +668-08577477

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: เพิ่มเมนูติดต่อผู้ดูแล (ส่งอีเมล์และเพิ่ม MSN Live Chat)  (อ่าน 1541 ครั้ง)
0 สมาชิก และ 1 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
*


!NeverDie

United States Minor Outlying Islands   หญิง ผู้เริ่มต้นกระทู้นี้ ออฟไลน์ เว็บไซต์
  • ชื่อ: 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

ค้นหา -->>
โค๊ด: [Select]
'coppa' => array('Register.php', 'CoppaForm'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'contact' => array('Contact.php', 'Contact'),

file Sources/ManagePermissions.php

ค้นหา -->>
โค๊ด: [Select]
'karma_edit' => false,

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]

'view_contact' => false,
ค้นหา -->>
โค๊ด: [Select]
'who_view',

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
'view_contact',

file Sources/Subs.php

ค้นหา -->>
โค๊ด: [Select]
$context['allow_calendar'] = allowedTo('calendar_view') && !empty($modSettings['cal_enabled']);

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
$context['allow_view_contact'] = allowedTo('view_contact');

file Themes/default/index.template.php

ค้นหา -->>
โค๊ด: [Select]
$current_action = 'admin';
if (in_array($context['current_action'], array(

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'contact',

ค้นหา -->>
โค๊ด: [Select]
// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</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 . '">&nbsp;</td>' : '';

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// the [contact] button
if ($context['allow_view_contact'])
echo ($current_action == 'contact' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</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 . '">&nbsp;</td>' : '';

file Themes/default/languages/Modifications.thai.php หรือ Themes/default/languages/Modifications.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com

สร้างไฟล์ Contact.php ใส่ code ด้านล่างนี้ แล้วนำไปไว้ที่โฟลเดอร์ Sources

โค๊ด: [Select]
<?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;
if ($_SESSION['visual_errors'] > && 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($subjectENT_QUOTES);
$message htmlspecialchars($messageENT_QUOTES);
$from htmlspecialchars($fromENT_QUOTES);
$email htmlspecialchars($emailENT_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

โค๊ด: [Select]
<?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 Chat

1. คุณต้องมี 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 เป็นภาษาไทย **

ค้นหา-->>
โค๊ด: [Select]
messenger.live.com&mkt=en-US

แก้เป็น -->>
โค๊ด: [Select]
messenger.live.com&mkt=th-TH

ตั้งค่าการใช้งาน

ผู้ดูแล --> แก้ไขการอนุญาต --> เลือกกลุ่มสมาชิกที่คุณต้องการ --> ในหมวดทั่วไป เลือก ให้ใช้งานเมนูติดต่อผู้ดูแล


ขอขอบคุณ
คุณ tongeng
คุณ มีน

ลิงค์หัวข้อ: http://dexmore.com/topic/378
Windows XP    Firefox 3.5.7   see ip บันทึกการเข้า
ดูรายการสิ่งของบัตรผ่านห้องเกมส์ใช้ได้ 30 วัน  

-:-DexMore.Com แหล่งมั่วสุมทางปัญญา-:-
ส่งหัวข้อนี้พิมพ์ หน้า: 1 
กระโดดไป:  

Creative Commons License

SMF Thai Translation Powered by SMF © 2006–2012, Simple Machines LLC

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : วันนี้ เวลา 00:02:46

jQuery Plugin Copyright © 2551-2555 Themes Design & Hosting by DexMoreGroup

Sitemap | Thai Simple Machines Forum support SMF Thai

Web Begining | SMF Modifications | SMF Thai Translation Web Begining

Drupal | WordPress | CMS Joomla | jQuery Plugin | Web Graphics CMS Joomla