Code solutions to PHP, JS, CSSCode source PHP, JS, CSS

Spread your code soluces to the world

Love me

PHP Source code

Display natural human dates for past dates

09/17/2014 by Dux   /   not rated
Little function to display past dates with a natural human language as on iphone based messages. It can write dates : now, 5mn ago, today at 12:18, yesterday at 08:20, monday at 21:12, 3 november at 12:18 (modify function for english users), 24 december 2013 at 23:59

Display a date in French

06/11/2011 by Dux   /   5/5 (2 ratings)
Function gdhfr for "Groupe Date Heure France" shows the date and time in the french format. mixed gdhfr ( int $timestamp = time() [, bool $hm = false [ , bool $s = false ] ] ) $timestamp = UNIX time $hm = when set to TRUE, displays hours and minutes $s = when set to TRUE, displays seconds

Extract images from a page

06/08/2011 by Dux   /   3.7/5 (3 ratings)
Getting all IMG sources and ALT from a local or remote page that returns an array. This function uses the DOM API from PHP 5. get_i( file ) = array( att, value )

Extract links from a page

06/08/2011 by Dux   /   3.7/5 (3 ratings)
Getting all A HREF links from a local or remote page that returns an array. This function uses the DOM API from PHP 5. get_a( file ) = array( att, value )

Force file download

06/07/2011 by Dux   /   5/5 (1 ratings)
Function that forces the files download. Sending the file size does not work in all configurations.

Simple image gallery PHP

06/01/2011 by Dux   /   3.8/5 (9 ratings)
The following code is an image gallery script in PHP as easy as possible. A single file of a few lines of code is sufficient to list the images, create thumbnails and display them. Copy the entire code into a PHP file. Name it as you wish and drop it in a directory containing images. For reasons of simplicity, this code has no error handling....

Simple function for PHP syntax highlighting

05/21/2011 by Dux   /   not rated
This little function uses the PHP syntax highlighting displaying the result in a table with line numbers. Hard to do simplest. You can add CSS. This function is used by solucior.com

Simple method : listing files from a directory

05/19/2011 by Dux   /   not rated
Here's my simple method for listing files from a directory. In this example I added the natural sort and the file sizes in KB to show how to combine tables and serialized values.

Dynamically add rows to a form. Complete solution

05/21/2011 by Dux   /   3.5/5 (22 ratings)
Here is a complete solution for adding rows to a form. This sample script displays a form for insert and update products. When clicking on the link [+], we add a new product line. It also includes the update by sending the "mod" parameter corresponding to the ID of the MySQL table row to edit. Dynamic system for adding rows : Initially, the...

wordwrap without breaking words

05/18/2011 by Dux   /   not rated
A simple function to cut a character string without breaking words. string wrap_word ( string $str [, int $length = 350] )

Make dir and upload files via FTP

05/19/2011 by Dux   /   5/5 (1 ratings)
These two functions simplify the creating directory and files upload by FTP in PHP.

Convert unknown text to ISO8859-1

05/19/2011 by Dux   /   not rated
This method is useful if you get a text field to display in ISO8859-1. In some cases, you do not know if the writer has written characters in UTF8 or ISO. Especially if the text has gone through several transitional stages.

Close HTML tags function

05/12/2011 by Dux   /   4.7/5 (3 ratings)
A simple function to close all open HTML tags from text. To be used for example when you propose an editable field with HTML.