Welcome Guest, Not a member yet? Register   Sign In
Protect helpers and setup db connection for helpers
#1

(This post was last modified: 12-23-2024, 06:35 AM by 4usol.)

Hi,

in ci3 i see this line at top of my helpers
"if ( ! defined('BASEPATH')) exit('No direct script access allowed');"

is it recommend to use it in ci4 too?

By the way, do i need to initialise the db-connection on every helper function again, or is there a better way to support db connection in the helper functions i need?

"my_helperfunction($this){
$db = \Config\Database::connect();
..
}

my_helperfunction_next($this){
$db = \Config\Database::connect();
..
}

..."
Reply


Messages In This Thread
Protect helpers and setup db connection for helpers - by 4usol - 12-23-2024, 06:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB