Some times we need to search the contents of many files through php. Personally I wrote this piece of code when I was using eaccelerator, and used it to search the whole server for files that are not compiled.
There are many cases that we need to display different content to our users depending on the location that they are visiting our site. In this tutorial we will give some examples regarding geo targeting with php.
Recently after a server crash, I wanted to know which of my sites have the most users online. Knowing that information would help me to determine which site is having the extra traffic, but what is the faster way to do this?
Recently I came to a major problem with our server. After installing the mod_evasive to our server, the module treated Google bot like a Ddos attacker. The results is that there are thousands of pages in our sites that Google can't crawl, and that way we lose a lot of traffic.
Recently I moved a feed to FeedBurner. The problem was that I wanted to redirect old users to the new feed url, but in the same time allow FeedBurner to visit the old feed in order to crawl it.
In this tutorial I will try to write some basic tips on how to optimize your php code. In general those are some very basic information that can make your writing style better, and your code run faster.
Bellow is a modification for the popular phpLD directory script which gives you the abillity to dissalow spammers from submiting their sites to your directory.
The script uses a blacklist and disallow submittions for every domain you want, including subdomains.
This tutorial will teach you how to properly handle user submitted data as well as displaying it, and even protecting the pages the scripts are run from.
Some times we want a php script not to be able to run from a web browser. For example a database backup script. This is reasonable as someone that knows the url of this script can easily abuse our web server.
A design flaw which can have really bad results is widely spread - not checking your form fields correctly. Here's how to make it better - yet note, the used htmlentities() function has a flaw itself in apache 2.2.2 so update to 2.2.3 which contains php 5.2.0.
As we faced some spam problems with the trackback bot, I thought to write a simple function that checks if a message contains "bad words", in order to prevent comment spam.
Latelly I was trying to optimize a perl script, and I realized that it had too many comments. Actually the half size of the script was comments, so I thought it would be easier for the perl intepreter if all the comments and empty lines would be removed from the script.
This simple script will detect the visitors that come from google, and parse the referer information to extract the phrases that those visitors search.
You can extend this script to keep track of the phrases that people search in google to find your site
Some people using shared hosting accounts, can't have registered globals. Regullarly this is not a big deal, and to be honest using register_globals = on is not the best way to program. But there are many cases that you use a script (eg. osCommerce) that requires registered globals, but your host has them off. Here is a small snippet with a solution.