<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2728107235097448137</id><updated>2011-09-01T07:33:18.464-07:00</updated><category term='routes'/><category term='codeigniter'/><category term='hmvc'/><category term='codeigniter php'/><category term='htaccess'/><category term='404'/><category term='bit.ly'/><category term='form validation'/><category term='php'/><category term='library'/><category term='codeigniter 2.0'/><title type='text'>Codeigniter Fan Blog</title><subtitle type='html'>codeigniter, codeigniter blog, unofficial, php framework</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-5248433790562012615</id><published>2010-12-04T19:45:00.000-08:00</published><updated>2010-12-04T19:54:12.401-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>Codeigniter 2.0 Controller</title><content type='html'>class Welcome extends CI_Controller&lt;br /&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;function __construct()&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;parent::__construct();&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-5248433790562012615?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/5248433790562012615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/12/codeigniter-20-controller.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/5248433790562012615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/5248433790562012615'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/12/codeigniter-20-controller.html' title='Codeigniter 2.0 Controller'/><author><name>aizuddinmanap</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-2238168970120553151</id><published>2010-08-06T02:29:00.000-07:00</published><updated>2010-08-06T02:31:46.212-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='library'/><category scheme='http://www.blogger.com/atom/ns#' term='bit.ly'/><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>Bit.ly Codeigniter</title><content type='html'>as simple as&lt;br /&gt;&lt;pre class="brush: js"&gt;$this-&gt;load-&gt;library('bitly');&lt;/pre&gt;&lt;br /&gt;then echo.simple!&lt;br /&gt;&lt;pre class="brush: js"&gt;echo $this-&gt;bitly-&gt;shorten('http://aizuddinmanap.blogspot.com/'); &lt;/pre&gt;&lt;br /&gt;&lt;a href="http://github.com/patrickpopowicz/bit.ly-Library-for-CodeIgniter/"&gt;http://github.com/patrickpopowicz/bit.ly-Library-for-CodeIgniter/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-2238168970120553151?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/2238168970120553151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/08/bitly-codeigniter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/2238168970120553151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/2238168970120553151'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/08/bitly-codeigniter.html' title='Bit.ly Codeigniter'/><author><name>aizuddinmanap</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-224119104563313624</id><published>2010-07-25T00:12:00.000-07:00</published><updated>2010-07-25T00:12:50.806-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hmvc'/><category scheme='http://www.blogger.com/atom/ns#' term='form validation'/><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>Form Validation Callbacks in HMVC in Codeigniter problem</title><content type='html'>create a file name &lt;b&gt;MY_Form_validation.php&lt;/b&gt; and put it in the application/libraries folder&lt;br /&gt;&lt;pre class="brush: js"&gt;&lt; ?php if (!defined('BASEPATH')) exit('No direct script access allowed');&lt;br /&gt;&lt;br /&gt;class MY_Form_validation extends CI_Form_validation&lt;br /&gt;{&lt;br /&gt; function run($module = '', $group = '') {&lt;br /&gt; (is_object($module)) AND $this-&gt;CI =&amp; $module;&lt;br /&gt; return parent::run($group);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;/* End of file MY_Form_validation.php */&lt;br /&gt;/* Location: ./application/libraries/MY_Form_validation.php */  &lt;/pre&gt;&lt;br /&gt;when using validation, put &lt;b&gt;&lt;i&gt;$this&lt;/i&gt;&lt;/b&gt; into the $this-&gt;form_validation-&gt;run()&lt;br /&gt;example &lt;br /&gt;&lt;pre class="brush: js"&gt;if($this-&gt;form_validation-&gt;run($this)) {&lt;br /&gt;//your code down there &lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-224119104563313624?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/224119104563313624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/07/form-validation-callbacks-in-hmvc-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/224119104563313624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/224119104563313624'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/07/form-validation-callbacks-in-hmvc-in.html' title='Form Validation Callbacks in HMVC in Codeigniter problem'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-5695253048432061236</id><published>2010-07-01T06:17:00.001-07:00</published><updated>2010-07-01T06:19:26.086-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='404'/><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>base_url in 404 error page codeigniter</title><content type='html'>simple to use &lt;br /&gt;&lt;pre class="brush: js"&gt;&amp;lt;?php echo config_item('base_url');?&amp;gt;&lt;/pre&gt;:)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-5695253048432061236?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/5695253048432061236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/07/baseurl-in-404-error-page-codeigniter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/5695253048432061236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/5695253048432061236'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/07/baseurl-in-404-error-page-codeigniter.html' title='base_url in 404 error page codeigniter'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-548996996812544505</id><published>2010-06-24T20:32:00.001-07:00</published><updated>2010-06-24T20:32:37.942-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>codeigniter get last mysql insert id</title><content type='html'>&lt;pre class="brush: js"&gt;$this-&gt;db-&gt;insert_id();&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-548996996812544505?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/548996996812544505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-get-last-mysql-insert-id.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/548996996812544505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/548996996812544505'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-get-last-mysql-insert-id.html' title='codeigniter get last mysql insert id'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-953669277613117712</id><published>2010-06-19T19:21:00.000-07:00</published><updated>2010-06-19T19:34:07.270-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='routes'/><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>Codeigniter Route Everything, except these Controllers</title><content type='html'>another &lt;a href="http://aizuddinmanap.blogspot.com/2010/06/codeigniter-routes.html"&gt;Codeigniter routes&lt;/a&gt;, &lt;b&gt;Codeigniter Route Everything, except these Controllers&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There was a recent post on the codeigniter forums trying to get urls like these:&lt;br /&gt;&lt;i&gt;http://yoursite.com/your-slug&lt;/i&gt;&lt;br /&gt;This problem could have been easily resolved using this route:&lt;br /&gt;&lt;pre class="brush: js"&gt;$route['(:any)'] = 'articles/$1';&lt;/pre&gt;&lt;br /&gt;In this route, all characters after the domain will be passed to the controller, 'article'.&lt;br /&gt;&lt;br /&gt;However, the problem was he also had some controllers that he didn't want to use the route for. A quick fix for the route was to use a 'simple' regex using negative lookahead&lt;br /&gt;&lt;pre class="brush: js"&gt;$route['^(?!controller|controller|controller)\S*'] = "article/$1";&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;p/s:original post from &lt;a href="http://pinoytech.org/blog/post/codeigniter-route-everything-except-these-controllers"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-953669277613117712?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/953669277613117712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-route-everything-except.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/953669277613117712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/953669277613117712'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-route-everything-except.html' title='Codeigniter Route Everything, except these Controllers'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-9103910337578418701</id><published>2010-06-19T19:01:00.000-07:00</published><updated>2010-06-19T19:01:11.521-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='routes'/><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>codeigniter routes</title><content type='html'>how to use http://localhost/receipt/view/1 as http://localhost/receipt/1 ?&lt;br /&gt;routes is the solution.&lt;br /&gt;&lt;br /&gt;1)edit /application/config/routes.php&lt;br /&gt;&lt;br /&gt;2)&lt;pre class="brush: js"&gt;$route['receipt/(:num)'] = "receipt/view/$1";&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-9103910337578418701?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/9103910337578418701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-routes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/9103910337578418701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/9103910337578418701'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-routes.html' title='codeigniter routes'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-6691232609784141808</id><published>2010-06-16T23:53:00.000-07:00</published><updated>2010-06-16T23:53:38.669-07:00</updated><title type='text'>Form generator for CodeIgniter</title><content type='html'>Nice tool to generate form. &lt;a href="http://formigniter.org"&gt;http://formigniter.org&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-6691232609784141808?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/6691232609784141808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/form-generator-for-codeigniter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/6691232609784141808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/6691232609784141808'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/form-generator-for-codeigniter.html' title='Form generator for CodeIgniter'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-2896890559847140183</id><published>2010-06-16T23:17:00.000-07:00</published><updated>2010-07-09T17:59:28.455-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='htaccess'/><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>Problems $_GET if using .htaccess to remove index.php</title><content type='html'>1) Use this .htaccess to fix and remove index.php&lt;br /&gt;&lt;pre class="brush: js"&gt;&lt;ifmodule mod_rewrite.c=""&gt;&lt;br /&gt;    RewriteEngine On&lt;br /&gt;    RewriteBase /&lt;br /&gt;&lt;br /&gt;    RewriteCond %{REQUEST_URI} ^system.*&lt;br /&gt;    RewriteRule ^(.*)$ /index.php?/$1 [L]&lt;br /&gt;&lt;br /&gt;    RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;    RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;    RewriteRule ^(.*)$ index.php/$1 [L]&lt;br /&gt;&lt;/ifmodule&gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;2)edit your application/config.php&lt;br /&gt;&lt;pre class="brush: js"&gt;$config['uri_protocol'] = "AUTO";&lt;/pre&gt;&lt;b&gt;to&lt;/b&gt; &lt;br /&gt;&lt;pre class="brush: js"&gt;$config['uri_protocol'] = "PATH_INFO";&lt;/pre&gt;3) Put to your controller&lt;br /&gt;&lt;pre class="brush: js"&gt;parse_str($_SERVER['QUERY_STRING'],$_GET);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;3)start using $_GET or &lt;pre class="brush: js"&gt;$this-&gt;input-&gt;get('input');&lt;/pre&gt;&lt;br /&gt;p/s: original post are &lt;a href="http://codeigniter.com/forums/viewthread/132757/#655555"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-2896890559847140183?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/2896890559847140183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/problems-get-if-using-htaccess-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/2896890559847140183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/2896890559847140183'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/problems-get-if-using-htaccess-to.html' title='Problems $_GET if using .htaccess to remove index.php'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-6389198262868677426</id><published>2010-06-11T00:57:00.000-07:00</published><updated>2010-06-11T00:57:31.758-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter'/><title type='text'>codeigniter callback function to check valid username or email</title><content type='html'>this post are from here &lt;a href="http://scottblaine.com/form-validation-callbacks-and-private-functions"&gt;http://scottblaine.com/form-validation-callbacks-and-private-functions&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you’re familiar with CodeIgniter you probably know about &lt;a href="http://codeigniter.com/user_guide/libraries/validation.html" title="Form Validation"&gt;callbacks  within form validation&lt;/a&gt;. Callbacks allow you to do your own  validation of fields. For example, if you want to verify if a username  is unique then you could create a username_check function to validate  the field. You add the callback rule like this:&lt;br /&gt;&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;1&lt;br /&gt;2&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="php" style="font-family: monospace;"&gt;&lt;span style="color: #000088;"&gt;$this&lt;/span&gt;&lt;span style="color: #339933;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color: #004000;"&gt;form_validation&lt;/span&gt;&lt;span style="color: #339933;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color: #004000;"&gt;set_rules&lt;/span&gt;&lt;span style="color: #009900;"&gt;(&lt;/span&gt; &lt;span style="color: blue;"&gt;'username'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;'Username'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: blue;"&gt;'trim|required|callback_username_check'&lt;/span&gt; &lt;span style="color: #009900;"&gt;)&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;And then create a matching function like this:&lt;br /&gt;&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="php" style="font-family: monospace;"&gt;&lt;span style="color: black; font-weight: bold;"&gt;function&lt;/span&gt; username_check&lt;span style="color: #009900;"&gt;(&lt;/span&gt; &lt;span style="color: #000088;"&gt;$username&lt;/span&gt; &lt;span style="color: #009900;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900;"&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #666666; font-style: italic;"&gt;// some code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-weight: bold;"&gt;?&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;However, as this is currently implemented someone could access your  function as a page at a URL like example.com/index.php/login/&lt;strong&gt;username_check&lt;/strong&gt;/  if they guessed the function name. While that may not have any ill  side-effects, it’s probably just as well if no one can access the  function besides you.&lt;br /&gt;In come &lt;a href="http://codeigniter.com/user_guide/general/controllers.html" title="Controllers"&gt;private  functions for controllers&lt;/a&gt;, which allow you to create a function  like this:&lt;br /&gt;&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="php" style="font-family: monospace;"&gt;&lt;span style="color: black; font-weight: bold;"&gt;function&lt;/span&gt; _utility&lt;span style="color: #009900;"&gt;(&lt;/span&gt;&lt;span style="color: #009900;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900;"&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #666666; font-style: italic;"&gt;// some code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;And if you try to access the function via a URL, like  example.com/index.php/login/&lt;strong&gt;_utility&lt;/strong&gt;/, you’ll get a 404  (page not found).&lt;br /&gt;You probably see where I’m going with this. If you create your  callbacks as private functions, no one will be able to access the  callbacks as pages. It’s quite simple to do. You add an underscore  before your callback function name:&lt;br /&gt;&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;9&lt;br /&gt;10&lt;br /&gt;11&lt;br /&gt;12&lt;br /&gt;13&lt;br /&gt;14&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="php" style="font-family: monospace;"&gt;&lt;span style="color: black; font-weight: bold;"&gt;function&lt;/span&gt; _username_check&lt;span style="color: #009900;"&gt;(&lt;/span&gt; &lt;span style="color: #000088;"&gt;$username&lt;/span&gt; &lt;span style="color: #009900;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900;"&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #000088;"&gt;$valid_username&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #009900; font-weight: bold;"&gt;TRUE&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; &lt;span style="color: #666666; font-style: italic;"&gt;// You would perform some kind of check on the field here&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;  &lt;span style="color: #b1b100;"&gt;if&lt;/span&gt; &lt;span style="color: #009900;"&gt;(&lt;/span&gt;&lt;span style="color: #000088;"&gt;$valid_username&lt;/span&gt; &lt;span style="color: #339933;"&gt;==&lt;/span&gt; &lt;span style="color: #009900; font-weight: bold;"&gt;FALSE&lt;/span&gt;&lt;span style="color: #009900;"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #009900;"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #000088;"&gt;$this&lt;/span&gt;&lt;span style="color: #339933;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color: #004000;"&gt;form_validation&lt;/span&gt;&lt;span style="color: #339933;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color: #004000;"&gt;set_message&lt;/span&gt;&lt;span style="color: #009900;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;'_username_check'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;'The username you have provided is not valid.'&lt;/span&gt;&lt;span style="color: #009900;"&gt;)&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #b1b100;"&gt;return&lt;/span&gt; &lt;span style="color: #009900; font-weight: bold;"&gt;FALSE&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #b1b100;"&gt;else&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #009900;"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #b1b100;"&gt;return&lt;/span&gt; &lt;span style="color: #009900; font-weight: bold;"&gt;TRUE&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;And then add an underscore in your callback rule (note the two  underscores after callback):&lt;br /&gt;&lt;div class="wp_syntax"&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="line_numbers"&gt;&lt;pre&gt;1&lt;br /&gt;2&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="php" style="font-family: monospace;"&gt;&lt;span style="color: #000088;"&gt;$this&lt;/span&gt;&lt;span style="color: #339933;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color: #004000;"&gt;form_validation&lt;/span&gt;&lt;span style="color: #339933;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color: #004000;"&gt;set_rules&lt;/span&gt;&lt;span style="color: #009900;"&gt;(&lt;/span&gt; &lt;span style="color: blue;"&gt;'username'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;'Username'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: blue;"&gt;'trim|required|callback__username_check'&lt;/span&gt; &lt;span style="color: #009900;"&gt;)&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;Done!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-6389198262868677426?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/6389198262868677426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-callback-function-to-check.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/6389198262868677426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/6389198262868677426'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-callback-function-to-check.html' title='codeigniter callback function to check valid username or email'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2728107235097448137.post-3273767828839190706</id><published>2010-06-10T19:47:00.001-07:00</published><updated>2010-06-10T19:47:38.087-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='codeigniter php'/><title type='text'>Codeigniter redirect to base_url</title><content type='html'>redirect(base_url());&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2728107235097448137-3273767828839190706?l=aizuddinmanap.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aizuddinmanap.blogspot.com/feeds/3273767828839190706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-redirect-to-baseurl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/3273767828839190706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2728107235097448137/posts/default/3273767828839190706'/><link rel='alternate' type='text/html' href='http://aizuddinmanap.blogspot.com/2010/06/codeigniter-redirect-to-baseurl.html' title='Codeigniter redirect to base_url'/><author><name>sinzmanual</name><uri>http://www.blogger.com/profile/13025696504788382912</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://bp2.blogger.com/_glRqVPQ4TUw/SElgEV9yR9I/AAAAAAAAAG0/YD6BrOsLu3E/S220/me---kecik.gif'/></author><thr:total>0</thr:total></entry></feed>
