Welcome, Guest
You have to register before you can post on our site.



Search Forums

(Advanced Search)

Forum Statistics
» Members: 14,612
» Latest member: lamopa
» Forum threads: 70,085
» Forum posts: 360,708

Full Statistics

Latest Threads
CodeIgniter 4.0.0-rc.3 re...
Forum: News & Discussion
45 minutes ago
» Replies: 5   » Views: 598
Making auto detecting of ...
Forum: CodeIgniter 4 Feature Requests
55 minutes ago
» Replies: 0   » Views: 15
ci-phpunit-test for CodeI...
Forum: Addins
1 hour ago
» Replies: 93   » Views: 81,618
How to prevent loading Co...
Forum: CodeIgniter 4 Discussion
1 hour ago
» Replies: 2   » Views: 148
Help implimenting filters...
Forum: CodeIgniter 4 Support
8 hours ago
» Replies: 0   » Views: 60
Default permitted_uri_cha...
Forum: General Help
8 hours ago
» Replies: 2   » Views: 133
Load two config file in o...
Forum: Model-View-Controller
9 hours ago
» Replies: 1   » Views: 75
CodeIgniter Banner Font
Forum: News & Discussion
11 hours ago
» Replies: 6   » Views: 1,211
CodeIgniter VS ZendFramew...
Forum: Choosing CodeIgniter
Today, 07:43 AM
» Replies: 5   » Views: 268
Updating my Codeigniter t...
Forum: Installation & Setup
Today, 06:00 AM
» Replies: 10   » Views: 309

  Making auto detecting of base url to be compatible with composer
Posted by: Chivinsdev - 55 minutes ago - Forum: CodeIgniter 4 Feature Requests - No Replies

Hello I love detecting my base url automatically which I discovered not compatible with composer base on http and at the same time not compatible to public file assets including such as:

PHP Code:
<img src="base_url('public/images/').'logo.png'" /> 

And here is my modification of app/Config/App.php

PHP Code:
public function __construct()
$root = (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS']) ? "https://" "http://") . $_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']), ''$_SERVER['SCRIPT_NAME']);

$this->baseURL $root;

Please can you make this compatible with compser it is not working for
PHP Code:
php spark 
which is composer command

  Help implimenting filters for redirects
Posted by: pkMyt1 - 8 hours ago - Forum: CodeIgniter 4 Support - No Replies

Hello.  There is obviously something I am not understanding here.  I am trying to do basically what was in this thread 'Redirection in a helper' 
I made this filter


namespace App\Filters;

use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use IonAuth\Libraries\IonAuth;

class LoginFilter implements FilterInterface
    * IonAuth library
    * @var IonAuth
    private $ionAuth;

    public function before(RequestInterface $request)
        $this->ionAuth = new IonAuth();

        if (! $this->ionAuth->loggedIn())
            // redirect them to the login page
            return redirect()->to('Home');

    public function after(RequestInterface $request, ResponseInterface $response)
        // Do something here

In app/Config/Filters.php I did this
<?php namespace Config;

use CodeIgniter\Config\BaseConfig;

class Filters extends BaseConfig
// Makes reading things below nicer,
// and simpler to change out script that's used.
public $aliases = [
'csrf'    => \CodeIgniter\Filters\CSRF::class,
'toolbar'  => \CodeIgniter\Filters\DebugToolbar::class,
'honeypot' => \CodeIgniter\Filters\Honeypot::class,
        'loggedin' => \App\Filters\LoginFilter::class

// Always applied before every request
public $globals = [
'before' => [
// 'csrf',

'after'  => [

// Works on all of a particular HTTP method
// (GET, POST, etc) as BEFORE filters only
//    like: 'post' => ['CSRF', 'throttle'],
public $methods = [];

// List filter aliases and any before/after uri patterns
// that they should run on, like:
//    'isLoggedIn' => ['before' => ['account/*', 'profiles/*']],
public $filters = [

A block of the Home controller
<?php namespace App\Controllers;

* @abstract This is the mains controller for the TriLIMS Site.
* @author Dennis A. Simpson
* @copyright April 2019

class Home extends TriLIMS
    * @var array
    public $data = [];

    * Views folder
    * Set it to 'auth' if your views files are in the standard application/Views/auth
    * @var string
    protected $viewsFolder = '\auth';

    public function __construct()


    public function index()
        if (! $this->ionAuth->loggedIn())
            // redirect them to the login page
            return redirect()->to('Home/login');
        $this->display('HomePage', $this->session->getFlashdata('message'), '', '', '', '', '', "", 'Home', 'Main Page');


The TriLims controller

namespace App\Controllers;
* Created by PhpStorm.
* User: pkMyt1
* Date: 10/23/2018
* Time: 9:19 AM

use CodeIgniter\Controller;
use Config\Services;
use IonAuth\Libraries\IonAuth;

class TriLIMS extends Controller

    public $smarty;

    * Validation library
    * @var \CodeIgniter\Validation\Validation
    public $validation;

    * Session
    * @var \CodeIgniter\Session\Session
    public $session;

    * IonAuth library
    * @var IonAuth
    public $ionAuth;

    * Configuration
    * @var \IonAuth\Config\IonAuth
    protected $configIonAuth;

    public function __construct()
        $this->smarty = Services::smarty();
        $this->validation = Services::validation();
        $this->session = Services::session();
        $this->ionAuth    = new IonAuth();
        $this->configIonAuth = config('IonAuth');
        helper(['form','cookie', 'date']);

    public function display(string $template, $success, string $actionMode, $errors, $data, $id, $pager, $fields, $controller, $title)
        if ($this->ionAuth->loggedIn())
            $this->smarty->assignByRef('isAdmin', $this->ionAuth->isAdmin());
            $this->smarty->assignByRef('userID', $this->ionAuth->getUserId());

        $this->smarty->assignByRef('db_fields', $fields);
        $this->smarty->assignByRef('record_id', $id);
        $this->smarty->assignByRef('controller', $controller);

        $this->smarty->assignByRef('title', $title);
        $this->smarty->assignByRef('pager', $pager);
        $this->smarty->assignByRef('action_mode', $actionMode);
        $this->smarty->assignByRef('success', $success);
        $this->smarty->assignByRef('errors', $errors);
        $this->smarty->assignByRef('data', $data);

        $this->smarty->assign('left_nav', 'LeftNav');
        $this->smarty->assign('header', 'Header');
        $this->smarty->assignByRef('template', $template);

        echo $this->smarty->view('MainFrame.tpl');

When I try this I get "The page isn't redirecting properly"  I am at a loss.  There is something I am doing wrong with the filter but I don't understand what.  The redirect code works if I remove the filter but I think I should be filtering so someone not logged in cannot jump into one of the controllers.

  CodeIgniter 4.0.0-rc.3 released
Posted by: jlp - Today, 07:48 AM - Forum: News & Discussion - Replies (5)

CodeIgniter-4.0.0-rc.3  launches today

This is a pre-release of 4.0.0. It is not suitable for production! (but it is pretty darn close)


  • Beefed up database, session & routing handling.
  • Fixed numerous bugs & user guide errata.
Check the changelog for details, and the installation writeup for further directions.

Looking to upgrade from CI3 to CI4?
Generated API docs accessible at https://codeigniter4.github.io/api/

This is our third (and hopefully final) release candidate! We have fixed the blocking bugs, and beefed up some of the troublesome areas. Let's find and put to bed any last bugs!

Thank you to the community for stepping up to help make this the best PHP framework!

Do NOT post support questions or feature requests in response to this thread - those will be deleted. Instead, use the appropriate CodeIgniter 4 subforum. We are trying to make the best of the limited resources that we have!

Thank you, and ENJOY!

  Load two config file in one controller
Posted by: pippuccio76 - Today, 07:46 AM - Forum: Model-View-Controller - Replies (1)

Can i load 2 config file in one controller in the construct simultaneously?

  How to prevent loading Controller without Route?
Posted by: kingstyles - Today, 12:46 AM - Forum: CodeIgniter 4 Discussion - Replies (2)

How to prevent loading Controller without Route?

  Default permitted_uri_chars msg not showing up, instead showing exception error msg
Posted by: gomesh - Yesterday, 06:58 PM - Forum: General Help - Replies (2)

I have a project made using CodeIgniter v 3.1.10. In the Config.php i have the default setting:

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
Now, when I manually modify the url for e.g. as xyz.com/cat/'. Please note the apostrophe at the end of the URL, then I'm expecting the default error message like -

An Error Was Encountered
The URI you submitted has disallowed characters.
But instead of the above error message I'm getting an uncaught exception error message
[Image: YLoPu.jpg]
Can anyone please tell me what and where I need to change/Check. Thanks

  How to Codeiqniter 3 conenct MYSQL cloud
Posted by: nikitamirzani - Yesterday, 05:56 PM - Forum: General Help - No Replies

Dear All Developer codeiqniter

I have plan build application used codeiqniter. but the problem i want try my application codeiqniter connect google mysql cloud or database in aws or digitalocean. different server

[Image: IFS.jpg]

you have tutorial how to codeiqniter connect mysql cloud maybe google cloud, aws cloud or digitalocean cloud but different server?



  Fatal Errors when DataBase command fails
Posted by: GuilhermeBiz - Yesterday, 07:34 AM - Forum: CodeIgniter 4 Support - Replies (4)

Hello all, I'm having a struggle with Fatal Errors being thrown when some of my Databases commands don't return successfully, for example:

$flag = true;
$db = \Config\Database::connect();
$builder_audio = $db->table('audios');

$data = [
'name' => $name,
'path' => $path


$flag = false;
return $flag;

return $flag;

In my Database (Postgres) I created an UNIQUE KEY for the column "name". So when I try to insert a name that already exists I would like to get a return of none "affectedRows", and then deal with this return in my function, but when the error occurs, I get a Fatal Error, my request returns instantly with code 500 and an error description that follows:

Uncaught CodeIgniter\Format\Exceptions\FormatException: Failed to parse json string, error: &quot;Type is not supported&quot;. in /var/www/html/mysite/system/Format/Exceptions/FormatException.php:9

I could create an SELECT to search for the name before the INSERT, but I'm planning in creating some control in my database using UNIQUE KEYS for a better setup.

Thanks in advance

  submit button will do 2 things
Posted by: ceta - Yesterday, 12:00 AM - Forum: General Help - Replies (3)

this project is on 2.1.2 version
the existing apps will post/submit form and save the input to database...

now i want to make the button will do post the same data to another webservice at another host... what should i do?

how to know what's the detail data posted ... i've found the code related to the page on folder [CI_ROOTDIR]/application/controller/production.php... CMIIW

Note: i have set the print($data) but nothing printed on the page... any pointer will be appreciated

  CodeIgniter\Log and multiple handlers
Posted by: dave friend - 10-17-2019, 09:43 PM - Forum: CodeIgniter 4 Discussion - Replies (4)

I'm curious why CodeIgniter\Log::log() is designed such that if one handler returns false it won't continue with any other handlers in the queue?

It seems to me that it would be a good thing that if the (theoretical) EmailHandler failed to send an email that the FileHandler would still write to a log file.

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.