MaggsWeb:7

www.maggsweb.com

Posts Tagged ‘ function ’

I hate compressing CSS files as they become totally unreadable for editing. I end up keeping 2 versions, compressed and uncompressed, etc.. But how about compressing all your CSS files into one file, ‘on-the-fly’. Now that has solved the problem.

[More]

Just a little script I wrote to work out the date of the first day of the week.
[More]


Taken from http://mypaaji.com/Index.php/php-quick-reference/


[More]


Taken from http://mypaaji.com/Index.php/how-to-download-upload-transfer-files-over-ftp/


The below given listing illustrates the process. First, a connection to the FTP server is initialized with a call to ftp_connect(); this function returns a connection handle that is used in all subsequent calls. The ftp_login() function is then used to log in to the server, while the ftp_close() function is used to terminate the connection and end the session. Between the calls to ftp_connect() and ftp_disconnect(), it is possible to perform all the actions commonly associated with an FTP session.

The below given listing illustrates four of the most common: listing files using ftp_nlist(); uploading files with ftp_put(); downloading files with ftp_get(); and deleting files with ftp_delete(). Note that ftp_put() and ftp_get() must be supplied with the remote and local file name, together with the transfer type (binary or ASCII).

[More]

Display filesizes

February 5, 2010 | Comments | Javascript

Ever clicked a link only to find out that the image/download was massive and you wished you hadn’t? Wouldn’t it have been nice to have an idea of the file-size when hovering over the link?
[More]

Displaying the day-part of the date, followed by the month etc. just looks plain wrong and lazy – ’20 September 2009′. ’20th’ would look much nicer and can be achieved without too much hard work. A simple function…
[More]

This has got to be the most self-explanatory, most obvious, but coolest function ever!
[More]

I usually write my own vars out to the screen for debugging using ‘print_r($_SESSION)’,'print_r($_POST)’etc inside <pre> tags, but this is awesome! (a little too much even). It’s like phpinfo(), but for your webpage!
[More]

PHP Image UpLoader

October 18, 2007 | Comments | PHP

My image upload script. Loads of checks, not all used each time. Optional file-physical-size checks rely on ‘getimagesize’ working. Its long, but stick with it. It works.
[More]

Logging user activity

August 22, 2007 | Comments | PHP

Logging user activity is vital when there are multiple authors for a site. It also helps with debugging user activity when there is problems. You certainly don’t want to be putting this into a database, so the next best thing is a nice little text file.
I have used this to log user activity in a number of sites, as it can easily be added after development. In this example, $PAGE and $pageTitle are set in each page as they are used to determine menu selections, etc.. but these can easily be set manually.
[More]