FuelPHP Bin
<?php class Controller_Test extends \Controller { public function action_test() { // check if we're already logged-in if ( ! \Auth::check()) { // do we have an auth user? if ( ! \Input::server('PHP_AUTH_USER')) { // prompt for authentication return Response::forge('', 401, array('WWW-Authenticate' => 'Basic realm="My Realm"')); } // attempt to login if ( ! \Auth::login(\Input::server('PHP_AUTH_USER'), \Input::server('PHP_AUTH_PW'))) { // login failed, show a message here and have the user try again die('login failed, invalid credentials'); } // login succesful die('login successful'); } } }