This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Runs this function when the page loads | |
$(document).ready(structureTabs); | |
function structureTabs() | |
{ | |
// Insert a list to hold the tab buttons | |
$('#tabs').prepend('<ul id="tabbtns"></ul>'); | |
// Split the content up, starting with each h2 and all other content until the following h2 comes. | |
$('#tabs h2').each(function(index){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Users_model extends MY_Model | |
{ | |
public function __construct() | |
{ | |
parent::__construct(); | |
/* Set Table info */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
switch( $_SERVER['HTTP_HOST'] ) | |
{ | |
// Local Site | |
case 'local.ci.com': | |
define('SITE', 'local'); | |
break; | |
// Development Site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function login() | |
{ | |
// Set required fields | |
$this->form_validation->set_rules('email', 'Email', 'required'); | |
$this->form_validation->set_rules('password', 'Password', 'required'); | |
if ($this->form_validation->run() == FALSE) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($this->session->userdata('user_id')) | |
{ | |
echo 'Hello user '.$this->session->userdata('user_id'); | |
echo ' '.anchor('users/logout','Logout').'<br />'; | |
echo anchor('/privatepage','Private page'); | |
} | |
else | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Privatepage extends MY_Controller { | |
function __construct() | |
{ | |
parent::__construct(); | |
} | |
function index() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
class MY_Controller extends Controller | |
{ | |
function MY_Controller() | |
{ | |
parent::Controller(); | |
$this->auth_logged_in(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>User registration</title> | |
</head> | |
<body> | |
<?=form_open(current_url())?> | |
<p><?=form_label('first name')?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User_model extends Model { | |
function add_user($user_array) | |
{ | |
return $this->db->insert('users',$user_array); | |
} | |
} |