Sample code for PHP, CodeIginter and JS