Category: CodeIgniter

Freelance Web development

Send SMS using CodeIgniter


$url = ‘http://smsgateways.com/api/sendmsg.php?’ . http_build_query([ ‘user’ => ”, ‘pass’ => ”, ‘sender’ => ”, ‘phone’ => ”, ‘text’ => ”, ‘priority’ => ‘ndnd’, ‘stype’ => ‘normal’ ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch);

Export Database using codeigniter


Database Utility Class : CodeIgniter PHP script to download mysql db-codeigniter,Backup MySQL database with CodeIgniter public function dbexport() { $this->load->dbutil(); $prefs = array( ‘format’ => ‘zip’, ‘filename’ => ‘my_db_backup.sql’ ); $backup =& $this->dbutil->backup($prefs); $db_name = ‘backup-on-‘. date(“Y-m-d-H-i-s”) .’.zip’; $save = ‘public/uploads/’.$db_name; $this->load->helper(‘file’); write_file($save, $backup); $this->load->helper(‘download’); force_download($db_name, $backup); }

How to print Codeigniter upload error


if you want to display errors on upload functionality in codeigniter. Use the following function if($this->upload->do_upload(‘image’)) { $contentimagedata=$this->upload->data(); $descdata[‘image’]=$contentimagedata[‘file_name’]; }else { $error = array(‘error’ => $this->upload->display_errors()); print_r($error); }

website development

CodeIgniter Disallowed Key Characters


Somewhere in the html form you simply missed the opening quote  of input name attribute(s). Example <input type=”text” name=last_name“> Just find and use the right syntax for happy coding. You can find the code for tracking disallowed characters are in system/core/input.php file function _clean_input_keys($string) { if (! preg_match(“/^[a-z0-9:_/-]+$/i”, $string)) { exit(‘Disallowed Key Characters.+’. $string)); } return

csrf exception url codeigniter


Add the following line to application/config/config.php file.   $config[‘csrf_exclude_uris’] = array(‘controller 1′,’controller 2′,’controller3/method 1′,’controller3/method 2’);   system/core/Security.php Modify the public function csrf_verify() function in Security.php public function csrf_verify() { // If it’s not a POST request we will set the CSRF cookie if (strtoupper($_SERVER[‘REQUEST_METHOD’]) !== ‘POST’) { return $this->csrf_set_cookie(); } // this IF statement is the

How to Check Expired Sessions using jQuery Ajax and PHP


We can achieve using the php and ajax.The following ajax call execute in every 10 seconds to check the status of session.If it expired the user redirected to seesionout page. Ajax call in every 10 seconds   var check_current_session; function CheckForCurrentSession() { var strSession=”check_current_session=true”; jQuery.ajax({ type: “GET”, url: “check_current_session.php”, data: strSession, cache: false, success: function(result){

Codeigniter utf-8 character input data save issue


Codeigniter have utf-8 character input data save issue in some hosting servers like Etisalat. system/core/Utf8.php have function to detect illegal char in input data(post/get). In some cases utf-8 char is consider as illegal and save function will fail. For avoid data saving issue do the following in clean_string() function of Utf8.php at line 85. $str

Codigniter arabic language issue in etisalat hosting server


Codeigniter have utf-8 character input data save issue in some hosting servers like Etisalat. system/core/Utf8.php have function to detect illegal char in input data(post/get). In some cases utf-8 char is consider as illegal and save function will fail. For avoid data saving issue do the following in clean_string() function of Utf8.php at line 85. $str

Add multiple products to Paypal Cart with One Click


Paypal is a payment gateway used in number of websites in world wide.We can post shopping cart info  to paypal from the website The following code shows the syntax of code used to post multiple cart items to paypal <form id=”paypalform” action=”https://www.paypal.com/cgi-bin/webscr” method=”post” name=”paypal_auto_form”> <input name=”rm” type=”hidden” value=”2″ /> <input name=”cmd” type=”hidden” value=”_cart” /> <input

Check database exists in codeigniter


Load the Database Utility Class Notice: Databse Connection should be already established before loading the above class. <?php $this->load->dbutil(); ?> loaded class can access the functions using the  following method: <?php $this->dbutil->some_function() ?> <?php $this->dbutil->list_databases(); ?> the above function will  show an array of database names: <?php $dbs_smarttips = $this->dbutil->list_databases(); ?> <?php foreach ($dbs_smarttips as $db_name)

Advertisment ad adsense adlogger