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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 23,060
» Latest member: simplicityau
» Forum threads: 73,113
» Forum posts: 374,269

Full Statistics

Latest Threads
Admin Panel for website
Forum: General Help
40 minutes ago
» Replies: 1   » Views: 34
"Class 'App\Models\UserMo...
Forum: CodeIgniter 4 Support
3 hours ago
» Replies: 2   » Views: 55
HTTPS site losing PHP con...
Forum: CodeIgniter 4 Support
4 hours ago
» Replies: 0   » Views: 23
A way to override the ins...
Forum: CodeIgniter 4 Feature Requests
5 hours ago
» Replies: 5   » Views: 176
Why the $this->find( $id ...
Forum: CodeIgniter 4 Support
7 hours ago
» Replies: 4   » Views: 1,223
Helper - Call to undefine...
Forum: General Help
Today, 09:33 AM
» Replies: 7   » Views: 684
Best practice in SEO
Forum: Best Practices
Today, 07:49 AM
» Replies: 2   » Views: 138
Why would I choose Nginx ...
Forum: General Help
Today, 02:51 AM
» Replies: 1   » Views: 149
PHP warning not logged in...
Forum: CodeIgniter 4 Support
Today, 01:57 AM
» Replies: 3   » Views: 107
is_ajax_request() doesn't...
Forum: Issues
Today, 01:44 AM
» Replies: 2   » Views: 1,863

 
  What causes this Page Not Found error?
Posted by: Ajax30 - Yesterday, 01:48 AM - Forum: CodeIgniter 3.x - Replies (1)

I am working on a basic blog application in Codeigniter 3.1.8 and Bootstrap 4.

I have added a registration and login system to this application. I am current working on a password reset system.

In the Changepasword controller, the `index` method takes the parameters `$email` and `$token`:

    

PHP Code:
public function index($email$token) {
        $data $this->Static_model->get_static_data();
        $data['pages'] = $this->Pages_model->get_pages();
        $data['tagline'] = 'New password';
        $data['categories'] = $this->Categories_model->get_categories();
   
        
// Form validation rules
        $this->form_validation->set_rules('password''Password''required|min_length[6]');
        $this->form_validation->set_rules('cpassword''Confirm password''required|matches[password]');
        $this->form_validation->set_error_delimiters('<p class="error-message">''</p>');
   
        
if(!$this->form_validation->run()) {
            $this->load->view('partials/header'$data);
            $this->load->view('auth/newpassword');
            $this->load->view('partials/footer');
        } else {
        $this->Usermodel->set_new_password($email$token);
        }
    

In the routes file I have this line for the above controller:

    
PHP Code:
$route['changepasword/(:any)/(:any)'] = 'changepasword/$1/$2/'


The entire routes file:

    
PHP Code:
<?php
    defined
('BASEPATH') OR exit('No direct script access allowed');
   
    $route
['default_controller'] = 'posts';
    $route['install'] = 'install';
    $route['migrate'] = 'migrate';
    $route['register'] = 'register';
    $route['login'] = 'login';
    $route['newpassword'] = 'newpassword';
    $route['changepasword'] = 'changepasword';
    $route['changepasword/(:any)/(:any)'] = 'changepasword/$1/$2/';
    $route['dashboard'] = 'dashboard';
    $route['dashboard/create-post'] = 'dashboard/posts/create';
    $route['dashboard/create-page'] = 'dashboard/pages/create';
    $route['dashboard/create-category'] = 'dashboard/categories/create';
    $route['dashboard/manage-authors'] = 'dashboard/users';
    $route['404_override'] = '';
    $route['categories/posts/(:any)'] = 'categories/posts/$1';
    $route['(:any)'] = 'posts/post/$1';
    $route['translate_uri_dashes'] = FALSE

I also added this to the `config.php` file:

    
PHP Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_()@=&\-!'


Yet, at the URL `http://ciblog.com/changepasword/[email protected]/f450469ac1970b06074acb7c430d431d` instead of the view being rendered, I get the error:

    404 Page Not Found
    The page you requested was not found.

If I use
Code:
md5($this->user_email)
 instead of $
Code:
this->user_email

I get the URL: `http://ciblog.com/changepasword/ec9814883d7f7149bc15f1ed1f472da9/d7571dc4e25ea76278bee5eb45251f11, but still, the 404 Page Not Found error message.

What am I doing wrong?


  Manual installation and the 404 error
Posted by: bastian - Yesterday, 01:24 AM - Forum: Installation & Setup - No Replies

Several months ago I gave CI4 a first try with version 4.0.4 and a manual installation.

Now I'd like to switch one of my project from CI3 to CI4. I'd like to choose the manual installation way. But now I ran into that 404-everywhere problem.

The user guide is not helpful. I realize that it needs some extra effort from me getting into this version 4 world. Maybe some of you guys can help me get through this.

So, what I did is:

1) Downloaded latest CI version (4.1.1) and uploaded it to my apache server. I put everything inside /public_html/project/

2) I then pointed the domain in cPanel to folder /public_html/project/public

3) I changed $baseUrl to the domains name.

4) I updated config/Database so that it matches my database information.

At this time there's no welcome message. Instead I get the 404 page.

As I used htaccess within my CI3 projects I can't believe it's a mod_rewrite problem. Any ideas?


  database configuration not work
Posted by: asadalizafar - 02-27-2021, 11:25 PM - Forum: General Help - No Replies

i have tried many time my database does not connected THIS ERROR HAVE COME I ALSO MY DATABASE .PHP file also i add datebase.php file attache for you to check the problem also i add new in model/property.php file i also another method on controller/properties.php file on this file i add db_test method 
and this is the link when i connect to the database 
http://localhost:8888/index.php/properties/db_test
and last thing 
this command when i run in terminal 
env DB_USER=root DB_PASSWD=root  DB_NAME=ci_course php -S localhost:8888
but not work please help to solve the issue 
A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (HY000/2002): No such file or directory
Filename: mysqli/mysqli_driver.php
Line Number: 202
Backtrace:
File: /Applications/file/Ex_Files_CodeIgniter_Basics/Ch01/01_06_final/application/models/Property.php
Line: 17
Function: database
File: /Applications/file/Ex_Files_CodeIgniter_Basics/Ch01/01_06_final/application/controllers/Properties.php
Line: 29
Function: connection_test
File: /Applications/file/Ex_Files_CodeIgniter_Basics/Ch01/01_06_final/index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Applications/file/Ex_Files_CodeIgniter_Basics/Ch01/01_06_final/system/core/Exceptions.php:272)
Filename: core/Common.php
Line Number: 573
Backtrace:
File: /Applications/file/Ex_Files_CodeIgniter_Basics/Ch01/01_06_final/application/models/Property.php
Line: 17
Function: database
File: /Applications/file/Ex_Files_CodeIgniter_Basics/Ch01/01_06_final/application/controllers/Properties.php
Line: 29
Function: connection_test
File: /Applications/file/Ex_Files_CodeIgniter_Basics/Ch01/01_06_final/index.php
Line: 315
Function: require_once

A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: controllers/Properties.php
Line Number: 29



Attached Files
.php   database.php (Size: 4.45 KB / Downloads: 2)
.php   Property.php (Size: 287 bytes / Downloads: 1)
.php   Properties.php (Size: 765 bytes / Downloads: 1)

  Understanding View Cells
Posted by: LeoKarun - 02-27-2021, 11:07 PM - Forum: CodeIgniter 4 Discussion - Replies (2)

Hello everyone!

I'm working on my first project on code igniter and found it quite promising so far. I've been going through the docs and came across View Cells, which seemed quite useful on the first glance. But after going through the entire documentation I found it a bit contradicting to the MVC pattern. 

On one hand, we are supposed to make calls to Views and Models only from a Controller class, but View Cells on the other hand, suggests that the method can be called from any class- even outside Controller. The doc mentioned an example that uses a function from a different class(not controller), querying data from a model and feeding the retrieved data to a view. Is it a good practice? Doesn't this approach break the MVC pattern? If someone could help clarify, it'd be really helpful. Cheers.


  A way to override the instantiation of the controller
Posted by: eavmarshall - 02-27-2021, 11:14 AM - Forum: CodeIgniter 4 Feature Requests - Replies (5)

I'd like to stop referencing the dependency injection container (DIC). I'm force to do this, because the controller is created with the new keyword. If I could override this behavior and have the DIC create the controller, I can get the dependencies I need by adding them to the constructor.

For example

PHP Code:
//what I currently have to do
class currentController extends controller
{
    public function 
index()
    {
        
Container::staticMethodToGetContainerInstance()
            ->
createInstance(DependencyIWant::class)
            ->
doSomeWork();
    }
}

//what I want to do
class theControllerIWant extends controller
{
    private 
$dependency;

    public function 
__construct(DependencyIWant $dependency)
    {
        
$this->dependency $dependency;
    }

    public function 
index()
    {
        
$this->dependency
            
->doSomeWork();
    }


I do have a branch https://github.com/eavMarshall/CodeIgniter4 that should allow me to do this, by adding a common function that can be overwritten


  CI4 ROUTING PROBLEMS: for dynamically created pages
Posted by: Avega Soft - 02-27-2021, 09:57 AM - Forum: CodeIgniter 4 Support - No Replies

Hello everyone. There was a difficulty in writing the route rules for dynamically created pages on the site. Example, a user can create pages with the following URLs:

  • sitename.com/aaa
  • sitename.com/bbb
  • sitename.com/bbb/ccc
  • sitename.com/bbb/ccc/ddd
Where, aaa, bbb,ccc, ddd-slug pages and subpages

Also on the site, there are modules for which their own route rules have already been created. Now the question. How can I make dynamic route rules so that they are executed after all the other rules?


  How to make both Nuxtjs and CI4 works with NGINX under the same domain?
Posted by: simonickalexs - 02-27-2021, 07:23 AM - Forum: CodeIgniter 4 Support - No Replies

So, what I need is like:
- example.test #this is the nuxt app
- example.test/api #this is the ci4 app

This is my current configuration (I'm using wamp.net on windows)

Code:
server
{
    listen 127.0.0.1:80;
    listen 127.0.0.1:443 ssl;
    server_name example.test;
    root "D:/Wamp.NET/sites/example/server/public/";
    
    # ssl
    ssl_certificate "D:/Wamp.NET/bin/2-nginx_1.19.6_x86/conf/vhosts/example.test.crt";
    ssl_certificate_key "D:/Wamp.NET/bin/2-nginx_1.19.6_x86/conf/vhosts/example.test.key";
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout 5m;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;
    
    gzip            on;
        gzip_types      text/plain application/xml text/css application/javascript;
        gzip_min_length 1000;
    
    location / {
        #proxy_redirect                      off;
        #proxy_set_header X-Real-IP          $remote_addr;
        #proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        #proxy_set_header X-Forwarded-Proto  $scheme;
        #proxy_read_timeout                  1m;
        #proxy_connect_timeout               1m;

        # Websocket support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        # Proxy to the Node.JS instance of the client app
        proxy_pass http://localhost:3000;
    }
    
    location /public {
        root "D:/Wamp.NET/sites/example/client/static/";
    }
    
    location /api {
        try_files $uri $uri/ /index.php$is_args$args;
    }
    
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:7415;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    
    location ~ /\.ht {
        deny all;
        }
}

But the current config throw error "404 File Not Found Can't find a route for 'api'.".
Any help would be appreciated. Thank you  (:


  Cannot get $useSoftDelete working
Posted by: kelvinwongg - 02-27-2021, 06:35 AM - Forum: CodeIgniter 4 Support - Replies (1)

I cannot make the 'Soft Delete' feature working in Codeigniter 4.1.1.

I setup the migration, model, and controller according to the documentation.

But the row is removed instead of marked delete date at 'deleted_at' column.

Wonder what I have missed to make it work as expected.

Migration

PHP Code:
$this->forge->addField("`deleted_at` datetime NULL"); 

Model

PHP Code:
class TestModel extends Model
{
    
// protected $DBGroup              = 'default';
    
protected $table                'test';
    protected 
$primaryKey           'id';
    
// protected $useAutoIncrement     = true;
    // protected $insertID             = 0;
    // protected $returnType           = 'array';
    
protected $useSoftDelete        true;
    
// protected $protectFields        = true;
    
protected $allowedFields        = ['district','state','country'];

    
// Dates
    
protected $useTimestamps        true;
    protected 
$dateFormat           'datetime';
    protected 
$createdField         'created_at';
    protected 
$updatedField         'updated_at';
    protected 
$deletedField         'deleted_at';



Controller

PHP Code:
$this->model model('App\Models\TestModel');
$this->model->delete(5); 


  upload on server
Posted by: vojkoz - 02-27-2021, 03:31 AM - Forum: CodeIgniter 4 Support - Replies (6)

Hello,
on my server (localhost) the site works great. when i upload it to an external server it reports an error


Code:
Error
Class 'App\libraries\AuthLibrary' not found

APPPATH/Controllers/Auth.php at line 29

SimpleAuth application


  Notice: Undefined property: Config \ App :: $ cookieSameSite
Posted by: Smirnov48 - 02-27-2021, 02:50 AM - Forum: CodeIgniter 4 Support - Replies (4)

Hello.

Why appears this notice?

Notice: Undefined property: Config\App::$cookieSameSite in C:\xampp\r_crm\vendor\codeigniter4\codeigniter4\system\HTTP\Response.php on line 168

Tested on my local machine. Xampp, Spark, it is in both.

I was fix it by adding this line to App.php
public $cookieSameSite = '';

But I don't understand what's happening at all.
Help me, please.

PS. Solution from https://forum.codeigniter.com/thread-765...ieSameSite doesn't work.

PSS. I found this site with same notice - https://www.qio.kr/



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