Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,909
» Latest member: greatlearning
» Forum threads: 66,192
» Forum posts: 415,370

Full Statistics

Latest Threads
PayPal button callback fa...
Forum: General Help
49 minutes ago
» Replies: 11   » Views: 126
Editable datatables
Forum: General Help
2 hours ago
» Replies: 7   » Views: 466
Problem with IPN paypal a...
Forum: Installation & Setup
2 hours ago
» Replies: 1   » Views: 72
What php variable is the ...
Forum: Installation & Setup
2 hours ago
» Replies: 2   » Views: 57
CodeIgniter 3.1.5 Release...
Forum: News & Discussion
2 hours ago
» Replies: 16   » Views: 3,286
Efficient way to convert ...
Forum: General Help
3 hours ago
» Replies: 1   » Views: 31
A tutorial about Ion Auth...
Forum: Learn More
3 hours ago
» Replies: 21   » Views: 13,655
CSRF Protection not being...
Forum: CodeIgniter 3.x
7 hours ago
» Replies: 4   » Views: 75
Login to client account p...
Forum: General Help
8 hours ago
» Replies: 19   » Views: 1,382
How to create Admin Secti...
Forum: Best Practices
8 hours ago
» Replies: 6   » Views: 1,035

 
  What php variable is the path to the views folder?
Posted by: desbest - 4 hours ago - Forum: Installation & Setup - Replies (2)

I want to insert a css stylesheet and I need the php variable for the codeigniter script/app path or the views/ path to be able to do so. What is it?


  Efficient way to convert my project from CI version 2.1.4 to CI version 3.1.5
Posted by: amogh - 4 hours ago - Forum: General Help - Replies (1)

Can anybody please provide me with the resources for version conversion i.e from Codeigniter 2.1.4 to Codeigniter 3.1.5.

I have a decently built web site (Link:https://www.travelur.com). How long will it take for the conversion?. Is the conversion worth the time spent?

Experts please respond.


  CSRF Protection not being set
Posted by: albertleao - Yesterday, 04:42 PM - Forum: CodeIgniter 3.x - Replies (4)

Hey everyone!

Long time since I've had an issue, hope you guys can help.

I've been running codeigniter on my production servers for quite some time without any issue. Spontaneously this afternoon I started receiving errors with people not being able to post to any of my forms.

After looking into it I noticed that my csrf_cookie was not being set. Has anyone ever encountered this issue? My config['csrf_protection'] is set to true and nothing else has changed.

What's confusing me even more is that my development box which is running the exact same code as production is setting my csrf token just fine. Weird one!


  Adding things to config.php
Posted by: doomie22 - Yesterday, 03:28 PM - Forum: General Help - Replies (2)

Hi all,

I am wondering if its safe/best practice to add global variables to the config.php file.  Reason for this is what I am making is for multiple sites and I just want to be able to quickly change the variable in the config file or to put it elsewhere.

Thanks,
Doomie


  Problem with IPN paypal after update
Posted by: StratoKyke - Yesterday, 02:21 PM - Forum: Installation & Setup - Replies (1)

Hi guys,

I have a big problem with my IPN paypal after the update codeigniter.

PHP Code:
public function ipn() {
        if (!
count($_POST)) {
            throw new 
Exception("Missing POST Data");
        }
        
$raw_post_data file_get_contents('php://input');
        
$raw_post_array explode('&'$raw_post_data);
        
$myPost = [];
        foreach (
$raw_post_array as $keyval) {
            
$keyval explode('='$keyval);
            if (
count($keyval) == 2) {
                if (
$keyval[0] === 'payment_date') {
                    if (
substr_count($keyval[1], '+') === 1) {
                        
$keyval[1] = str_replace('+''%2B'$keyval[1]);
                    }
                }
                
$myPost[$keyval[0]] = urldecode($keyval[1]);
            }
        }
        
$req 'cmd=_notify-validate';
        
$get_magic_quotes_exists false;
        if (
function_exists('get_magic_quotes_gpc')) {
            
$get_magic_quotes_exists true;
        }
        foreach (
$myPost as $key => $value) {
            if (
$get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
                
$value urlencode(stripslashes($value));
            } else {
                
$value urlencode($value);
            }
            
$req .= "&$key=$value";
        }
        
$ch curl_init(info('link_paypal''shop'));
        
curl_setopt($chCURLOPT_HTTP_VERSIONCURL_HTTP_VERSION_1_1);
        
curl_setopt($chCURLOPT_POST1);
        
curl_setopt($chCURLOPT_RETURNTRANSFER,1);
        
curl_setopt($chCURLOPT_POSTFIELDS$req);
        
curl_setopt($chCURLOPT_SSL_VERIFYPEER1);
        
curl_setopt($chCURLOPT_SSL_VERIFYHOST2);
        
curl_setopt($chCURLOPT_FORBID_REUSE1);
        
curl_setopt($chCURLOPT_HTTPHEADER, array('Connection: Close'));
        
$res curl_exec($ch);
        
$info curl_getinfo($ch);
        
$http_code $info['http_code'];
        if (
$http_code != 200) {
            throw new 
Exception("PayPal responded with http code $http_code");
        }
        if (!(
$res)) {
            
$errno curl_errno($ch);
            
$errstr curl_error($ch);
            
curl_close($ch);
            throw new 
Exception("cURL error: [$errno$errstr");
        }
        
$my_file 'file.txt';
        
$handle fopen($my_file'w') or die('Cannot open file:  '.$my_file);
        
fwrite($handle$res);
        
curl_close($ch);
        if (
$res == 'VERIFIED') {
            
$payment_amount $myPost['mc_gross'];
            
$payment_currency $myPost['mc_currency'];
            
$txn_id $myPost['txn_id'];
            
$payer_email $myPost['payer_email'];
            
$custom explode('|'$myPost['custom']);
            
$userID $custom[0];
            
$username $custom[1];
            
$custom $myPost['custom'];
            
$payment_status $myPost['payment_status'];
            
$this->load->model('shop/donations');
            
$this->donations->add_coins($payment_amount$payment_currency$txn_id$payer_email$userID$username);
            return 
true;
        } else {
            return 
false;
        }
    } 

And this is the form

PHP Code:
{form url="https://www.sandbox.paypal.com/cgi-bin/webscr" type=""}
                            <
input type="hidden" name="cmd" value="_xclick" />
                            <
input type="hidden" name="item_name" value="tester" />
                            <
input type="hidden" name="business" value="email"/>
                            <
input type="hidden" name="notify_url" value="{base_url}index.php/shop/donation/ipn" />
                            <
input type="hidden" name="return" value="{base_url}index.php/shop/donation/success" />
                                <
input type="hidden" name="cancel_return" value="{base_url}index.php/shop/donation/delete" />
                            <
input type="hidden" name="rm" value="2" />
                            <
input type="hidden" name="no_note" value="1" />
                            <
input type="hidden" name="no_shipping" value="1" />
                            <
input type="hidden" name="currency_code" value="EUR" />
                            <
input type="hidden" name="page_style" value="paypal" />
                            <
select name="amount">
                                {foreach 
$donation_view as $dv}
                                    <
option value="{$dv.price}">{$dv.name}</option>
                                {/foreach}
                                  </
select>
                            <
input value="Donate" type="submit" name="submit" />
                        {
form


Before updating the codeigniter files it worked perfectly.

Now when I make a donation I can not make any mistakes in any way is like PayPal does not contact ipn.

Instead if I go to the ipn link, it returns the various errors.

How can I fix this problem?

I look forward to your answer.



EDIT: Sorry, I write in a wrong section


  Codeigniter transactions with multiple functions
Posted by: funcion - Yesterday, 07:31 AM - Forum: Best Practices - Replies (8)

I need to add a product in the "products" table, and I get the added product ID and then add the details of that product in the table "product details"

In the official page of Codeigniter they show how to do this but without using functions, eg:

PHP Code:
$this->db->trans_start(TRUE); // Query will be rolled back
$this->db->query('AN SQL QUERY...');
$this->db->trans_complete(); 

I need to use functions and still maintain integrity that if one of the two queries fails then the records are not added, I have prepared the following code and I want to know if in this way Codeigniter will be able to detect if the query fails or not to undo the records Or if there is another best practice or other way of doing it.


PHP Code:
// Instead of using the $this->db->query('AN SQL QUERY...'); I am using a function:
public function init_product()
{
 
   $this->db->trans_begin();
 
   $this->new_product();
 
   $this->new_product_details();

 
   if ($this->db->trans_status() === FALSE)
 
       $this->db->trans_rollback();
 
   } else {
 
       $this->db->trans_commit();
 
   }


PHP Code:
// Adding the product and returning the aggregate product ID
public function new_product()
     
    $data 
= array(            
        
'name' => $this->input->post('name'),
 
       'details' => $this->input->post('details'),
 
       'price' => $this->input->post('price')
 
   );
 
   $this->db->insert('products'$data);
 
   if($this->db->affected_rows()) {            
        return $this
->db->insert_id();
 
   }
 
   return false;


PHP Code:
// Adding Product Details
public function new_product_details()
     
    $data 
= array(            
        
'product_id' => $this->new_product(),
 
       'user_id' => $this->session->id_user
    
);
 
   $this->db->insert('products'$data);
 
   if($this->db->affected_rows()) {            
        return true
;
 
   }
 
   return false;



As you specify, I need to know if this way is functional even though I do not follow the example as done in Codeigniter, and if using these functions Codeigniter can detect whether or not queries or insertions in the database fail, also if they can give me Some better example.

Thanks for your help


  Remove index.php without .htaccess
Posted by: krystian2160 - Yesterday, 07:21 AM - Forum: CodeIgniter 4 Feature Requests - Replies (3)

It would be great to have no index.php in address without needing of .htaccess file with


Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

I don't like it.  Confused


  Query Caching or NOT?!!!
Posted by: pb.sajjad - Yesterday, 07:13 AM - Forum: Best Practices - No Replies

Hi to all developers...
I'm using last version of CI, created a blog system (some posts, series, commenting, payment link, login,... and more) and want run it on a shared host.

In order to get best performance, I want to use CACHE. As you an option is to cache whole page, but I think it is not good (at least for me!). Another option is Query Caching, that I think it's good (but not sure!). Instead to get a post or other thing from database (for second attempt and up), it read from generated files. And when I update a post, I could delete files in order to regenerating.
(I test output profiler to see loading time and memory usage, loading time is different and same to when do not use query caching, memory usage is a little more.)

My Questions:
What's your opinion about this option? What are advantages/disadvantages? How could I handle this issue in best way? What about other options (like libraries)? And any guide to reach best performance for CI app.

thanks to all (especially experts!) Smile


  I have a problem
Posted by: weserve - Yesterday, 06:30 AM - Forum: General Help - Replies (2)

i have error ==> Parse error: syntax error, unexpected T_CONST in /home/weserveint/domains/weserve.in.th/public_html/WeShop/system/core/CodeIgniter.php on line 58

help me pls. 

remark ==> version 3.1.4  up


  how to use order by codeigniter
Posted by: kayinja.denis - Yesterday, 03:58 AM - Forum: General Help - Replies (7)

am trying to use order by but i don't get all the results in table.
i have payment table 

Code:
payments={
          paymentid|academicID| studentID| invoiceID| amount
             1     |     1    |     1    |     1    |   2000  
             1     |     1    |     1    |     2    |    300  
             1     |     1    |     1    |     1    |     5  
             1     |     1    |     1    |     3    |    600
             1     |     1    |     1    |     3    |     10 

}
 and i have these two scripts
MY_model.php
PHP Code:
function get_order_by($array=NULL) {
 
       if($array != NULL) {
 
           $this->db->select()->from($this->_table_name)->order_by($this->_order_by)->where($array);
 
           $query $this->db->get();
 
           return $query->result();
 
       } else {
 
           $this->db->select()->from($this->_table_name)->order_by($this->_order_by);
 
           $query $this->db->get();
 
           return $query->result();
 
       }
    } 

action_helper.php
PHP Code:
function joide($array$value$key=NULL) {
 
   $returnArray = array();
 
   if(count($array)) {
 
       foreach ($array as $item) {
 
           if($key != NULL) {
 
               $returnArray[$item->$key] = strtolower($value) == 'obj' $item $item->$value;
 
           } else {
 
               $returnArray[] = $item->$value;
 
           }
 
       }
 
   }
 
   return $returnArray;

amount_m.php
PHP Code:
function get_order_by_amount($array=NULL) {
 
       $query parent::get_order_by($array);
 
       return $query;
 
   

controller.php

PHP Code:
$payments joide($this->amount_m->get_order_by_amount(['academicID' => $academicID]), 'obj''invoiceID');

$this->data['amount'] = $payments

so when i run  <?php dd($mummy) ?> i don't get all the results,  i mean it won't get the amount = 3 and 10 where invoiceid =1 and 3 respectively but it returns  the 2000, 3000 and 600, it seems it doesn't return the amount where invoiceID is the same like for 1 and 3



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.