Barattalo

Collection of WordPress plugins, code snippets, tools and posts for developers and happy makers

Correct headers to download a CSV from PHP

With these headers you can force a download from php, for example, to let the user download a csv frmatted…

Aprile 27, 2010

Always remove slashes from GET and POST

This is a small piece of code that I use since many years. It removes all slashes from $_GET and…

Mini Bot Class Updated

Now there are 17 bots included in this class! Well I’ve updated the mini bots class with some new things:…

Aprile 9, 2010

PHP google images mini bot

UPDATE 2013/12/12: Now, in the  Mini Bot Class there is a version of this function that is still working. You…

Marzo 30, 2010

PHP parse url, mailto, and also twitter’s usernames and arguments

This small function receive a text as input and returns an html text with links if the source text contains…

Marzo 10, 2010

How to write a text description into html input type password

Sometime designers put form labels and instrucions into html inputs. One of the common uses is for login boxes when…

PHP curl bot to update Facebook status

I’ve found this great mini bot from Alste blog, and I’ve decided to add it to the mini bot class.…

Marzo 1, 2010

PHP to get twitter infos and avatar

I’ve just updated the Mini Bot Php Class with an improved version of the twitterInfo function, here is the code…

Ping pingomatic.com services with PHP

Ping-o-matic is a service that calls (ping) server engines and popular services to notify them that you have new contents…

Febbraio 24, 2010

Reading mp3 informations with php (id3 tags)

Inside mp3 files there are often some usefull informations stored. Those data are called “id3 tags” and deal with Author…

Febbraio 22, 2010

How to capture enter key pressed in a form (JavaScript)

Suppose you have a login form and you want to send the form when user press enter on his keyboard…

Febbraio 16, 2010

Mixing bots to gain new services

Spiders and bots let you take services from other web sites, this could be very cool, but also this could…

Febbraio 15, 2010

PHP function to fix collation on database fields of MySQL

This PHP function search for tables in the active db, match table’s name with the regular expression passed as first…

Febbraio 11, 2010

PHP how to calculate age from date of birth

This is a very simple script that starts from a string date in format yyyy-mm-dd and return the age. To…

Febbraio 10, 2010

ASP equivalent to PHP strip_tags

I’ve found those functions around in the internet and I put them here just to remind how to strip tags…

Febbraio 9, 2010

ASP Function to count files in a folder

This ASP function counts files of a specified extension inside a folder: this is done by creating a file system…

Fix html tags, close tags, repair bad quotes and more

This class can solve many problems coming from user generated html content or to fix html content before making some…

Febbraio 3, 2010

Recursive remove directory (RMDIR) in PHP

This small php function is a recursive remove directory that remove non empty dirs recursively. It enters every directory, removes…

Febbraio 2, 2010

Calculate dir size recursively with PHP (and count files)

This small PHP function lets you calculate the dir size entering each sub dir and making the sum of the…

Febbraio 1, 2010

10 PHP usefull functions for MySQLi stuff (mysql improved)

I’ve modified the previous post to use mysqli instead of mysql. Was it necessary? I think it was good step…

Gennaio 29, 2010

10 PHP usefull functions for MySQL stuff

Here is my personal collection of 10 php function that I always include in my database function library. I think…

Gennaio 25, 2010

Using REPLACE in an UPDATE statement to fix data on MSSQL and MySQL

Sometimes it’s necessary fix data on the database. I had to fix on a Microsoft database: I had to fix…

Gennaio 21, 2010

New version of Mini Bots PHP Class (v.1.4)

I’ve added three more bots to the Mini Bots Php Class, now the version number is 1.4 and it has…

Gennaio 20, 2010

PHP to get enum/set values from mysql field

This function returns an array with the elements allowed in a ENUM or SET mysql field. This can be usefull…

Gennaio 19, 2010

Recursive chmod on files and directory

It has happened to me that files uploaded with a small CMS cannot be downloaded with a FTP client for…

Posting to Facebook from website with Facebook Connect

This post is part of the Facebook Connect Tutorial and it will show how to add “post to wall” function…

Gennaio 17, 2010

PHP Web page to text function

I’ve found this nice small bot on the www.php.net site, thanks to the author of the script on the preg_replace…

Gennaio 16, 2010

Copying remote files on your server with PHP

UPDATE: This function has been inserted in the Mini Bots PHP Class Here is a function that let you copy…

Bot that retrieves url meta data and other infos

From a given url this function retrieves page title, meta description, keywords, favicon, and an array of 5 images to…

Gennaio 12, 2010

Sending HTML emails with attachment with PHP

This function allows you to send an HTML email with a file attachment. To do this it’s necessary to read…

Gennaio 10, 2010