SONTAYA'P BLOGGER

IT Digital lifestyle

SMF – การติดตั้ง reCAPTCHA สำหรับ SMF (ก่อนที่จะกดปุ่ม Post)

bySONTAYA May 21, 2011 WordPress/SMF

การติดตั้ง reCAPTCHA สำหรับ SMF

กรณีใช้ reCAPTCHA ในหน้าสมัครสมาชิกสามารถดาวน์โหลด mod ได้ที่
//custom.simplemachines.org/mods/index.php?mod=1044

แต่ผมจะแนะนำก็คือ การนำ reCAPTCHA มาใช้งานขณะผู้เยี่ยมชมตั้งกระทู้หรือตอบกระทู้

1. สมัครสมาชิกได้ที่ reCAPTCHA Register

หลังจากสมัครเสร็จคุณจะได้รับ Public Key และ Private Key (ใช้ติดต่อสื่อสารระหว่างเซิร์ฟเวอร์และเซิร์ฟเวอร์ของเรา ทำให้ลับยิ่งขึ้น)

2. ดาวน์โหลด  reCAPTCHA PHP library ไฟล์สำหรับ PHP

3. แตกไฟล์ library แล้วอับโหลดไฟล์ recaptchalib.php (ใช้ไฟล์เดียว)

– สร้างไดร์เรอทอรี ชื่อ captcha ที่รูท forum
– อับโหลดไฟล์ recaptchalib.php ไปยัง ไดร์เรอทอรี captcha

4. ดาวน์โหลดไฟล์ Post.template.php

/Themes/default/Post.template.php

ค้นหา
[php]
// Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
if (!empty($modSettings[‘attachmentCheckExtensions’]))
echo ‘
‘, $txt[‘smf120’], ‘: ‘, $context[‘allowed_extensions’], ‘
‘;
echo ‘
‘, $txt[‘smf121’], ‘: ‘, $modSettings[‘attachmentSizeLimit’], ‘ ‘ . $txt[‘smf211’], !empty($modSettings[‘attachmentNumPerPostLimit’]) ? ‘, ‘ . $txt[‘maxAttachPerPost’] . ‘: ‘ . $modSettings[‘attachmentNumPerPostLimit’] : ”, ”; 

}
[/php]
พิมพ์ต่อท้าย
[php]
// Start; Recaptcha on Guest Posts
echo ‘ 

‘;
if ($context[‘user’][‘is_guest’]) {

require_once(‘captcha/recaptchalib.php’);
$publickey = "your public key"; // you got this from the signup page
echo recaptcha_get_html($publickey);
}
// End; Recaptcha on Guest Posts
[/php]

บรรทัด $publickey = “your public key”; // ให้ระบุ Public Key คุณ

5. ดาวน์โหลดไฟล์ Post.php

/Sources/Post.php

ค้นหา
[php]
"function Post2()"
[/php]

แล้วเพิ่ม
[php]
//reCAPTCHA
require_once(‘captcha/recaptchalib.php’);
$privatekey = "your_private_key";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[‘REMOTE_ADDR’],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]); 

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn’t entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
[/php]

บรรทัด $privatekey = “your_private_key”; // ให้ระบุ Private Key คุณ

Link of Reference – Using reCAPTCHA with PHP

บทความอื่นๆ ที่เกี่ยวกับการหยุด Spam

หยุด Joomla registration spam

ติดตั้ง MOD httpBL (Stop bots and spammers)

TaggedWordPress/SMF

SMF - Adding menu to SMF

SMF - การติดตั้ง CAPTCHA ร่วมกับ SMF Forum เพื่อป้องกัน Spam Posting

2 thoughts on “SMF – การติดตั้ง reCAPTCHA สำหรับ SMF (ก่อนที่จะกดปุ่ม Post)”

  1. wardnep
    June 13, 2013 at 4:54 pm

    หมายความว่าผู้เข้าเยี่ยมชม (guest) สามารถตั้งหระทู้หรือตอบกระทู้ได้โดยที่ไม่ต้อง registation หรือป่าวครับ? ผมกำลังสนใจประเด็นนี้อยู่

  2. SONTAYA
    June 13, 2013 at 5:11 pm

    น่าจะเข้าใจคงล่ะอย่างกันนะครับ แบบที่คุณเข้าใจ SMF มีฟีเจอร์ทำได้อยู่แล้ว ส่วนเรื่อง reCAPTCHA เป็นตัวเสริมป้องกันพวกสคริปต์ spambot มาโพสต์มั่วๆ ครับ
    e.g //www.susethailand.com/suseforum/

Leave a Reply Cancel reply

You must be logged in to post a comment.

Tag Cloud

3G Android Backup Blognone Chromecast Cloud Comparison CUPS Dell DNS Facebook Firefox Firewall Google Guitar Hacked HP Joomla LGP500 LibreOffice Linux Mozilla Firefox OpenOffice.org Open Source OpenStack openSUSE openSUSE11.3 openSUSE12.1 Peplink Performance Postfix Printer Samsung Security Storage SUSE SUSE Enterprise Desktop SUSE Enterprise Server SUSE Linux Enterprise Switch Thin client Tips VMware WordPress WordPress/SMF

Comments

  • Narupon Pattapat on การ cleaning the imaging unit หรือ Drum (Imaging Unit)
  • 76Rusty on แอพ aVia Media Player Pro และ Pocket Casts 4 อนาคตอาจรองรับ Chromecast
  • JindaTheme on CloudFlare คืออะไร?
  • viva3388 on CloudFlare คืออะไร?
  • SONTAYA on Linux Foundation T-Shirt มาแล้ว

Categories

  • Android (7)
  • Joomla (9)
  • LibreOffice/OpenOffice.org (16)
  • Linux (159)
  • Music (16)
  • News (55)
  • Office (55)
  • Online Marketing (3)
  • Personal (232)
  • VMware (5)
  • WordPress/SMF (20)

Archives

  • May 2019
  • March 2019
  • January 2019
  • December 2018
  • September 2018
  • August 2018
  • July 2018
  • April 2018
  • March 2018
  • January 2018
  • December 2017
  • June 2017
  • December 2016
  • November 2016
  • April 2016
  • March 2016
  • February 2016
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • February 2015
  • January 2015
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009

Archives

  • May 2019 (1)
  • March 2019 (1)
  • January 2019 (1)
  • December 2018 (1)
  • September 2018 (1)
  • August 2018 (3)
  • July 2018 (1)
  • April 2018 (1)
  • March 2018 (1)
  • January 2018 (2)
  • December 2017 (1)
  • June 2017 (3)
  • December 2016 (1)
  • November 2016 (1)
  • April 2016 (1)
  • March 2016 (2)
  • February 2016 (1)
  • September 2015 (3)
  • August 2015 (2)
  • July 2015 (7)
  • June 2015 (5)
  • May 2015 (1)
  • April 2015 (1)
  • February 2015 (2)
  • January 2015 (1)
  • November 2014 (3)
  • October 2014 (2)
  • September 2014 (2)
  • August 2014 (1)
  • July 2014 (3)
  • June 2014 (3)
  • May 2014 (2)
  • April 2014 (5)
  • March 2014 (2)
  • February 2014 (5)
  • December 2013 (3)
  • November 2013 (15)
  • October 2013 (15)
  • September 2013 (11)
  • August 2013 (9)
  • July 2013 (26)
  • June 2013 (7)
  • May 2013 (15)
  • April 2013 (6)
  • March 2013 (5)
  • February 2013 (4)
  • January 2013 (2)
  • December 2012 (9)
  • November 2012 (2)
  • October 2012 (4)
  • September 2012 (2)
  • August 2012 (4)
  • June 2012 (3)
  • May 2012 (4)
  • April 2012 (6)
  • March 2012 (14)
  • February 2012 (9)
  • December 2011 (8)
  • November 2011 (6)
  • October 2011 (13)
  • September 2011 (7)
  • August 2011 (10)
  • July 2011 (4)
  • June 2011 (12)
  • May 2011 (26)
  • April 2011 (6)
  • March 2011 (3)
  • February 2011 (4)
  • January 2011 (10)
  • December 2010 (6)
  • November 2010 (4)
  • October 2010 (5)
  • September 2010 (10)
  • August 2010 (5)
  • July 2010 (8)
  • June 2010 (6)
  • May 2010 (4)
  • April 2010 (9)
  • March 2010 (10)
  • February 2010 (8)
  • January 2010 (21)
  • December 2009 (28)
Proudly powered by WordPress | Theme: Showme by NEThemes.