PHP Classes

Login class variants

Recommend this page to a friend!

      PHP Login Script  >  All threads  >  Login class variants  >  (Un) Subscribe thread alerts  
Subject:Login class variants
Summary:Is there one using MySQL
Messages:2
Author:Brian Read
Date:2012-04-23 15:13:28
Update:2013-05-10 13:09:28
 

  1. Login class variants   Reply   Report abuse  
Picture of Brian Read Brian Read - 2012-04-23 15:13:28
Hi

I see that you indicated in the READMe that you might do a version for MySQL- did that happen?

My reason is that I already have a MySQL db in the app, so it would make sense to use that. However if not I'll proceed with you package, using SQLite.

Cheers

Brian

  2. Re: Login class variants   Reply   Report abuse  
Picture of The Hau LE The Hau LE - 2013-05-10 13:09:28 - In reply to message 1 from Brian Read
I had the same problem with you, but now i've found to fix it.

First you need to create by yourself the database, table with columns id, name, password, temp. You need to modify method sqlite() to work this MySQL.

Find this code in your user.php file

protected function sqlite(){ // returns the database object
return new PDO('sqlite:'.dirname(dirname(__FILE__)).'/users.db');
}

Replace with

protected function sqlite(){
// returns the database object
return new PDO('mysql:host=localhost;dbname=YOUR_DATABASE', 'YOUR_DB_USERNAME', 'YOUR_DB_PASSWORD');
}

Now it works perfectly.

Cheers