วันพุธที่ 21 กุมภาพันธ์ พ.ศ. 2567

วิธีตั้งค่า CRONJOB ใน DA สำหรับเช็ค Force change pass

 - ช่อง command ใช้คำสั่ง

php /home/admin/domains/panel.technologyland.co.th/public_html/testfunction/cronfcp.php

 - ช่อง minute ใส่ 0

- ช่อง Hours ใส่ 1 = 08.00 , 6 = 13.00

วิธีเพิ่ม code force change password สำหรับ WEBMAIL

 สร้างไฟล์ condb.php เพื่อเชื่อม DB


ไฟล์ที่ 1 /var/www/html/index.php

- เพิ่ม code บรรทัด ที่ 48 ในไฟล์ index.php

include('condb.php');

- เพิ่มฟังก์ชั่น getRandomStringShuffle (ใช้สร้าง token) กับ disableuser (ใช้ disable user)

function getRandomStringShuffle($length = 50)
{
    $stringSpace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $stringLength = strlen($stringSpace);
    $string = str_repeat($stringSpace, ceil($length / $stringLength));
    $shuffledString = str_shuffle($string);
    $randomString = substr($shuffledString, 1, $length);
    return $randomString;
}


function disableuser($user){
    $email = [];
    array_push($email,$user);
    $data = json_encode($email);

    $curl = curl_init("https://panel.technologyland.co.th/api/alertdisable.php");
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    $headers[] = 'Content-Type: application/*+json';
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    $response = curl_exec($curl);
    $resultStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    curl_close($curl);

    
}


- เพิ่ม code ทั้งหมด ไว้หลัง code ในภาพ


 

        $key_session = $obj->getRandomStringShuffle(); // เรียกใช้ฟังก์ชั่น สร้าง Token
        $exp_key_session = date("Y-m-d H:i:s",strtotime("+5 minutes")); // กำหนดเวลาหมดอายุ 5 นาที
       

        // เช็คสถานะ force change ใน db
        $sql_q = "SELECT token,key_session,expire_key_session,status,policy_pass FROM `tb218_force_change_password` WHERE user_name like '".$_SESSION['username']."' AND policy_pass = '1001' LIMIT 1";
        $a = mysqli_query( $connect, $sql_q );
        $result =mysqli_fetch_array($a,MYSQLI_ASSOC);

        // สร้าง url เพื่อใช้สำหรับ redirect ในหน้า force change password
        $url = 'http' . (($_SERVER['HTTPS'] == 'on') ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

        // เช็คว่ามี สถานะ force change หรือไม่ ถ้ามีก้อเข้าเงื่อนไข
        if($a->num_rows > 0 && $result['status'] == 'no'){
            $u = array("token"=>$result['token'],"key_session"=>$key_session,"policy"=>$result['policy_pass'],"url" => $url);
            $urlArray = urlencode(base64_encode(json_encode($u)));
            $sql_u = "UPDATE `tb218_force_change_password` SET `key_session` = '$key_session',expire_key_session = '$exp_key_session',session_expired = 'no' WHERE user_name like '".$_SESSION['username']."' AND policy_pass = '1001'";
            $b = mysqli_query( $connect, $sql_u );
            $disables = $obj->disableuser($_SESSION['username']);
            $RCMAIL->logout_actions();
            $RCMAIL->kill_session();
            
            header('Location: https://panel.technologyland.co.th/forcechangepass/fchp.php?u='.$urlArray);
            exit();
        } else {
           
            $sql_q = "SELECT token,key_session,expire_key_session,status,policy_pass,date_reset_password FROM `tb218_force_change_password` WHERE user_name like '".$_SESSION['username']."' AND policy_pass != '1001' LIMIT 1";
            $a = mysqli_query( $connect, $sql_q );
            $result =mysqli_fetch_array($a,MYSQLI_ASSOC);
            if($a->num_rows > 0){
                $reset_date = strtotime(date($result['date_reset_password']));
                $date_now = strtotime(date('Y-m-d'));
                if($date_now >= $reset_date  ){
                    $u = array("token"=>$result['token'],"key_session"=>$key_session,"policy"=>$result['policy_pass'],"time" => date("Y-m-d H:i:s"),"username" => $_SESSION['username'],"url" => $url);
                    $urlArray = urlencode(base64_encode(json_encode($u)));
                    $sql_u = "UPDATE `tb218_force_change_password` SET `key_session` = '$key_session',expire_key_session = '$exp_key_session',session_expired = 'no' WHERE user_name like '".$_SESSION['username']."' AND policy_pass = '".$result['policy_pass']."'";
                    $b = mysqli_query( $connect, $sql_u );
                    $disables = $obj->disableuser($_SESSION['username']);
                    $RCMAIL->logout_actions();
                    $RCMAIL->kill_session();
                    
                    header('Location: https://panel.technologyland.co.th/forcechangepass/fchp.php?u='.$urlArray);
                    exit();
                }
            }
        }

======================================================================

ไฟล์ที่ 2 /var/www/html/skins/larry/templates/login.html

เพิ่มcode ด่านลงในปุ่ม log in 

oncliick="clicklogin()"

เพิ่ม code ด้านล่างใน <form>

id="form-login"

 เพิ่ม script ด้านล่างสุดของ ไฟล์

<script>
function clicklogin(){
  var user = document.getElementById("rcmloginuser").value;
  var pass = document.getElementById("rcmloginpwd").value;
  //           form_login.submit();
  // console.log(val);
 
  const payload_jwt_data_checkpay = {
                user:user,
                pass: pass
            };
     
  // console.log(val);
  const options = {
        method: 'POST',
        headers: {accept: 'application/json', 'content-type': 'application/*+json'},
        body: JSON.stringify(payload_jwt_data_checkpay)
        };
        fetch('https://panel.technologyland.co.th/api/alertactive.php', options)
        .then(response => response.json())
          .then(data => {
        // console.log(data); // แสดงข้อมูล JSON จาก then ข้างบน
       
        var form_login = document.getElementById("form-login");
            form_login.submit();
        
        // document.getElementById("test_checkpay").value = data.payload;
        // console.log(parseJwt(data.payload));
        
        })
        
    
  }

</script>
 

วันพุธที่ 27 ธันวาคม พ.ศ. 2566

การตั้งค่าอีเมล์บนโปรแรกม Outlook สำหรับโดเมน logistplus.co.th

แก้ไขตรงส่วน  incoming และ outgoing เป็น 

incoming : private-logistplus.technologyland.co.th

outgoing : private-logistplus.technologyland.co.th




ส่วน port ตั้งค่าดังนี้ครับ

POP : 110
IMAP : 143

SMTP : 587




วันจันทร์ที่ 4 ธันวาคม พ.ศ. 2566

วิธีการแก้ไขชื่อโดเมน ในโปรแกรม MS Outlook

 1. ดำเนินการค้นหา control ในเครื่องคอม > จากนั้นกด Open



2. หาหัวข้อ Mail แล้ว กดเข้าที่หัวข้อ Mail



3. กดเข้าที่ Email Account



4. กด ดับเบิ้ลคลิก เข้าที่ชื่ออีเมล์ ที่ต้องการแก้ไข



5. แก้ไขตรงส่วน ชื่อโดเมนให้เป็นชื่อโดเมนใหม่ แล้วกด Next เป็นอันเสร็จสิ้น





วิธีแก้ไขค่า incoming และ outgoing บนโปรแกรม MS Outlook

1. ดำเนินการค้นหา control ในเครื่องคอม > จากนั้นกด Open



2. หาหัวข้อ Mail แล้ว กดเข้าที่หัวข้อ Mail



3. กดเข้าที่ Email Account



4. กด ดับเบิ้ลคลิก เข้าที่ชื่ออีเมล์ ที่ต้องการแก้ไข



5. แก้ไขตรงส่วน  incoming และ outgoing เป็น 25.technologyland.co.th แล้วกด Next เป็นอันเสร็จสิ้น




วันอังคารที่ 4 เมษายน พ.ศ. 2566

ลายเซ็นต์หรือคำลงท้ายอีเมลควรมีอะไรบ้าง ?

การใช้งาน Email Hosting ผ่านโปรแกรมต่าง ๆ สมัยนี้นั้น เราสามารถตั้งค่าลายเซ็นต์หรือคำลงท้ายของเรานั้นใส่ในอีเมลบริษัทของเราได้ แต่ว่าในลายเซ็นต์หรือคำลงท้ายอีเมลนั้นควรใส่ข้อมูลใดบ้างและมีอะไรบ้างที่ไม่ควรใส่

ข้อมูลที่ควรใส่ในลายเซ็นต์หรือคำลงท้ายอีเมล

  • คำลงท้าย  เช่น Regards เป็นต้น
  • Slogan ของบริษัท (หากมี) 
  • สินค้าที่บริษัทมีขายหรือให้บริการ (หากมี)
  • ชื่อและที่อยู่ของบริษัทที่ใช้สำหรับติดต่อ
  • ข้อมูลการติดต่อต่าง ๆ เช่น อีเมลบริษัท เบอร์โทรศัพท์ของบริษัท และ เว็บไซต์ เป็นต้น

ข้อมูลที่ไม่ควรใส่ในลายเซ็นต์หรือคำลงท้ายอีเมล

  • รูปภาพ หรือ Logo บริษัท เนื่องจากในการส่งอีเมลนั้นบางอีเมลนั้นอาจไม่อนุญาตให้ส่งไฟล์รูปภาพ หรือ Logo นั้น ๆ จึงทำให้ภาพไม่ขึ้น หรือ ขึ้นเป็นรูปภาพ X ทำให้อีเมลบริษัทนั้นดูไม่เป็น Professional
  • เบอร์โทรศัพท์ส่วนตัว เนื่องจากเป็นอีเมลบริษัท หากใส่เบอร์ส่วนตัวไป อาจทำให้อีเมลบริษัทนั้นดูไม่เป็น Professional

ข้อมูลโดยสรุป

ข้อมูลที่ควรใส่ในลายเซ็นต์หรือคำลงท้ายอีเมลนั้น ควรเป็นข้อมูลที่พูดถึงเกี่ยวกับสินค้าและตัวของบริษัท และก็อย่าลืมที่จะต้องมีคำลงท้าย เพื่อแสดงความอ่อนน้อมอยู่ในนั้นด้วย


วันพุธที่ 1 มิถุนายน พ.ศ. 2565

[Thunderbird]เพิ่มบัญชีอีเมล Type IMAP


1. เข้าไปที่โปแกรม Thunderbird เลือก Account Setting


2. กดที่ Account Setting ตรงแทบซ้ายมือ เลือก Add Mail Account..




3. ใส่ข้อมูล ชื่ออีเมล และรหัสผ่าน ตามภาพ จากนั้นเลือก Configure Manually



4. กรอกข้อมูลตามตามรายละเอียดดังนี้
Incoming Server
Protocol : IMAP
Hostname : imap.permarflex.co.th
Port : 143
Connection Security : None
Authentication method : Normal password
Outgoing Server
Protocol : SMTP
Hostname : smtp.permarflex.co.th
Port : 587
Connection Security : None
Authentication method : Normal password

ทบทวนข้อมูลให้ถูกต้อง จากนั้นกด Done




5. เมื่อมี POPUP ตามภาพขึ้นมา เลือก I Understand the risks แล้วกด Confirm



6. กด Finish