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

Nigerian Community

$
0
0
New Thread for the Nigerian CI developers, Newbies and other interested members. Post Job requests, Freelancing, tasks, challenges and fixes

Simultaneous connection to a Sqlite and Mysql

$
0
0
Is it possible to connect to both Sqlite and Mysql databases at same time in Codeigniter application

Database connection issues

$
0
0
Hey eveyone!

Im having issues connecting CI to database. I have a feeling some of it is due to my wbehost but was wondering if some of it was due to configuration mistake on my end. Ive attached a screenshot but if that doesnt open here it is:

A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (28000/1045): Access denied for user 'cpses_cuzpghfnyu'@'localhost' (using password: YES)
Filename: mysqli/mysqli_driver.php
Line Number: 203
Backtrace:
File: /home4/cultured/public_html/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 /home4/cultured/public_html/system/core/Exceptions.php:271)
Filename: core/Common.php
Line Number: 564
Backtrace:
File: /home4/cultured/public_html/index.php
Line: 315
Function: require_once
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/CodeIgniter.php
Line Number: 518

Thank you for any help given!

Heart Heart ,
Mekaboo

.png   Screenshot_2019-04-14 Database Error.png (Size: 50.95 KB / Downloads: 0)

Session Issues

$
0
0
So I'm having a strange issue with sessions on one of my websites. Before getting into too much detail, I have two websites using the same CI version (3.1.10) configured exactly the same and both are also using PHP 7.2. Sessions are working perfectly fine on one, but not on the other. Upon using the browser debug tools, I see that on the site that is not working, the session is showing the full array instead of the session ID. The extent of the differences between both websites are the HTML, CSS, Domain, and DB credentials (shared VPS, same PHP INI, same DB version). Both domains use SSL.

Here is my session configuration in config.php:

$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

In browser debug under storage (firefox) working website shows:

ci_session: "f89h3983hf89h389fh3" (ID isn't real, just wanted to show you what I see).

And website that has the issue shows:

ci_session: array 0 : "blah" 1 : "blah: 2 : "blah" (all the way up to...) 22 : "blah"

Funny part is that if I swap the DB configuration from the non-working site over to the working site and post information, it works without issue, which is what I've been doing to circumvent the issue in the interim. 

I turned on logging and there were no errors. Figured I'd just suck it up and ask for help because at this point I'm just spinning my wheels. Let me know if there is anything else I can provide that might shed some light on the issue.

[split] Help with POS system (CodeIgniter 3.1.10 Released??)

$
0
0
Hi,

I'm samgione,

I am new on the forum, I have some problem with the Problem with Point of Sales - Multi Outlets POS system

I found this point of sale interesting, I download it on the website github.com.

I found two problems that I would like to solve:


1- I would like to include the French language package
2- I would like to limit the rights of other users, for example the Sales Person and the manager should not be able to modify the prices of the products or Update the inventory.

please, could you fix these problems for me?


while waiting for your answer, receive my distinguished greetings.

cordially, samgione.

I recently came across this error

$
0
0
Hello guy 
I recently came across this error while I was updating my apps. It said, "fix unable to download patch files".. All I was able to conclude was for the particular file that I was downloading, they couldn't get the patch files. Correct me if I am wrong and also help me to get a fix for this. I checked my settings and everything but nothing worked. Please help me out with this issue. 
Thanks in advance.

problem in form_validation using is_callable()

$
0
0
I separate all processing data models in libraries, the model is only used to handle data from the database only and the controller is specialized to control requests.

I get a problem when processing data in library_models because of the limitations of calling methods in model_joins, so I tried experimenting so that it became a method below.
controller:
PHP Code:
$this->form_validation->set_rules(
    
'email',
    
'Email',
    [
        
'required',
        [
            
'checkEmail',
            [
                
$this->library_models->check_email($this->model_joins->user_campaign('user_email'$this->input->post('email'))) // problem here
            
]
        ],
        [
            
'checkRole',
            [
                
$this->library_models->check_role($this->model_joins->user_campaign('user_email'$this->input->post('email'))) // problem here
            
]
        ]
    ],
    [
        
'checkEmail'    => 'Email not exists',
        
'checkRole'    => 'Account is not activef'
    
]
); 

libraries:
PHP Code:
public function check_role($email){
    if (
$email->user_role == 0) {
        return 
false;
    }
    return 
true;


models:
PHP Code:
   public function user_campaign($key$value)
 
   {
 
       return $this->db->query("
            SELECT *
            FROM (
                SELECT *
                FROM users
                WHERE 
$key = '$value'
            ) users_campaigns
            INNER JOIN campaigns
            ON users_campaigns.id = campaigns.id
        "
)->row();
 
   

but the results failed, because the above method does not return any values so that it displays the message "Trying to get property 'user_role' of non-object".

please help me to solve this problem.

How to use silexphp/Pimple in Codeigniter 3


missing data after redirect

$
0
0
I have an old CI 2 project back to '11. My task was to change http to https. The frontend works well, but at backend I have problems. Step by step process:
- at the login controller the user successfully logs in (I use DX_Auth auth library) it puts all data (username, user_id, logged_in etc) to session. I debugged, all data are there.
- after positive login there's a redirect to admin/index page. like redirect('admin/index');
- here in the constructor is a login check, but the check fails because nothing in the session previously put into it.
it seems that somehow at redirect these data are losing..   Dodgy

Two facts:
1. it was working before changing to https
2. this project is set up on my computer using MAMP, the login and redirect into admin works also well. Huh

I see in CI 3 docs, that redirect() has a second parameter, like 'https'. Maybe that's the solution, or?

Any idea?
Thanks

CI3 to CI4 Migrations (__construct)

$
0
0
Hello,

i'm currently migrating a CI3 project over to CI4, my old project relied heavily on __constructor() so that each extended controller would require this.
PHP Code:
public function __construct($permission_to_check)
 
   {
 
       parent::__construct();
 
       $this->lang->load('2fa/2fa_error_messages'$this->user_lang);
 
       $this->permission_to_check $permission_to_check;
 
       if(!$this->check_permission($this->permission_to_check)){
 
           redirect('home');
 
       }
 
   

So each extended controller checks a specific permission on construct and redirects if the permission is not set.

PHP Code:
parent::__construct('has_perm_024D'); 


In CI4 i've noticed that __construct() is no longer required i wonder if it's still a "good practice"  to use the __construct() function or is there a way to achieve this with the initController function.

It might be a silly question but i want to get it right from the start Big Grin

Thanks for the tips and / or info.

Best regards,
Bart

CodeIgniter and Ingres ODBC

$
0
0
Hello, 

is CodeIgniter supporting Ingres II? I would like to connect a webpage with odbc to an ingres II database and display informations from some tables in an gridview. 

Thanks in advance!

Managing multiple applications under single folder

$
0
0
Hello everyone, I see that CI4 have for managing multiple application system where is everything put under root to subfolders. I would like to ask if it is possible to change it so similar to Windows where every application is under one folder "Program Files" and in this folder, we have all applications (by default). This way it makes sense only if you want to have completely different projects based on the same core but I want to have one platform including more application like OS. Similar to one XHMVC project for CI 3.

-> https://bitbucket.org/wiredesignz/codeig...niter-3.x/

THX

How to create templates

$
0
0
Hi 
I am new to codeigniter and i want to create a template for my codeigniter website so that that template appears in in pages in both admin and front side of the website. I read tutorial for simple header and footer view files but that is not enough, i want full examples. If there are any prepared template demo available online then tell me here.

Thanks in avance.

Namespace Migrations Ordering

$
0
0
TLDR: Should migrations run in order across all namespaces?

I'm working on user authentication, and a common problem is how to setup a users table that has the necessary fields and structure for authentication but doesn't result in duplicated data. I imagine the three approaches one could take:
1. Create a comprehensive user table, with common fields beyond those require for auth (phone, avatar, fav color, etc)
2. Create an authentication-specific table (`auth_accounts`) and let devs make their own users table to link to it
3. Create a bare-minimum `users` table and let devs add to the table as needed

With CI4's migration controls, #3 seems to me the best practice approach. However I'm running into the issue that namespace migrations are handled namespace-by-namespace (https://github.com/codeigniter4/CodeIgni...r.php#L345) with the following priority: App, PSR4, Classmap, Composer. This is fine for a slow build where the dev includes the authentication library, runs the migrations, then writes her own migration to modify the new `users` table and runs migrations again - but it will fail on deployments.

Considering the above scenario then pushed to a new container: all migrations files are detected at once, the dev's modification migration gets priority and fails because the `users` table doesn't exist yet. The simplest solution (logically, not implementation wise) is to have migrations run in order regardless of their namespace.

Migration Methods


CI4 Validation - how use/work with calleble functions

$
0
0
Hi everyone, I've read CI4-manual for validation library and not found example code how use/work with calleble or anonymous functions? When I use example code from CI3 - this code don't works
.png   Screenshot_1.png (Size: 26.74 KB / Downloads: 7) . May be anybody know how use calleble/ anonymous functions validation in CI4-version. Sorry for my English.    

My exaple rule for email code:

PHP Code:
'email' => [

 
                   'label'  => 'Email',
 
                   'rules'  => [

 
                       'required',
 
                       'valid_email',
 
                       [
 
                           'email_exist', function( $str )
 
                           {
 
                               return $this->checkExistsUserEmail$str );
 
                           }
 
                       ]
 
                   ],
 
                   'errors' => [

 
                       'email_exist' =>'Email not found'
 
                   ]
 
               

Uncaught ReferenceError: $ is not defined - Datepicker - Codeigniter 3

$
0
0
Hello Guys, Greetings!

First of all, thank you so much for the help!

Scenario:

1° I use codeigniter

2° I added this very simple script in my VIEW FILE.
(https://jqueryui.com/datepicker/#default)

3° This is the error message that i receive in the browser:
Code:
Uncaught ReferenceError: $ is not defined at VM113 info:21
(anonymous) @ VM113 info:21

This my controller method:



Code:
public function info()
{
   $data['pagetitle'] = 'general use';

   $this->load->view('theme/header1');
   $this->load->view('multiform/register2',$data);
   $this->load->view('theme/footer');
}


This my Header VIEW file: header1



Code:
<!DOCTYPE html>
<html lang="en">
<head>  
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Teste</title>

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/testelib/jquery-ui.min.css">  

<script type="text/javascript" defer src="<?php echo base_url(); ?>assets/testelib/jquery-3.3.1.min.js"></script>

<script type="text/javascript" defer src="<?php echo base_url(); ?>assets/testelib/jquery-ui.js"></script>

<script>

   $( "#datepicker" ).datepicker({
   inline: true
   });
</script>

This my VIEW file: register2


Code:
<p>Date: <input type="text" id="datepicker"></p>

PS: If i try this example with "all files in the same folder", the script works normally.

Just because the .js and .css Links of the Jquery Libraries are in separeted files, i got this conflict.

What should i do please?

Is that even possible to call the Jquery Script when the HTML-Attributenode is in another file??

Jquery Script - Header File
Code:
<script>

   $( "#datepicker" ).datepicker({
   inline: true
   });
</script>

HTML-Attributenode - VIEW File

Code:
<p>Date: <input type="text" id="datepicker"></p>


I would be MEGA Thanksful if someone can help me with it.

csrf_exclude_uris with regex

$
0
0
Hi Guys,

Looking for a bit of help with getting wild cards into the csrf_exclude_uris.

I want to exclude all urls that are like the following /(anything)/page/view

I tried the following \/*\/page\/view but no dice.

Many thanks for any help

Thanks

Colin

codeigniter 3.1.10 index.php code is not concise

$
0
0
codeigniter 3.1.10 index.php code is not concise,duplicate code in many.
$application_folder = strtr(
rtrim($application_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
);
Why not deal with it in one place?
for example:
arr=[dir1,dir2,dir3];
foreach($arr as $k=>$v) {
$arr[$k]= strtr(
rtrim($v, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
}

Clear Codeigniter libraries

$
0
0
Hello, i have to remove a libraries under system directory as "Image_Lib" Javascript folder because i must have a clear Codeigniter for Fortify scan. Smile

It's possible remove ?

thanks
Viewing all 14348 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>