I know this may look like duplicate from this question: Ignore slash while using encryption in Codeigniter. But I still didn't have the answer from it.
I want to sent encrypted email name as URL to their email account. Then that URL is decrypted to search if that email name is exist in my database to permit that email into my system.
The problem is:
- If I use urlencode or base64_encode after encryption, it always resulted in empty value to search the database after decrypt. I think it because the encrypted value always changing.
- If I use the casual encryption, it might have the ("/") character.
- If I only use the encode, without the encryption, it might permit the email name to have access into my system.
Lastly, I found some library: Ignore Slash while using encryption in codeigniter - GitHub .
But it gave me this error: Undefined property: CI_Loader::$my_encrypt
I don't know what I've done wrong, I already:
- Capitalized the class name first letter.
- Using the same file name with the class name. (capitalized too)
- Change the extend to CI_Encryption because the Encrypt class is already deprecated.
- Insert the
public function __construct() {parent::__construct();}before all method. - Place the file inside application/library.
- Load the library
$this->load->library('my_encrypt'); - Load the method using
$this->my_encrypt->encode($key);this is the line that gave me an error.
I know that this may sound like a simple mistake, but I'm using another third-party library too but it didn't give me an error at all.
Can anyone help me find the mistake / missing step there?
Update - Before I load the library in the controller, I want to check the result first in view. But it doesn't give me any changes even when I put the code inside controller. Here is the code :
$key = '[email protected]';
$this->load->library('my_encrypt');
$segment = $this->my_encrypt->encode($key);
echo $segment;
echo ( $this->my_encrypt->decode($segment) );
Update: Fix library code to extend with CI_Encryption library