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

Object Logging Library

$
0
0
Hi all! I'd like to share my first completely original CodeIgniter4 Library. While my other libraries so far have been mostly ports from CI3, this one was conceived and implemented entirely from working in CI4. It's another lightweight library designed to "plug and play" so you don't have to worry about how to set it up or spend a lot of time configuring.
Presenting:


Tatter/Audits - out-of-the-box object event logging for CodeIgniter 4

Basic usage:
1. Install with Composer: `> composer require tatter/audits`
2. Update the database: `> php spark migrate:latest -all`
3. Setup your models:
PHP Code:
class JobModel extends Model
{
use \
Tatter\Audits\Traits\AuditsTrait;
protected 
$afterInsert = ['auditInsert'];
protected 
$afterUpdate = ['auditUpdate'];
protected 
$afterDelete = ['auditDelete']; 
4. All done!

Audits will watch for insert, update, and delete calls (or whichever you include) on configured models and log it in the `audits` table:
Code:
| id | source | source_id | user_id | event  | summary  |          created_at |
+----+--------+-----------+---------+--------+----------+---------------------+
| 10 | sites  |        27 |       9 | create | 2 rows   | 2019-04-05 15:58:40 |
| 11 | jobs   |        10 |       9 | update | 5 rows   | 2019-04-05 16:01:35 |
(Logs are batched to optimize database calls.)


I am eager for feedback, suggestions, and contributions - feel free to respond here or on GitHub (https://github.com/tattersoftware/codeigniter4-audits).
Thanks for reading!

How to set session expire on close

$
0
0
Hello eveybody,


do you know how to set:


$config['sess_expire_on_close'] = TRUE;


in version 4? My app\Config\App.php is:


public $sessionDriver            = 'CodeIgniter\Session\Handlers\FileHandler';
public $sessionCookieName        = 'ci_session';
public $sessionExpiration        = 7200;
public $sessionSavePath          = WRITEPATH . 'session';
public $sessionMatchIP           = false;
public $sessionTimeToUpdate      = 300;
public $sessionRegenerateDestroy = false;

and if I close the browser (not a single Tab, the browser) and then reopen it my old sessions are still there.

Thank you!

SQL Connection

$
0
0
Hi, i like using CodeIgniter, because is good practice for code, but now i stack with error SQL SERVER Connection using "sqlsrv" driver in CI, the error look like this "Unable to connect to your database server using the provided settings."

My specification :
PHP : v 5.6.31
CI : v 3

Email configuration file does not exist

$
0
0
After upgrading from version 2 to 3 i am getting this error "The configuration file email.php does not exist" Already Replace the ion auth files with the new files. Could you please help me out to figure out this problem. Thanks

CodeIgniter 4 appstarter beta.2 updated

$
0
0
Re-issued the CI4.0.0-beta.2 appstarter ... the tests folder structure wasn't correct.

If you are using this distribution, and want to make unit tests for your app, you want to check the new release. The "_support" folder moves to "tests/_support".

verify_password is failing

$
0
0
I moved my mysql table from another machine. I have noticed that on the new machine 

if (!password_verify($current_pass,$db_pass))

is failing. My current_pass is OK. But the $db_pass was hashed on a Windows PC. Do I need to set the "seed" (if that is what it is called) from my old PC to this new PC so that this password_verify will work? How to debug this? Should I hash the $current_pass to see if it is the same as the $db_pass?

Settings Management Library

$
0
0
Hi all! I'd like to share my final CodeIgniter 3 library, fully rewritten for CI4 and ready to use. As with all my libraries, it's "configuration lite" so read the docs at GitHub, plug it in, and go.

Tatter/Settings - plug-and-play settings management for CodeIgniter 4

Basic usage:
1. Install with Composer: `> composer require tatter/settings`

2. Update the database: `> php spark migrate:latest -all`
3. Add settings: `> php spark settings:add timezone user America/New_York`
4. Load the service: `$settings = service('settings');`
5. Get/set settings per user:
PHP Code:
$settings->timezone $_POST['timezone_preference'];
...
$userTimezone $settings->timezone

Once the library is included all the resources are ready to go and you are ready to start adding settings. You may import setting templates directly into the `settings` table or add them manually with the provided CLI command: `> php spark settings:add`

Settings take one of three scopes: session, user, global.
  • Global settings are the same for every user and provide a dynamic way to set application-wide values
  • User settings start with a default template value but each user may make their own default that persists across sessions
  • Session settings start with a default template value and may be changed by a user but revert for each new session

In addition to the five libraries I have ported (and the original 'Audits') I have two CI3 libraries I never completed: 'Notices' (a user communication gateway) and 'Plots' (a sitemap generator and route analyzer). Please let me know if you'd find interest in these for CI4.
As always I am eager for feedback, suggestions, and contributions - feel free to respond here or on GitHub (https://github.com/tattersoftware/codeigniter4-settings). Thanks for reading!

Thanks for reading!

Message: syntax error, unexpected end of file

$
0
0
Hi Friends,

Good Day!

I would like to ask help from you,

I have encounter this error.

Quote:An uncaught Exception was encountered

Type: ParseError

Message: syntax error, unexpected end of file

Filename: D:\xampp\htdocs\webdev\automation\application\views\posts\view.php

Line Number: 46

Backtrace:

File: D:\xampp\htdocs\webdev\automation\application\controllers\Comments.php
Line: 17
Function: view

File: D:\xampp\htdocs\webdev\automation\index.php
Line: 315
Function: require_once

Please see below whole page code,




Quote:
<h2> <?php echo $post['title']; ?> </h2>  
<small class="post-date">Posted on: <?php echo $post['created_at']; ?> <?php// echo $post['posts']; ?> </small><br>
<img  src="<?php echo site_url();?>assets/images/posts/<?php echo $post['post_image']; ?>">
<br><br>
<div class="post-body">
   <?php echo $post['body']; ?>    
</div>
<hr>

<?php echo form_open('posts/delete/'.$post['id']); ?>
<a class="btn btn-primary" href="edit/<?php echo $post['slug']; ?>">Edit</a>
<input type="submit" value="Delete" class="btn btn-danger">      
</form>

<hr>
<h3>Comments</h3>
<?php if($comments): ?>
<?php foreach($comments as $comment): ?>
<div class="well">
<h5><?php echo $comment['body']; ?> [by <strong><?php echo $comment['name'];
?> </strong>] </h5>
</div>
<?php endforeach; ?>
<?php else: ?>
<p>No Comments to Display </p>
<hr>

<h3>Add Comments</h3>
<?php echo validation_errors(); ?>
<?php echo form_open('comments/create/'.$post['id']); ?>
   <div class="form-group">
   <label>Name:</label>
   <input type="text" name="name" class="form-control">
    </div>
    <div class="form-group">
   <label>Email:</label>
   <input type="text" name="email" class="form-control">
    </div>
    <div class="form-group">
   <label>Body:</label>
   <textarea type="textarea" name="body" class="form-control"></textarea>
    </div>
    <input type="hidden" name="slug" value="<?php echo $post['slug']; ?>">
    <button class="btn btn-primary" type="submit">Submit</button>
</form>

Syntax error been show up after adding this code below

Quote:<hr>
<h3>Comments</h3>
<?php if($comments): ?>
<?php foreach($comments as $comment): ?>
<div class="well">
<h5><?php echo $comment['body']; ?> [by <strong><?php echo $comment['name'];
?> </strong>] </h5>
</div>
<?php endforeach; ?>
<?php else: ?>
<p>No Comments to Display </p>
<hr>

How does the Session-Library work if cookies are rejected by the browser?

$
0
0
If cookies are accepted by the browser everything works well. But if cookies are rejected by the browser it doesn’t work.

With the following PHP-settings in case of rejected cookies the session-id should be attached to the URL. I tried it with the native PHP-command session_start() and it works (http://localhost/ /read.php?PHPSESSID=db06i2694i0tfbf80h39jm8fd0).

Many thanks in advance.

PHP-settings:
session.use_cookies
On
session.use_only_cookies
Off
session.use_strict_mode
Off
session.use_trans_sid
1

permissions for uploading project to server

$
0
0
i will be uploading a project from lampp to server .
localhost has permissions of 777 on all files and directories of the project.
for uploading i thought of changing permissions to 755 for directories and 644 for files but when i do it paypal breaks.

how do i set up permissions so that everything works normally ?

any links to do what im looking to would be appreciated too.

getting a not found error

$
0
0
"The requested URL /sub_crud/Configure/index was not found on this server."

I am trying to setup a development env on a Ubuntu PC. I have moved my code across and am able to get the program to start. The first line, after logging in is to run the index function in the Configure controller. This is failing with the error above. The actual path to my program is /var/www/html/sub_crud/application/controllers/Configure.php and in it I have a function called index(). I am thinking that there is some path I didn't set up for Codeigniter?

I have set $config['base_url'] = 'http://localhost/sub_crud'; in config.php
I have index.php at /var/www/html/sub_crud
$system_path = 'system';
$application_folder = 'application';

Introduction

$
0
0
Hi, I'm Junaid Shahid.

Professionally a Software Engineer and worked in CodeIgniter and .NET Framework.

I think Admin have to create and Separate thread for the Intro..

Anyways joined this forum to get update and to share my technical skills Smile

Language helper not working, only showing variables as comments

$
0
0
Hi guys,

I have made a language file I like to use.
Using my code in my View, it doesn't work. (see PHP Code)

When I retrieve the page it only shows the langauge as a html comment, without showing the variable value.... (see attachment)


PHP Code:
<?php

//Load header specific language file
$this->load->helper('language'); //Loads the language helper
$this->lang->load('header_lang'''); //Selects the default language

?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">

  <?php echo '<title>' $this->lang->line('header_title') . '</title>'?>
  <?php echo '<meta name="description" content="' $this->lang->line('header_description') . '>'?>
  <?php echo '<meta name="author" content="' $this->lang->line('header_author') . '>'?>

logout without unsing cron-job

$
0
0
dear friend,
 i want to make function that working are than user can close this broswer ,than after 10 second he logout and his update status  user table column name logout yes, i am try this code...

function logout()
{
............update query...........
.............................
...............................
...........session destoy......
}

<script>
var stinterval;
stinterval=setInterval(unsetsession,5000);
function unsetsession(){
    var url= '<?=base_url('logout1')?>';
    $.get(url,function(data){
       if(data)
       {
        clearInterval(stinterval);
        window.location.reload();
       } 
    });
}
</script>


but in case when browser clode than script are no working

A PHP Error was encountered

$
0
0
A PHP Error was encountered

Severity: Notice
Message: Undefined variable: row
Filename: admin/user_account.php
Line Number: 79
Backtrace:


File: /home/cryplniv/trade4me.cryptogenie.cc/application/views/admin/user_account.php
Line: 79
Function: _error_handler


Severity: Notice

Message: Undefined variable: row

Filename: admin/user_account.php

Line Number: 79

Backtrace:



File: /home/cryplniv/trade4me.cryptogenie.cc/application/views/admin/user_account.php

Line: 79

Function: _error_handler



CODE OF USER ACCOUNT BELOW



<?php if($row['blocked']=='yes'){

    echo "<i class='glyphicon glyphicon-ban-circle text-danger' style='font-size:160%;'></i> 

    &nbsp; 

    <a href='####' class='btn btn-primary btn-xs' title='function will be activated later'>Enable</a>";

    }   

    else{

    echo "<i class='glyphicon glyphicon-ok-circle text-success' style='font-size:160%;'></i>

    &nbsp; 

    <a href='####' class='btn btn-danger btn-xs' title='function will be activated later'>Disable</a>";

    }?> 

    &nbsp;

   

    </td>

        </tr>


</table>

File: /home/cryplniv/trade4me.cryptogenie.cc/application/views/layout_blade.php
Line: 204
Function: include


else{

                        include ($account_type.'/'.$page_name.'.php');
                    } 


File: /home/cryplniv/trade4me.cryptogenie.cc/application/controllers/Account.php
Line: 84
Function: view


$this->load->view( 'layout_blade', $this->data );


}

File: /home/cryplniv/trade4me.cryptogenie.cc/index.php
Line: 315
Function: require_once


require_once BASEPATH.'core/CodeIgniter.php';

Make a new query builder inside a model afterCreate callback

$
0
0
Hi guys. i'm having troubles with the models callback...

in my ProductModel.php, i've got this afterCreate callback

PHP Code:
public function createCatalogPivots($data){
        if (! isset(
$data['data']['catalog_pages_ids'])){
            return 
$data;
        }

        
$product_id $data['result']->connID->insert_id;
        
        foreach (
$data['data']['catalog_pages_ids'] as $catalog_page_id){

            
$productPivotModel = new CatalogPageProductModel();

            
$insert = [
                
'catalog_page_id' => $catalog_page_id,
                
'product_id' => $product_id,
            ];

            
$productPivotModel->insert($insert);
        }

        unset(
$data['data']['catalog_pages_ids']);

        
//var_dump($data);die;

        
return $data;
    } 

when i create a product, i reference many categories linked with this product in a category_product table (HABTM).

and when i send 1 or many "catalog_pages_ids" my $data['result']->connId reference my last pivot insert and not my single product created.

so the problem is that the $product_model->getInsertID() on my Product controller return the last insert id of my pivot table and not my product table.

is that the normal behavior ? maybe i'm missing something or doing my callback's wrong.

thanks guys !

pdo_msql.so

$
0
0
Hello everyone!!, sorry for my bad english

I have been trying to upgrade my webapps from php 5.6 to 7.2 on my host, but when I make the change the apps gives me the following error

A PHP Error was encountered
Severity: Core Warning
Message: PHP Startup: Unable to load dynamic library 'pdo_msql.so' (tried: /opt/cpanel/ea-php72/root/usr/lib64/php/modules/pdo_msql.so (/opt/cpanel/ea-php72/root/usr/lib64/php/modules/pdo_msql.so: cannot open shared object file: No such file or directory), /opt/cpanel/ea-php72/root/usr/lib64/php/modules/pdo_msql.so.so (/opt/cpanel/ea-php72/root/usr/lib64/php/modules/pdo_msql.so.so: cannot open shared object file: No such file or directory))
Filename: Unknown
Line Number: 0
Backtrace:

I already try find on php ini editor but i can't find the library, could you help me to fix this issue

Thansk to everyone

Regards!!!

.png   Captura.PNG (Size: 18.26 KB / Downloads: 2)

looking for CI4 tutor

$
0
0
Hi! I am looking for a "Tutor" to make my own CI4 RESTful base webapp, I dont want to use the views (I will do for starter page and some printing outputs) ... for views I am going to use BackboneJS.  
Nothing fancy, I want to learn while I make a base webapp (RESTful service, login and start page) using CI4.  If any want to help me please contact me!!!
I had some expierence with CI2, but I dont build the platform, and want to learn how to from scratch.

Thx for read!

HTML table class

$
0
0
Does anyone know if the HTML table class will be supported in CI4? 

I did some searching and couldn't find it.

Newcomer needing help!

$
0
0
Hello all, hope things are well! Im very new to CI and have gotten off to a somewhat easy start. My issues I have as of now are with text alignment, button color, and background image. Im making the welcome_message.php a landing page then will connect it to a login/register page. As of now on the welcomme_message.php page I cant get my background image and "Enter" button color to show and center heading and text as well as button. How do I go about doing this?

Heart Heart ,
Mekaboo
Viewing all 14348 articles
Browse latest View live


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