26 พ.ย. 2561

How To Create a Self-Signed SSL Certificate for Apache in Ubuntu

#nano /etc/apache2/sites-available/default-ssl.conf
 
                SSLEngine on

                SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
                SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key 
 
 
 
 #nano /etc/apache2/sites-available/000-default.conf
 
 <VirtualHost *:80>
        . . .

        Redirect "/" "https://your_domain_or_IP/"

        . . .
</VirtualHost>
 
 #a2enmod ssl
 #a2enmod headers
 #a2enconf ssl-params
 #restart apache2

25 มิ.ย. 2561

php multiple insert ผ่าน Checkbox

SQL customer (PHP)
01.CREATE TABLE IF NOT EXISTS `customer` (
02.`CustomerID` varchar(4) NOT NULL,
03.`Name` varchar(50) NOT NULL,
04.`Email` varchar(50) NOT NULL,
05.`CountryCode` varchar(2) NOT NULL,
06.`Budget` double NOT NULL,
07.`Used` double NOT NULL,
08.PRIMARY KEY (`CustomerID`)
09.) ENGINE=MyISAM DEFAULT CHARSET=utf8;
10. 
11.--
12.-- dump ตาราง `customer`
13.--
14. 
15.INSERT INTO `customer` (`CustomerID`, `Name`, `Email`, `CountryCode`, `Budget`, `Used`) VALUES
16.('C001''Win Weerachai''win.weerachai@thaicreate.com''TH', 1000000, 600000),
17.('C002''John  Smith''john.smith@thaicreate.com''UK', 2000000, 800000),
18.('C003''Jame Born''jame.born@thaicreate.com''US', 3000000, 600000),
19.('C004''Chalee Angel''chalee.angel@thaicreate.com''US', 4000000, 100000);

20 มิ.ย. 2561

reCAPTCHA For smf

ติดตั้ง reCAPTCHA หน้าลงทะเบียน
1. ติดตั้ง Mod reCAPTCHA for SMF
2. ไปที่  กระดานสนทนา »ศูนย์ดำเนินการระบบ »Security and Moderation »Anti-Spam
ตรงหัวข้อ  reCAPTCHA Verification System ให้ใส่ Public Key และ  Private Key

18 มิ.ย. 2561

Let's Encrypt RouterOS / Mikrotik

CertBot Let's Encrypt

Install CertBot using official manuals https://certbot.eff.org/#ubuntuxenial-other
for Ubuntu 16.04apt update
apt install software-properties-common -y
add-apt-repository ppa:certbot/certbot
apt update
apt install certbot -y

23 เม.ย. 2561

Backup ข้อมูล ย้อนหลัง 7 วัน

สิ่งที่ต้องเตรียมก่อนใช้

  1. Linux/Unix Only
  2. ติดตั้ง rsync
  3. เครื่อง Backup ต้องสามารถ SSH Without Password เข้าเครื่องเป้าหมายได้ (ลองอ่านอันนี้ หรืออันนี้ดูครับ)
  4. เครื่อง Backup ต้องติดตั้ง PHP (ไม่จำเป็นต้องมี Apache)
  5. เครื่องเป้าหมายควรมี MySQL Tools (พวก mysqldump เป็นต้น) ในกรณ๊ต้องการสำรองข้อมูลจาก MySQL

SSH Key Setup

คัดลอกมาจากเว็ปไซต์ 
https://arnondora.in.th/installing-ssh-key/
เพื่อจดบันทึกไว้
Step 1 สร้าง RSA Key บนเครื่อง
ssh-keygen -t rsa
หลังจากที่เรารันคำสั่งด้านบน มันจะมีถามว่าจะใช้ Save ไฟล์ Key ไว้ที่ไหน ถ้าต้องการเติม Path ของ Key ก็ให้เติมลงไปได้เลย แต่ถ้าไม่ก็กด Enter ได้เลย
Enter file in which to save the key (/home/demo/.ssh/id_rsa):