0

I have this issue: trying to make admin panel and there i have the inputs of user and pass of SMTP account and i need to make it as secure as possible before sending it to DB, and i'm doing like this:

$config = array(
'protocol' => 'smtp',
'smtp_host' => Settings_model::$db_config['smtp_host'],
'smtp_port' => Settings_model::$db_config['smtp_port'],
'smtp_user' => $this->encrypt->decode(Settings_model::$db_config['smtp_user']),
'smtp_pass' => $this->encrypt->decode(Settings_model::$db_config['smtp_pass']),
'smtp_timeout' => 30,
'charset' => "utf-8",
'newline' => "\r\n"
            );

and i got this error : Fatal error: Using $this when not in object context in /application/helpers/send_email_helper.php on line 29

for this lines:

'smtp_user' => $this->encrypt->decode(Settings_model::$db_config['smtp_user']),

'smtp_pass' => $this->encrypt->decode(Settings_model::$db_config['smtp_pass']),

Any ideas? i don't want to expose the pass and user in files. Thanks in advance!

0

2 Answers 2

0

Thanks all!

I resolved this from this answser: https://stackoverflow.com/a/9321743

$ci = get_instance(); // $ci replaces $this

and now works!

Sign up to request clarification or add additional context in comments.

Comments

0

You cannot use $this operator in a static method.

You should make use of self:: instead of $this for static methods.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.