Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated to 1.0.4

  • Loading branch information...
commit 61da4231fbb493a3510642f0961002f081248c9f 0 parents
Adam Griffiths authored
25 config/Auth.php
... ... @@ -0,0 +1,25 @@
  1 +<?php
  2 +
  3 +/**
  4 +* The array which holds your user groups and their ID.
  5 +* If you have a database table for groups, these ID's must be the same as in the database.
  6 +*/
  7 +$config['auth_groups'] = array(
  8 + 'admin' => '1',
  9 + 'editor' => '2',
  10 + 'user' => '100'
  11 + );
  12 +
  13 +/**
  14 +* The default URI string to redirect to after a successful login.
  15 +*/
  16 +$config['auth_login'] = 'admin/';
  17 +
  18 +
  19 +/**
  20 +* bool TRUE / FALSE
  21 +* Determines whether or not users will be remembered by the auth library
  22 +*/
  23 +$config['auth_remember'] = TRUE;
  24 +
  25 +?>
58 controllers/admin.php
... ... @@ -0,0 +1,58 @@
  1 +<?php
  2 +
  3 +class Admin extends Application
  4 +{
  5 + function Admin()
  6 + {
  7 + parent::Application();
  8 + }
  9 +
  10 + function index()
  11 + {
  12 + if($this->auth->logged_in())
  13 + {
  14 + echo("This is the admin section.");
  15 + }
  16 + else
  17 + {
  18 + echo("This is the client section.");
  19 + }
  20 + }
  21 +
  22 + function admin_area()
  23 + {
  24 + // This is only accessible to admins
  25 + $this->auth->restrict('admin');
  26 + echo("admin area");
  27 + }
  28 +
  29 + function editor_area()
  30 + {
  31 + // This is accessible to editors and admins
  32 + $this->auth->restrict('editor');
  33 + echo("editor area");
  34 + }
  35 +
  36 + function user_area()
  37 + {
  38 + // This is accessible to all users
  39 + $this->auth->restrict('user');
  40 + echo("user area");
  41 + }
  42 +
  43 + function users_area()
  44 + {
  45 + // This is accessible to all users too
  46 + $this->auth->restrict();
  47 + echo("user area");
  48 + }
  49 +
  50 + function just_user()
  51 + {
  52 + // This is accessible to only 'users'
  53 + $this->auth->restrict('user', TRUE);
  54 + echo("user area only");
  55 + }
  56 +}
  57 +
  58 +?>
10 controllers/index.html
... ... @@ -0,0 +1,10 @@
  1 +<html>
  2 +<head>
  3 + <title>403 Forbidden</title>
  4 +</head>
  5 +<body>
  6 +
  7 +<p>Directory access is forbidden.</p>
  8 +
  9 +</body>
  10 +</html>
46 dump.sql
... ... @@ -0,0 +1,46 @@
  1 +-- phpMyAdmin SQL Dump
  2 +-- version 2.10.2
  3 +-- http://www.phpmyadmin.net
  4 +--
  5 +-- Host: localhost
  6 +-- Generation Time: Feb 24, 2009 at 09:12 PM
  7 +-- Server version: 5.0.41
  8 +-- PHP Version: 5.2.5
  9 +
  10 +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  11 +
  12 +--
  13 +-- Database: `ci_auth`
  14 +--
  15 +
  16 +-- --------------------------------------------------------
  17 +
  18 +--
  19 +-- Table structure for table `users`
  20 +--
  21 +
  22 +CREATE TABLE `users` (
  23 + `id` int(11) NOT NULL auto_increment,
  24 + `username` varchar(255) NOT NULL,
  25 + `email` varchar(255) NOT NULL,
  26 + `password` varchar(255) NOT NULL,
  27 + `group_id` int(11) NOT NULL default '100',
  28 + `identifier` varchar(255) NOT NULL,
  29 + `token` varchar(255) NOT NULL,
  30 + PRIMARY KEY (`id`)
  31 +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  32 +
  33 +CREATE TABLE `groups` (
  34 +`id` int(11) NOT NULL,
  35 +`title` varchar(20) NOT NULL default '',
  36 +`description` varchar(100) NOT NULL default '',
  37 +PRIMARY KEY (`id`));
  38 +
  39 +CREATE TABLE IF NOT EXISTS `ci_sessions` (
  40 +session_id varchar(40) DEFAULT '0' NOT NULL,
  41 +ip_address varchar(16) DEFAULT '0' NOT NULL,
  42 +user_agent varchar(50) NOT NULL,
  43 +last_activity int(10) unsigned DEFAULT 0 NOT NULL,
  44 +user_data text NOT NULL,
  45 +PRIMARY KEY (session_id)
  46 +);
10 index.html
... ... @@ -0,0 +1,10 @@
  1 +<html>
  2 +<head>
  3 + <title>403 Forbidden</title>
  4 +</head>
  5 +<body>
  6 +
  7 +<p>Directory access is forbidden.</p>
  8 +
  9 +</body>
  10 +</html>
12 language/english/auth_lang.php
... ... @@ -0,0 +1,12 @@
  1 +<?php
  2 +
  3 +$lang['insufficient_privs'] = "You do not have sufficient privileges to access this page.";
  4 +$lang['username_callback_error'] = "The username was not found in our database.";
  5 +$lang['reg_username_callback_error'] = "The username is in use, please select another username.";
  6 +$lang['reg_email_callback_error'] = "The email is in use, please select another email.";
  7 +$lang['login_details_error'] = "The username and password did not match our records, please try again.";
  8 +$lang['max_login_attempts_error'] = "You have exceeded your maximum number of attempted logins, if you have forgotten your password, please consult the lost password form. You will be able to login again in 15 minutes.";
  9 +
  10 +$lang['logout_perms_error'] = "You have been logged out due to a permission error, please login again.";
  11 +
  12 +?>
10 language/english/index.html
... ... @@ -0,0 +1,10 @@
  1 +<html>
  2 +<head>
  3 + <title>403 Forbidden</title>
  4 +</head>
  5 +<body>
  6 +
  7 +<p>Directory access is forbidden.</p>
  8 +
  9 +</body>
  10 +</html>
348 libraries/Auth.php
... ... @@ -0,0 +1,348 @@
  1 +<?php
  2 +ob_start();
  3 +/**
  4 +* Authentication Library
  5 +*
  6 +* @package Authentication
  7 +* @category Libraries
  8 +* @author Adam Griffiths
  9 +* @link http://programmersvoice.com
  10 +* @version 1.0.4
  11 +*
  12 +* Auth provides a powerful, lightweight and simple interface for user authentication
  13 +*/
  14 +
  15 +class Auth
  16 +{
  17 +
  18 + var $CI; // The CI object
  19 + var $config; // The config items
  20 +
  21 + /**
  22 + * Auth constructor
  23 + *
  24 + * @access public
  25 + * @param string
  26 + */
  27 + function Auth($config)
  28 + {
  29 + $this->CI =& get_instance();
  30 + $this->config = $config;
  31 +
  32 + $this->CI->load->database();
  33 + $this->CI->load->helper(array('form', 'url', 'email'));
  34 + $this->CI->load->library('form_validation');
  35 + $this->CI->load->library('session');
  36 +
  37 + $this->CI->lang->load('auth', 'english');
  38 +
  39 + if($this->logged_in())
  40 + {
  41 + $this->_verify_cookie();
  42 + }
  43 + else
  44 + {
  45 + if(!isset($_COOKIE['login_attempts']))
  46 + {
  47 + setcookie("login_attempts", 0, time()+900, '/');
  48 + }
  49 + }
  50 + } // function Auth()
  51 +
  52 + /**
  53 + * Restricts access to a page
  54 + *
  55 + * Takes a user level (e.g. admin, user etc) and restricts access to that user and above.
  56 + * Example, users can access a profile page, but so can admins (who are above users)
  57 + *
  58 + * @access public
  59 + * @param string
  60 + * @return bool
  61 + */
  62 + function restrict($group = NULL, $single = NULL)
  63 + {
  64 + echo("1<br />");
  65 + if($group === NULL)
  66 + {
  67 + echo("1.1<br />");
  68 + if($this->CI->session->userdata('logged_in') == TRUE)
  69 + {
  70 + echo("1.2<br />");
  71 + return TRUE;
  72 + }
  73 + else
  74 + {
  75 + echo("1.3<br />");
  76 + show_error($this->CI->lang->line('insufficient_privs'));
  77 + }
  78 + }
  79 + elseif($this->logged_in() == TRUE)
  80 + {
  81 + echo("2<br />");
  82 + $level = $this->config['auth_groups'][$group];
  83 + $user_level = $this->CI->session->userdata('group');
  84 +
  85 + if($user_level > $level OR $single == TRUE && $user_level !== $level)
  86 + {
  87 + echo("2.1<br />");
  88 + show_error($this->CI->lang->line('insufficient_privs'));
  89 + }
  90 +
  91 + return TRUE;
  92 + }
  93 + else
  94 + {
  95 + echo("3<br />");
  96 + redirect($this->config['auth_login'], 'refresh');
  97 + }
  98 + } // function restrict()
  99 +
  100 +
  101 + /**
  102 + * Log a user in
  103 + *
  104 + * Log a user in a redirect them to a page specified in the $redirect variable
  105 + *
  106 + * @access public
  107 + * @param string
  108 + */
  109 + function login($redirect = NULL)
  110 + {
  111 + $this->CI->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|max_length[40]|callback_username_check');
  112 + $this->CI->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[12]');
  113 + $this->CI->form_validation->set_rules('remember', 'Remember Me');
  114 +
  115 + if($this->CI->form_validation->run() == FALSE)
  116 + {
  117 + if((array_key_exists('login_attempts', $_COOKIE)) && ($_COOKIE['login_attempts'] >= 5))
  118 + {
  119 + echo $this->CI->lang->line('max_login_attempts_error');
  120 + }
  121 + else
  122 + {
  123 + $this->CI->load->view('auth/login');
  124 + }
  125 + }
  126 + else
  127 + {
  128 + $username = set_value('username');
  129 + $auth_type = $this->_auth_type($username);
  130 + $password = $this->_salt(set_value('password'));
  131 + $email = set_value('email');
  132 +
  133 + if(!$this->_verify_details($auth_type, $username, $password))
  134 + {
  135 + show_error($this->CI->lang->line('login_details_error'));
  136 + }
  137 +
  138 + $userdata = $this->CI->db->query("SELECT * FROM `users` WHERE `$auth_type` = '$username'");
  139 + $row = $userdata->row_array();
  140 +
  141 + $data = array(
  142 + $auth_type => $username,
  143 + 'username' => $row['username'],
  144 + 'user_id' => $row['id'],
  145 + 'group' => $row['group_id'],
  146 + 'logged_in' => TRUE
  147 + );
  148 + $this->CI->session->set_userdata($data);
  149 +
  150 + if($this->config['auth_remember'] === TRUE)
  151 + {
  152 + $this->_generate();
  153 + }
  154 +
  155 + redirect($redirect);
  156 + }
  157 + } // function login()
  158 +
  159 +
  160 + /**
  161 + * Logout - logs a user out
  162 + *
  163 + * @access public
  164 + */
  165 + function logout()
  166 + {
  167 + $this->CI->session->sess_destroy();
  168 + $this->CI->load->view('auth/logout');
  169 + } // function logout()
  170 +
  171 +
  172 + /**
  173 + * Register a new user
  174 + *
  175 + * Register a user and redirect them to the success page
  176 + *
  177 + * @access public
  178 + * @param string
  179 + */
  180 + function register()
  181 + {
  182 + $this->CI->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|max_length[40]|callback_reg_username_check');
  183 + $this->CI->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[12]|matches[conf_password]');
  184 + $this->CI->form_validation->set_rules('conf_password', 'Password confirmation', 'trim|required|min_length[4]|max_length[12]|matches[password]');
  185 + $this->CI->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_reg_email_check');
  186 +
  187 + if($this->CI->form_validation->run() == FALSE)
  188 + {
  189 + $this->CI->load->view('auth/register');
  190 + }
  191 + else
  192 + {
  193 +
  194 + $username = set_value('username');
  195 + $password = $this->_salt(set_value('password'));
  196 + $email = set_value('email');
  197 +
  198 + $this->CI->db->query("INSERT INTO `users` (username, email, password) VALUES ('$username', '$email', '$password')");
  199 +
  200 + $userdata = $this->CI->db->query("SELECT * FROM `users` WHERE `username` = '$username'");
  201 + $row = $userdata->row_array();
  202 +
  203 + $data = array(
  204 + 'username' => $username,
  205 + 'user_id' => $row['id'],
  206 + 'group' => $row['group_id'],
  207 + 'logged_in' => TRUE
  208 + );
  209 + $this->CI->session->set_userdata($data);
  210 +
  211 + if($this->config['auth_remember'] === TRUE)
  212 + {
  213 + $this->_generate();
  214 + }
  215 +
  216 + $this->CI->load->view('auth/reg_success');
  217 + }
  218 + } // function register()
  219 +
  220 +
  221 + /**
  222 + * Check to see if a user is logged in
  223 + *
  224 + * Look in the session and return the 'logged_in' part
  225 + *
  226 + * @access public
  227 + * @param string
  228 + */
  229 + function logged_in()
  230 + {
  231 + if($this->CI->session->userdata('logged_in') == TRUE)
  232 + {
  233 + return TRUE;
  234 + }
  235 + else
  236 + {
  237 + return FALSE;
  238 + }
  239 + } // function logged_in()
  240 +
  241 +
  242 + /**
  243 + * Check to see if a user is logging in with their username or their email
  244 + *
  245 + * @access private
  246 + * @param string
  247 + */
  248 + function _auth_type($str)
  249 + {
  250 + if(valid_email($str))
  251 + {
  252 + return 'email';
  253 + }
  254 + else
  255 + {
  256 + return 'username';
  257 + }
  258 + } // function _auth_type()
  259 +
  260 +
  261 + /**
  262 + * Salt the users password
  263 + *
  264 + * @access private
  265 + * @param string
  266 + */
  267 + function _salt($str)
  268 + {
  269 + return sha1($this->CI->config->item('encryption_key').$str);
  270 + } // function _salt()
  271 +
  272 +
  273 + /**
  274 + * Verify that their username/email and password is correct
  275 + *
  276 + * @access private
  277 + * @param string
  278 + */
  279 + function _verify_details($auth_type, $username, $password)
  280 + {
  281 + $query = $this->CI->db->query("SELECT * FROM `users` WHERE `$auth_type` = '$username' AND `password` = '$password'");
  282 +
  283 + if($query->num_rows != 1)
  284 + {
  285 + $attempts = $_COOKIE['login_attempts'] + 1;
  286 + setcookie("login_attempts", $attempts, time()+900, '/');
  287 + return FALSE;
  288 + }
  289 +
  290 + return TRUE;
  291 + } // function _verify_details()
  292 +
  293 +
  294 + /**
  295 + * Generate a new token/identifier from random.org
  296 + *
  297 + * @access private
  298 + * @param string
  299 + */
  300 + function _generate()
  301 + {
  302 + $username = $this->CI->session->userdata('username');
  303 +
  304 + $token_source = fopen("http://random.org/strings/?num=1&len=20&digits=on&upperalpha=on&loweralpha=on&unique=on&format=plain&rnd=new", "r");
  305 + $token = fread($token_source, 20);
  306 +
  307 + $identifier = $username . $token;
  308 + $identifier = $this->_salt($identifier);
  309 +
  310 + $this->CI->db->query("UPDATE `users` SET `identifier` = '$identifier', `token` = '$token' WHERE `username` = '$username'");
  311 +
  312 + setcookie("logged_in", $identifier, time()+3600, '/');
  313 + }
  314 +
  315 +
  316 + /**
  317 + * Verify that a user has a cookie, if not generate one. If the cookie doesn't match the database, log the user out and show them an error.
  318 + *
  319 + * @access private
  320 + * @param string
  321 + */
  322 + function _verify_cookie()
  323 + {
  324 + if((array_key_exists('login_attempts', $_COOKIE)) && ($_COOKIE['login_attempts'] >= 5))
  325 + {
  326 + $username = $this->CI->session->userdata('username');
  327 + $userdata = $this->CI->db->query("SELECT * FROM `users` WHERE `username` = '$username'");
  328 +
  329 + $result = $userdata->row();
  330 +
  331 + $identifier = $result->username . $result->token;
  332 + $identifier = $this->_salt($identifier);
  333 +
  334 + if($identifier !== $_COOKIE['logged_in'])
  335 + {
  336 + $this->CI->session->sess_destroy();
  337 +
  338 + show_error($this->CI->lang->line('logout_perms_error'));
  339 + }
  340 + }
  341 + else
  342 + {
  343 + $this->_generate();
  344 + }
  345 + }
  346 +} // class Auth
  347 +
  348 +?>
81 libraries/MY_Controller.php
... ... @@ -0,0 +1,81 @@
  1 +<?php
  2 +
  3 +class Application extends Controller
  4 +{
  5 +
  6 + function Application()
  7 + {
  8 + parent::Controller();
  9 + $this->load->library('auth');
  10 + $this->load->database();
  11 + }
  12 +
  13 + function login()
  14 + {
  15 + $this->auth->login();
  16 + }
  17 +
  18 + function logout()
  19 + {
  20 + $this->auth->logout();
  21 + }
  22 +
  23 + function register()
  24 + {
  25 + $this->auth->register();
  26 + }
  27 +
  28 + function username_check($str)
  29 + {
  30 +
  31 + $auth_type = $this->auth->_auth_type($str);
  32 +
  33 + $query = $this->db->query("SELECT * FROM `users` WHERE `$auth_type` = '$str'");
  34 +
  35 + if($query->num_rows === 1)
  36 + {
  37 + return TRUE;
  38 + }
  39 + else
  40 + {
  41 + $this->form_validation->set_message('username_check', $this->lang->line('username_callback_error'));
  42 + return FALSE;
  43 + }
  44 +
  45 + } // function username_check()
  46 +
  47 + function reg_username_check($str)
  48 + {
  49 + $query = $this->db->query("SELECT * FROM `users` WHERE `username` = '$str'");
  50 +
  51 + if($query->num_rows <> 0)
  52 + {
  53 + $this->form_validation->set_message('reg_username_check', $this->lang->line('reg_username_callback_error'));
  54 + return FALSE;
  55 + }
  56 + else
  57 + {
  58 + return TRUE;
  59 + }
  60 +
  61 + } // function reg_username_check()
  62 +
  63 + function reg_email_check($str)
  64 + {
  65 + $query = $this->db->query("SELECT * FROM `users` WHERE `email` = '$str'");
  66 +
  67 + if($query->num_rows <> 1)
  68 + {
  69 + return TRUE;
  70 + }
  71 + else
  72 + {
  73 + $this->form_validation->set_message('reg_email_check', $this->lang->line('reg_email_callback_error'));
  74 + return FALSE;
  75 + }
  76 +
  77 + } // function reg_email_check()
  78 +
  79 +}
  80 +
  81 +?>
10 libraries/index.html
... ... @@ -0,0 +1,10 @@
  1 +<html>
  2 +<head>
  3 + <title>403 Forbidden</title>
  4 +</head>
  5 +<body>
  6 +
  7 +<p>Directory access is forbidden.</p>
  8 +
  9 +</body>
  10 +</html>
18 upgrade.sql
... ... @@ -0,0 +1,18 @@
  1 +ALTER TABLE `users` CHANGE `group_id` `group_id` INT( 11 ) NOT NULL DEFAULT '100';
  2 +ALTER TABLE `users` ADD `token` VARCHAR( 255 ) NOT NULL ,
  3 +ADD `identifier` VARCHAR( 255 ) NOT NULL ;
  4 +
  5 +CREATE TABLE `groups` (
  6 +`id` int(11) NOT NULL,
  7 +`title` varchar(20) NOT NULL default '',
  8 +`description` varchar(100) NOT NULL default '',
  9 +PRIMARY KEY (`id`));
  10 +
  11 +CREATE TABLE IF NOT EXISTS `ci_sessions` (
  12 +session_id varchar(40) DEFAULT '0' NOT NULL,
  13 +ip_address varchar(16) DEFAULT '0' NOT NULL,
  14 +user_agent varchar(50) NOT NULL,
  15 +last_activity int(10) unsigned DEFAULT 0 NOT NULL,
  16 +user_data text NOT NULL,
  17 +PRIMARY KEY (session_id)
  18 +);
61 views/auth/login.php
... ... @@ -0,0 +1,61 @@
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 +<html xmlns="http://www.w3.org/1999/xhtml">
  3 + <head>
  4 + <title>Login</title>
  5 + <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6 + <style type="text/css">
  7 + body
  8 + {
  9 + background-image: none;
  10 + background-color: white;
  11 + color: #454545;
  12 + background-repeat: no-repeat;
  13 + margin: 0;
  14 + font-family: Helvetica;
  15 + font-size: 12px;
  16 + }
  17 +
  18 + #container
  19 + {
  20 + width: 100%;
  21 + }
  22 +
  23 + #login
  24 + {
  25 + width: 726px;
  26 + margin: 0 auto;
  27 + margin-top: 140px;
  28 + }
  29 +
  30 + .title
  31 + {
  32 + font-size: 14px;
  33 + }
  34 +
  35 + .box
  36 + {
  37 + width: 726px;
  38 + padding: 15px;
  39 + }
  40 + </style>
  41 + </head>
  42 + <body>
  43 +
  44 + <div id="container">
  45 +
  46 + <div id="login">
  47 +
  48 + <div class="title">Login</div>
  49 + <div class="box">
  50 + <form method="POST">
  51 + Username/Email:<br />
  52 + <input type="text" name="username" value="<?php echo set_value('username'); ?>" size="50" class="form" /><?php echo form_error('username'); ?><br /><br />
  53 + Password:<br />
  54 + <input type="password" name="password" value="<?php echo set_value('password'); ?>" size="50" class="form" /><?php echo form_error('password'); ?><br /><br />
  55 + <input type="submit" value="Login" name="login" />
  56 + </form>
  57 + </div>
  58 + </div>
  59 + </div>
  60 +</body>
  61 +</html>
57 views/auth/logout.php
... ... @@ -0,0 +1,57 @@
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 +<html xmlns="http://www.w3.org/1999/xhtml">
  3 + <head>
  4 + <title>Fresh</title>
  5 + <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6 + <style type="text/css">
  7 + body
  8 + {
  9 + background-image: none;
  10 + background-color: white;
  11 + color: #454545;
  12 + background-repeat: no-repeat;
  13 + margin: 0;
  14 + font-family: Helvetica;
  15 + font-size: 12px;
  16 + }
  17 +
  18 + #container
  19 + {
  20 + width: 100%;
  21 + }
  22 +
  23 + #login
  24 + {
  25 + width: 726px;
  26 + margin: 0 auto;
  27 + margin-top: 140px;
  28 + }
  29 +
  30 + .title
  31 + {
  32 + font-size: 14px;
  33 + }
  34 +
  35 + .box
  36 + {
  37 + width: 726px;
  38 + padding: 15px;
  39 + }
  40 + </style>
  41 + </head>
  42 + <body>
  43 +
  44 + <div id="container">
  45 +
  46 + <div id="login">
  47 +
  48 + <div class="title">Logout</div>
  49 +
  50 + <div class="box">
  51 + You have been successfully logged out!
  52 + </div>
  53 +
  54 + </div>
  55 + </div>
  56 +</body>
  57 +</html>
57 views/auth/reg_success.php
... ... @@ -0,0 +1,57 @@
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 +<html xmlns="http://www.w3.org/1999/xhtml">
  3 + <head>
  4 + <title>Fresh</title>
  5 + <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6 + <style type="text/css">
  7 + body
  8 + {
  9 + background-image: none;
  10 + background-color: white;
  11 + color: #454545;
  12 + background-repeat: no-repeat;
  13 + margin: 0;
  14 + font-family: Helvetica;
  15 + font-size: 12px;
  16 + }
  17 +
  18 + #container
  19 + {
  20 + width: 100%;
  21 + }
  22 +
  23 + #login
  24 + {
  25 + width: 726px;
  26 + margin: 0 auto;
  27 + margin-top: 140px;
  28 + }
  29 +
  30 + .title
  31 + {
  32 + font-size: 14px;
  33 + }
  34 +
  35 + .box
  36 + {
  37 + width: 726px;
  38 + padding: 15px;
  39 + }
  40 + </style>
  41 + </head>
  42 + <body>
  43 +
  44 + <div id="container">
  45 +
  46 + <div id="login">
  47 +
  48 + <div class="title">Success!</div>
  49 + <div class="box">
  50 + The user has been created, you have now been logged in.
  51 + </div>
  52 +
  53 + <div class="box_bottom"></div>
  54 + </div>
  55 + </div>
  56 +</body>
  57 +</html>
67 views/auth/register.php
... ... @@ -0,0 +1,67 @@
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 +<html xmlns="http://www.w3.org/1999/xhtml">
  3 + <head>
  4 + <title>Fresh</title>
  5 + <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6 + <style type="text/css">
  7 + body
  8 + {
  9 + background-image: none;
  10 + background-color: white;
  11 + color: #454545;
  12 + background-repeat: no-repeat;
  13 + margin: 0;
  14 + font-family: Helvetica;
  15 + font-size: 12px;
  16 + }
  17 +
  18 + #container
  19 + {
  20 + width: 100%;
  21 + }
  22 +
  23 + #login
  24 + {
  25 + width: 726px;
  26 + margin: 0 auto;
  27 + margin-top: 140px;
  28 + }
  29 +
  30 + .title
  31 + {
  32 + font-size: 14px;
  33 + }
  34 +
  35 + .box
  36 + {
  37 + width: 726px;
  38 + padding: 15px;
  39 + }
  40 + </style>
  41 + </head>
  42 + <body>
  43 +
  44 + <div id="container">
  45 +
  46 + <div id="login">
  47 +
  48 + <div class="title">Register</div>
  49 + <div class="box">
  50 + <form method="post">
  51 + Username:<br />
  52 + <input type="text" name="username" size="50" class="form" value="<?php echo set_value('username'); ?>" /><br /><?php echo form_error('username'); ?><br />
  53 + Password:<br />
  54 + <input type="password" name="password" size="50" class="form" value="<?php echo set_value('password'); ?>" /><?php echo form_error('password'); ?><br /><br />
  55 + Password confirmation:<br />
  56 + <input type="password" name="conf_password" size="50" class="form" value="<?php echo set_value('conf_password'); ?>" /><?php echo form_error('conf_password'); ?><br /><br />
  57 + Email:<br />
  58 + <input type="text" name="email" size="50" class="form" value="<?php echo set_value('email'); ?>" /><?php echo form_error('email'); ?><br /><br />
  59 + <input type="submit" value="Register" name="register" />
  60 + </form>
  61 + </div>
  62 +
  63 + <div class="box_bottom"></div>
  64 + </div>
  65 + </div>
  66 +</body>
  67 +</html>
10 views/index.html
... ... @@ -0,0 +1,10 @@
  1 +<html>
  2 +<head>
  3 + <title>403 Forbidden</title>
  4 +</head>
  5 +<body>
  6 +
  7 +<p>Directory access is forbidden.</p>
  8 +
  9 +</body>
  10 +</html>

0 comments on commit 61da423

Please sign in to comment.
Something went wrong with that request. Please try again.