Welcome to CANG!

The page you are looking at is being generated dynamically by CodeIgniter.

The generated code :

Array ( [code_base] => MVZ7LLNK [code_base_md5] => 3f599ff4049541567a55a1cc3afb0ad3 [code_base_sha1] => 299a0fccf8516bcf46e343f85a5c21a63a91d817 [code_base64_encode] => TVZaN0xMTks= [code_max_number] => 2821109907456 [code_pos_num] => 987650007887 [code_time] => 1513031366.2193 [code_message] => is_acurrate [code_name] => [A-Z,0-9] [code_description] => Alphabetical and Numerical -> Simple:Capital letters(Megaupload.com) [code_type] => 5 [code_max_type] => 8 [code_length] => 8 )

The corresponding library for this page is found at:

application/libraries/CANG.php <?php
class CANG {
    
    public 
$default_code_length 1;
    public 
$default_code_type 1;
    public 
$run_default_code TRUE;
    public 
$run_random_code TRUE;
    protected 
$code_max_type 8;
    
    public function 
__construct(){
        
/*
        Nothing to do here but if you need to use it with CI must write :
        class CANG extends CI_Library {}
        and remove the double back slash below
        */
        //parent::__construct();
    
}
    
    public function 
SetLength($SetLength=FALSE){
        if(
is_numeric($SetLength)){
            
$this->default_code_length $SetLength;
        }
    }
    
    public function 
SetType($SetType=FALSE){
        if(
is_numeric($SetType) AND $this->code_max_type>=$SetType){
            
$this->default_code_type $SetType;
        }
    }
    
    public function 
CodeCountRange($code_char_range=[]){
        
$count_characters count($code_char_range);
        if(
function_exists('bcpow')){
            return 
bcpow($count_characters$this->default_code_length);
        }else{
            return 
pow($count_characters$this->default_code_length);
        }
        
    }
    
    public function 
CodeTypes(){
        
        
$CodeTypes[1]['code_name'] = '[A-Z]';
        
$CodeTypes[2]['code_name'] = '[a-z]';
        
$CodeTypes[3]['code_name'] = '[A-Z,a-z]';
        
$CodeTypes[4]['code_name'] = '[0-9]';
        
$CodeTypes[5]['code_name'] = '[A-Z,0-9]';
        
$CodeTypes[6]['code_name'] = '[a-z,0-9]';
        
$CodeTypes[7]['code_name'] = '[A-Z,a-z,0-9]';
        
$CodeTypes[8]['code_name'] = '[A-Z,a-z,0-9,-_]';
        
        
$CodeTypes[1]['code_description'] = 'Alphabetical -> Simple:Capital letters';
        
$CodeTypes[2]['code_description'] = 'Alphabetical -> Simple:Small letters';
        
$CodeTypes[3]['code_description'] = 'Alphabetical -> Combi:Capital and small letters';
        
$CodeTypes[4]['code_description'] = 'Numerical -> Simple';
        
$CodeTypes[5]['code_description'] = 'Alphabetical and Numerical -> Simple:Capital letters(Megaupload.com)';
        
$CodeTypes[6]['code_description'] = 'Alphabetical and Numerical -> Simple:Small letters';
        
$CodeTypes[7]['code_description'] = 'Alphabetical and Numerical -> Combi:Capital and small letters';
        
$CodeTypes[8]['code_description'] = 'Alphabetical and Numerical -> Combi:Capital and small letters plus special chars(Youtube.com)';
        
        
$CodeTypes[1]['code_generated_time'] = microtime(TRUE);
        
$CodeTypes[2]['code_generated_time'] = microtime(TRUE);
        
$CodeTypes[3]['code_generated_time'] = microtime(TRUE);
        
$CodeTypes[4]['code_generated_time'] = microtime(TRUE);
        
$CodeTypes[5]['code_generated_time'] = microtime(TRUE);
        
$CodeTypes[6]['code_generated_time'] = microtime(TRUE);
        
$CodeTypes[7]['code_generated_time'] = microtime(TRUE);
        
$CodeTypes[8]['code_generated_time'] = microtime(TRUE);
        
        
$CodeTypes[1]['code_char_range'] = range('A','Z');
        
$CodeTypes[2]['code_char_range'] = range('a','z');
        
$CodeTypes[3]['code_char_range'] = array_merge(range('A','Z'), range('a','z'));
        
$CodeTypes[4]['code_char_range'] = range(0,9);
        
$CodeTypes[5]['code_char_range'] = array_merge(range('A','Z'), range(0,9));
        
$CodeTypes[6]['code_char_range'] = array_merge(range('a','z'), range(0,9));
        
$CodeTypes[7]['code_char_range'] = array_merge(range('A','Z'), range('a','z'), range(0,9));
        
$CodeTypes[8]['code_char_range'] = array_merge(range('A','Z'), range('a','z'), range(0,9),array('-','_'));
        
        
$CodeTypes[1]['code_char_count'] = count($CodeTypes[1]['code_char_range']);
        
$CodeTypes[2]['code_char_count'] = count($CodeTypes[2]['code_char_range']);
        
$CodeTypes[3]['code_char_count'] = count($CodeTypes[3]['code_char_range']);
        
$CodeTypes[4]['code_char_count'] = count($CodeTypes[4]['code_char_range']);
        
$CodeTypes[5]['code_char_count'] = count($CodeTypes[5]['code_char_range']);
        
$CodeTypes[6]['code_char_count'] = count($CodeTypes[6]['code_char_range']);
        
$CodeTypes[7]['code_char_count'] = count($CodeTypes[7]['code_char_range']);
        
$CodeTypes[8]['code_char_count'] = count($CodeTypes[8]['code_char_range']);
        
        
$CodeTypes[1]['code_max_number'] = $this->CodeCountRange($CodeTypes[1]['code_char_range']);
        
$CodeTypes[2]['code_max_number'] = $this->CodeCountRange($CodeTypes[2]['code_char_range']);
        
$CodeTypes[3]['code_max_number'] = $this->CodeCountRange($CodeTypes[3]['code_char_range']);
        
$CodeTypes[4]['code_max_number'] = $this->CodeCountRange($CodeTypes[4]['code_char_range']);
        
$CodeTypes[5]['code_max_number'] = $this->CodeCountRange($CodeTypes[5]['code_char_range']);
        
$CodeTypes[6]['code_max_number'] = $this->CodeCountRange($CodeTypes[6]['code_char_range']);
        
$CodeTypes[7]['code_max_number'] = $this->CodeCountRange($CodeTypes[7]['code_char_range']);
        
$CodeTypes[8]['code_max_number'] = $this->CodeCountRange($CodeTypes[8]['code_char_range']);
        
        
$this->CodeType $CodeTypes[$this->default_code_type];
        return 
$CodeTypes;
    }
    
    public function 
CodeInput($CodeInput=''){
        if(!empty(
$CodeInput)){
            
$this->run_default_code FALSE;
            
$this->CodeInputOld $CodeInput;
        }else{
            
$this->run_random_code FALSE;
        }
    }
    
    public function 
Search($Value){
        
$code_char_range $this->CodeType['code_char_range'];
        foreach(
$code_char_range AS $KeyNumber=>$KeyString){
            if(
"$KeyString"=="$Value"){
                return 
$KeyNumber;
                break;
            }
            
        }
    }
    
    public function 
CodeCreateNext(){
    
    
$code_char_range $this->CodeType['code_char_range'];
    
$code_char_range_start reset($code_char_range);
    
$code_char_range_end end($code_char_range);
    
    
$code_str_split str_split($this->CodeInputOld);
    
    
// Starts a search for the next incrementable character, ie, other than code_char_range_end
    // Note that it starts from the last character for the first character
        
for($i count($code_str_split)-1;$i>-1;$i--){
            if(
"$code_str_split[$i]== "$code_char_range_end"){
                if(
$i==0){
                
// If it is equal to code_char_range_end and is the first character, then it increases the length and zera
                
$code_str_split array_fill(0,count($code_str_split) + 1,"$code_char_range_start");
                return 
$code_str_split;
                }else{
                    
$n $i-1;
                    
$code_str_pos $this->Search("$code_str_split[$n]")+1;
                    if(
"$code_str_split[$n]!= "$code_char_range_end"){
                    
// If the previous character is different from code_char_range_end, it increments it and clears the current and subsequent characters
                    // If the previous character is the first one, it also works, because it increments it and zeroes the others
                    
if(empty($code_char_range[$code_str_pos])){
                        
$code_str_split[$n] = settype($code_char_range[$code_str_pos],'string');
                    }else{
                        
$code_str_split[$n] = $code_char_range[$code_str_pos];
                    }
                        for(
$j $i$j count($code_str_split); $j++){
                            
$code_str_split[$j] = $code_char_range_start;
                        }
                    return 
$code_str_split;
                    }
                }
            }else{
                
// calculates the next character, ie, increments the current character
                
$code_str_pos $this->Search("$code_str_split[$i]")+1;
                if(empty(
$code_char_range[$code_str_pos])){
                    
$code_str_split[$i] = settype($code_char_range[$code_str_pos],'string');
                }else{
                    
$code_str_split[$i] = $code_char_range[$code_str_pos];
                }
                if(
$i == 0){
                    
// If it is the first character, it means that the others are code_char_range_end
                    // That is, he zeroes them
                    
$novo_array array_fill(0,count($code_str_split),"$code_char_range_start");
                    
$novo_array[0] = $code_str_split[$i];
                    
$code_str_split $novo_array;
                }
            return 
$code_str_split;
            }
        }
    }
    
    public function 
CodeCreate(){
        
        
$code_char_count $this->CodeType['code_char_count'];
        
$code_char_range $this->CodeType['code_char_range'];
        
$code_char_range_start reset($code_char_range);
        
        
$this->code_char_base = [];
        if(
$this->run_default_code){
            for(
$n=1;$this->default_code_length>=$n;$n++){
                if(
$this->run_random_code){
                    
$this->code_char_base[] = $code_char_range[mt_rand(0,($code_char_count-1))];
                }else{
                    
$this->code_char_base[] = $code_char_range_start;
                }
            }
        }else{
            
$this->code_char_base $this->CodeCreateNext();
        }
    }
    
    public function 
CodeCountNumber() {
        
$code_char_count $this->CodeType['code_char_count'];
        
$code_char_range $this->CodeType['code_char_range'];
        
        
$character_keys array_flip($code_char_range);
        
$code_characters $this->code_char_base;
 
        
$number 0;
        for (
$i 0$i count($code_characters); $i++) {
                
$number $number $code_char_count $character_keys[$code_characters[$i]];
        }
        
$this->code_pos_num = ($number+1);
    }
    
    public function 
CodeArray(){
        
$code_base implode($this->code_char_base);
    if(
$this->default_code_length==strlen($code_base)){
            return array(
                    
'code_base'=>$code_base,
                    
'code_base_md5'=>md5($code_base),
                    
'code_base_sha1'=>sha1($code_base),
                    
'code_base64_encode'=>base64_encode($code_base),
                    
'code_max_number'=>$this->CodeType['code_max_number'],
                    
'code_pos_num'=>$this->code_pos_num,
                    
'code_time'=>$this->CodeType['code_generated_time'],
                    
'code_message'=>'is_acurrate',
                    
'code_name'=>$this->CodeType['code_name'],
                    
'code_description'=>$this->CodeType['code_description'],
                    
'code_type'=>$this->default_code_type,
                    
'code_max_type'=>$this->code_max_type,
                    
'code_length'=>$this->default_code_length
                    
);
        }elseif(
$this->default_code_length<strlen($code_base)){
            return array(
                        
'code_base'=>$code_base,
                        
'code_base_md5'=>md5($code_base),
                        
'code_base_sha1'=>sha1($code_base),
                        
'code_base64_encode'=>base64_encode($code_base),
                        
'code_max_number'=>$this->CodeType['code_max_number'],
                        
'code_pos_num'=>$this->code_pos_num,
                        
'code_time'=>$this->CodeType['code_generated_time'],
                        
'code_message'=>'is_upper_or_full',
                        
'code_name'=>$this->CodeType['code_name'],
                        
'code_description'=>$this->CodeType['code_description'],
                        
'code_type'=>$this->default_code_type,
                        
'code_max_type'=>$this->code_max_type,
                        
'code_length'=>$this->default_code_length
                        
);
        }else{
            return array(
                        
'code_base'=>$code_base,
                        
'code_base_md5'=>md5($code_base),
                        
'code_base_sha1'=>sha1($code_base),
                        
'code_base64_encode'=>base64_encode($code_base),
                        
'code_max_number'=>$this->CodeType['code_max_number'],
                        
'code_pos_num'=>$this->code_pos_num,
                        
'code_time'=>$this->CodeType['code_generated_time'],
                        
'code_message'=>'is_lower',
                        
'code_name'=>$this->CodeType['code_name'],
                        
'code_description'=>$this->CodeType['code_description'],
                        
'code_type'=>$this->default_code_type,
                        
'code_max_type'=>$this->code_max_type,
                        
'code_length'=>$this->default_code_length
                        
);
        }
    }
    
    public function 
Generate_String(){
        
$this->CodeTypes();
        
$this->CodeCreate();
        
$this->CodeCountNumber();
        return 
$this->CodeArray();
    }
    
    public function 
Generate_ID($GenerateID){
        
is_numeric($GenerateID) OR die('The ID must be numberic!');
        
$this->CodeTypes();
        
$code_char_count $this->CodeType['code_char_count'];
        
$code_char_range $this->CodeType['code_char_range'];
        
        
$one 1;
        if(
$GenerateID>$this->CodeType['code_max_number']){
            
//Perform reset
            
$code_id = ($one $one);
        }else{
            
$code_id = ($GenerateID $one);
        }
        for(
$length=($this->default_code_length $one);$length>=0;$length--){
            if(
function_exists('bcpow')){
                
$bcpow bcpow($code_char_count$length);
                
$possition floor($code_id $bcpow);
                
$code_id $code_id - ($possition $bcpow);
            }else{
                
$pow pow($code_char_count$length);
                
$possition floor($code_id $pow);
                
$code_id $code_id - ($possition $pow);
            }
            
            
$this->code_char_base[$length] = $code_char_range[$possition];
        }
        
$this->CodeCountNumber();
        return 
$this->CodeArray();
    }
}
?>

The corresponding model for this page is found at:

application/models/CANG_Model.php <?php
defined
('BASEPATH') OR exit('No direct script access allowed');
class 
CANG_Model extends CI_Model {
    
    public function 
__construct(){
        
parent::__construct();
        
$this->load->library('CANG');
    }
    
    public function 
HTTP_Generate($_REQUESTED=[]){
        
header("Content-type:application/json");
        echo 
$this->PLAIN_Generate($_REQUESTED);
    }
    
    public function 
PLAIN_Generate($_REQUESTED=[]){
        
//Length of code
        
$this->cang->SetLength((@$_REQUESTED['Length'] ? $_REQUESTED['Length'] : 'false'));
        
//Type of code
        
$this->cang->SetType((@$_REQUESTED['Type'] ? $_REQUESTED['Type'] : 'false'));
        
//echo $bool_val ? 'true' : 'false';
        
switch((@$_REQUESTED['Run'] ? $_REQUESTED['Run'] : 'false')){
            case 
1
                    
//Randomly
                    
return json_encode($this->cang->Generate_String());
            break;
            case 
2:
                    
//Sequentially:Last Identification Key
                    
$this->cang->CodeInput((@$_REQUESTED['Lik'] ? $_REQUESTED['Lik'] : ''));
                    return 
json_encode($this->cang->Generate_String());
            break;
            case 
3:
                    
//Generate Key by Identification Number
                    
return json_encode($this->cang->Generate_ID((@$_REQUESTED['Gin'] ? $_REQUESTED['Gin'] : 'false')));
            break;
            default: 
'';
        }
    }
}
?>

If you would like to edit this page you'll find it located at:

application/views/Public/App/CANG_CP/index.php <?php
defined
('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Welcome to CANG</title>

    <style type="text/css">

    ::selection { background-color: #E13300; color: white; }
    ::-moz-selection { background-color: #E13300; color: white; }

    body {
        background-color: #fff;
        margin: 40px;
        font: 13px/20px normal Helvetica, Arial, sans-serif;
        color: #4F5155;
    }

    a {
        color: #003399;
        background-color: transparent;
        font-weight: normal;
    }

    h1 {
        color: #444;
        background-color: transparent;
        border-bottom: 1px solid #D0D0D0;
        font-size: 19px;
        font-weight: normal;
        margin: 0 0 14px 0;
        padding: 14px 15px 10px 15px;
    }

    code {
        font-family: Consolas, Monaco, Courier New, Courier, monospace;
        font-size: 12px;
        background-color: #f9f9f9;
        border: 1px solid #D0D0D0;
        color: #002166;
        display: block;
        margin: 14px 0 14px 0;
        padding: 12px 10px 12px 10px;
    }

    #body {
        margin: 0 15px 0 15px;
    }

    p.footer {
        text-align: right;
        font-size: 11px;
        border-top: 1px solid #D0D0D0;
        line-height: 32px;
        padding: 0 10px 0 10px;
        margin: 20px 0 0 0;
    }

    #container {
        margin: 10px;
        border: 1px solid #D0D0D0;
        box-shadow: 0 0 8px #D0D0D0;
    }
    </style>
</head>
<body>

<div id="container">
    <h1>Welcome to CANG!</h1>

    <div id="body">
        <p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
        
        <p>The generated code :</p>
        <code><?php print_r($Api);?></code>
        
        <p>The corresponding library for this page is found at:</p>
        <code>application/libraries/CANG.php</code>
        
        <code><?php show_source(realpath(APPPATH .'libraries/CANG.php'));?></code>
        
        <p>The corresponding model for this page is found at:</p>
        <code>application/models/CANG_Model.php</code>
        
        <code><?php show_source(realpath(APPPATH .'models/CANG_Model.php'));?></code>
        
        <p>If you would like to edit this page you'll find it located at:</p>
        <code>application/views/<?php echo implode('/',$this->uri->segment_array()).'.php';?></code>
        <code><?php show_source(__FILE__);?></code>
        
        <p>The corresponding controller for this page is found at:</p>
        <code>application/controllers/Public/App/CANG_CP.php</code>
        <code><?php show_source(realpath(APPPATH .'controllers/Public/App/CANG_CP.php'));?></code>
        
        <p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="/user_guide/">User Guide</a>.</p>
    </div>

    <p class="footer">Page rendered in <strong>0.1975</strong> seconds. <?php echo  (ENVIRONMENT === 'development') ?  'CodeIgniter Version <strong>' CI_VERSION '</strong>' '' ?></p>
</div>

</body>
</html>

The corresponding controller for this page is found at:

application/controllers/Public/App/CANG_CP.php <?php
defined
('BASEPATH') OR exit('No direct script access allowed');
class 
CANG_CP extends My_CANG {
    public function 
__construct(){
        
parent::__construct();
    }
    
    public function 
index(){
        if(
$_GET){
            
$Replace 'Run/'.$_GET['Run'].'?Type='.$_GET['Type'].'&Length='.$_GET['Length'];
        }else{
            
$Replace 'Run/1?Length=8&Type=5';
        }
        
/*echo*/ $RemoteURL str_replace(__FUNCTION__ '.php',$Replace,current_url());
        
$CodeArray json_decode(file_get_contents($RemoteURL),TRUE);
        
//print_r($CodeArray);
        
$this->load->view(implode('/',$this->uri->segment_array()),['Api'=>$CodeArray]);
    }
    
    public function 
Run($RunType=FALSE){
        if(
is_numeric($RunType)){
            
$_REQUESTED['Run'] = $RunType;
            
$_REQUESTED['Length'] = @$_GET['Length'] ? $_GET['Length'] : '';
            
$_REQUESTED['Type'] = @$_GET['Type'] ? $_GET['Type'] : '';
            
$_REQUESTED['Lik'] = @$_GET['Lik'] ? $_GET['Lik'] : '';
            
$_REQUESTED['Gin'] = @$_GET['Gin'] ? $_GET['Gin'] : '';
            echo 
$this->CANG_Model->HTTP_Generate($_REQUESTED);
        }else{
            echo 
'RunType is not specified!';
        }
        
    }
}
?>

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.