Archive for 'PHP Library'
php.js – Use your favorite PHP functions client-side
PHP.JS is an open source project in which PHP functions are ported to JavaScript. This library can speed up development for programmers who are increasingly confronted with client-side technology.
Some of the higher-level functions implemented in PHP.JS are: file_get_contents(), mktime(), serialize(), md5(), date(), base64_decode().
Developer Kevin van Zonneveld was once working on a project with a lot [...]
Read moreA PHP Contact Form with JavaScript Real Time Validation
This is a PHP Contact Form having an Image Verification (Captcha) and fields’ validator (PHP & JavaScript).
Read moreA basic PHP Captcha (Image Verification) with refresh feature
This a simple PHP Captcha Class useful to prevent automatic submissions of your forms. It
Read moreHow to create mirror images using GD
This class is useful to create mirror images using the GD Library. You just need to set the source path of the image (URL or local path) and the folder where the new image should be saved. If the latter is not specified the image will output without being saved. This is useful if you [...]
Read moreSanitize data to prevent SQL Injection Attacks
This is a simple function that sanitizes the data before sending it to MySQL. First it removes whitespaces from the beginning and ending of the string. If magic_quotes_gpc is enabled and the data has been already escaped we will apply stripslashes() to the data. This way the data won’t be escaped twice when mysql_real_escape_string() is [...]
Read moreHow to download a remote image using GD or cURL
This a PHP Class useful if you need to download images from a remote location.
Read moreConstruct SQL Query Statements in an efficient way
This is a PHP function that generates an SQL Insert Query using 2 parameters: a variable (table name) and an array (field names & values).
Read moreCreate a PHP script that logins in to a password protected area
Hi,
The aim of this tutorial is to help you create a web fetching script that can extract content from a password protected area using the necessary login credentials. I will use the well know cURL command line tool to connect to the protected web area. PHP supports libcurl which is required in order to use [...]
Scraping data with PHP Simple HTML DOM Parser
PHP Simple HTML DOM Parser, written in PHP5+, allows you to manipulate HTML in a very easy way. Supporting invalid HTML, this parser is better then other PHP scripts that use complicated regexes to extract information from web pages.
Before getting the necessary info, a DOM should be created from either URL or file. The following [...]
Some ways to scan a directory in PHP
This is a list with some methods to retrieve the contents from a directory (folder). The following functions show both the files & the folders located in a specific directory.
1. scandir()
array scandir ( string $directory [, int $sorting_order [, resource $context]] )
This function only works in PHP5+. It returns an array of files and [...]
AutoLogin (’Remember Me’) using cookies
Are you tired of typing your username & password each time you have to login to the Control Panel of your site? Check this tutorial that we’ll give you an idea of how you can implement an auto-login feature.
Read moreDynamic DropDown with countries
Hi,
This is a snippet that creates a dynamic dropdown menu with countries. The select is created from the $countries array. You can set a country that will be selected automatically when the drop down is loaded. This can be done by editing the variable $default. You can specifying the key from the array (i.e.: 220 [...]
Creating the array_isearch() function
Hello coders,
We know that arrray_search() is a function used to search the array for given value and return the corresponding key. This works fine in a case sensitive mode, but in an insensitive one we have a problem. If we search for ‘blue’ and there is a value in array ‘BLUE’, our array_search() will return [...]
How to create a word popularity script
This is an useful function that calculates the popularity of words from a specific text.
Read moreHow to create an advanced (bad, naughty) words filter
This is a PHP Class useful if you need to filter (bad, naughty) words from a string (text), whether is a simple string or one containing HTML tags.
Read more