[eluser]JamieBarton[/eluser]
This was the library, the code above was my first attempt at authentication. Very simple authentication too.
It was basic and didn't use a Model.
my Controller is:
Code:
<?php
class Session extends Controller {
function Session()
{
parent::Controller();
$this->load->library('auth');
}
function index()
{
$this->layout->view('session/index');
}
function create()
{
if(isset($_POST['password']) && $_POST['password'] == "secret") {
$this->auth->login();
redirect('/panel');
} else {
redirect('session');
}
}
function destroy()
{
$this->auth->logout();
redirect('/');
}
}
?>
The view:
Code:
<?php echo validation_errors(); ?>
<form action="/session/create" method="post">
<input name="password" />
<input type="submit" />
</form>
Session is the name of the Controller.
Totally not getting on with CodeIgniter at the moment, I was doing fine the other day with normal CRUD stuff, but when it came to sessions and authentication I just seem to have hit a brick wall and totally got me sick.
Regards,
Jamie