Skip to main content

Posts

Showing posts from May, 2013

hash passwords using MySQL inbuilt functions

I just realized that MySQL has inbuilt function for encrypting strings upon insertions and it can easily be accessed from phpMyAdmin. It has many other inbuilt functions as well. Previously I used to hash strings manually through PHP functions or used external sites whenever I was building some login system and needed some database records to test. I used to copy output of PHP’s md5/sha1 function and paste it into password field manually. All those instructors in screencasts from which I learned used to do it manually too. I just picked up from them.

Removing index.php from CodeIgniter installation

CodeIgniter by default routes URLs through index.php. It is a bad practise from SEO perspective and also makes URLs ugly. In order to remove index.php from CodeIgniter we need to create a .htaccess file in the root directory of CodeIgniter installation. First of all we need ensure that AllowOverride is On in order to .htaccess to work. Second we need to check mod_rewrite is installed and enabled. In the .htaccess file created above we need to write following rules. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # PHP under mod_php5 <IfModule mod_php5.c>     RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> # PHP under fast-CGI or other <IfModule !mod_php5.c>     RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule> </IfModule> Note the difference between mod_php5 and fast-CGI RewriteRule. fastCGI rule has a ‘ ? ’ after index.php. What Rewrite rule behind the

WordPress Not sufficient permissions to access admin page

While installing WordPress for my blog, I was trying out different subdomain/ folder options. After final installation when I tried to access the admin page I was being redirected to /wp-admin/profile.php but getting insufficient permission error like shown below. I could access the front page easily but couldn’t log in admin panel. I tried changing the permission of WordPress files  and directories to 755 but to no avail. The problem was that while installing WordPress I used different table prefixes each time. WordPress uses the table prefix for forming the option and usermeta keys name for storing roles and capabilities information. So in the process, database tables had correct table prefixes but some records in the some  of the tables still had old table prefix and this was causing the problem. To fix the issue you need to update your database using phpMyAdmin or php. Check in your database in the usermeta and options table if they have correct table prefix in al