Archive for the ‘PHP’ Category

Simple PHP Email Obfuscation

8

Sep
15

Here’s a simple piece of code that performs PHP based email obfuscation to replace standard characters with an ASCII encoded alternative.

This technique, although simple, will block some of the less intelligent spiders/robots out there. There are many other techniques including using JavaScript to render email address or images or even reversing the email address through CSS, however they all have their pros and cons and remember there isn’t an solution.

<?php

function email_obfuscator( $email )
{
$strArray = str_split( $email );
$obfEmail = '';

foreach( $strArray as $char )
{
$obfEmail .= '&#'.ord( $char );
}

return $obfEmail ;
}

echo '<a href="mailto:'.email_obfuscator('test@test.com').'">'.email_obfuscator('test@test.com').'</a>';

?>

HTML Forms on the fly

6

Feb
19

I have been looking about at form generators recently and I think it’s fair to say pForm have created one of the best. The generator offers many options including; theme/colour scheme selection, the choice of a multitude of field elements (from a textbox to a file upload) to add to your form, editable form and form field properties and finally ability to download your recently created form.

This is a really nice generator so if your interested have a look at pForm (HTML Forms on the fly).

PHP UK Postcode Validation

4

Feb
15

Well I’ll start off by saying I’m not dead.  I’m very much a live and kicking.  Sorry for the delay in posting, however, I have been working on a couple of big projects which I will post about here soon so check back to find out more.

Anyway back on topic I thought I would share a really neat piece of code with you.  I recently had the need to validate a UK post code, using PHP, and decided it was worth looking to see what other people had developed (no point in reinventing the wheel).  I found a very useful piece of code at braemoor.co.uk that offers full UK Postcode validation  as per the official specification and from the list of BFPO codes.

The code is very thorough and works like a charm so I would definitely recommend it.  They also offer other validation methods for UK telephone numbers, National Insurance, Credit Card, Email Address etc in a multitude of languages including JavaScript, PHP, ASP and PERL so check it out.

Top 10 Resources for Basic PHP Security

2

Jul
10

When developing a dynamic website it is essential that possible security issues or flaws are considered. To this end I decided it would be worth while producing a list of resources which I have used to help others understand best practice and potential techniques that are used to exploit bad coding standards.

General PHP Security Issues

For a general overview the following resources provide a good grounding as to security risks and how to prevent them from becoming a porblem.

Google your Site for Security Issues

It amazed me during my research quite how easy it was to hack peoples sites by using simple Google searches to return results of potentially weak websites. The following links elaborate on this somewhat:

Cross Site Scripting

A common method used to retrieve information or to deliberately cause harm and well worth understanding. The following link shows the different methods used with examples:

SQL Injection

Again another very common method by which hackers try to breach website security. This is an essential must know before building a website otherwise there is the possibility that you will leave yourself wide open to an attack.

As always I would love to hear your comments or if you have any resources that you feel would be beneficial than post the in the comments section below as well.

Free and Open Source Search Engines (mainly) for PHP Developers

13

May
21

I recently carried out a great deal of research to obtain a simple but impressive site search application and decided to list the results as a nice articles for all you guys and girls out there.  This is very much from a PHP point of view, however, there are some search engines listed below that could be used across other languages.

Sphider

Sphider is a lightweight web spider and search engine written in PHP, using MySQL as its back end database. It is suitable for adding search functionality to small or medium sites (up to around 100,000 pages). It also works great as a tool for site analysis – finding broken links, gathering statistics about the site etc.

More about Sphider…

mnoGoSearch

mnoGoSearch is a full-featured web search engine software for intranet and internet servers.

mnoGoSearch software has a number of unique features, which makes it appropriate for a wide range of applications from search within your site to specialized search systems such as cooking recipes or newspaper searches, ftp archive search, MP3 search, news articles search or even national-wide portal search engine.

The search software consists of two parts. The first is an indexing mechanism (indexer). The purpose of the indexer is to walk through HTTP, FTP, NEWS servers or local files, recursively grabbing all the documents and storing words meta-data about those documents in a database in a smart and efficient manner.

After every document is referenced by its corresponding URL, meta-data, collected by the indexer is used later in the search process. Search is performed via Web interface using your favorite browser.

mnoGoSearch is distributed in several variations, depending on operating system and features included.

Note: This product is not free on Windows.

More about mnoGoSearch…

RiSearch

RiSearch PHP is a fully functional search script for small to medium sites and is fast enough to search 5000-10000 of pages in less then one second. RiSearch is an indexing search engine, which means that it will index your site first and then create a database with all words from your pages for faster search. Risearch provides a full-text search script and an index of all words contained within a document except small words and common words (this can be defined in the config file).

RiSearch can create an index using either binary files or MySQL which allows for a great deal of flexibility.

More about RiSearch…

Zoom

Zoom is a software package that creates a search engine for your website, intranet, CD, or DVD. It provides fast and powerful full-text searching by indexing your website in advance with an user friendly desktop application that allows you to configure and index your site, from the convenience of your Windows computer.

More about Zoom…

iSearch

The iSearch PHP search engine allows you to build a searchable database for your web site. Visitors can search for key words and a list of any pages that match is returned to them.

More about iSearch…

PhpDig

PhpDig is a web spider and search engine written in PHP, using a MySQL database and flat file support. PhpDig builds a glossary with words found in indexed pages. On a search query, it displays a result page containing the search keys, ranked by occurrence.

More about PhpDig…

Bravenet Search

A really simple hosted site search. Simply integrate the provided form code into your site and away you go.

More about Bravenet Search…

TSEP

TSEP is a simple search engine for your website and is free of charge. SEP provides an installer to make integration and smooth and painless as possible. With only two lines of code you can add TSEP to your website and into your layout, it is as easy as that.

TSEP requires a MySQL database to store all indexation data.

More about TSEP…

JRank

JRank is a pure Java search engine. We give you full control of when and how our spider visits your site and how your site is included in our index. You have a choice of using a simple HTML form in your site or customizing JRank with XML based output.

More about JRank…

Google AJAX Search API

The AJAX Search API is the easiest way to incorporate a Google search box on your site. You can incorporate results from Web Search, News Search, and Blog Search into your blog or web site with just a few lines of JavaScript.

More about Googe AJAX Search API…

WebSideStory Search

With WebSideStory Search you have the ability to help visitors find the information, products or services they seek while also meeting your business objectives. With this on-demand site search solution, you are able to control how search results are presented, influence search results rankings based on your key business criteria, and integrate relevant promotions and offers directly into your search results pages.
· Targeting & Relevancy Controls
· Drive Results Based on Visitor Behavior
· Gain Greater Merchandising Flexibility
· Minimize Clicks, Maximize Sales & Conversions
· Actionable Reporting and Analytics
· Plug & Play With Your Existing Web Site
· Advanced Linguistic Support
· Scalable, Robust, Secure

More about WebSideStory Search…

Yahoo Search Web Services

Yahoo! Search Web Services allow you to access Yahoo content and services in your favorite programming languages. This means you can now build Yahoo directly into your own applications. Get more ideas for what you can build by playing with the applications and mashups featured in our Search Application Gallery.

More about Yahoo Search Web Services…

Let me know if you have found anything better out there.