yokaiyonseo@gmail.com
"

Video by Taiyaki Studio

https://taiyakistudio.com/

Requirements

- Familiar with MVC frameworks - Use Fuel PHP's template extension

SQL

Create sql data for users table CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `profile_fields` text NOT NULL, `group` int(11) NOT NULL, `last_login` int(20) NOT NULL, `login_hash` varchar(255) NOT NULL, `created_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Create sql data for sessions table CREATE TABLE IF NOT EXISTS `sessions` ( `session_id` varchar(40) NOT NULL, `previous_id` varchar(40) NOT NULL, `user_agent` text NOT NULL, `ip_hash` char(32) NOT NULL DEFAULT '', `created` int(10) unsigned NOT NULL DEFAULT '0', `updated` int(10) unsigned NOT NULL DEFAULT '0', `payload` longtext NOT NULL, PRIMARY KEY (`session_id`), UNIQUE KEY `PREVIOUS` (`previous_id`) ) ENGINE=INNODB DEFAULT CHARSET=utf8;

Configuration

Configure config.php file. Directory: fuelphp/fuel/app/config/config.php Add random Salt. This salt should not be copied from here! Create a random set of symbols and characters. It should be unique. [cms:asset 39 title="Config salt"] Autoload auth and orm [cms:asset 41 title="Config autoload"] Configure auth.php file. Directory: fuelphp/fuel/app/config/auth.php Configure the driver to 'SimpleAuth' and add random salt. This  salt should not be copied from here! Create a random set of symbols and characters. It should be unique. [cms:asset 43 title="Auth"]

Fuel PHP functions: Must Know

When creating a login system there are several functions you should become familiar with to better understand the way Fuel PHP works. Because we are creating a login system these functions will be used often. Let's look at some of them to understand what they do. Auth::check() used to check if a user is logged in Auth::member(100) used to check user group. Fuel PHP has preset the numbers to match a role. This information can be found in Directory: fuelphp/fuel/app/config/simpleauth.php [cms:asset 45 title="User groups"] $auth = Auth::instance(); create a new authentication instance $auth->login('email@web.com', 'password'); attempt a login using credentials
$val = Validation::forge(); create a new validation instance to use when validating data. $val->add_field('email', 'Your email', 'required|min_length[3]|max_length[50]');  validating user input $val->create_user( 'username', 'password', 'email@web.com', 1, array( 'username' => 'username', ) );  validating  a new user
Session::set_flash('error', 'Error Message!'); Session::set_flash('success', 'Success Message!'); a flash message to display errors and success messages Response::redirect('/login');  redirect to a page"
prevnext