Skip to content

Commit

Permalink
user auth from config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Attila Dobi committed Jan 16, 2012
1 parent 301dfcc commit 17259ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion application/config/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');

define('SITE_TITLE', '');
define('SITE_TITLE', 'SITE NAME');

/* End of file constants.php */
/* Location: ./application/config/constants.php */
17 changes: 17 additions & 0 deletions application/config/user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/hooks.html
|
*/

$config['username'] = 'admin';
$config['password'] = 'a';

/* End of file hooks.php */
/* Location: ./application/config/user.php */
7 changes: 5 additions & 2 deletions application/controllers/auth.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

if (! defined('BASEPATH')) exit('No direct script access');

Expand Down Expand Up @@ -32,7 +32,10 @@ public function check_credentials()

//$user = $this->users->login($_POST['username'], md5($_POST['password']));
//dump($_POST); die;
if ($_POST['username'] === 'admin' && md5($_POST['password']) === md5('a')) {

$this->config->load('user');

if ($_POST['username'] === $this->config->item('username') && md5($_POST['password']) === md5($this->config->item('password'))) {

$this->session->set_userdata('logged_in', true);

Expand Down

0 comments on commit 17259ef

Please sign in to comment.