Monday, September 5, 2016

Limiting Failed Login Attempts on Laravel 5.3

First... let's create a new fresh laravel 5.3...


Create new database config...I'm using xampp here... then do migration...
Next.. create new auth :

After that.... Let's run our laravel and register a new user....
After registering new user, we will automatically log in... So log out first......Then Login at the top right... After that you will be directed to login page... aaand... try to log in with wrong password or wrong email... For laravel 5.3 maksimum login attempt is 5 with locking period 60 seconds

If we want to change this number to 3 with different lockin period, we just have to change the value on ThrottlesLogins.php as shown below :

Then let's try again....

Sooow... The failed login attemp become 3 with locking period 180 seconds... ehehe... Coool... B-)


That's all... ;)


Demo :

Sunday, September 4, 2016

Maen Object PHP Ala Hisoka... B-)

Pertama-tama test test dl aaaah... :D
Klu di run di cmd :
atau kalo lewat browser :
Terusss.... Object di php tuuh... kyk gini :
Daaan... hasilnya seperti ini :
Jadi contoh sederhananya seperti itu... :v

Kalo objectnya kita taro di file php lain kyk gini :

Berarti kita perlu ngeinclude atau require di index.php seperti ini :
Kita bisa make include('hisokaobject.php'); ... bedanya tuuuh... apa yaaah... klu require katanya klu ada yg salah.. pagenya g' bisa kebuka..trs klu include, skalipun ada yang salah, pagenya masih tetep kebuka... *katanya seeeh gityu... :v

Teruuss.... klu kita punya array... cara ngecasting ke object kyk gini :
Hasilnya :
Daan...kita ngakses elemenntya disini pake iterasi ajjah,.. trs klu kita liad hasilnya diatas, key nya tuuh 1... soalnya emg ngeset key... naaah... gimana klu g' ngeset keynya...??? tampilannya seperti ini  :
Hasilnya kek gini :
Ooowwh... jadi klu g' ngeset keynya, berarti keynya default dari 0.. :D

Okieee... teruuuus.... mmmmmmmm...........Klu misalkan pengen nambain properti object setelah objectnya dicreate, contohnya kyk gini :
Hasilnya :
Selain pake new stdClass(), Kita juga bisa pke yg lain kyk class{} dan (object)[] kyk gini :
Hasilnya sama ajjah...
Teruuus... klu misalkan kita punya array terus dimasukin ke array lain, terus diconvert ke object, carana kyk gini :
Hasilna kek gini :