LDAP login with PHP

LDAP ကို PHP မှာ ပါထားပြီးသားဖြစ်ပေမယ့် login ဝင်တာ မရလို့ အတော်ကို တိုင်ပတ်သွားတယ်။ ၁ ပတ်လောက် အချိန်တွေ ကုန်သွားတယ်။ ပုံမှန် LDAP ကို <?php //try to login first $ldaprdn = $request->user_id; $ldappass = $request->password; $ldapconn = ldap_connect(“TNMMADCSRV10P”); if ($ldapconn) { $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); if ($ldapbind) { echo “LOG INE DONE”; } else { echo “CANNOT LOGIN”; } } Code […]

Tech Changes in Feb and March 2021

အခု တလော နည်းပညာ နဲ့ ကျွန်တော် အပါအဝင် တော်တော်များများ အဆက်ပြတ်နေကြပါတယ်။ အဲဒီအတွက် ဒီ ၂ လ အတွင်း နိုင်ငံတကာမှာ ပြောင်းလဲ နေသည့် နည်းပညာ အကြောင်းကို ပြန်လည် ဖော်ပြထားပါတယ်။ Flutter 2 PHP 8 Penpot.app New iPad New Apple M1X on Mac mini Flutter 2 Flutter 2 မှာတော့ web အတွက်ကော desktop အတွက်ပါ ready ဖြစ်လာပါပြီ။ တခါတည်း ရေးပြီး အကုန်လုံးကို export လုပ်သည့် ပုံစံ ဖြစ်လာပါပြီ။​ ပြဿနာကတော့ library တွေ အကုန်လုံးက […]

3DES Encrypt Decrypt with PHP

ပြီးခဲ့သည့် အပတ်က .NET ဘက်ကနေပြီးတော့ TripleDES ကို သုံးပြီး encrypt လုပ်ထားတာကို PHP က ပြန်ဖြည်ဖို့ ဖြစ်လာတယ်။ PHP ရဲ့ default openssl encrypt decrypt က အလုပ်မလုပ်ဘူး။ ဒါနဲ့ ရှာကြည့်တော့ နောက်ဆုံး phpseclib နဲ့ပဲ အဆင်ပြေသွားတယ်။ အရင်ဆုံး composer နဲ့ phpseclib ကို သွင်းဖို့ လိုမယ်။ composer require phpseclib/phpseclib ပြီးရင် composer နဲ့ အခုလို အသုံးပြုနိုင်ပါတယ်။ use phpseclib\Crypt\TripleDES; function encrypt($val,$key) { $des = new \phpseclib\Crypt\TripleDES(\phpseclib\Crypt\Base::MODE_ECB); $key = "HELLO"; $des->setKey($key); […]

Blockchain

Blockchain ဆိုတာ ဘာလဲ သိချင်လို့ ဖတ်ကြည့်တော့ Block Chain နှင့် distributed ledger မတူဘူး ဆိုတာကို နားလည်လာတယ်။ Blockchain ကတော့ ရိုးရိုးရှင်းရှင်းလေးပါပဲ။ Block တစ်ခု နဲ့ တစ်ခု ကို ချိတ်ဆက်ထားသည့် သဘောလေးပါပဲ။ Block တိုင်းမှာ hash တစ်ခုပါတယ်။ နောက်ပြီး အရှေ့ဘက်က hash ပါရှိတယ်။ idea လေးက ရိုးရှင်းပြီး တကယ်ကို အသုံးဝင်ပါတယ်။ crypto currency တွေဖြစ်သည့် bitcoin, ethereum အကြောင်းကိုတော့ ထည့်ပြီး မပြောတော့ပါဘူး။ Code လေးကို တစ်ချက်လောက်ကြည့်ကြည့်ရအောင် class Block { public $data = array(); public […]

Replacement of mcrypt in PHP

PHP 7 မှာ mcrypt ကို သုံးလို့ မရတော့ပါဘူး။ mcrypt အစား openssl_encrypt, openssl_decrypt ကို ပြောင်းသုံးဖို့ လိုပါတယ်။ သို့ပေမယ့် mcrypt နဲ့ encrypt လုပ်ထားတာတွေကို openssl_decrypt နဲ့ ပြန်ဖြည်ရင် အဆင်မပြေ သလို openssl_encrypt နဲ့ လုပ်ထားရင် mcrypt_decrypt နဲ့ ပြန်ဖြည်ရင် လွဲနေတာတွေ ရှိပါတယ်။ အဓိကကတော့ padding ပုံစံ ကွာသွားလို့ပါ။ ဒါကြောင့် system အဟောင်းတွေ မှာ အဆင်ပြေအောင် မူရင်း စာ ကို padding ထပ်ဖြည့်ပေးဖို့လိုပါတယ်။   <?php function aes_128_encrypt($message,$key,$iv) { $message_padded = $message; if […]

After trying Larvel 7 months

PHP ကို မလုပ္ျဖစ္တာ အေတာ့္ကို ၾကာခဲ့ျပီ။ PHP ျပန္လုပ္မယ့္ ဆိုမွ ဘယ္ framework ေတြ ရိွလဲ ျမန္မာႏိုင္ငံမွာ ဘယ္ framework အားေကာင္းလဲဆိုတာ ေလ့လာၾကည့္ေတာ့ Laravel ပဲ။ ကၽြန္ေတာ္ PHP framework ေတြ စထြက္တုန္းက CodeIgniter , Symfony, Cake စတာေတြက အေတာ္ကို ေခတ္စားသည့္ အခ်ိန္။ အဲဒီအခ်ိန္တုန္းကေတာ့ အေတာ္ကို ေရြးရခက္တာ။ CodeIgniter က ေလ့လာရတာ အလြယ္ဆံုးျဖစ္ျပီး share hosting ေတြမွာ တင္လို႕ ရေတာ့ အသံုးျပဳခဲ့တယ္။ အဲဒီ အခ်ိန္ေတြက Digital Ocean လိုမ်ဳိး $10 ေလာက္နဲ႕ VPS ေကာင္းေကာင္းရဖို႕ မလြယ္ဘူး။ […]

Building API You Won’t Hate

ဒီစာအုပ်ကို မဖတ်ခင်တုန်းက အတော့်ကို မျှော်လင့်ထားပါတယ်။ သို့ပေမယ့် တစ်အုပ်လုံး ဖတ်ပြီးသွားသည့် အချိန်မှာတော့ သိပ်ပြီးတော့ အချက်အလက် တွေ မပါပေမယ့် အခုမှ စပြီးတော့ REST API ဆိုတာ ဘာလဲ REST API ဘယ်လို တည်ဆောက် သင့်သလဲ ဆိုတာကို လေ့လာ နေသည့် သူတွေ အတွက် အသုံးဝင်မယ့် စာအုပ်ပါ။ Build API You Won’t Hate ဆိုတဲ့ ခေါင်းစဉ်ထက် How RESTFUL API should be ဆိုရင် စာအုပ်ထဲက စာနဲ့ ခေါင်းစဉ်နဲ့ ကိုက်ပါလိမ့်မယ်။ စာအုပ်ထဲမှာ စိတ်ဝင်စားဖို့ ကောင်းတာက Authentication , Pagination and API […]

Language , framework ? it doesn’t matter

Node.js ကို စသုံးတုန်းကတော့ အတော်ကို သဘောကျပြီးတော့ Node.js နဲ့ ပဲ web ကော script တွေပါ အကုန် ရေးဖြစ်တယ်။ အခု project တစ်ခုကို ပြန်လုပ်တော့ ဘာနဲ့ မြန်မြန်ပြီးမလဲဆိုပြီး စဉ်းစားတော့ slim framework ကို စဉ်းစားမိပြီး slim နဲ့ ပဲ လုပ်လိုက်တာ တော်တော်လေးကို မြန်မြန်ဆန်ဆန် ပြီးသွားတယ်။ Front end ကိုတော့ HTML , jQuery ပဲ သုံးထားပြီး backend ကိုတော့ restful ကို slim နဲ့ လုပ်လိုက်တာ ပြီးသွားတယ်။ Database ကတော့ အရင် အဟောင်း data ရှိတဲ့ အတွက် […]