Search engine keyword highlighter.
-5
This multiple-use PHP script will randomly generate content based on a randomly generated number.
10
This simple function will check if a url is valid (going by parse_url()) and if it's 'online' - by seeing if it returns a 302, 301, or 200 status code.
5
This small snippet will not allow _POST requests from a 'foreign' domain. It relies on the HTTP_REFERER variable.
7
This function will reverse the affects of register_globals
7
This class can be used to retrieve the search words entered by an user in a search engine site that lead the user to the current page.
The class can parse the HTTP_REFERER variable if present. Then it can detect which search engine site lead the user to the current page, and extract the search words.
Currently the following engines are supported:
- Google
- Yahoo
- MSN
- AllTheWeb
- LookSmart
- AskJeeves
The class can parse the HTTP_REFERER variable if present. Then it can detect which search engine site lead the user to the current page, and extract the search words.
Currently the following engines are supported:
- Yahoo
- MSN
- AllTheWeb
- LookSmart
- AskJeeves
12
Here's a little snippet I got from SitePoint that I now use all the time. Add the code below to the start of each script.
Basically, what this does is checks to see if magic_quotes_gpc() is enabled on the server, and if it is, then it gets rid of all the slashes that magic_quotes_gpc() adds to input from $_GET, $_POST and $_COOKIES globals.
It's a good snippet to use, because it negates the bad programming practices that having magic_quotes_gpc() lets you get away with, and means that you don't really on PHP to validate your input; you get to do it all yourself ;-)
Basically, what this does is checks to see if magic_quotes_gpc() is enabled on the server, and if it is, then it gets rid of all the slashes that magic_quotes_gpc() adds to input from $_GET, $_POST and $_COOKIES globals.
It's a good snippet to use, because it negates the bad programming practices that having magic_quotes_gpc() lets you get away with, and means that you don't really on PHP to validate your input; you get to do it all yourself ;-)
-17
A little function that does some basic checking for data input by a user. Should get rid of code injection ;-)
8
This function simply splits a file based on the splitter supplied and returns an array with the values. It's pretty much like the file() function. This script could be helpful in section editings.
12
Over the summer, I worked on a project in which I needed to parse logfiles which were in the following format:
IP|USE|TIME>IP2|USE2|TIME2>
and so on.
When I parsed them to display the log file in a user-friendly fashion, I used the following code:
IP|USE|TIME>IP2|USE2|TIME2>
and so on.
When I parsed them to display the log file in a user-friendly fashion, I used the following code:
6
A simple page hits counter that uses a single cookie to tell the user how many times they have visited the page.









