1. Cara menyimpan data user yang sedang login dari session yang sedang aktif ?
SOLUSI :
1. Masuk folder website CODEIGNITER anda
2. Masuk folder "APPLICATION"
3. Buka file "CONFIG.PHP"
4. Cari kata "Session Variables"
5. Ubah blok berikut :
$config['sess_cookie_name'] = 'ci_session';MENJADI :
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_cookie_name'] = 'ci_session';6. Buat tabel pada databasemu
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`session_id` varchar(40) CHARACTER SET latin1 NOT NULL DEFAULT '0',
`ip_address` varchar(45) CHARACTER SET latin1 NOT NULL DEFAULT '0',
`user_agent` varchar(120) CHARACTER SET latin1 NOT NULL,
`last_activity` int(10) unsigned NOT NULL DEFAULT '0',
`user_data` text CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`session_id`),
KEY `last_activity_idx` (`last_activity`)
);
-- SELAMAT MENCOBA --
** (BELAJAR,BELAJAR,BELAJAR) **
No comments:
Post a Comment