ユーザー管理に特化したPHPのライブラリ『phpUserClass』
- November 11th, 2007
- Posted in 開発ツール・技術
- Write comment
こちらもいつか使ってみたい、という意味でエントリー。
phpUserClassはユーザー管理に関する機能に特化したライブラリです。ユーザーの認証、ログイン、ユーザーの追加などなど、コミュニティサイトに必要そうな機能をさくっと使うことができます。なお、MySQLと連動させて使います。
実例で見たほうがいいですかね。いくつかコードをご紹介。
if ($user->is_loaded() && !$user->is_active() ) echo 'Please activate your account first';
↑ ユーザーがログインしていて、なおかつ、有効かどうかをチェック。
if ($user->is('customer'))//This will return true if the field `customer` has the value `1`
echo 'Hello, ' . $user->get_property('firstName');
↑ データの取得。簡単そう。
if ( !$user->login($_POST['username'],$_POST['password']) ) echo 'Wrong username and/or password';
↑ 面倒なログイン処理もこんな感じで。
こういうライブラリはそのまま使っても便利ですが、コードを読み解くことで勉強になりそうですね。よろしければどうぞ。
» PHP User Class – php user class


ユーザー管理に特化したPHPのライブラリ『phpUserClass』
http://www.ideaxidea.com/archives/2007/1...