Create user permission by URI in Codeigniter 3

Hello. No I want to share how to about to create user role/permission by access URI. Oke now the first you must download new CodeIgniter 3 in this site https://www.codeigniter.com/download.
After that we must open CodeIgniter framework on your editor. Example I use sublime text.
Oke lest go code, the first we must change config/autoload.php and add auto load library ‘session’ and helper ‘url’.

/*
| -------------------------------------------------------------------
|  Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
|	$autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
|	$autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('session');

/*
| -------------------------------------------------------------------
|  Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
|	$autoload['drivers'] = array('cache');
*/
$autoload['drivers'] = array();

/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
|	$autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url');

Then change config/database.php with your database config.
(more…)

Firebase basic chating

Hello, long not post and now I’m back to post new article again. And now I’m ready to write article again. 😀
And again sorry for bad english, I’m from Indonesian and and my English grades at school are very ugly. But why do I still write in English? Because I want share this article not for Indonesian people, but for every one and I’ve you understand this article. Thank you. 🙂

Ok back to the topic, now I want share how to create basic chating (push chat and reply chat) using firebase. What is firebase? You can learn more at https://www.firebase.com. And now go to code…
First create File HTML and rename file to basic-chat.html:
(more…)

Javascript currency formatting

Hello now I am back again and now I want write how about to convert number to currency format. Maybe we know about javascript plugin to convert currency but it actually has a javascript function itself. Example I from Indonesia and I want currency number to “Rupiah”. If we want use javascript, you must read from this documentation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat.
Example this is basic number formatting:

var number = 3500;

document.write(new Intl.NumberFormat().format(number));
// Result = 3,500

And this is if I using locales, example I use Indonesian:

var number = 123456.789;

// Indonesian uses comma as decimal separator and period for thousands
document.write(new Intl.NumberFormat('ID').format(number));
// Result = 123.456,789

And for more info list code locales, you can read from this http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
And now how if I want use currency code like ¥ or €

var number = 123456.789;

// the Japanese yen doesn't use a minor unit
document.write(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number));
// Result = ï¿¥123,457

Form more info about style currency code, you can read from this http://www.currency-iso.org/en/home/tables/table-a1.html
For more info about date format you can read on this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat

File permission

File permission digunakan untuk mendefinisikan hak akses terhadap sebuah file atau folder untuk user lain. Jadi dengan file permission ini kita dapat menentukan apakah user lain memiliki hak akses terhadap sebuah file, untuk kemudian kita tentukan hak akses seperti apa yang akan kita berikan? Apakah user tersebut hanya bisa membaca file (read-only)? Atau membaca sekaligus memodifikasi file (read and write)?

Secara default, semua file dan folder mempunyai pemiliknya masing-masing, pemilik dari file dan folder ini adalah salah satu dari user yang terdapat pada system kita (bila komputer anda multiuser). Jika seorang user (kita sebut user x) memiliki hak kepemilikan terhadap sebuah file (katakan file x) maka user x memiliki kontrol penuh terhadap file x. sang user dapat melakukan apa saja terhadap file x seperti menghapus file, moving file, modifikasi file dan lain-lain.
Selai user x, user-user lain yang tergabung ke dalam grup user x juga memiliki hak akses terhadap file x, namun tentu saja kontrol hak akses ada di tangan user x yang dapat sewaktu-waktu mengganti hak akses terhadap grup.
Walaupun demikian, selain user x ada user lain yang memiliki kontrol penuh terhadap file x, siapakah dia? Ya dia adalah sang dewa dari sistem yaitu root. root dapat melakukan apa saja (termasuk menghapus, modifikasi file bahkan mengganti hak kepemilikan ke user lain) terhadap semua file meskipun file tersebut bukan miliknya. Selain root, user dengan hak akses administrator atau para sudoers juga dapat melakukannya, karena user jenis ini juga memiliki kemampuan dewa.

Mysql Insert Into Select (Copy data from another table/database table)

Hello, has long seemed to me not to write again. But now I can write about copy data from another table or from table on another database.
First we must create database and the table:

mysql> create database learn;
mysql> use learn;
mysql> create table guest_book1( id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, name VARCHAR(50), tlp VARCHAR(15));
mysql> create table guest_book2( id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, name VARCHAR(50), tlp VARCHAR(15));
mysql> INSERT INTO guest_book1(name, tlp) VALUES('user 1', '089123456789'), ('user 2', '089223456789'), ('user 3', '089323456789'), ('user 4', '089423456789'), ('user 5', '089523456789');

(more…)