How to load ion auth model in codeigniter HMVC - php

I am using the ion auth library for the CodeIgniter HMVC, I have copied all files from ion auth library to main CodeIgniter files but the controller, model, and views files copy to module directory Now it's showing me this error.
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Auth::$ion_auth_model
Filename: libraries/Ion_auth.php
Line Number: 122
Backtrace:
File: /opt/lampp/htdocs/CI_Hmvc/application/libraries/Ion_auth.php
Line: 122 Function: _error_handler
File: /opt/lampp/htdocs/CI_Hmvc/application/libraries/Ion_auth.php
Line: 70 Function: __get
File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php
Line: 173 Function: _ci_load_library
File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php
Line: 192 Function: library
File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php
Line: 153 Function: libraries
File:
/opt/lampp/htdocs/CI_Hmvc/application/modules/home/controllers/Auth.php
Line: 9 Function: library
File: /opt/lampp/htdocs/CI_Hmvc/index.php Line: 315 Function:
require_once
could anybody tell me how to load the model, when I work as modules?

I believe the problem is that the library is not finding the model. Check inside ion auth library construct. Look for the line where it says
$this->load->model('ion_auth_model').
It should be line 122 since that's where the error is ocurring. In here you need to prefix the module name - where you have the ion_auth_model - to the model path so the loader class knows where to find it.
In your case if the module's name is directory, then 'directory/ion_auth_model'.
Check this solution https://stackoverflow.com/a/7003180/5785088, point 10, last item. Hope it helps.

Related

Can't get the default controller of codeigniter to work in IIS

I am trying to host a codeigniter project on IIS Server but I can't get even the default controller to show instead what I receive is this below
A PHP Error was encountered
Severity: 8192
Message: Creation of dynamic property CI_URI::$config is deprecated
Filename: core/URI.php
Line Number: 101
Backtrace:
File: C:\inetpub\wwwroot\app\index.php
Line: 315
Function: require_once
I have web.config file, HTTP mappings, ISAPI, URL rewrite module and FastCGI all set but still the problem persist.
I will be very grateful if you guys can help me, am stranded.

Issue: Class 'CI_Config' not found in codeigniter

I am trying to run a codeIgniter project downloaded from 1and1.co.uk ....
But when I am browsing it showing this message:
An uncaught Exception was encountered
Type: Error
Message: Class 'CI_Config' not found
Filename: C:\xampp\htdocs\projectname\system\core\Common.php
Line Number: 196
Backtrace:
File: C:\xampp\htdocs\projectname\index.php
Line: 315
Function: require_once
I dont know why?
The class is ok in system/core/config.
Its version in system/core/codeigniter is 3.1.8.
can anyone tell me the reason pls?
Atleast some clue!
never ever faced anything like this before !
You have duplicate config file also in application/core folder which was causing this issue, there should be only one config in application/config folder.

Codeigniter Form_Validation issue

I have issue with From_Validation in Codeigniter.
Everything work fine in localhost, but when I upload the script in the server (online) I get error.
Severity: Notice
Message: Undefined offset: 0
Filename: libraries/Form_validation.php
Line Number: 226
Line: 238 Function: set_rules
Line: 315 Function: require_once
could you please help me with this?
Thank you
I think you need to Rename First letter of your Filename and Controller to Uppercase. because codeigniter controller name work are case sensitive on server.

custom library and helper not being called in database.php

I am using Codeigniter 3.1.2. I have a custom library and helper which i have auto loaded in autoload.php.
But all of these functions from helper and library not being called when I use these in database.php or in hooks (pre_controller) BUT SYSTEM'S LIBRARIES WORKS FINE THERE LIKE session, router etc etc
database.php
$CI = & get_instance();
echo $CI->nuts_lib->enc($_REQUEST['clid']);
return;
It shows following error
A PHP Error was encountered
Severity: Notice
Message: Undefined property: My_controller::$nuts_lib
Filename: config/database.php
Line Number: 76
Backtrace:
File: C:\xampp\htdocs\my_project\application\config\database.php Line:
76 Function: _error_handler
File: C:\xampp\htdocs\my_project\application\controllers\My_controller.php
Line: 18 Function: __construct
File: C:\xampp\htdocs\my_project\index.php Line: 280 Function:
require_once
I have tried through hooks still not worked. Help Please.
Found a solution. I can use native/system libraries direct in database.php and I have placed my encryption related code there. Now its working
See the flow of CI, Libraries are loaded before Database/Models
https://www.codeigniter.com/user_guide/overview/appflow.html

Unable to locate an appunto-auth model in CI 3

I'm trying to integrate appunto system to my application so I followed the full installation structure from the documentation but all time I got the next message :
An uncaught Exception was encountered
Type: RuntimeException
Message: Unable to locate the model you have specified: Pathmodel
Filename: /var/zpanel/hostdata/zadmin/public_html/git-backup_releasecandidate_net/system/core/Loader.php
Line Number: 344
Backtrace:
File: /var/zpanel/hostdata/zadmin/public_html/git-backup_releasecandidate_net/application/libraries/appunto-auth/Appunto_auth.php
Line: 24
Function: model
File: /var/zpanel/hostdata/zadmin/public_html/git-backup_releasecandidate_net/index.php
Line: 315
Function: require_once
If you are following this guide. You may need to change these lines in Appunto_auth library class.
$this->CI->load->model('appunto-auth/pathmodel');
$this->CI->load->model('appunto-auth/usermodel');
You may remove the appunto-auth folder from the path to the models since they will no longer be in that directory as we have moved it according to the guide.
$this->CI->load->model('pathmodel');
$this->CI->load->model('usermodel');
You may do the same if your app screams about the helper and config files on lines 22 and 15.

Categories