“The URI you submitted has disallowed characters.” CI Poblem Now Solved


When setup an CI application on my localhost its successfully install. But application links that use application route does not work. It show “The URI you submitted has disallowed characters.” error message. After googling the problem find that its PHP version related problem, you can also say that a CI version problem. But what is it not matter, I need to fix the bug and time is short. So its simple solution we can try:

As my application CI version is 1.7 do the following:

=> Go to system/libraries/URI.php

When open URI.php go to line 189 and you will find below:
if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))

Change it to below:
if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))

=> Then go to system/application/config/config.php

Open the file config.php and go to line 126 and you will find below :
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';

Change it to below:
$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';

Now our problem fix. The application run ok.


A series solutions of Codeigniter version errors


In the article I am going to post some solutions of well-known Codeigniter errors. These errors list are here:

1. When you run an old codeigniter applications in new version localhost server (PHP5.x, MySQL5, Xampp7.2 ) it shows blank page known as white skin (?screen) of death.

2. Shows the error message “The URI you submitted has disallowed characters”

3. Shows the error message “Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\……….php on line ……”

If you see any of the errors, follow these steps one after another. May be it could help you to run your Codeigniter applications without errors.


First check is your Codeigniter version is new or old. To do this, go to ci_applicationname/system/codeigniter folder. Open CodeIgniter.php file. On the top of the file find-out these two lines:

// CI Version
define('CI_VERSION', '1.6.3');

If it shows older Codeigniter version then download a Latest Codeigniter from here.
What will you do now? Unzip the new CI version and go to system folder. In system folder copy codeigniter, database, helpers, language, libraries, scaffolding, plugins all these folder. Place/Paste these folders in your old Codeigniter application system folder. Please backup your old CI apps before do any change. Now again go to new version of Codeigniter, and go to system/application/config folder and copy the file constants.php file and paste it in your old Codeigniter application same directed folder. Now your CI version up-gradation done. Ok now going to solve some common problems.

Open the index.php file located in your application folder root. Find out this two line:

Reverse the code, mean remove comment tag from first line and place comment tag in second line like followings:

Now run your application on your localhost. It will show all error if any file/folder missing. Fix that by place those files/folders on that specified location from other running CI apps or from new CI version.

If you see this message “The URI you submitted has disallowed characters” do the followings:
Go to your application system/libraries and open the file URI.php. At line 189 or like something this you will see this:
if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
and replace that by this
if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
or by this
if ( ! preg_match("|^[".str_replace('\\-', '-', preg_quote ($this->config->item('permitted_uri_chars')))."]+$|i", $str))

And go to your application system/application/config folder and open config.php file and go to line 126 or something like that, you will see this $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-'; and replace this by $config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';

Now the error “The URI you submitted has disallowed characters” may be fixed.

Till your application show error? It may be look like this “Deprecated: Assigning the return value of new by reference is deprecated in ….php on line …”. What now? Yeah! I like to solve the bugs by dirty way. Again Open the index.php file located in your application folder root. Find out this two line:


Now again reverse the code, mean remove comment tag from second line and place comment tag in first line like followings:

Now go to http://localhost/your_apps and run apps. Hope all errors are fix now.

Paypal Integration Using Codeigniter – Phase:1


Paypal is one papular e-payment gateway and there are different types of API or way to integrate Paypal in your site. Most of us implement the PayPal package Website Payment Standard on our website. It is the process where user payment handled on PayPal website instead of seller website. I implement a process where user buy different products and all selected product show in my wesite cart also in PayPal Cart (multiproducts show on PayPal) and pay on paypal website. Then user redirect to my website with some post data necessary for database entry (back office process for order tracking) in my site. On the phase I will discuss, how to make a codeigniter controller for send request to paypal website. This phase also include paypal form creation, send request to paypal, show data on paypal cart, and all prerequisite need to integrate the gateway.

First of all we need to make a form that send data to paypal website. There are different discussion about that how make a form, and all are the same discussions. Everybody omit some essential issues as below :

  1. Need to create PayPal Sandbox account by developer (It need for create environment of dummy transaction)
  2. Forget to configure some essential value for successful test transaction (Discuss in future)
  3. Need to discuss how to send multiproduct list to paypal (Show Paypal Cart on Paypal page)
  4. How codeigniter create PayPal Request Form

(i) First we need to create paypal test account known as sandbox account on paypal. Go to here and create a test/developer account. Then create demo Sellers and Buyer account for live experience of dummy transaction. You can get different tutorial how to do that on Google. After create all account make a note of your buyer and seller email and password by notepad that you just created on paypal. In future you will need to set the seller/marcent email on paypal request form and you will enter the buyer email when redirect to PayPal site for pay. When you finish, go to the next step.

(ii) Now we will create a form for send request to paypal website. For minimize our development task we implement a well known PayPal library download from here . Place all files to specific location. Load the PayPal library on your request controller that create the PayPal Form. I have write the following code on my controller to make a PayPal Form by a view page.

// Generate Paypal Request Form
// By the Function Create Payment Processing Form And Submit a Pending Order to our MySQL database
function create_paypal_form()
$orderarr = array();
* Get post data/order details from ckeckout request form to send
* PayPal and and to add database for order process start
// Get all the products ID by comma(') saperated from Shopping Cart
$setpaypal_prodid = $this->input->post('getpaypal_prodid');
// Get all the products name by comma(') saperated from Shopping Cart
$setpaypal_prodname = $this->input->post('getpaypal_prodname');
// Get all the products quentities by comma(') saperated from Shopping Cart
$setpaypal_totlqunt = $this->input->post('getpaypal_totlqunt');
// Get he total price value from Shopping Cart
$setpaypal_totlprice = $this->input->post('getpaypal_totlprice');
// Get all the subtotal prices of products/items by comma(') saperated from Shopping Cart
$setpaypal_itemprice = $this->input->post('getpaypal_itemprice');
//Get splited products IDs from comma(') saperated products IDs
$paypal_id_array = explode('|',$setpaypal_prodid);
//Get splited products name from comma(') saperated products name
$paypal_prod_array = explode('|',$setpaypal_prodname);
//Get splited products quentities from comma(') saperated products quentities
$paypal_qunt_array = explode('|',$setpaypal_totlqunt);
//Get splited subtotal prices from comma(') saperatedsubtotal prices
$paypal_price_array = explode('|', $setpaypal_itemprice);
* Initialize & Submit Order to DATABASE Before Pass to Paypal Payment Gateway
$orderarr['set_order_date'] = time();
$orderarr['set_order_item_id'] = $setpaypal_prodid;
$orderarr['set_order_item_name'] = $setpaypal_prodname;
$orderarr['set_order_totl_price'] = $setpaypal_totlprice;
$orderarr['set_order_item_qunt'] = $setpaypal_totlqunt;
$orderarr['set_item_summery_id'] = $setpaypal_summid;
$orderarr['set_order_status'] = "Pending";
$orderarr['set_order_transaction_id'] = "";
$orderarr['set_order_transaction_status'] = "Not Start";
$orderarr['set_order_shipto_id'] = "";
$orderarr['set_order_member_id'] = $this->session->userdata('member_id');
$orderarr['set_order_member_email'] = $this->session->userdata('member_userid_email');
$orderarr['set_delete_flag'] = '0';
Configure Basic Setup for Payment Request Form
$result_paypal_business_accemail = $this->orderprocessing_model->get_paypal_acc('Paypal');
// "seller_email" is a table fieldname, on that table we store all paypal marcent information
$set_paypal_business_accemail = $result_paypal_business_accemail[0]->seller_email;
// If we want to show user cart also on PayPal site then we use this
// In that case we send multiple products to PayPal site
$this->paypal_lib->add_field('cmd', '_cart');
// Use value 1 for this
$this->paypal_lib->add_field('upload', '1');
// This is marcent/seller business email, we use our sandbox business email that create early
$this->paypal_lib->add_field('business', $paypal_business_acc );
// This is success page URL, in our case(MVC) we set there a controller URI
//here paypal is a controller & success is a method
$this->paypal_lib->add_field('return', site_url('paypal/success'));
// This is cancle page URL, in our case(MVC) we set there a controller URI
//here paypal is a controller & cancle is a method
$this->paypal_lib->add_field('cancel_return', site_url('paypal/cancel'));
// This is paypal notification page URL, in our case(MVC) we set there a controller URI
//here paypal is a controller & ipn is a method
$this->paypal_lib->add_field('notify_url', site_url('paypal/ipn'));
// This is Currency Code, never send symbolic code like $, #
$this->paypal_lib->add_field('currency_code', 'USD');
// Configure Return method = POST by set value 2
// Set this if you want to send any custom value
$this->paypal_lib->add_field('custom', '1234567890');
*Use this for SingleProduct/TotalPrice_IN_A_SingleRow Type Order Process by PayPal
/*$this->paypal_lib->add_field('item_name', $paypal_prod_array[0]);
$this->paypal_lib->add_field('item_number', $paypal_id_array[0]);
$this->paypal_lib->add_field('amount', $setpaypal_totlprice);
$this->paypal_lib->add_field('add', '1');*/
*Use for PaypalCartType/MultiProducts Order Process
for($loop=0; $looppaypal_lib->add_field($item_name_set, $paypal_prod_array[$loop]) {
$this->paypal_lib->add_field($item_number_set, $paypal_id_array[$loop]);
$this->paypal_lib->add_field($item_amount_set, $paypal_price_array[$loop]);
$this->paypal_lib->add_field($item_quent_set, $paypal_qunt_array[$loop]);
$this->paypal_lib->add_field($item_ship_set, '1');
//Generate Paypal Submition Form With Hidden Field
//Based on Form Field Configuration on The Above
$header_data['paypal_form'] = $this->paypal_lib->paypal_form();
$header_data['paypal_prodid_array'] = $paypal_id_array;
$header_data['paypal_name_array'] = $paypal_prod_array;
$header_data['paypal_qunt_array'] = $paypal_qunt_array;
//header('Location: '.config_item('base_url').'index.php/index/admindashboard/homeflag');
* Available CART POST DATA to Header and Session
$country_list = $this->user_model->get_country_list();
$header_data['country_list'] = $country_list;
$header_data['setpaypal_prodid'] = $flash_sess['setpaypal_prodid'] = $setpaypal_prodid;
$header_data['setpaypal_prodname'] = $flash_sess['setpaypal_prodname'] = $setpaypal_prodname;
$header_data['setpaypal_totlprice'] = $flash_sess['setpaypal_totlprice'] = $setpaypal_totlprice;
$header_data['setpaypal_totlqunt'] = $flash_sess['setpaypal_totlqunt'] = $setpaypal_totlqunt;
$header_data['setpaypal_itemprice'] = $flash_sess['setpaypal_itemprice'] = $setpaypal_itemprice;
$header_data['setpaypal_summid'] = $flash_sess['setpaypal_summid'] = $setpaypal_summid;
if($paypal_flag=="OFF") {
if($paypal_flag=="ON") {

Do not follow the same on the above code. Your controller just like your requirements. My code just help you to guess what to do.