Recently the handler for sqlsrv has been incorporated into the develop version of codeigniter, doing some tests I have not been able to configure the settings for the use of schemas, everything is being stored in dbo. and for example I have different schemes like adm, transactios, blgs etc. anyone have any idea how to solve this problem.
↧
How to configure DB Sqlsrv schemas
↧
installing CI4 via Composer, but getting error, please help!
I tried the composer command right above my project root to install CI4, but got this:
I'm using PHP 7.3.+ and nowhere in my Plesk setup do I see anything about PHP 7.0.33. I'm running Ubunto 16.04, Plesk 18, and Apache. All my sites are using 7.3.
Please help!![Huh Huh]()
Okay, update, I got this with php -v in console:
But my sites clearly use PHP 7.3+. Any ideas??
Code:
Could not find package codeigniter4/appstarter with stability stable in a version installable using your PHP version 7.0.33
I'm using PHP 7.3.+ and nowhere in my Plesk setup do I see anything about PHP 7.0.33. I'm running Ubunto 16.04, Plesk 18, and Apache. All my sites are using 7.3.
Please help!

Okay, update, I got this with php -v in console:
Code:
PHP 7.0.33-0ubuntu0.16.04.7 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.4.0, Copyright (c) 2002-2020, by ionCube Ltd.
with Zend OPcache v7.0.33-0ubuntu0.16.04.7, Copyright (c) 1999-2017, by Zend Technologies
But my sites clearly use PHP 7.3+. Any ideas??
↧
↧
CI4 - ROUTES - FILTER PROBLEM
Hello Everyone,
I am using CI 4.0.4
XAMPP CONTROL 3.2.4
I AM USING CI 4.0.4 FOR MY ONGOING LIVE PROJECT
CURRENTLY I AM FACING SOME ISSUE
MY WEBSITE URL : http://localhost/shashi/public/ , i am not using spark
I HAVE CREATED A CONTROLLER
In App\Routes:
Now when i open :
http://localhost/shashi/public/dash/dashboard
http://localhost/shashi/public/dash/adddash
page opens and filter -> auth ( session check for login user ) also work - as i check in 2 bowers
but suppose i open
http://localhost/shashi/public/dash/dashboard/addsystemprice
page open , but why filter is not working ??
as it already route to http://localhost/shashi/public/dash/adddash
any thing missing ?
if some one can get my controller/methods name - then he/she can open the page and do the wrong stuff - as filter is not working which has session check for login user
please let me know
I am using CI 4.0.4
XAMPP CONTROL 3.2.4
I AM USING CI 4.0.4 FOR MY ONGOING LIVE PROJECT
CURRENTLY I AM FACING SOME ISSUE
MY WEBSITE URL : http://localhost/shashi/public/ , i am not using spark
I HAVE CREATED A CONTROLLER
Code:
<?php namespace App\Controllers;
class Dashboard extends BaseController
{
public function index()
{
$data = [];
echo view('templates/header', $data);
echo view('dashboard');
echo view('templates/footer');
}
//--------------------------------------------------------------------
public function addsystemprice()
{
$data = [];
echo view('templates/header', $data);
echo view('addsystem');
echo view('templates/footer');
}
}
In App\Routes:
Code:
$routes->group('dash',['filter' => 'auth'], function($routes) {
$routes->get('dashboard', 'Dashboard::index',['namespace' => 'App\Controllers\Dash']);
$routes->get('adddash', 'Dashboard::addsystemprice',['namespace' => 'App\Controllers\Dash']);
});
Now when i open :
http://localhost/shashi/public/dash/dashboard
http://localhost/shashi/public/dash/adddash
page opens and filter -> auth ( session check for login user ) also work - as i check in 2 bowers
but suppose i open
http://localhost/shashi/public/dash/dashboard/addsystemprice
page open , but why filter is not working ??
as it already route to http://localhost/shashi/public/dash/adddash
any thing missing ?
if some one can get my controller/methods name - then he/she can open the page and do the wrong stuff - as filter is not working which has session check for login user
please let me know
↧
CI4 and wp in shared hosting
Can i use wp e codeigniter4 in the same shared hosting ?
↧
Tutorial for myth / auth
Does anyone have any manual to use the Lonnie Ezell module myth/auth
↧
↧
Installation CI4 - Cloning failed using an ssh key for authentication - solution
I was facing a problem during a CodeIgniter 4 installation via Composer on my fully updated Linux Mint 20:
composer create-project codeigniter4/appstarter project-root
The terminal threw me an error when attempted to install fzaninotto/faker and waited for a token.
The solution for me was to close a terminal and installing a git package with it's dependencies git-man and liberror-perl. Next time a CodeIgniter 4 installation passed with no problem.
I am not the only one who has this problem:
https://github.com/composer/composer/issues/9205
composer create-project codeigniter4/appstarter project-root
The terminal threw me an error when attempted to install fzaninotto/faker and waited for a token.
Code:
- Installing fzaninotto/faker (dev-master 26c3c62): Cloning 26c3c624bb
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+computername+2020-10-26+1924
to retrieve a token. It will be stored in "/home/username/.config/composer/auth.json" for future use by Composer.
Token (hidden):
The solution for me was to close a terminal and installing a git package with it's dependencies git-man and liberror-perl. Next time a CodeIgniter 4 installation passed with no problem.
I am not the only one who has this problem:
https://github.com/composer/composer/issues/9205
↧
Purchase code Admin panel
Greetings guys
May I ask where would I aquire the purchase code for the database admin panel. Please I need it so that i may initiate integration right away
Regards
May I ask where would I aquire the purchase code for the database admin panel. Please I need it so that i may initiate integration right away
Regards
↧
CI4 libaries function call in VIEW
Hello Everyone,
I am using CI 4.0.4
XAMPP CONTROL 3.2.4
I AM USING CI 4.0.4 FOR MY ONGOING LIVE PROJECT
CURRENTLY I AM FACING SOME ISSUE
I HAVE CREATED LIBRARIES
in basecontroller.php
in products.php controller
How i can i access libraries Check_operation in above products view file
view file of products.php
i taught of using
but it giving me ArgumentCountError 0
in ci3
we can use directly in view
like
but ci4 - cant
please let me know
I am using CI 4.0.4
XAMPP CONTROL 3.2.4
I AM USING CI 4.0.4 FOR MY ONGOING LIVE PROJECT
CURRENTLY I AM FACING SOME ISSUE
I HAVE CREATED LIBRARIES
Code:
<?php
namespace App\Libraries;
use CodeIgniter\HTTP\RequestInterface;
class Product
{
protected $session;
protected $obj;
private $module;
function __construct($one,$two) {
helper(['html', 'url', 'form']);
$this->obj = $this;
$this->session = \Config\Services::session();
$this->session->start();
$this->module = $this->session->get('modulevalue');
}
function Check_operation($final,$operation)
{
if(isset($this->obj->module[$final][$operation]))
return 1;
else
return 0;
}
}
in basecontroller.php
Code:
protected $libcon;
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->libcon= new Product($one,$two);
}
in products.php controller
Code:
<?php namespace App\Controllers;
class Products extends BaseController
{
public function recentPosts()
{
$data = [];
echo view('templates/header', $data);
echo view('products'); // here in above products view file i need to access libraries Check_operation , and this i have to used in multiple view files
echo view('templates/footer');
}
}
How i can i access libraries Check_operation in above products view file
view file of products.php
i taught of using
Code:
<?= view_cell('\App\Libraries\Product::recentPosts', ['4' , '7']) ?>
but it giving me ArgumentCountError 0
in ci3
we can use directly in view
like
Code:
<?php $this->libcon->Check_operation(4,7) ;?>
but ci4 - cant
please let me know
↧
Outbox: Email management
Hi friends- This one has actually been out for a while but I didn't post it originally. A major new feature goes live today so I thought I would share:
Tatter\Outbox
Email toolkit for CodeIgniter 4
https://github.com/tattersoftware/codeigniter4-outbox
This is a bundle of supplemental tools to help make using CI4's Email class a little easier. Major features include:
1. Email Logging - Defines an Event listener triggered on Email:
end and logs email content to the database
2. Inlining - Adds CSS-inlining to email bodies, to make it easy to incorporate your site's CSS or any custom CSS you want into an HTML email to help it look snazzy.
3. Tokens - Uses {tokens} with the View Parser to let you swap content out for bulk email needs
4. Templating - With tokens and inlining, templates let you define as many prearranged email templates in the database to be sent at any time. The module includes its own MVC for this so it is easy to add to any application.
Quick Start
* Install with Composer: > composer require --dev tatter/outbox
* Migrate the database: > php spark migrate -all
* Define the template routes in app/Config/Routes.php (if you want to use them)
Find the package on Packages: https://packagist.org/packages/tatter/outbox
Add issues and requests on GitHub: https://github.com/tattersoftware/codeigniter4-outbox
Tatter\Outbox
Email toolkit for CodeIgniter 4
https://github.com/tattersoftware/codeigniter4-outbox
This is a bundle of supplemental tools to help make using CI4's Email class a little easier. Major features include:
1. Email Logging - Defines an Event listener triggered on Email:

2. Inlining - Adds CSS-inlining to email bodies, to make it easy to incorporate your site's CSS or any custom CSS you want into an HTML email to help it look snazzy.
3. Tokens - Uses {tokens} with the View Parser to let you swap content out for bulk email needs
4. Templating - With tokens and inlining, templates let you define as many prearranged email templates in the database to be sent at any time. The module includes its own MVC for this so it is easy to add to any application.
Quick Start
* Install with Composer: > composer require --dev tatter/outbox
* Migrate the database: > php spark migrate -all
* Define the template routes in app/Config/Routes.php (if you want to use them)
Find the package on Packages: https://packagist.org/packages/tatter/outbox
Add issues and requests on GitHub: https://github.com/tattersoftware/codeigniter4-outbox
↧
↧
Help With Contact Form Abuse - a Trivial solution
In the last few months I have had problems with spammers abusing my contact form. The contact form result only goes to two or three departments in my company, depending on where it was accessed, but we all got tired of dealing with robot spam.
My solution was to add an id to the URL. This is an example -- contact/index/CKjuFiDk5tPO6wWfuclc6l
This is a trivial solution which will defeat most robot spammers. The token is generated as follows:
and confirmed as follows by the contact form:
It is somewhat trivial but at least contains a secret phrase. MD5 works because it returns URL friendly characters and is relatively short and reasonably fast.
If you encounter a spammer, always say the message was delivered. You can add spam rules for those who go through your pages to send spam, but I found most robots use old URLs.
Old tokens will always work. Saving this to a database with a 'time to live' helps more but adds overhead. At a minimum, this help stops the dumb ones.
My solution was to add an id to the URL. This is an example -- contact/index/CKjuFiDk5tPO6wWfuclc6l
This is a trivial solution which will defeat most robot spammers. The token is generated as follows:
Code:
$token = $this->mylibrary->GetRandomString(16) . 'my secret phrase';
$token = md5($token);
$token .= base_convert( crc32($token), 10 , 36);
and confirmed as follows by the contact form:
Code:
$actual_token = substr( $token, 0, 32);
$crc = substr( $token, 32);
if(base_convert( crc32($actual_token), 10 , 36) != $crc) { $spammer = TRUE ; }
else { $spammer = FALSE; }
##################
function GetRandomString( $length = 50)
{
$OK_CHARS= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$maxChar = strlen($OK_CHARS) - 1;
$string = "";
for( $i = 0; $i < $length; $i++)
{
rand(0,$maxChar);
$string .= $OK_CHARS[rand(0,$maxChar)];
}
return $string;
}
It is somewhat trivial but at least contains a secret phrase. MD5 works because it returns URL friendly characters and is relatively short and reasonably fast.
If you encounter a spammer, always say the message was delivered. You can add spam rules for those who go through your pages to send spam, but I found most robots use old URLs.
Old tokens will always work. Saving this to a database with a 'time to live' helps more but adds overhead. At a minimum, this help stops the dumb ones.
↧
Installing Existing CI project on another System
Dear All,
Please help me in installing an existing CI project into my system.
I am able to install the AppStarter and it is working as said in the user-guide. But now the problem is I am given an existing CI project and said to install in my system and I don't know the exact installing steps. I followed the steps as the previous one but it's not working![Sad Sad]()
Please Guide me![Angel Angel]()
Thanks!
Please help me in installing an existing CI project into my system.
I am able to install the AppStarter and it is working as said in the user-guide. But now the problem is I am given an existing CI project and said to install in my system and I don't know the exact installing steps. I followed the steps as the previous one but it's not working

Please Guide me

Thanks!
↧
error on the AdminPanel
guys on the AdminPanel I keep getting this error(please refer to the attachement) "internal error- server connection terminated". Any idea as to what could be the problem??
↧
security of CI information with Docker Secrets
In config/database.php my userid and password for mySQL is visable, unencryted. I have some other things that I use in my app that are secrets such as my AWS userids. I need to secure these and since I am using Docker I am investigating using Docker Secrets. But how can I modify the $db array prior to bringing up my system with the userid and password kept in Docker Secrets. I am not sure yet but I presume that there is an api call I will make to get the secret. But where do I place that in the CI application?
↧
↧
Session issue with CI Environment set to Testing (CI4)
I was having trouble setting up session data and retrieve them in other files. After a lot of trial and error, I found out that was because of the CI_ENVIRONMENT set to 'testing' in .env file. When this was set to either 'development' or 'production', this was working all fine.
Upon investigating the matter, this is the piece of code I found in Session.php file.
protected function startSession()
{
if (ENVIRONMENT === 'testing')
{
$_SESSION = [];
return;
}
// @codeCoverageIgnoreStart
session_start();
// @codeCoverageIgnoreEnd
}
So essentially, for 'testing' environment, it is setting session to null and hence session data was not available. Can somebody let me know why session is set to null in here? What is the reason behind this?
Upon investigating the matter, this is the piece of code I found in Session.php file.
protected function startSession()
{
if (ENVIRONMENT === 'testing')
{
$_SESSION = [];
return;
}
// @codeCoverageIgnoreStart
session_start();
// @codeCoverageIgnoreEnd
}
So essentially, for 'testing' environment, it is setting session to null and hence session data was not available. Can somebody let me know why session is set to null in here? What is the reason behind this?
↧
CodeIgniter\Database\Exceptions\DatabaseException #8
Hello guys.
I'm new here and I don't have much experience with CodeIgniter. I'm having this problem when trying to connect to the database. I tried a few things that didn't work. I installed the MySQLi extension and configured the database in the .env file but that's it. I wonder if you guys could help me with this. Thank you.
I'm new here and I don't have much experience with CodeIgniter. I'm having this problem when trying to connect to the database. I tried a few things that didn't work. I installed the MySQLi extension and configured the database in the .env file but that's it. I wonder if you guys could help me with this. Thank you.
↧
Accessing PHP library in CI4
Hello,
I am rewriting my old CI3 project to CI4.
I have a part where the app accesses the external PHP library and uses its functions.
it looks like this:
But in CI4, I get an error.
Class 'App\Controllers\WebToPay' not found
It looks like CI4 thinks that WebToPay is a controller.
Is it possible to make CI4 read external PHP classes?
I am rewriting my old CI3 project to CI4.
I have a part where the app accesses the external PHP library and uses its functions.
it looks like this:
PHP Code:
require_once('libwebtopay/WebToPay.php');
try {
$request = WebToPay::redirectToPayment(array(
But in CI4, I get an error.
Class 'App\Controllers\WebToPay' not found
It looks like CI4 thinks that WebToPay is a controller.
Is it possible to make CI4 read external PHP classes?
↧
Send email with custom html template
Hi,
How do can I send custom email template(html) using CI 4 email class?!
Thanks for any help
How do can I send custom email template(html) using CI 4 email class?!
Thanks for any help
↧
↧
WordPress Connector
Hi all- I have a pretty interesting but niche module to share with you, compliments of an employer who likes to support open-source software.
If you're like me you would love to spend all our time in CodeIgniter, but those constant requests for "help with my website" keep landing you back in WordPress (bless its little heart).
Well what if I told you that you could work on a WordPress site in CodeIgniter? Look no further!
Tatter\WordPress
WordPress content management for CodeIgniter 4
https://github.com/tattersoftware/codeig...-wordpress
Tatter\WordPress is a module you may add to any CodeIgniter 4 app to allow it to connect to and work with an existing WordPress installation. The library comes with the Reader class, a parser designed to read configuration values from WordPress' wp-config.php file. By extracting database information and installation path, Tatter\WordPress can connect to the same database and work with its content. An example addition to your Database config:
Once you have a successful connection, you may use the modules's Models and Entities corresponding to WordPress's database tables to make changes. This initial release includes full support for "wp_posts" (that was the scope needed for my current project) but support for more tables will be added over time and on request.
View and install the package from Packagist or provide feedback, bug reports, and requests at GitHub.
If you're like me you would love to spend all our time in CodeIgniter, but those constant requests for "help with my website" keep landing you back in WordPress (bless its little heart).
Well what if I told you that you could work on a WordPress site in CodeIgniter? Look no further!
Tatter\WordPress
WordPress content management for CodeIgniter 4
https://github.com/tattersoftware/codeig...-wordpress
Tatter\WordPress is a module you may add to any CodeIgniter 4 app to allow it to connect to and work with an existing WordPress installation. The library comes with the Reader class, a parser designed to read configuration values from WordPress' wp-config.php file. By extracting database information and installation path, Tatter\WordPress can connect to the same database and work with its content. An example addition to your Database config:
PHP Code:
class Database extends BaseConfig
{
public $wordpress = [
'DBDriver' => 'Tatter\WordPress\Database',
'WPConfig' => '/path/to/wp-config.php',
];
Once you have a successful connection, you may use the modules's Models and Entities corresponding to WordPress's database tables to make changes. This initial release includes full support for "wp_posts" (that was the scope needed for my current project) but support for more tables will be added over time and on request.
View and install the package from Packagist or provide feedback, bug reports, and requests at GitHub.
↧
How do I load a view from outside the default views folder in this application?
I am working on a CMS with [b]CodeIgniter 3.1.8[/b] and Bootstrap 4. I have decided to add themes to it.
The [i]themes[/i] directory is outside [i]application[/i] as can be see in the image below:
[color=var(--blue-700)]![[Image: syL0A.jpg]]()
Inside [i]themes[/i] I have the theme directory (of course) which contains the "master view", layout.php:
[/color][color=var(--blue-700)]![[Image: gOGzZ.jpg]]()
In application/core [/color]I have added a Loader.php file with the following contents:
In my Posts controller's index() method, I load the view passing it the data:
I get this error message:
[b]NOTE:[/b] the application is [b]not HMVC[/b], only MVC.
What am I doing wrong?
The [i]themes[/i] directory is outside [i]application[/i] as can be see in the image below:
[color=var(--blue-700)]
![[Image: syL0A.jpg]](http://i.stack.imgur.com/syL0A.jpg)
Inside [i]themes[/i] I have the theme directory (of course) which contains the "master view", layout.php:
[/color][color=var(--blue-700)]
![[Image: gOGzZ.jpg]](http://i.stack.imgur.com/gOGzZ.jpg)
In application/core [/color]I have added a Loader.php file with the following contents:
Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH."../system/core/Loader.php";
class MY_Loader extends CI_Loader {
function ext_view($folder, $view, $vars = array(), $return = FALSE) {
$this->_ci_view_paths = array_merge($this->_ci_view_paths, array(APPPATH . $folder . '/' => TRUE));
return $this->_ci_load(array(
'_ci_view' => $view,
'_ci_vars' => $this->_ci_prepare_view_vars($vars),
'_ci_return' => $return
));
}
}?>
In my Posts controller's index() method, I load the view passing it the data:
Code:
public function index() {
//more code here
$this->load->ext_view('third_party', 'themes/caminar/layout', $data);
}
I get this error message:
Code:
Call to undefined method CI_Loader::ext_view()
[b]NOTE:[/b] the application is [b]not HMVC[/b], only MVC.
What am I doing wrong?
↧
Can I have 2 tables in codeigniter 4 model?
Hello
In CI v.3x I used (and I was used it extensively) the following code:
So later, in the MyModel I was able to call funciton getWithCategories like this:
The role of this function was to provide me with the category name for each pair of related tables. In this example I have the faq and faq category name, but I used this for each and every case where I needed to get the category name (news, articles, etc).
Is there any way to implement this in CodeIgniter 4? I checked the documentation but I didn't find a way to have 2 tables in one model. Any idea how could I create similar reusable function in CI 4?
In CI v.3x I used (and I was used it extensively) the following code:
Code:
public function __construct()
{
parent::__construct();
$this->table_name = ('faq');
$this->primary_key = ('faqID');
$this->order_by = ('faqcategoryID, faqSorder DESC');
// my vars, used in joins, to get the category name
$this->table_name2 = ('faqcategory');
$this->foreign_key = ('faqcategoryID');
$this->parent_name = ('faqcategoryName');
} // end of constructor function
}
So later, in the MyModel I was able to call funciton getWithCategories like this:
Code:
public function get_with_category ($table_name2 = FALSE, $parent_name = FALSE, $foreign_key = FALSE, $order_by = FALSE)
{
$data = array();
$query = $this->db->query("SELECT $this->table_name. * , $this->table_name2.$this->parent_name
FROM $this->table_name
LEFT JOIN $this->table_name2
ON ( $this->table_name.$this->foreign_key = $this->table_name2.$this->foreign_key)
ORDER BY $this->order_by");
if($query->num_rows() > 0)
{
foreach($query->result_array() as $row)
{
$data[] = $row;
}
}
$query->free_result();
return $data;
} // end of function get_with_category
The role of this function was to provide me with the category name for each pair of related tables. In this example I have the faq and faq category name, but I used this for each and every case where I needed to get the category name (news, articles, etc).
Is there any way to implement this in CodeIgniter 4? I checked the documentation but I didn't find a way to have 2 tables in one model. Any idea how could I create similar reusable function in CI 4?
↧