PHP

Create user permission by URI in Codeigniter 3

Hello. No I want to share how to about to create user role/permission by access URI. Oke now the first you must download new CodeIgniter 3 in this site https://www.codeigniter.com/download.
After that we must open CodeIgniter framework on your editor. Example I use sublime text.
Oke lest go code, the first we must change config/autoload.php and add auto load library ‘session’ and helper ‘url’.

/*
| -------------------------------------------------------------------
|  Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
|	$autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
|	$autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('session');

/*
| -------------------------------------------------------------------
|  Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
|	$autoload['drivers'] = array('cache');
*/
$autoload['drivers'] = array();

/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
|	$autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url');

Then change config/database.php with your database config.
(more…)

Php sort multi dimensional array

Long not post, and now I want post again about how to sort multi dimensional array. Example I’ve array like this:

$arr = [
	[
	'title' => 'Tree',
        'num' => 3
	],
	[
		'title' => 'Four',
        'num' => 4
	],
	[
		'title' => 'One',
        'num' => 1
	],
	[
		'title' => 'Two',
        'num' => 2
	]
];
echo "<pre>";
print_r($arr);
echo "</pre>";

And if I run this code, the result is:
(more…)

Jquery Input Post with Same name Input Like PHP Post

A few days ago I found a problem with my Input name. If I using PHP, I can create form input using name array if I have form input with same name like this:

<!DOCTYPE html>
<html>
<head>
	<title>Example POST</title>
</head>
<body>
	<form method="post" accept-charset="utf-8" action="getPost.php">
		<input type="text" name="people[]" value="john"><br />
		<input type="text" name="people[]" value="bill"><br />
		<input type="text" name="places[]" value="california"><br />
		<input type="text" name="places[]" value="michigan"><br />

		<input type="submit" value="Save" />
	</form>
</body>
</html>

And this is file php to get post:

<?php 
	echo "<pre>";
		print_r($_POST);
	echo "</pre>";
?>

And if we run that code (click submit/save button), we can get result like this:
(more…)

Bootstrap 3.1 load tab content using ajax (external view) on laravel 4.1

Ok now I want create a tutorial about how to load external view using ajax on laravel. Okay we just started the tutorial. 🙂
The first, I assume You have to install the laravel framework. If not, You can follow from this link http://laravel.com/docs/installation, after that, now I assume you have download Bootstrap from twitter and latest jquery from this site. http://getbootstrap.com/ and this http://jquery.com/. Ok after all has been downloaded, now open your laravel framework on your editor text.
Okay the first paste all jquery and bootstrap to public/assets like this:

And then, create file on your app/views with name home.php and fill the code like this:
(more…)