Simple PHP Functions To Hash Passwords For Saving Into Database

This is a simple php function for hashing a plain text password so that it can be saved into the database securely.

MySQLi Wrapper for PHP

I was very much interested in the database class of CodeIgniter, especially the Active Records.

I was quite satisfied with an old mysql wrapper that I have been using for long time. But I’ve decided to start using MySQLi for all my future projects so started to write my own database wrapper for php.

php.net official recommend the usage of mysqli over mysql if we are using MySQL database version 4.1.3 or more.

The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later.

The class has been made available online for free and is available at https://bitbucket.org/getvivekv/php-mysqli-class

For a complete documentation, refer https://bitbucket.org/getvivekv/php-mysqli-class/wiki/Home

The code was heavily inspired from CodeIgniter free library. The code is freely available for anyone to download. If you find any error or have any feature to add, please report me. You can also post new issue if you find any bug.

Fuse – Open Source Ticket Management System

6
Hey,

I am glad to release a free and open source ticket management system – “Fuse”.

Fuse is a simple ticket system which requires nearly zero configuration. It is built using CodeIgniter and Twitter Bootstrap frameworks. Fuse does not boast any special features. It is designed for small size organization with a couple of staffs managing the tickets.

Fuse Ticket Management System is still in development and is available for downloading at Fuse Website

Fuse offers basic functions of a ticket system. This was developed using CodeIgniter framework in less than 8 days. The development is still going on. I am not a CodeIgniter guru, this was my simply try to refresh my memory about CodeIgntier PHP Framework. If you find any bugs in the application, please do report.

Vivek

Find c99 Shell Scripts on cPanel Server

c99 Shell Scripts are one of the main headache for almost all cPanel server administrators even though they use mod_security and all. This small snippt would help you to find those possible shell script.

You can open a new ‘screen’ session and execute the code and close the window. You can then have a nice cup of coffee and come back after some hours. The script would scan the entire user folders and saves you the full report of possible infected files.

The code can be found at GitHub Gist

Once the scan is completed, you would be able to see the result in the file “/root/c99result.txt”

Uniqid() – The easiest way to generate unique strings

I have seen many PHP developers still use rand() for generating security tokens/unique strings, mostly for generating validation strings such as Email validation etc

rand() is a secuirty hazard and should never be used to generate a security token. However, there is another function mt_rand() which generates better random value.

What if you want to generate a quick and dirty random string for your program? Try uniqid()

[php]
<?php
echo uniqid();
?>
[/php]

The above code will output a string such as “4f3cb635538ed”. If you execute it again, you will get another string. If you want to include a prefix, you can use this

[php]
<?php
echo uniqid("prefix_");
?>
[/php]

which will generate “prefix_4f3cb635538ed”

If you need 32 character string, you can md5 the random value

[php]
<?php
echo md5(uniqid());
?>
[/php]

Similarly, you can get 40 character using sha1
[php]
<?php
echo sha1(uniqid());
?>
[/php]

A combination of these all will give you some more powerful unique string. For most security purposes this is a good token

[php]<?php
echo md5(uniqid(mt_rand(), true));
?>
[/php]

Returns a string similar to “4ef2854881f4cd9bdd84081477bc3317”