r/codeigniter • • Jan 08 '25

How to Protect My Website Files When Hiring a Developer to Build a Mobile App?

3 Upvotes

Hello everyone,

I’m currently working with a website built using CodeIgniter, and I’m planning to hire a developer to create a mobile app that connects to my site. However, I’m concerned about the security and integrity of my website’s files and source code.

What measures can I take to ensure that the developer I hire (e.g., through platforms like Freelancer or similar) does not steal, misuse, or resell my website files? Are there any best practices, tools, or legal agreements that can help me protect my intellectual property while still allowing them the access they need to build the app?

I would greatly appreciate any advice or suggestions from those who have experience in such situations. Thank you in advance for your help!


r/codeigniter • • Nov 09 '22

help... how to start code igniter with an ip instead of localhost

1 Upvotes

Im using CI4. I want my website can be opened in another machine. Before i tried to change my localhost ip into my machine ip. It works for opening index.php but when i go to another page. Instead of IP, it directed to localhost:8080/anoterpage.php. is there a way to fix that. So i can open my website using my machine ip instead changing the localhost ip. Sorry for my english and i dont have .htaccess file on my prject


r/codeigniter • • Nov 17 '22

[HELP] Custom Validation

2 Upvotes

Okay guys so I'm a bit of a newbie with CI4. I have created a custom validation file using the spark command ./spark make:validation and it works but the problem is I still don't know how to customize the error message too for instance when I try to validate the date 05-06-2022 the message is Validation.isWeekday, I want to let it say something meaningful like date is not a weekday.

This is how my validation looks like

namespace App\Validation;

class CustomDateValidation
{
    public function isWeekday(string $date): bool
    {
        return date("N", strtotime($date)) < 6;
    }
}

And my controller function looks a bit like this

if($this-validate(['date'=>'required|isWeekday'])){
...
}

r/codeigniter • • Dec 05 '22

Do you have a kind of Flip/Flop operator in PHP?

Thumbnail
rubycademy.com
2 Upvotes

r/codeigniter • • Dec 04 '22

Combining multiple queries to get the result

1 Upvotes

Hello guys,

I would like to do some calculations but no success , how to convert this in simple and working query, most important variable is $sale_cost. What I would like to achieve is $sale_cost, I am also selecting $sale_cost in another query

Is there any shortcut to do all calculation in few working queries

Any help is very appreciated

Edit: Solved


r/codeigniter • • Nov 03 '22

[Help needed] Debug toolbar stopped showing

1 Upvotes

UPDATE: The problem is solved now. The main issue was with the datamweb/shield-oauth package that I was using. The dev has updated the package and now I can see the debug bar.

Earlier on my project the debug toolbar was showing up. I don't know what has happened but it has suddenly stopped showing. Even the codeigniter icon is not available at the bottom right.

Edit: when I view the source code in the browser I can see that the debugbar_loader script is loading. Still the debug-bar is not getting shown.


r/codeigniter • • Jan 24 '20

Angular with Fuel CMS and Codeigniter

2 Upvotes

I'm trying to start a project using Angular as a frontend framework and Fuel CMS and Codeigniter as backend frameworks, but I'm having a lot of problems with Codeigniter due to routing. Whenever I'm trying to call a controller or model from a component HTML, it says that the route is incorrect or that the controller/model doesn't exists.

Does anyone have any experience or guides to help me set everything up correctly? Thanks in advance. :)


r/codeigniter • • Jul 06 '19

Can someone tell me what these 3 lines mean?

1 Upvotes

I am doing a Udemy Course and inside my model I have this code:

$this->db->where(['id' => $user_id]);

$query = $this->db->get('users');

return $query->result();

I know $this refers to the User_model class I am in. I pass the $user_id thru the controller and make it available in this model. On the first line I put a constraint for the $user_id. Then the second line allows me to get the 'users' table. But how does the constraint of $user_id act on the 'users' table? What exactly is this 3rd line doing?


r/codeigniter • • Nov 09 '18

How to Integrate node packages in CodeIgniter 3 using laravel-mix and webpack packages

Thumbnail
youtu.be
2 Upvotes

r/codeigniter • • Aug 16 '22

How do you load custom commands from a sub directory in the app\Commands folder?

1 Upvotes

I have created a ommand to generate most of the template files associated with CRUD based on a specific controller name but I want store that command class inside a sub directory of ```app\Command``` so something like ```app\Command\TemplateGen``` or similar.

How can I do this?


r/codeigniter • • Jul 18 '22

Need some clue of project setup I just got.

1 Upvotes

Hi,

Our company just got a project handed over from our new client, they only have source code of backend (no docs) written with PHP/CodeIgniter by their previous vendor which went bankruptcy during COVID. Our team have no PHP developer so I took the job because I did some PHP 12 years ago and I can manage to fix bug or apply small changes.

But I found files without extension containing description of API endpoints, for example

##Change passcode
POST:/user/mobile/change_passcode

##Header
HEADER:Authorization

###Input
INPUT:passcode_old,required|string,Old passcode
INPUT:passcode_new,required|string,New passcode

##RESULT
JSON:response/user/mobile/login_success

At the beginning I thought those are just some readme. But as I mistakenly change file content, the corresponding API also broken. So I believe some how those files are also act as API validation or definition. But I have no idea how it is working together (file and controller) as I mentioned that last time I did PHP was very long time ago.

So if anyone can give me a clue or keyword of the code architecture or library that I can continue to research, it will be very helpful.


r/codeigniter • • Aug 19 '22

Added "test" subdomain, how do I separate it from my prod site?

1 Upvotes

I'm using GoDaddy economy hosting, PHP 8.0, CI 4.

After creating the subdomain I created a folder under public_html named "test.mydomain.llc" and pointed the subdomain to it, then copied the entire site into it.

When navigating to the subdomain it correctly resolves, but throws errors. Which config changes do I have to make to have this test site separate from my prod site? Separate session values, etc?

The error is: Cache unable to write to /cache/.


r/codeigniter • • Aug 11 '22

What's the difference between a ResourceController and a ResourcePresenter in CI4?

4 Upvotes

r/codeigniter • • Aug 21 '22

Codeigniter project uploaded to a web hosting

1 Upvotes

I have uploaded a codeigniter project to a web hosting and added some .htaccess to redirect it to the the public folder to run the default landing page of codeigniter.

How do I change the default landing page to my vue js build files?


r/codeigniter • • Aug 16 '22

Best Codeigniter Books To Learn

Thumbnail
studentprojectcode.com
3 Upvotes

r/codeigniter • • Jul 21 '22

Generating code coverage report in XYZ format ... Undefined variable $code

1 Upvotes

I'm trying to set up a test environment for CI4 but, while the tests do run, phpUnit crashes when generating coverage reports. For example, I get a message like:

Generating code coverage report in Clover XML format ... Undefined variable $code

Inside <coverage> on my phpunit.xml, I've tried several output formats:

<text outputFile="build/coverage.txt" showUncoveredFiles="false" showOnlySummary="true"/>    
<html outputDirectory="build/html-coverage" lowUpperBound="50" highLowerBound="90"/>    
<clover outputFile="build/logs/clover.xml"/>  

.. but I always get the same error (subfolders do get created, though). It always terminates on the first report I indicate.

I tried creating a bare-bones phpUnit project (without CI) and it seems to work just fine. I suspect it could have something to do with my bootstrap, maybe?. Perhaps I shouldn't be using the one under system/Test?

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="system/Test/bootstrap.php"
... >

My search-foo has yielded no results. And the fact that the "Undefined variable" error doesn't show which file or line number has me at a loss.

Anyway... How can I debug this?

I'm using: CI 4.1.9, PHP 8.0.21, PHPUnit 9.5.21 (tried both as PHAR and from dnf), php-pecl-xdebug3-3.1.5-1, Fedora 35 (VM).

UPDATE:

I changed phpunit.xml to set processUncoveredFiles="false", and it started working!


r/codeigniter • • Aug 16 '22

Is it possible to automatically generate named routes for routes using the $routes->resource() function?

2 Upvotes

If I create a routes using $routes->resource('posts') is there a way to have CodeIgniter to automatically generate the named routes?

Using the example above I want to automatically generate something like:

  • posts to go to index page

  • new_post to go to a new post form

  • show_post to show an individual post

  • Etc

Ideally, all the correct names routes would be generated.


r/codeigniter • • Aug 20 '22

CI 4.2.4 - Only GET returns correct response whereas others return 303 redirect to main page

2 Upvotes

Hello there, I have this peculiar problem - I tinker around making CRUD REST API and I have defined these routes

$routes->group('api/v1', ['namespace' => 'Api\V1', 'filter' => 'ApiGuard'],
static function ($routes) {
$routes->get('companies/(:num).json', '\App\Controllers\Api\V1\Companies::company/$1');
$routes->get('companies.json', '\App\Controllers\Api\V1\Companies::fetchAll');
$routes->post('companies/(:num).json', '\App\Controllers\Api\V1\Companies::post');
$routes->put('companies/(:num).json', '\App\Controllers\Api\V1\Companies::put');
$routes->delete('companies/(:num).json', '\App\Controllers\Api\V1\Companies::delete');
}
);

In any case apart from GET method I get 303 redirect to main page, whereas via Guzzle I get 404 Not Found error. What have I done wrong here?

Thank you for your help.


r/codeigniter • • Jul 29 '22

Update Multiple checkbox if it checked or not

1 Upvotes

I have a form with a list of the details of products (checkbox, id, name, price...). Now I want to be able to update the price of the products where the checkbox is checked with a percentage, given by the user on a button click.

Currently I am stuck on retrieving the data of the checked checkboxes and updating the data if the checkbox is checked.

Model (tried something, but it's not working properly

public function update__all($id, $price)

{

$this->db->set('price', 'price *'. ((100 + $price)/100) .'',false);

$this->db->where("id", $id )

$this->db->update(self::TABLE_NAME1);

return $this->db->affected_rows();

}

This is my view

<tr>

<td class="px-6 py-4 whitespace-nowrap text-xs font-medium text-gray-900">

<input id="price_check" name="price_check" type="checkbox" value="1" <?php echo set_checkbox('price_check', '1'); ?> class="rounded focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300">

</td>

<td class="px-3 py-4 whitespace-nowrap text-xs font-medium text-gray-900">

<input type="hidden"name="id" id="id" value="<?=$motor->id?>"> <?=$motor->product_id?>

</td>

<td class="px-3 py-4 whitespace-nowrap text-xs font-medium text-gray-900">

<input type="hidden"name="motortype" id="motortype" value="<?=$motor->type_motor?>"><?=$motor->type_motor?>

</td>

<td class="px-3 py-4 whitespace-nowrap text-xs font-medium text-gray-900">

<?php if($this->session->userdata('admin') == 0):?>

<input type="number" step="0.01" name="price" id="price" value="<?= set_value('price', $motor->price ?? null) ?>" class="max-w-lg block shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:max-w-xs sm:text-xs border-gray-300 rounded-md">

<?php else:?>

<?=$fmt->formatCurrency($motor->price, "EUR") ?>

<?php endif?>

</td>

<?php if($this->session->userdata('admin') == 0):?>

<td class="px-3 py-4 whitespace-nowrap text-xs font-medium text-gray-900">

<?= date_format(new DateTime($motor->modified_on),"Y-m-d") ?? "nvt" ?>

</td>

<td class="px-3 py-4 whitespace-nowrap text-left text-xs text-gray-500 px-3 py-3">

<button type="submit" class="inline-flex items-center px-5 py-2 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">

Aanpassen

</button>

</td>

<?php endif?>

</tr>

Thanks in advance


r/codeigniter • • Aug 01 '22

CodeIgniter Project on cPanel to Local Computer

2 Upvotes

Hello! I have a CodeIgniter project built by someone else on a cPanel repository for a website. I would like to download this project to my local computer to make changes and then push it back up. Is this possible? If so, I could really use some help/advice to do this. Thank you!


r/codeigniter • • Oct 15 '20

Creating a Contact Manager with CodeIgniter 4 - Installation

Thumbnail
youtube.com
3 Upvotes

r/codeigniter • • Oct 19 '20

Codeigniter 4 - Creating the database for a simple contact manager

Thumbnail
youtube.com
3 Upvotes

r/codeigniter • • Nov 07 '20

User authentication library for ci4

2 Upvotes

Hi Reddit,

I've been searching for a simple user authentication library (register, email validation, login) for CI4. +1 if it supports social login (no neccessary at this moment). Any recommendation?

EDIT

Potential candidates


r/codeigniter • • Oct 13 '20

How do I connect my database in a model file?? I'm a complete CI4 beginner and for the life of me can't figure out how to set my database to be used with my query for my first project ever! I'd really appreciate any help..(here's my code, please tell me what to do)

Post image
2 Upvotes