Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all 14108 articles
Browse latest View live

Best to Start Paid or Not

$
0
0
Hi all,

I have developed a CI app for about 2 years ago and now I want a new start for it.
I'm looking for a paid or not script that will help me start with the best standards.
Most important things for me is secure login, user roles.
It would be great if this app included ajax datatables , form builder. Looked everywhere , only found obsolete scripts.
My current app looks great , but in terms of scale is not.
I want to start a CI app from a script with the best practices.
How can ı do?

Is it possible to intercept CSRF token failure on POST operation?

$
0
0
Reading the docs, I see that you can turn on CSRF protection by editing app/Config/Filters.php. I've done so, and was somewhat surprised that the function just redirects back to the prior page. I suppose this makes some sense -- you can let the user try again what they were previously trying to do. However, I very much wish as a developer that I could more reliably detect this situation and respond accordingly. Is there no way to intercept this CSRF failure in your form handler?

From what I can tell, the only indication I have that CSRF has failed is not some well-defined variable (e.g., \CodeIgniter\Filters\CSRF::$crsf_failure = TRUE) that I might check either in my form handling controller::method (or even in the original form to which the user gets redirected) but the only indication I have in code is to check flash data:

PHP Code:
$session session();
var_dump($session->getFlashdata("error")); 
That yields the bland error message "The action you requested is not allowed.".

Is there any way to intercept this CSRF failure such that I might choose some other action than just redirecting back to the form? There's no log entry or anything as far as I can see. Is there some hook I can define? Or some more structured/precise variable that I can check?

ErrorException #64 Declaration of App\Filters\LoginFilter::before(CodeIgniter\HTTP\Re

$
0
0
ErrorException #64

Declaration of App\Filters\LoginFilter::before(CodeIgniter\HTTP\RequestInterface $request) must be compatible with CodeIgniter\Filters\FilterInterface::before(CodeIgniter\HTTP\RequestInterface $request, $arguments = NULL) 

I am working on codeIgniter 4.0.4 facing this problem with Login Filters.

Please suggest what to do??

How can I remove a unique constraint on a field when performing a down migration?

$
0
0
Copy-pasted from https://stackoverflow.com/questions/6503...-migration, feel free to answer the question there too to win a few points.

I have to add a unique constraint to a field after the table was created. I therefore set up a migration file with this in the up() method:
Code:
$fields = [
    'slug' => [
        'type' => 'varchar',
        'constraint' => 255,
        'unique' => true
    ]
];
$this->forge->modifyColumn('pages', $fields);
And in down():
Code:
$fields = [
    'slug' => [
        'type' => 'varchar',
        'constraint' => 255,
        'unique' => false
    ]
];
$this->forge->modifyColumn('pages', $fields);
This doesn't work.

When calling
Code:
php spark migrate:rollback
, the migration is correctly un-applied ("migrations" table is modified) but the fields stay unique.
What should I put in down() instead?

Integrate with PHPMailer

$
0
0
Hi guys,

Is anyone used PHPMailer with codeignitor 4?

I am struggling to integrate PHPMailer with codeignitor 4. Please help me with step by step.

Thanks in advance.

Hope you will help me Smile

coming in another doorway

$
0
0
My app runs fine. It is using something called "passwordless" authentication. I send out emails to employees telling them that they should complete a survey and there is a link in the email for them to do this. An employee clicks on the link and if the email checks out as OK (within a time contraint) they get access to a particular function in my Controller. I have tested this and they get in there fine. The only thing my CI app knows about the guy who just entered is their email address. 

I now need to lookup that email address in one of my tables to get some other information about them. But I have found that coming in by that "side door" means that I don't have access to the database handle I have opened in database.php. Is there some way to communicate the dbase handle, like sticking it in a cookie? Will that work so i don't have to reopen it? One issue is that the main application that opened the dbase handle might not be running (like in the middle of the night). Any suggestions?

Since the proper database.php already exists (although it hasn't been initialized in this case), is there anyway to initialize it? I tried calling l$this->load->database(); but it couldn't find the command "load".  At a minimum, is there stuff I must load first? 

About multiples caches on same file

$
0
0
How i can use A multiples times at same php file?
my code is that above, i need use 2 different cache system for same php but different queries, if not i'll need use another .php for the same purpose for use multiples caches.

PHP Code:
public function index()

$data['Inicial'] = "";

if (
$this->input->get('act') == "db")
{
if (
$this->load->database() == True)
{
$this->output->cache(30);

// Routine db
}
}
elseif (
$this->input->get('act') == "db2")
{
if (
$this->load->database() == True)
{
$this->output->cache(30);

// Routine db2
}
}

$this->load->view("Login"$data);

Path problem I have while using route groups

$
0
0
Hello, first of all I apologize for my bad English.
I am having a problem with the routes and if there will be no problem, I would like to explain by giving examples. I will give the example from a completely clean and fresh install. So there is no additional development etc.

There is a line in the "welcome_message.php" page that calls a style file from the "public" folder.
This line is:
Code:
<link rel = "stylesheet" href = "assets/css/style.css">



If I call the route as follows, the style.css file loads without problems and looks like this (example.com/assets/css/style.css)

PHP Code:
$routes-> get('welcome''Home::index'); 



But if I call the route as a group that I mentioned below, the style.css file is not loaded and the path looks like this (example.com/blog/assets/css/style.css)

PHP Code:
$routes->group('blog', function ($routes) {
    $routes->add('welcome''Home::index');
}); 


I follow such a way to avoid using base_url when calling entities. If I add "base_url ()" to the beginning of the line I call this css file, there is no problem and it calls the file in both ways without any problem, but I wanted to get your feedback because it was interesting to me. Is this a normal process? So is this what it should be or I'm making my mistake somewhere. And I wonder if there is a way to solve this without adding base_url ?

Thank you very much for your help in advance.

replacing a dropdown by checkboxes

$
0
0
Hi, I’m with a development company and I’m currently working on the SmartSchool template ( https://codecanyon.net/item/smart-school...m/19426018 ) and I’m facing a problem, when I joined the company, the software was already well advanced but new customer requests make that I cannot find a solution.

My goal would be to replace my "section" fields which are a single data per user, we must make sure that it can have several "section" and this thanks to checkboxes potentially but I do not see how to make them appear, the data displayed in "section" is necessarily linked to the class of the student, and when we modify a student page, we can only modify "section" when the field "class" is filled... I don’t know if you know what I mean.


In any case, I have to make sure to replace a dropdown that only activates when another dropbox is complete with checkboxes that only activate when the first dropdown is complete.


So if you have some tips or something i'll take it, thanks.

helper

$
0
0
Hello
I am new to codeginiter4

I cannot see the controller that I am currently in from a helper.

In codeigniter3 I used:
$ CI = & get_instance ();
$ CI-> router-> class;
$ CI-> router-> method;

I don't know how to do it in codeigniter4

Thanks!

New XAMPP release 7.4.13, 8.0.0-0

$
0
0
Just an update I tried the XAMPP 8.0.0 and it keeps throwing a missing extension error from CodeIgniter but it doe's not tell you which extension is missing.

The XAMPP 7.4.13 Is running fine here.

transfer project

$
0
0
I attempted to transfer my project from windows using XAMPP to a Raspberry using Apache and PHP 7. The links don't seem to function and some images are not showing.

Appending Session data[Username] to an existing PDF File

$
0
0
Hello, 
I have been trying to append the name of the logged in user to an existing pdf when the user clicks the download button, though have not achieved it. I tried to read about how dompdf can be utilized but seems it doesn't have that what i wish to implement, can anyone guide me please.
Thanks.

Codeigniter 4 not workin PHP 8

$
0
0
I downloade development version from github, but not show this error for php on xampp 8.0.0


Code:
Deprecated: Required parameter $userAgent follows optional parameter $body in /opt/lampp/htdocs/hu/of/system/HTTP/IncomingRequest.php on line 131

Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/of/ofi/app/Config/Events.php:35) in /opt/lampp/htdocs/of/ofi/system/Debug/Exceptions.php:137 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', '/opt/lampp/htdo...', 137) #1 /opt/lampp/htdocs/of/ofi/system/Debug/Exceptions.php(137): header('HTTP/1.1 500 In...', true, 500) #2 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #3 {main} thrown in /opt/lampp/htdocs/of/ofi/system/Debug/Exceptions.php on line 137

Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/of/ofi/app/Config/Events.php:35) in /opt/lampp/htdocs/of/ofi/system/Debug/Exceptions.php:137 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', '/opt/lampp/htdo...', 137) #1 /opt/lampp/htdocs/of/ofi/system/Debug/Exceptions.php(137): header('HTTP/1.1 500 In...', true, 500) #2 /opt/lampp/htdocs/of/ofi/system/Debug/Exceptions.php(197): CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #3 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() #4 {main} thrown in /opt/lampp/htdocs/of/ofi/system/Debug/Exceptions.php on line 137

Sad Sad Sad

Use XAMPP 8.0.0
Fedora 33 x86_64
Codeigniter 4 from github

PHP 8 Readiness - Codeigniter 4

$
0
0
Hi Seniors,

When we can expect working version of Codeigniter 4 for PHP 8 ?

Regards

CI 3.1.11, PHP 7.4, url_helper Critical Error

$
0
0
Hello. I've been running CI 3.0.6 with PHP 5.6 and 7.2 for years with no problems.



I had to upgrade my PHP version to 7.4 due to my ISP. The site now has the error below:




Message:  Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`


Filename: helpers/url_helper.php

Line Number: 162



I cannot upgrade to CI 4.x at this time. So I upgraded to 3.1.11.



The offending code is:


PHP Code:
$site_url is_array($uri)
 ? 
site_url($uri)
: (
preg_match('#^(\w+:)?//#i'$uri) ? $uri site_url($uri)); 



Since I don't get a valid url everything is messed up. (No CSS, etc.)



Frankly I don't use PHP enough to know how to convert the is_array() to make use of the parens that PHP 7.4 now wants. Searching came up dry for me.



Any help would be deeply appreciated.  Thank you.

CLI-Tools

$
0
0
Hello Everyone,
I use Codeigniter 3 and recently upgraded to Codeigniter4 with codeigniter4 CLI tools are feels most attractive. I made a CLI Tools Called CI-Recharge for Boliplate for the model, migration seed, and other stuff. I get the idea from @vulcan. So please try these add-ons. I will be glad for any review and tweaks for updates. Sorry For any Typos.

Composer Link: https://packagist.org/packages/hafijul233/ci-recharge
Command:
Code:
composer require hafijul233/ci-recharge

How do I get Scheme Information with RESTful controller?

$
0
0
Hi,



I'm trying to get Schema Information with every request from a RESTful controller ...



I have absolutely no clue HOW to debug by using var_dump from the model, as it will simply fail if I do not provide all the bells and whistles for it to function the ways it's supposed to ... now HOW would I 'break' (basically STOP) the Model from expecting to get everything it provides, and simply enable me to simply return a var_dump for getting a better understanding of WHAT's going on internally.




I find myself completely crippled when trying to get an understanding (oh no, don't ask me to read the docs ... I've DONE that at least 50 times by now). But when I need to 'inspect' anything in codeigniter I find it extremely difficult to 'intercept' ANYTHING in the way I like to ... by simply outputting stuff for me to inspect.




Instead of doing this ($id comes from a config object):





Code:
$response->data = $this->setResponseFormat('json')->respond($this->model->find($id), 200);



I'm trying to do this ($resource comes from a config object):




Code:
$fields = $db->getFieldsNames($resource->table);

    $response->fields = $fields;

    $response->data = $this->setResponseFormat('json')->respond($this->model->find($id), 200);

    return $response;



But my main question is basically: HOW do I debug or 'inspect' what a Model is actually returning?




I seem to have to in first go provide the RIGHT information, in all other cases I'll get kicked in the balls.





Please, enlighten me on what I'm missing on how to control CI instead of it controlling me ... ; )

return $fields = $db->getFieldNames('menus') not working!?

$
0
0
What am I missing here (again).

I can't get a ResourceController to return the field names of a database table ... I can't seem to get my head around HOW to debug ANYTHING in CI except randomly typing stuff in ... WHAT am I missing in debugging CI 4?

$db is confusing in the docs.

$
0
0
When I enter the docs and see something like this:

Code:
$fields = $db->getFieldNames('table_name');


It confuses the hell out of me to figure out WHERE $db 'magically' comes from ... I see it NOWHERE in MY ResourceControllers ... and if I try to define it all hell breaks loose ...

Now, please add some understandable CONTEXT when writing docs.

Can someone please shed some light on HOW to understand the docs when trying to use it as a reference?
Viewing all 14108 articles
Browse latest View live