Home > PHP > Membuat Single-Login di CakePHP

Membuat Single-Login di CakePHP


Syarat: Uses CakePHP’s database sessions.

Langkah Untuk Setting ‘Database-Sessions’:

  1. buat table cake_sessions
    CREATE TABLE cake_sessions (
      id varchar(255) NOT NULL default '',
      data text,
      expires int(11) default NULL,
      PRIMARY KEY  (id)
    );
    
  2. buka file \app\config\core.php
  3. edit Session.save menjadi Configure::write(‘Session.save’, ‘database’);
  4. uncomment Configure::write(‘Session.model’, ‘Session’);
  5. uncomment Configure::write(‘Session.table’, ‘cake_sessions’);
  6. uncomment Configure::write(‘Session.database’, ‘default’);

Setelah ‘Database-Sessions’ berjalan, maka selanjutnya membuat logic Single-Login, secara umum dapat dilakukan dengan query:

SELECT (COUNT(*) = 0) AS LOGINABLE FROM cake_sessions WHERE data LIKE '%'.$username.'%'

Semoga membantu..

[sumber|sumber|sumber|sumber]

Categories: PHP Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: