How to remove index.php from codeigniter url

open the .htaccess file in application folder and paste the following code in there.


 RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]  

copy this file and paste it in application folder i.e. one level higher than this….That’s it.

How to set date.timezone for code igniter to work with php5.3

With some versions of PHP you get this error message.

A PHP Error was encountered
Severity: Warning
Message: main(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘-8.0/no DST’ instead.

Here is the solution of this error.

To fix this, you only need to edit the main index.php for your CodeIgniter application:


if( ! ini_get('date.timezone') )
{
   date_default_timezone_set('GMT');
} 

This modification is something you will probably need to make for any CodeIgniter application running on PHP 5.3 and can easily be modified to your local timezone. There is a full list of supported timezones in the PHP manual here.

Monitoring user activites

This is one the ways to monitor what your users are doing with your website.
<ol>
<ol>Create a table in your database to log your user activity.</ol>
</ol>
&nbsp;
<ol>
<ol>Define the various activity types that can happen in your App.</ol>
</ol>
&nbsp;
Create a common function that logs any activity to that table.

Call that function from anywhere you you perform log-worthy activities in your app.

You can then write a reporting tool that gives your admins access to those logged activities, you can filter by user, time and activity types.

In my log-framework, I specially mark activities which could be seen as malicious actions and assign them different numeric threat-values. If the sum of a user’s thread-value reaches a certain threshold I log-out the user.

Ideally if you write an Application, you write your infrastructure code like logging at the very beginning and then use it in all your business logic code later.