Welcome Guest, Not a member yet? Register   Sign In
URL Encryption Issues
#1

(This post was last modified: 07-11-2020, 01:13 AM by rfctech.)

Dear, Viewers I am facing issue with URL Encryption, I have done almost but stacking in some case let me explain...

First Try: I have encrypted the URL by custom function & then I route the page to common controller like below

$route["(:any)"] = "Decrypt/index/$1"; 

Below is Decrypt Controller code

PHP Code:
    public function index()
    {
        
$get_url $this->uri->segment(1);
        
$dcrypt_url decrypt_url($get_url);

        if(!
$dcrypt_url){
             
redirect(base_url().$get_url);
        }else{
             
redirect(base_url().$dcrypt_url);
        }
    } 


So its decrypt & redirect to desire page, but the issue is URL is not encrypted anymore example this was the encrypted url:

http://example.com/ded055278695fe8a7c8b2...wVkm.2QV1o-

After decrypt its become http://example.com/users & when its redirect URL is not encrypted anymore its showing decrypted url. I want URL will be remain encrypted. hope experts understand.

2nd Try: 

PHP Code:
    class Home extends Crypto_Controller {
    
    function 
__construct()
    {
        
parent::__construct();
        if(!
$this->session->userdata('id'))
        {
            
$this->session->sess_destroy();
            
redirect('login''refresh');    
        }
        
$this->load->model('M_users');        
    }


    public function 
index()
    {
        
$data['users']=$this->M_users->getAllUsers();
        
$get_url $this->uri->segment(1);
        
$dcrypt_url decrypt_url($get_url);

        if(!
$dcrypt_url){
            echo 
$this->load->view($get_url$dataTRUE);
        }else{
            echo 
$this->load->view($dcrypt_url$dataTRUE);
        }
    } 

In above code url is remain encrypted & working fine but as you can see I have load the modules to pass the data of users, I believe each & every controller & module should separate & just load when the paged called it, but by this way all models will load when page will load which is make site slower.

I hope someone can guide me or suggest me to reach my goal, T.I.A
Reply


Messages In This Thread
URL Encryption Issues - by rfctech - 07-10-2020, 12:20 PM
RE: URL Encryption Issues - by jreklund - 07-11-2020, 01:32 AM
RE: URL Encryption Issues - by rfctech - 07-12-2020, 07:48 AM
RE: URL Encryption Issues - by jreklund - 07-12-2020, 09:06 AM
RE: URL Encryption Issues - by rfctech - 07-20-2020, 07:51 AM
RE: URL Encryption Issues - by jreklund - 07-20-2020, 11:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB