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

Undefined index: operater_id

$
0
0
I will attach my problem, thx in advance

everity: Notice
Message: Undefined index: operater_id
Filename: ajax/ponude.php
Line Number: 49
Backtrace:
File: /var/www/html/almaks_gps_secured/application/views/ajax/ponude.php
Line: 49
Function: _error_handler

File: /var/www/html/almaks_gps_secured/application/controllers/Ponude.php
Line: 93
Function: view

File: /var/www/html/almaks_gps_secured/index.php
Line: 315
Function: require_once


.php   ponude.php (Size: 4.59 KB / Downloads: 2)

CI4 and SQQLite

$
0
0
Apologies if this is old ground. Have searched but no luck.

Trying to use latest (March 2019) CI4-develop with SQLite database.

Have setup config/Database (tried .env as well) but get following error on Line 87:


Code:
Class 'SQLite3' not found


80         if ($persistent && $this->db->DBDebug)
81         {
82             throw new DatabaseException('SQLite3 doesn\'t support persistent connections.');
83         }
84         try
85         {
86             return (! $this->password)
87                 ? new \SQLite3($this->database)
88                 : new \SQLite3($this->database, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, $this->password);
89         }
90         catch (\Exception $e)
91         {
92             throw new DatabaseException('SQLite3 error: ' . $e->getMessage());
93         }
94     }

My main question is where does this \SQLite3 class live?

I have been using CI3 with SQLite for past 12 months with no problems but I suspect this problem is down to me as I do not see any issues raised in the forum.

Post's comments

$
0
0
Hi, colleagues!

For my small blog I've added ability to post comments. Now it's just plain, w/o ability to post an answer to the comment. But I am planning to add this ability. I do not want invent the wheel, so may be anybody has useful link with some help/useful information regarding my question?
Especially I need info about DB structure.

Thank you.

compatibility site - session and unique user id tie in with paypal

$
0
0
BACKGROUND:
im working on a couple compatibility website based on astrology. the workflow of the website is as below
1. user lands on local website
2. user enters his and partners birth details like date place time of birth (data not stored in database)
3. local website sends this data to a third party vendor which calculates the astrological charts and sends it back (data stored in mysql - multiple rows and columns - one big chunk, no unique identifier sent by vendor)
4. local website performs calculations and spits out a result
5. user pays through paypal
6. local website displays the result.

now the status is that paypal is working, and compatibility score is coming out fine

ISSUE:

i want the session to be set and unique id to be set so that each user is uniquely traceable and one user doesnt end up getting results mixed up with another user.

How do i go about doing this? step by step instruction will be very much appreciated.

Multiple applications server setup

$
0
0
Hello everyone,
        I have created a multiple applications inside of  codeingiter which share the common system folder by following the guide in Code Igniter documentation.
        The setup is as follows
         (I have removed the application and system folder outside the public_html as I have read it provides security)
         codeigniter/
              application/
                   project1/
                   project2 
              system/
              webroot/
                  index.php  -Points to project1 
                  project2.php  --Points to project2 

          I am able to call my applications in the following way 
  • example.com
  • example.com/project2.php
    Now the problem is that I want to setup these on a server as the following Urls.
  •  example.com
  • project2.example.com
    How can I achieve this ...I am a newbie to codeigniter..                        

login prompt bypassed

$
0
0
i have an admin account setup in the database which allows login from login form but if someone knows the url of pages protected by login they can bypass the login

how do i protect the pages from not being viewed without login?

Your best suggestions to implement Google AMP ?

$
0
0
Hello Wonderful Community ! 

I'm interested regarding what's the best solution to implement Google AMP in a Codeigniter structure ?

In a nutshell, the concept is to have another version of your HTML (mainly) matching all the AMP specs and easily-access through a suffixed url like http://www.yoursite.com/yourpage/amp 
The specs : https://www.ampproject.org/docs/fundamentals/spec
For example <img tag must become <amp-img, image URL must contains a pre-url of a CDN, etc. 

How would you do that ? What will be the best solution ? 
I hope Cloudflare will have an automatic convert tools for that, but that's not the case unfortunately.

If some people here already implemented that, I will be happy to hear what choice they did. And if you didn't do that already, I'm interested about your opinion too ! 

Thanks a lot Smile

form_open() - URL Redirect Error

$
0
0
Helloo, I was following the Tutorial off the main CodeIgniter page and when I tried to submit the form, I was directed to this URL:
http://localhost/index.php/news/localhost/index.php/news/create. I have some PHP experience and tried a few things to get the result I wanted, but nothing worked. If anyone can offer a sugestion it would greatly appreciated.

controllers and model

$
0
0
I'm a beginner with codeigniter, I'm trying to insert the records into the database, but the in the editor phpstorm I'm using showing the model as an unidentified. someone please help me with this.

Code:
public function index()
   {
       $this->load->library('form_validation');
       $data['title']= 'Workload';
       $this->load->model('Workload_Model');
       $data['workload']  = $this->Workload_Model->get_workload();
       $this->load->view('templates/header');
       $this->load->view('administrator/Workload', $data);
       $this->load->view('templates/footer');
   }
$data['workload']  = $this->Workload_Model->get_workload();
 workload_model in this line is showing not found.

Error 508

$
0
0
Has any one else had problems with 508 messages after upgrading to version 3. The site I look after was fine until I upgraded it and I am trying to pin down why it isn't now. It is trying to display a lot of images at once. It just seems odd that once it was ok but now isn't and the upgrade seems to be the only difference not that I can see how that can affect it

Problem with code developed with XAMPP on LAMP

$
0
0
I have developed a software using XAMPP, CodeIgniter, HTML, CSS, JavaScript, PHP, MySQL, JQuery, AJAX. For uploading it on to a website I purchased a website on GoDaddy. There I am facing problems. When contacted with the website support, I was told that for shared website they have LAMP only. Now, for making it functional I need to convert the entire system for working on LAMP. Actually, as per my understanding both XAMP & LAMP have Apache, MySQL & PHP engine. But, as of now it is giving problems. 

Need help, request to suggest on what all I need to work on in above case to arrive at a solution?

Issue while running phpunit in codeigniter

$
0
0
Hi,
I am new to PHPUnit tests for CodeIgniter application. I have installed ci-phpunit-test(with reference from https://github.com/kenjis/ci-phpunit-test) in my CI application and tried to run it with Welcome Test case. Then I got some errors. I am not sure whether I missed any configuration. Please find the issues below,

  1. Undefined index: scheme in DB.php line number 121. Then, I statically gave mysqli instead of $dns['scheme'] to check further.

  2. After 1, got an error such Error: Call to a member function close() on string in the file mysqli_driver line number 541. Then I commented this line and executed the phpunit. Welcome controller got tested successfully.

  3. So, I thought to test the model and then I wrote a test and executed. The error is Error: Call to a member function result() on null. Model Code below,
    $this->db->select('name,value'); $query = $this->db->get('config'); $configData=$query->result();
I tried to fix it by myself but I couldn't. Please help me to fix these errors.

Just discovered how to utilise RSYNC to eliminate FileZilla

$
0
0
Just discovered how to utilise RSYNC to eliminate FileZilla

For years I have laboriously written code on my Localhost then used FileZilla to update the relevant Server files. 

Although FileZilla is very good it does take quite a few clicks to synchonise all the updated files so... eventually got round to trying RSYNC.  Updating changes now only takes a couple of seconds!!! FileZilla is never used!!!

The web-page update links and function can be used on any CodeIgniter installation.

The following prerequisites does take a bit of trial and error to install but the effort is well rewarded. 

Prerequisites:

1. install RSYNC
2. install Linux SSH
3. Localhost mirror image of the Server files 
4. Upload links on home page banner/footer (only on Localhost web-pages) 

Test for the following GET parameter links:

1. https://my-ci-website.com/web-page?rsync=app 
2. https://my-ci-website.com/web-page?rsync=wri
3. https://my-ci-website.com/web-page?rsync=ass

The main controller tests for above links and if true calls the following function:

PHP Code:
// Controller Web_page

  
$rsync = isset($_GET['rsync']) ? $_GET['rsync'] : false;
 
  
$data['updatedFiles'] = '';
  if(
LOCALHOST && $rsync):
   
$updatedFiles $this->rsync($rsync$DEBUG=TRUE);
   echo 
'<pre>' .print_r($updatedFilesTRUE) .'</pre>';
   
$data['updatedFiles'] = $updatedFiles;
 endif; 

 return 
view('web-page'$data);
}
//endfunc

// ===========================================================
private function rsync
(
 
string $rsync ''
 
bool   $DEBUG FALSE
)
:
string 
{
 
$result '';

 
$HERE  '/var/www/my-ci-website.com/';
  
$THERE 'ssh-root-name@123.321.222.163:';

  switch(
$rsync):
    case 
'wri':
      
$HERE .= 'writable/';
    break;  

    case 
'ass':
     
$HERE .= 'public_html/assets/';
   break;

    
// case 'app':
     
default:
      
$HERE 'app/'// application for CI3.??
     
break;  
  endswitch;  

   
$THERE .= $HERE;
   
$USER   'ssh-root-user';  
   
$PWORD  'ssh-password';
   
   
// START - PHP HereDoc syntax  
   
$tmp = <<< ____EOT
     /usr/bin/rsync -vratlz      \
     --progress \
     --rsh="/usr/bin/sshpass -p  \
     
$PWORD ssh -o               \
     StrictHostKeyChecking=no -l \
     
$USER" \
     
$HERE \
     
$THERE
____EOT;
   
// FINISH - PHP HereDoc syntax  

  // call RSYNC and get parameters by reference
  
exec($tmp$aRefFilesUploaded$iRefResult);

  
// Maybe DEBUG - return updated files
  
if($DEBUG):
    
$result $aRefFilesUploaded;   
  endif; 

  return 
$result;
}
// endfunc 

sqlite3 connection

$
0
0
Hi everyone,
I can't find out what's the problem whit my sqlite3 connection
This is my configuration:

PHP Code:
    public $sqlite = [
        'DSN'    => '',
        'hostname' => 'localhost',
        'username' => '',
        'password' => '',
        'database' => APPPATH 'Database/mydb.sql3',
        'DBDriver' => 'SQLite3',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'cacheOn'  => false,
        'cacheDir' => '',
        'charset'  => 'utf8',
        'DBCollat' => '',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ]; 

When I run
$query = $builder->get();
I have this response:
Error
Class 'SQLite3' not found

PHP Code:
86             return (! $this->password)
87                 ? new \SQLite3($this->database)
88                 : new \SQLite3($this->databaseSQLITE3_OPEN_READWRITE SQLITE3_OPEN_CREATE$this->password);
89         

Some idea?
Thanks.

Luk

Public variable

$
0
0
Codeigniter 3 I had in /config/config.php:

$config['cdn_url']  = 'https://domain.com/';

But Codeigniter 4 it does not work this way:

public $cdn_url  = 'https://domain.com/';

paypal php sdk issue

$
0
0
im using this guide for integrating paypal gateway in a website

http://webeasystep.com/blog/view_article...odeigniter

the issue is here
\
line 195 of paypal.php in controller


Code:
/** Here Write your database logic like that insert record or value in database if you want **/
           $this->paypal->create($Total,$Subtotal,$Tax,$PaymentMethod,$PayerStatus,$PayerMail,$saleId,$CreateTime,$UpdateTime,$State);

code throws an error at this line probably because it can't enter this information into the database?

i have a table called payments with above variables set in mysql database called dbpaypal

how do i enter this information into that table? or otherwise how do i fix this error

date / time help

$
0
0
hello, i have something this but dont know how make it for month *check/reset every month, (i tried something but i don't know how test it, cannot wait for end of month) can someone help me remake it for months? (reset every month) Angel

Code:
public function getWeekStartEnd()
    {
           $ts = time();
        

        if (date('w', $ts) == 1)
        {
            $start = strtotime('today', $ts);
        }
        else
        {
            $start = strtotime('this week last monday', $ts);
        }
    
        if (date('w', $ts) == 0)
        {
            $end = strtotime('today', $ts);
        }
        else
        {
            $end = strtotime('this week next sunday', $ts);
        }
        
     
        return array(date('Y-m-d H:i', $start), date('Y-m-d H:i', $end + 60*60*23 + 60*59));
    }

IDEA: Default core class extensions

$
0
0
Hi all! So after this thread we decided to create BaseController, an extended controller shipping by default in /app/Controllers (see the pull request). I'm now working on my next library which includes extending the Model and Entity classes, which got me thinking...  Should we be providing default extensions in /app for the common core classes? It seems a win-win for everyone:
  • the new/casual user won't extend anyways, it won't make a difference
  • the intermediate user (or one needing to extend later in development) will appreciate having it ready and their classes already using the /app versions
  • the power user will implement the provided classes, make their own extended versions, or bypass it and extend the /system version if they are worried about the extra parent class
Controller, Model, and Entity are the ones that stick out to me, but maybe also Filters? others?
Curious everyone's thoughts on this...

Dashboard navigation problem!!

$
0
0
am having two dashboard one for user and another of Admin
In the header when i click the admin page it cannot navigate to the corresponding page.


<a href="<?php echo base_url(); ?>users/dashboard"><?php echo $this->session->userdata('username'); ?></a>

User dashboard
Code:

Code:
$data['title'] = 'Dashboard';
            $this->load->model('user_model');          
     $data['appdetails_show'] = $this->user_model->getapp();    


            $this->load->view('templates/header');
            $this->load->view('user/dashboard', $data);
            $this->load->view('templates/footer');



Admin Dashboard
Code:

Code:
$data['title'] = 'Admin Dashboard';
     $this->load->model('user_model');          
     $data['appdetails_admin'] = $this->user_model->getapp_admin();    


     $this->load->view('templates/header');
     $this->load->view('users/admin_dashboard', $data);
     $this->load->view('templates/footer');



how to redirect ?

Duplicate record in postgresql from CodeIgniter

$
0
0
Hi Everyone,

 Before I have used mysql, for insert action my code : 

// in mymodel
 public function insertData($table, $data) {
        $res=$this->db->insert($table, $data);
        return  $db_error = $this->db->error();
         
    }
// in my controller 
 $result = $this->mymodel->insertData($mytable, $data);


if ($result['code'] == 1062){
echo "dublicate"
}

However now I am using postgresql and it returns error like this:

A PHP Error was encountered
Severity: Warning
Message: pg_query(): Query failed: ERROR: duplicate key value violates unique constraint "user_keywords_keyword_key" DETAIL: Key (keyword)=(fa) already exists.
Filename: postgre/postgre_driver.php
Line Number: 242

array(2) { ["code"]=> string(0) "" ["message"]=> string(126) "ERROR: duplicate key value violates unique constraint "user_keywords_keyword_key" DETAIL: Key (keyword)=(fa) already exists." } 


my question is that how to ignore this error
Viewing all 14062 articles
Browse latest View live


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