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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 24,051
» Latest member: ellariasandy
» Forum threads: 73,338
» Forum posts: 375,210

Full Statistics

Latest Threads
View
Forum: Model-View-Controller
2 hours ago
» Replies: 0   » Views: 13
Cors php issues
Forum: CodeIgniter 4 Discussion
3 hours ago
» Replies: 4   » Views: 112
Problems with Unit Testin...
Forum: Installation & Setup
5 hours ago
» Replies: 0   » Views: 22
CI 4 contact form with co...
Forum: CodeIgniter 4 Support
9 hours ago
» Replies: 3   » Views: 70
One .env File for Develop...
Forum: CodeIgniter 4 Support
10 hours ago
» Replies: 3   » Views: 101
Hi, sir Update query is n...
Forum: General Help
11 hours ago
» Replies: 3   » Views: 74
Problem with mime_in only...
Forum: CodeIgniter 4 Support
11 hours ago
» Replies: 1   » Views: 33
CI 4 will not recognize U...
Forum: CodeIgniter 4 Support
11 hours ago
» Replies: 1   » Views: 26
google/facebook/ldap logi...
Forum: Libraries & Helpers
11 hours ago
» Replies: 1   » Views: 31
How to use LayoutView wit...
Forum: CodeIgniter 4 Support
Today, 09:34 AM
» Replies: 6   » Views: 941

 
  Prepare ci_sessions for future Migration
Posted by: nurmyrat - 04-08-2021, 12:39 AM - Forum: CodeIgniter 4 Support - No Replies

Hello CodeIgnitians.

Recently I started to work on some project and decided to do it with CodeIgniter ( Laravel was the first choice ) and had an idea to prepare 
common needed libraries and controllers at hand ( like in Laravel ) and later just have a new copy of a prepared ( by a composer ) project and
start a new one with everything at hand.

I copied the two migrations from Laravel and make a migration for CI 4
1) 2014_10_12_000000_create_users_table
2) 2014_10_12_100000_create_password_resets_table  (has this line $table->string('email')->index())

and also prepared ci_session database from https://www.codeigniter.com/user_guide/l...ler-driver documentation

However there was a problem with KEY/INDEX ( yes I know they are the same for MySQL)

CREATE TABLE IF NOT EXISTS `ci_sessions` (
        `id` varchar(128) NOT NULL,
        `ip_address` varchar(45) NOT NULL,
        `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
        `data` blob NOT NULL,
        KEY `ci_sessions_timestamp` (`timestamp`)
);


the following code 

$this->forge->addKey('timestamp')

has not the same effect with the SQL statement written above which in MySQL it is done with CREATE INDEX statement.

Is there any solution or way to replicate the CREATE INDEX statment with $this->forge->!!!   ?


  Schedule releases of CI4
Posted by: Avega Soft - 04-07-2021, 08:56 PM - Forum: CodeIgniter 4 Discussion - Replies (15)

Hi everyone. Want discuss about schedule releases of CI4. I think that the release cycle framework unstable and many fixes and features long time stay on dev version, instead it can be used on productions in new releases on CI4.

What if at the end of each month to make a new release, which will include fixes and new features of the current month. I think this would be the most acceptable option to keep the framework up to date. What you think about?


  Codeigniter 4 / PayPal integration
Posted by: naravind - 04-07-2021, 08:10 PM - Forum: General Help - No Replies

Can someone point me to examples of PayPal integration with codeigniter 4?


  Form Re-submission Error
Posted by: waleed - 04-07-2021, 09:24 AM - Forum: CodeIgniter 4 Support - Replies (5)

Hye guys.
Just need a help!!!
When I was using ci3 so I faced an issue when user clicked browser back button, that's show " resubmit the form", so I solved that issue after setting header in ci3. Now I upgrade my site ci3 to ci4 and again I m facing same issue. Can anyone plz convert this code in CI4?


CI 3 code in Controller construct


$this->output->set_header('Last-Modified:' . gmdate('D, d M Y H:i[Image: confused.png]') . 'GMT');
$this->output->set_header('Cache-Control: no-cache, must-revalidate');
$this->output->set_header('Cache-Control: post-check=0, pre-check=0', false);
$this->output->set_header('Pragma: no-cache');

CI 4 code in BaseController

$response->setHeader('Last-Modified',gmdate("D, d M Y H:i[Image: confused.png]").'GMT');
$response->setHeader('Cache-Control', 'no-store');
$response->setHeader('Cache-Control', 'no-cache');
$response->setHeader('Cache-Control', 'must-revalidate');
$response->setHeader('Cache-Control', 'post-check=0');
$response->setHeader('Cache-Control', 'pre-check=0');
$response->setHeader('Pragma','no-cache');
$response->setHeader('Cache-Control', 'no-cache');

In CI 4 it is not working.
Any help will be appreciated.


  Header not set in CI4
Posted by: waleed - 04-07-2021, 08:52 AM - Forum: CodeIgniter 4 Support - No Replies

Hye guys.
Just need a help!!!
When I was using ci3 so I faced an issue when user clicked browser back button, that's show " resubmit the form", so I solved that issue after setting header in ci3. Now I upgrade my site ci3 to ci4 and again I m facing same issue. Can anyone plz convert this code in CI4?


CI 3 code in Controller construct


$this->output->set_header('Last-Modified:' . gmdate('D, d M Y H:iConfused') . 'GMT');
$this->output->set_header('Cache-Control: no-cache, must-revalidate');
$this->output->set_header('Cache-Control: post-check=0, pre-check=0', false);
$this->output->set_header('Pragma: no-cache');

CI 4 code in BaseController

$response->setHeader('Last-Modified',gmdate("D, d M Y H:iConfused").'GMT');
$response->setHeader('Cache-Control', 'no-store');
$response->setHeader('Cache-Control', 'no-cache');
$response->setHeader('Cache-Control', 'must-revalidate');
$response->setHeader('Cache-Control', 'post-check=0');
$response->setHeader('Cache-Control', 'pre-check=0');
$response->setHeader('Pragma','no-cache');
$response->setHeader('Cache-Control', 'no-cache');

In CI 4 it is not working.
Any help will be appreciated.


  Possible bug in Connection.php --> Connection to encrypted ssl database
Posted by: fedeburo - 04-07-2021, 06:03 AM - Forum: General Help - No Replies

Hi, i started a thread a few days ago, about having problems with connecting to database encrypted with ssl...
The problem is the following:

I need to make a:
mysqli->ssl_set(null, null,null,....), and then
mysqli_real_connect($mysqli, $hostname,$username, $password, $database, $port,null, MYSQLI_CLIENT_SSL);

The problem is that seeing the documentation, there is not so much information of how to do this (is all done automatically filling the encrypt array of the database configs), so i started dagging into codeigniter libraries...

I found the class that make the connection that is Connection.php, and seeing the code, i realize that it is impossible to gather a connection as i want, because in order to set the clientFlag to MYSQLI_CLIENT_SSL, it is needed that one of the paths of the encrypt part of the database config is fullfill (line 130 if (!empty($ssl)):

$ssl = [];

            empty($this->encrypt['ssl_key'])    || $ssl['key']    = $this->encrypt['ssl_key'];
            empty($this->encrypt['ssl_cert'])   || $ssl['cert']   = $this->encrypt['ssl_cert'];
            empty($this->encrypt['ssl_ca'])     || $ssl['ca']     = $this->encrypt['ssl_ca'];
            empty($this->encrypt['ssl_capath']) || $ssl['capath'] = $this->encrypt['ssl_capath'];
            empty($this->encrypt['ssl_cipher']) || $ssl['cipher'] = $this->encrypt['ssl_cipher'];

            if (! empty($ssl))
            {

         .....


I need to make this type of connection automatically with the driver of mysqli (in other apps that dont use codeigniter is done), without putting any path.
$this->mysqli->ssl_set(
                    $ssl['key'] ?? null$ssl['cert'] ?? null$ssl['ca'] ?? null,
                    $ssl['capath'] ?? null$ssl['cipher'] ?? null
                );
this should also be null, null,null ...

And then the call to:
$this->mysqli->real_connect($hostname$this->username$this->password,
                $this->database$port$socket(should be null)$clientFlags).


I realize that changing the code of Connection.php, the line number 130:

if (! empty($ssl))  --> to if (empty($ssl)) 


or without that if, the connection is done correctly. Is this a bug?

In few words, i want to make an ssl connection with all the params of ssl_set to null so all the paths should be null.

What would be the solution?

this id the Database.php encrypt array that i have:
'encrypt' => array(
            'ssl_ca' => '',
            'ssl_verify' =>false),

  

If i put the real path in 'ssl_ca', this wont work. Is there a way to access to this part of Connection.php, without putting any path? Because the actual mysqli version support making this connections with the paths to NULL.


  how to catch a user 'X' ing the tab?
Posted by: richb201 - 04-07-2021, 04:02 AM - Forum: General Help - Replies (4)

My application uses only a single tab. When the user presses the regular "logoff" button my code runs the send_to_locker() function. But I also need to catch when users just X out the tab in the browser. How to do this? I tried putting the below line into my code but that doesn't seem to work. 

<body onbeforeunload="return send_to_locker()">


public function send_to_locker()
{
//some junk
}


Basically I am trying to store a user's "state" for the next time they visit. My code tries to send a few needed files to S3. If my server could somehow tell that the client is no longer connected,  that might do it. How can I do this?


  Can't access my code igniter 3 website
Posted by: Lazarus-CG - 04-06-2021, 02:21 PM - Forum: General Help - Replies (2)

My website has been working for almost a year and then it suddenly stopped loading. When I go to the link it just keeps loading. I am hosting on a shared server. I found this error on the cpanel:
 client denied by server configuration: /site.com/system/
[i] client denied by server configuration: /site.com/application[/i]
[i][i] client denied by server configuration: /site.com/php.ini[/i][/i]

I can access HTML pages that I put at the root of the website but not PHP ones. 
By renaming the index.php and changing from the build from production to development and vice versa, the website works for a short period and the problem reoccurs. I'm assuming the problem is the .htaccess file and apache. 
Any ideas on how to solve the problem?


  Avoid using helpers
Posted by: MrWhite - 04-06-2021, 10:23 AM - Forum: Best Practices - No Replies

I don't get why pretty much every PHP framework comes with this shit. I wish CI4 helpers were libraries instead of helpers. global methods are the worst thing. hard to test and bad for readability.

Now it's too late. ci4 helpers will be a thing forever. but if you are gonna create custom helpers, please don't! create and use libraries instead.


  Change dynamically setting variables
Posted by: AleJSON - 04-06-2021, 10:15 AM - Forum: General Help - No Replies

Hi to everybody! I need to change the 'defaultLocale' var from a controller, in codeigniter 3 I could do that simply with this line:

$this->config->set_item('language', $lang);

But in Codeigniter4 if try to do this:

config('Config\\App')->defaultLocale = $lang;

The value of the global config don't change...

How can i do this? With the function config() i'm accessing to the global config or to a new instance of config?

Thx!



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