<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Webnetics UK Ltd. - Forums - Programming]]></title>
		<link>https://www.webneticsuk.com/forum/</link>
		<description><![CDATA[Webnetics UK Ltd. - Forums - https://www.webneticsuk.com/forum]]></description>
		<pubDate>Wed, 06 May 2026 13:45:25 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Forum Etiquette and Common Sense]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=201</link>
			<pubDate>Sun, 27 Mar 2011 12:29:51 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=201</guid>
			<description><![CDATA[<span style="font-weight: bold;" class="mycode_b">Common rules</span><br />
<br />
1. Only one account per person is permitted.<br />
2. Do not pretend to be/represent somebody else. Your account will be deleted if found to be in breach of this rule.<br />
3. When registering, a valid email address has to be used. Disposable email addresses are not permitted. If found, we will remove the account in question.<br />
4. Keep all posts on-topic.<br />
5. All posts must be in English, unless posted in a specific international forum. If posting in a international forum, please use the language of that forum, and not English.<br />
6. DO NOT SEND SUPPORT REQUESTS VIA PM, unless expressly invited to do so. Using PM to actively solicit work is not allowed. Post, in accord with the rules in the correct forum. Abuse of the PM system in this way can lead to your membership being removed.<br />
7. Do not discuss illegal activities.<br />
8. No useless posts. This includes: Thread bumping, useless one liners, repeated requests about new versions, Flamewars, Trolling and Spamming.<br />
9. Do not propose/link to any site that contains warez/copyrighted software/materials that can be downloaded illegally.<br />
10. Do not link to any site that contains adult content, sexually oriented material or might otherwise be considered offensive. Any post containing an inappropriate link will be deleted and the poster will receive a warning.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">At all times</span><br />
<br />
1. Keep all commentary civil, and be courteous at all times. Constructive criticism is welcome, but insults directed towards other users or the site admins will not be tolerated. Coarse/insulting language will not be tolerated.<br />
2. Choose an appropriate subject line. Try to summarise the problem briefly in the subject, and elaborate in the message itself. A title like "Have you seen this..." or "Help needed!!!!" will be deleted.<br />
3. Spend 10 minutes with the admin panel before posting common sense questions like "How do I see orders", or "How do I add products". If you go through each admin menu you will find all you need to know about the basic features.<br />
4. Search before posting. You may need to search multiple variation of the terms.<br />
5. Any posts deemed to be self promotion, advertising, or spam can and will be removed. NO SPAM - NO ADVERTISING eg. Posting and making excessive, inappropriate and unnecessary references to your products and websites is self promotion.<br />
6. Don't lump sum mods and inquiries in one post. People asking for help and at the same time attaching a contribution should be avoided. Contributions go in the contrib thread. Help goes in one of the support threads, based on the affected element (modules, templates, languages, general, etc).<br />
7. Bugs go into the bug area ONLY after you have searched the bug forum and found nothing similar.<br />
8. Hijacking threads because you feel the need to whine or complain about your personal opinions that have nothing to do with the main topic of the thread will be instantly deleted at will!<br />
9. If you feel a post violates any of these rules, or you need to bring it to the attention of a moderator (move threads/close/split), please use the â€˜report this postâ€™ link to notify the moderators.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Signatures &amp; Avatars</span><br />
<br />
1. Must be setup in your Profile (user Control Panel) , and not manually added to your messages.<br />
2. May not contain any pricing, sales, product etc. details.<br />
3. Only exact URLs allowed ie not LOOK HERE - No tinyurls, affiliate links etc either, only exact, literal URLs<br />
4. Maximum font size should not be larger than normal +1.<br />
5. Signature shall not have more than 4 lines (at a line width of 75 chars).<br />
6. Any signature or avatar that is offensive or insulting to either us, our members, or our staff, is prohibited.<br />
7. Signature size should not exceed the maximum size of 60 x 180 px (height x width).<br />
8. Avatar size should not exceed the maximum size of 75 x 75 px (height x width).<br />
9. Signature &amp; Avatar images may not contain any copyright material (e.g. trademarks)<br />
10. We reserve the right to ask you to change and/or remove your signature or avatar at any time, for any reason.<br />
<br />
Failure to abide by these rules may result in an editing, negative moderation or deletion of your post. <br />
We reserve the right to ban users from the site. <br />
We reserve the right to change these rules at any time.]]></description>
			<content:encoded><![CDATA[<span style="font-weight: bold;" class="mycode_b">Common rules</span><br />
<br />
1. Only one account per person is permitted.<br />
2. Do not pretend to be/represent somebody else. Your account will be deleted if found to be in breach of this rule.<br />
3. When registering, a valid email address has to be used. Disposable email addresses are not permitted. If found, we will remove the account in question.<br />
4. Keep all posts on-topic.<br />
5. All posts must be in English, unless posted in a specific international forum. If posting in a international forum, please use the language of that forum, and not English.<br />
6. DO NOT SEND SUPPORT REQUESTS VIA PM, unless expressly invited to do so. Using PM to actively solicit work is not allowed. Post, in accord with the rules in the correct forum. Abuse of the PM system in this way can lead to your membership being removed.<br />
7. Do not discuss illegal activities.<br />
8. No useless posts. This includes: Thread bumping, useless one liners, repeated requests about new versions, Flamewars, Trolling and Spamming.<br />
9. Do not propose/link to any site that contains warez/copyrighted software/materials that can be downloaded illegally.<br />
10. Do not link to any site that contains adult content, sexually oriented material or might otherwise be considered offensive. Any post containing an inappropriate link will be deleted and the poster will receive a warning.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">At all times</span><br />
<br />
1. Keep all commentary civil, and be courteous at all times. Constructive criticism is welcome, but insults directed towards other users or the site admins will not be tolerated. Coarse/insulting language will not be tolerated.<br />
2. Choose an appropriate subject line. Try to summarise the problem briefly in the subject, and elaborate in the message itself. A title like "Have you seen this..." or "Help needed!!!!" will be deleted.<br />
3. Spend 10 minutes with the admin panel before posting common sense questions like "How do I see orders", or "How do I add products". If you go through each admin menu you will find all you need to know about the basic features.<br />
4. Search before posting. You may need to search multiple variation of the terms.<br />
5. Any posts deemed to be self promotion, advertising, or spam can and will be removed. NO SPAM - NO ADVERTISING eg. Posting and making excessive, inappropriate and unnecessary references to your products and websites is self promotion.<br />
6. Don't lump sum mods and inquiries in one post. People asking for help and at the same time attaching a contribution should be avoided. Contributions go in the contrib thread. Help goes in one of the support threads, based on the affected element (modules, templates, languages, general, etc).<br />
7. Bugs go into the bug area ONLY after you have searched the bug forum and found nothing similar.<br />
8. Hijacking threads because you feel the need to whine or complain about your personal opinions that have nothing to do with the main topic of the thread will be instantly deleted at will!<br />
9. If you feel a post violates any of these rules, or you need to bring it to the attention of a moderator (move threads/close/split), please use the â€˜report this postâ€™ link to notify the moderators.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Signatures &amp; Avatars</span><br />
<br />
1. Must be setup in your Profile (user Control Panel) , and not manually added to your messages.<br />
2. May not contain any pricing, sales, product etc. details.<br />
3. Only exact URLs allowed ie not LOOK HERE - No tinyurls, affiliate links etc either, only exact, literal URLs<br />
4. Maximum font size should not be larger than normal +1.<br />
5. Signature shall not have more than 4 lines (at a line width of 75 chars).<br />
6. Any signature or avatar that is offensive or insulting to either us, our members, or our staff, is prohibited.<br />
7. Signature size should not exceed the maximum size of 60 x 180 px (height x width).<br />
8. Avatar size should not exceed the maximum size of 75 x 75 px (height x width).<br />
9. Signature &amp; Avatar images may not contain any copyright material (e.g. trademarks)<br />
10. We reserve the right to ask you to change and/or remove your signature or avatar at any time, for any reason.<br />
<br />
Failure to abide by these rules may result in an editing, negative moderation or deletion of your post. <br />
We reserve the right to ban users from the site. <br />
We reserve the right to change these rules at any time.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Cache it! (PHP) - Part 1]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=122</link>
			<pubDate>Sat, 06 Sep 2008 10:32:17 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=122</guid>
			<description><![CDATA[In the good old days when building web sites was as easy as knocking up a few pages, the delivery of a web page to a browser was a simple matter of having the web server fetch a file. A site's visitors would see its small, text-only pages almost immediately, unless they were using particularly slow modems. Once the page was downloaded, the browser would store it somewhere on your local computer so that, should the page be requested again, after performing a quick check with the server to ensure the page hadn't been updated, the browser could display the locally cached version. Pages were served as quickly and efficiently as possible, and everyone was happy.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Then dynamic web pages came along and spoiled the party by introducing two problems: </span><br />
<br />
â€¢	When a request for a dynamic web page is received by the server, some intermediate processing must be completed, such as the execution of scripts by the engine. This processing introduces a delay before the web server begins to deliver the output to the browser. This may not be a significant delay where simple PHP scripts are concerned, but for a more complex application, the PHP engine may have a lot of work to do before the page is finally ready for delivery. This extra work results in a noticeable time lag between the user's requests and the actual display of pages noticeable time lag between the user's requests and the actual display of pages in the browser.<br />
<br />
â€¢	A typical web server, such as, uses the time of file modification to inform a web browser of a requested page's age, allowing the browser to take appropriate action. With dynamic web pages, the actual PHP script may change only occasionally; meanwhile, the content it display s, which is often fetched from a database, will change frequently. The web server has no way of discerning updates to the database, so it doesn't send a last modified date. If the client (that is, the user's browser) has no indication of how long the data will remain valid, it will take a guess. This is problematic if the browser decides to use a locally cached version of the page which is now out of date, or if the browser decides to request from the server a fresh copy of the page, which actually has no new content, making the request redundant. The web server will always respond with a freshly constructed version of the page, regardless of whether or not the data in the database has actually changed.<br />
<br />
To avoid the possibility of a web site visitor viewing out-of-date content, most web developers use a meta tag or HTTP headers to tell the browser never to use a cached version of the page. However, this negates the web browser's natural ability to cache web pages, and entails some serious disadvantages. For example, the content delivered by a dynamic page may only change once a day, so there's certainly a benefit to be gained by having the browser cache a page--even if only for 24 hours.<br />
<br />
If you're working with a small PHP application, it's usually possible to live with both issues. But as your site increases in complexity --and attracts more traffic--you'll begin to run into performance problems. Both these issues can be solved, however: the first with server-side caching; the second, by taking control of [6] caching from within your application. The exact approach you use to solve these problems will depend on your application, but in this chapter, we'll consider both PHP and a number of class libraries from as possible panaceas for your web page woes.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">How do I prevent web browsers from caching a page?</span><br />
<br />
If timely information is crucial to your web site and you wish to prevent out-of-date content from ever being visible, you need to understand how to prevent web browsers--and proxy servers--from caching pages in the first place.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Answer</span><br />
<br />
There are two possible approaches we could take to solving this problem: using HTML meta tags, and using HTTP headers.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Using HTML Meta Tags</span><br />
<br />
The most basic approach to the prevention of page caching is one that utilizes HTML meta tags:<br />
<br />
&lt;meta http-equiv="expires" content="Mon, 26 Jul 1997 05:00:00 GMT"/&gt;<br />
&lt;meta http-equiv="pragma" content="no-cache" /&gt;<br />
<br />
The insertion of a date that's already passed into the Expires meta tag tells the browser that the cached copy of the page is always out of date. Upon encountering this tag, the browser usually won't cache the page. Although the Pragma: no-cache meta tag isn't guaranteed, it's a fairly well-supported convention that most web browsers follow. However, the two issues associated with this approach, which we'll discuss below, may prompt you to look at the alternative solution.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Using HTTPHeaders</span><br />
<br />
A better approach is to use the HTTP protocol itself, with the help of PHP's header function, to produce the equivalent of the two HTML meta tags above:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Expires:&nbsp;Mon,&nbsp;26&nbsp;Jul&nbsp;1997&nbsp;05:00:00&nbsp;GMT'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Pragma:&nbsp;no-cache'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
We can go one step further than this, using the Cache-Control header that's supported by HTTP 1.1 -capable browsers:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Expires:&nbsp;Mon,&nbsp;26&nbsp;Jul&nbsp;1997&nbsp;05:00:00&nbsp;GMT'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Cache-Control:&nbsp;no-store,&nbsp;no-cache,&nbsp;must-revalidate'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Cache-Control:&nbsp;post-check=0,&nbsp;pre-check=0'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">FALSE</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Pragma:&nbsp;no-cache'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Summary</span><br />
<br />
Using the Expires meta tag sounds like a good approach, but two problems are associated with it:<br />
<br />
Using the Expires meta tag sounds like a good approach, but two problems are associated with it:<br />
<br />
â€¢	The browser first has to download the page in order to read the meta tags. If a tag wasn't present when the page was first requested by a browser, the browser will remain blissfully ignorant and keep its cached copy of the original.<br />
â€¢	Proxy servers that cache web pages, such as those common to ISPs, generally won't read the HTML documents themselves. A web browser might know that it shouldn't cache the page, but the proxy server between the browser and the web server probably doesn't--it will continue to deliver the same out-of-date page to the client.<br />
<br />
On the other hand, using the HTTP protocol to prevent page caching essentially guarantees that no web browser or intervening proxy server will cache the page, so visitors will alway s receive the latest content. In fact, the first header should accomplish this on its own; this is the best way to ensure a page is not cached. The Cache-Control and Pragma headers are added for some degree of insurance. Although they don't work on all browsers or proxies, the Cache-Control and Pragma headers will catch some cases in which the Expires header doesn't work as intended--if the client computer's date is set incorrectly, for example.<br />
<br />
Of course, to disallow caching entirely introduces the problems we discussed at the start of this chapter: it negates the web browser's natural ability to cache pages, and can create unnecessary overhead, as new versions of pages are always requested, even though those pages may not have been updated since the browser's last request. We'll look at the solution to these issues in just a moment.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">To be continued â€¦â€¦.</span>]]></description>
			<content:encoded><![CDATA[In the good old days when building web sites was as easy as knocking up a few pages, the delivery of a web page to a browser was a simple matter of having the web server fetch a file. A site's visitors would see its small, text-only pages almost immediately, unless they were using particularly slow modems. Once the page was downloaded, the browser would store it somewhere on your local computer so that, should the page be requested again, after performing a quick check with the server to ensure the page hadn't been updated, the browser could display the locally cached version. Pages were served as quickly and efficiently as possible, and everyone was happy.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Then dynamic web pages came along and spoiled the party by introducing two problems: </span><br />
<br />
â€¢	When a request for a dynamic web page is received by the server, some intermediate processing must be completed, such as the execution of scripts by the engine. This processing introduces a delay before the web server begins to deliver the output to the browser. This may not be a significant delay where simple PHP scripts are concerned, but for a more complex application, the PHP engine may have a lot of work to do before the page is finally ready for delivery. This extra work results in a noticeable time lag between the user's requests and the actual display of pages noticeable time lag between the user's requests and the actual display of pages in the browser.<br />
<br />
â€¢	A typical web server, such as, uses the time of file modification to inform a web browser of a requested page's age, allowing the browser to take appropriate action. With dynamic web pages, the actual PHP script may change only occasionally; meanwhile, the content it display s, which is often fetched from a database, will change frequently. The web server has no way of discerning updates to the database, so it doesn't send a last modified date. If the client (that is, the user's browser) has no indication of how long the data will remain valid, it will take a guess. This is problematic if the browser decides to use a locally cached version of the page which is now out of date, or if the browser decides to request from the server a fresh copy of the page, which actually has no new content, making the request redundant. The web server will always respond with a freshly constructed version of the page, regardless of whether or not the data in the database has actually changed.<br />
<br />
To avoid the possibility of a web site visitor viewing out-of-date content, most web developers use a meta tag or HTTP headers to tell the browser never to use a cached version of the page. However, this negates the web browser's natural ability to cache web pages, and entails some serious disadvantages. For example, the content delivered by a dynamic page may only change once a day, so there's certainly a benefit to be gained by having the browser cache a page--even if only for 24 hours.<br />
<br />
If you're working with a small PHP application, it's usually possible to live with both issues. But as your site increases in complexity --and attracts more traffic--you'll begin to run into performance problems. Both these issues can be solved, however: the first with server-side caching; the second, by taking control of [6] caching from within your application. The exact approach you use to solve these problems will depend on your application, but in this chapter, we'll consider both PHP and a number of class libraries from as possible panaceas for your web page woes.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">How do I prevent web browsers from caching a page?</span><br />
<br />
If timely information is crucial to your web site and you wish to prevent out-of-date content from ever being visible, you need to understand how to prevent web browsers--and proxy servers--from caching pages in the first place.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Answer</span><br />
<br />
There are two possible approaches we could take to solving this problem: using HTML meta tags, and using HTTP headers.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Using HTML Meta Tags</span><br />
<br />
The most basic approach to the prevention of page caching is one that utilizes HTML meta tags:<br />
<br />
&lt;meta http-equiv="expires" content="Mon, 26 Jul 1997 05:00:00 GMT"/&gt;<br />
&lt;meta http-equiv="pragma" content="no-cache" /&gt;<br />
<br />
The insertion of a date that's already passed into the Expires meta tag tells the browser that the cached copy of the page is always out of date. Upon encountering this tag, the browser usually won't cache the page. Although the Pragma: no-cache meta tag isn't guaranteed, it's a fairly well-supported convention that most web browsers follow. However, the two issues associated with this approach, which we'll discuss below, may prompt you to look at the alternative solution.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Using HTTPHeaders</span><br />
<br />
A better approach is to use the HTTP protocol itself, with the help of PHP's header function, to produce the equivalent of the two HTML meta tags above:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Expires:&nbsp;Mon,&nbsp;26&nbsp;Jul&nbsp;1997&nbsp;05:00:00&nbsp;GMT'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Pragma:&nbsp;no-cache'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
We can go one step further than this, using the Cache-Control header that's supported by HTTP 1.1 -capable browsers:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Expires:&nbsp;Mon,&nbsp;26&nbsp;Jul&nbsp;1997&nbsp;05:00:00&nbsp;GMT'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Cache-Control:&nbsp;no-store,&nbsp;no-cache,&nbsp;must-revalidate'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Cache-Control:&nbsp;post-check=0,&nbsp;pre-check=0'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">FALSE</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Pragma:&nbsp;no-cache'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Summary</span><br />
<br />
Using the Expires meta tag sounds like a good approach, but two problems are associated with it:<br />
<br />
Using the Expires meta tag sounds like a good approach, but two problems are associated with it:<br />
<br />
â€¢	The browser first has to download the page in order to read the meta tags. If a tag wasn't present when the page was first requested by a browser, the browser will remain blissfully ignorant and keep its cached copy of the original.<br />
â€¢	Proxy servers that cache web pages, such as those common to ISPs, generally won't read the HTML documents themselves. A web browser might know that it shouldn't cache the page, but the proxy server between the browser and the web server probably doesn't--it will continue to deliver the same out-of-date page to the client.<br />
<br />
On the other hand, using the HTTP protocol to prevent page caching essentially guarantees that no web browser or intervening proxy server will cache the page, so visitors will alway s receive the latest content. In fact, the first header should accomplish this on its own; this is the best way to ensure a page is not cached. The Cache-Control and Pragma headers are added for some degree of insurance. Although they don't work on all browsers or proxies, the Cache-Control and Pragma headers will catch some cases in which the Expires header doesn't work as intended--if the client computer's date is set incorrectly, for example.<br />
<br />
Of course, to disallow caching entirely introduces the problems we discussed at the start of this chapter: it negates the web browser's natural ability to cache pages, and can create unnecessary overhead, as new versions of pages are always requested, even though those pages may not have been updated since the browser's last request. We'll look at the solution to these issues in just a moment.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">To be continued â€¦â€¦.</span>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Next-gen CAPTCHAs]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=116</link>
			<pubDate>Sat, 02 Aug 2008 10:00:45 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=116</guid>
			<description><![CDATA[It seemed like such a straightforward idea: create a simple test that would baffle computers, but humans could solve easily. And for a few years the CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) has done its job, successfully protecting forums, wilds, web mail services and other online resources from being exploited by bots. But concerns are increasingly being raised about the technology, and even the best CAPTCHA systems are now beginning to appear vulnerable.<br />
<br />
It all started as guesswork, when eBay bots were discovered back in 2006. Had someone discovered a way for malware to break the registration system? Possibly, but there wasn't enough information to definitively say that eBay's CAPTCHA had been broken.<br />
<br />
The doubts disappeared in 2007, though, when the eBayCaptcha Populator was released as a Firefox add-on. The tool promised to detect and enter the eBay CAPTCHA code automatically, saving you the trouble. Soon afterwards a number of web- based CAPTCHA-cracking services appeared, and now even Gmail has been broken. The Jiffy Gmail Creator promises to "create unlimited Gmail accounts in seconds flat without breaking a sweat", and is being sold for &#36;77 a copy.<br />
<br />
As CAPTCHA begins to fail, so the consequences can be seen elsewhere. Earlier this year, sparn sent from Gmail doubled in a month, for instance, while the zombie accounts have reportedly been used to attack services including the likes of Craigslist.<br />
<br />
The traditional response has been to try to make the CAPTCHA more difficult. Add extra colours and noise to an image, say. Distort and rotate letters, perhaps add some images too. But you can't do this forever. RapidShare's notorious 'kitten' CAPTCHA is so tricky even humans have problems using it, yet apparently hackers have broken the system already.<br />
<br />
It's plain that we need a different approach, and image-based CAPTCHA could be it. Implement KittenAuth and you'll see a grid of cute animal photos while being asked to 'select all the dolphins' (or hedgehogs, rabbits, or whatever else is chosen). Sounds good, but even here there are weaknesses. The small database only contains a few images by default, which leaves it vulnerable to attack.<br />
<br />
Unusually, our best hope for security could come from a Microsoft project, Asirra. It's even simpler than KittenAuth â€” you just have to recognise cats and dogs â€” but is backed by a database of over three million images. The system is in beta right now.]]></description>
			<content:encoded><![CDATA[It seemed like such a straightforward idea: create a simple test that would baffle computers, but humans could solve easily. And for a few years the CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) has done its job, successfully protecting forums, wilds, web mail services and other online resources from being exploited by bots. But concerns are increasingly being raised about the technology, and even the best CAPTCHA systems are now beginning to appear vulnerable.<br />
<br />
It all started as guesswork, when eBay bots were discovered back in 2006. Had someone discovered a way for malware to break the registration system? Possibly, but there wasn't enough information to definitively say that eBay's CAPTCHA had been broken.<br />
<br />
The doubts disappeared in 2007, though, when the eBayCaptcha Populator was released as a Firefox add-on. The tool promised to detect and enter the eBay CAPTCHA code automatically, saving you the trouble. Soon afterwards a number of web- based CAPTCHA-cracking services appeared, and now even Gmail has been broken. The Jiffy Gmail Creator promises to "create unlimited Gmail accounts in seconds flat without breaking a sweat", and is being sold for &#36;77 a copy.<br />
<br />
As CAPTCHA begins to fail, so the consequences can be seen elsewhere. Earlier this year, sparn sent from Gmail doubled in a month, for instance, while the zombie accounts have reportedly been used to attack services including the likes of Craigslist.<br />
<br />
The traditional response has been to try to make the CAPTCHA more difficult. Add extra colours and noise to an image, say. Distort and rotate letters, perhaps add some images too. But you can't do this forever. RapidShare's notorious 'kitten' CAPTCHA is so tricky even humans have problems using it, yet apparently hackers have broken the system already.<br />
<br />
It's plain that we need a different approach, and image-based CAPTCHA could be it. Implement KittenAuth and you'll see a grid of cute animal photos while being asked to 'select all the dolphins' (or hedgehogs, rabbits, or whatever else is chosen). Sounds good, but even here there are weaknesses. The small database only contains a few images by default, which leaves it vulnerable to attack.<br />
<br />
Unusually, our best hope for security could come from a Microsoft project, Asirra. It's even simpler than KittenAuth â€” you just have to recognise cats and dogs â€” but is backed by a database of over three million images. The system is in beta right now.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Testing eCommerce Websites!]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=115</link>
			<pubDate>Sat, 02 Aug 2008 09:59:18 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=115</guid>
			<description><![CDATA[Virtual Web Designs are currently in the process of building a bespoke multi shop eCommerce website which will access all itâ€™s products from one database (6 different urlâ€™s). Testing will be a major part of this website build. So we though we would share some of our thoughts on how we will go about testing this sort of eCommerce website.<br />
<br />
Although a lot of time and consideration is usually spent on preparing the creative side and content aspects of websites, functionality and web application testing is often neglected. This can be an oversight for which a company's reputation may pay dearly. According to the research, bugs found after release can not only spell doom for a project, but also cost 80 to 1,000 times more to fix than if they were found during pre- deployment testing.<br />
<br />
Usually the best way to ensure web applications meet the demands of visitors, while meeting internal deadlines, is to keep testing simple. Here's an analogy: in order to check the plumbing of a major sports stadium in the US on the eve of opening day, the entire workforce got together and flushed the toilets simultaneously. This simple, labour intensive approach is often used to load-test new web applications, with lots of people asked to log in at the same time. However, not only is this approach logistically challenging, it's often impossible to realistically simulate the number of users who might hit the site.<br />
<br />
This is where Rapid Bottleneck Identification (RBI) comes in. Every web application has at least one bottleneckâ€” an element of hardware, software or bandwidth that places defining limits on data flow or processing speed. In addition, applications are only as efficient as their least efficient elements, and it's here that bottlenecks directly impact on performance and scalability.<br />
<br />
While the best testing should be quick and simple, it needs to be thorough, which is why RBI is a great testing methodology for web developers.<br />
<br />
Back to basics<br />
<br />
Performance testing often begins with scenarios that are overly complicated: exercising too many components makes it easy for bottlenecks to hide. By starting with basic system-level testing you can check the web application's performance before it's even deployed.<br />
<br />
Furthermore, applying a modular approach helps simplify things. You start by testing the simplest possible test case and gradually build in complexity. If this works, testing moves on. If the next stage fails, you can identify where your bottleneck is. What's useful about the modular method is that after uncovering each bottleneck, you've already ruled out previously tested components. For example, if you hit the homepage and encounter no problems, but then decide to execute a search, which shows poor performance, you've established that the cause of the bottleneck is the search functionality.<br />
<br />
All performance testing should begin with assessing the basic network infrastructure supporting the web applications. If this cannot uphold anticipated user load, then even an infinitely scalable application will bottleneck.<br />
<br />
Next, it's time to focus on web applications. The approach, again, should be to start with the simplest possible test case and then to add complexity. For typical eCommerce applications this means testing the homepage first, then adding pages and business functions until complete transactions are being tested, first individually and then in complex scenario usage patterns.<br />
<br />
Once this is complete, transactions can be put into scenario concurrency tests. These must reflect real user behaviour (for example, 50 per cent just browse, 35 per cent search, in per cent register and log in and five per cent add to the shopping cart and make a purchase). But the virtual users who are testing the site must execute the steps of those transactions using the same pace and behaviour as real-world visitors.<br />
<br />
Testing is a bit like insurance â€” usually you don't realise it's not good enough until it's too late. So, whether or not you conduct performance testing in-house or via a managed service, it's important that it's done methodically and rigorously.]]></description>
			<content:encoded><![CDATA[Virtual Web Designs are currently in the process of building a bespoke multi shop eCommerce website which will access all itâ€™s products from one database (6 different urlâ€™s). Testing will be a major part of this website build. So we though we would share some of our thoughts on how we will go about testing this sort of eCommerce website.<br />
<br />
Although a lot of time and consideration is usually spent on preparing the creative side and content aspects of websites, functionality and web application testing is often neglected. This can be an oversight for which a company's reputation may pay dearly. According to the research, bugs found after release can not only spell doom for a project, but also cost 80 to 1,000 times more to fix than if they were found during pre- deployment testing.<br />
<br />
Usually the best way to ensure web applications meet the demands of visitors, while meeting internal deadlines, is to keep testing simple. Here's an analogy: in order to check the plumbing of a major sports stadium in the US on the eve of opening day, the entire workforce got together and flushed the toilets simultaneously. This simple, labour intensive approach is often used to load-test new web applications, with lots of people asked to log in at the same time. However, not only is this approach logistically challenging, it's often impossible to realistically simulate the number of users who might hit the site.<br />
<br />
This is where Rapid Bottleneck Identification (RBI) comes in. Every web application has at least one bottleneckâ€” an element of hardware, software or bandwidth that places defining limits on data flow or processing speed. In addition, applications are only as efficient as their least efficient elements, and it's here that bottlenecks directly impact on performance and scalability.<br />
<br />
While the best testing should be quick and simple, it needs to be thorough, which is why RBI is a great testing methodology for web developers.<br />
<br />
Back to basics<br />
<br />
Performance testing often begins with scenarios that are overly complicated: exercising too many components makes it easy for bottlenecks to hide. By starting with basic system-level testing you can check the web application's performance before it's even deployed.<br />
<br />
Furthermore, applying a modular approach helps simplify things. You start by testing the simplest possible test case and gradually build in complexity. If this works, testing moves on. If the next stage fails, you can identify where your bottleneck is. What's useful about the modular method is that after uncovering each bottleneck, you've already ruled out previously tested components. For example, if you hit the homepage and encounter no problems, but then decide to execute a search, which shows poor performance, you've established that the cause of the bottleneck is the search functionality.<br />
<br />
All performance testing should begin with assessing the basic network infrastructure supporting the web applications. If this cannot uphold anticipated user load, then even an infinitely scalable application will bottleneck.<br />
<br />
Next, it's time to focus on web applications. The approach, again, should be to start with the simplest possible test case and then to add complexity. For typical eCommerce applications this means testing the homepage first, then adding pages and business functions until complete transactions are being tested, first individually and then in complex scenario usage patterns.<br />
<br />
Once this is complete, transactions can be put into scenario concurrency tests. These must reflect real user behaviour (for example, 50 per cent just browse, 35 per cent search, in per cent register and log in and five per cent add to the shopping cart and make a purchase). But the virtual users who are testing the site must execute the steps of those transactions using the same pace and behaviour as real-world visitors.<br />
<br />
Testing is a bit like insurance â€” usually you don't realise it's not good enough until it's too late. So, whether or not you conduct performance testing in-house or via a managed service, it's important that it's done methodically and rigorously.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Browser Type]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=89</link>
			<pubDate>Sun, 27 Apr 2008 10:52:01 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=89</guid>
			<description><![CDATA[Find out what type of browser and their computer details are with this simple PHP script which informs you of your visitor Browser details. This is good information so you can improve your website for a more targeted audience.<br />
<br />
This is a simple script which will allow you to see what type of browser your website visitors are using. This can give you a better idea of your target audience.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*****************************************************<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Filename.....â€¦...:&nbsp;vistorcheck.php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Package&nbsp;Name.....:&nbsp;Free&nbsp;Version<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Client&nbsp;..........:&nbsp;N/A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Specification&nbsp;No.:&nbsp;SVWD-0005<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Author..â€¦.....â€¦..:&nbsp;Virtual&nbsp;Web&nbsp;Designs&nbsp;(Webnetics&nbsp;UK&nbsp;Ltd.)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Contact.....â€¦.â€¦..:&nbsp;support@vwdesigns.co.uk<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;File&nbsp;Version.....:&nbsp;1.0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Date&nbsp;.......â€¦â€¦...:&nbsp;12/04/2008<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Change&nbsp;No..&nbsp;.....:&nbsp;N/A&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Last&nbsp;Changed&nbsp;....:&nbsp;N/A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*****************************************************/<br />##&nbsp;GET&nbsp;THE&nbsp;DETAILS<br /></span><span style="color: #0000BB">&#36;date</span><span style="color: #007700">=(</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"F&nbsp;j,&nbsp;Y"</span><span style="color: #007700">));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;Current&nbsp;date<br /><br /></span><span style="color: #0000BB">&#36;time</span><span style="color: #007700">=(</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"H:i:s"</span><span style="color: #007700">));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;Current&nbsp;time<br /></span><span style="color: #0000BB">&#36;IPnumber</span><span style="color: #007700">=</span><span style="color: #0000BB">getenv</span><span style="color: #007700">(</span><span style="color: #DD0000">"REMOTE_ADDR"</span><span style="color: #007700">);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;IP&nbsp;Number&nbsp;assigned&nbsp;to&nbsp;your&nbsp;DUN<br /></span><span style="color: #0000BB">&#36;Browser</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">"HTTP_USER_AGENT"</span><span style="color: #007700">];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;Browser&nbsp;agent<br /></span><span style="color: #0000BB">&#36;ReferURL</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">"HTTP_REFERER"</span><span style="color: #007700">];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;Refferal&nbsp;URL<br /></span><span style="color: #0000BB">&#36;ServerName</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">"SERVER_NAME"</span><span style="color: #007700">];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##<br /></span><span style="color: #0000BB">&#36;ServerSoftware</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">"SERVER_SOFTWARE"</span><span style="color: #007700">];&nbsp;</span><span style="color: #FF8000">##<br /></span><span style="color: #0000BB">?&gt;<br /></span><br />&lt;html&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;head&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;Visitor&nbsp;Browser&nbsp;Check&lt;/title&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;meta&nbsp;http-equiv&nbsp;=&nbsp;"Content-Type"&nbsp;content&nbsp;=&nbsp;"text/html;&nbsp;charset=iso-8859-1"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;style&nbsp;type&nbsp;=&nbsp;"text/css"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-family:&nbsp;Arial,&nbsp;Helvetica,&nbsp;sans-serif;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-size:&nbsp;11px;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:&nbsp;BOLD;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P.text<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-family:&nbsp;Arial,&nbsp;Helvetica,&nbsp;sans-serif;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-size:&nbsp;13px;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:&nbsp;NORMAL;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-family:&nbsp;Arial,&nbsp;Helvetica,&nbsp;sans-serif;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-size:&nbsp;13px;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:&nbsp;NORMAL;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color:&nbsp;#000099;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;INPUT<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FONT-SIZE:&nbsp;11;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FONT-FAMILY:&nbsp;Verdana;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;COLOR:&nbsp;#ffffff;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BACKGROUND:&nbsp;#a19797;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CURSOR:&nbsp;HAND;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;H1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-family:&nbsp;Arial,&nbsp;Helvetica,&nbsp;sans-serif;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-size:&nbsp;20px;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:&nbsp;NORMAL;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/style&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/head&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;body&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h1&gt;Visitor&nbsp;Browser&nbsp;Check&lt;/h1&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(isset(</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"op"</span><span style="color: #007700">])&nbsp;&amp;&amp;&nbsp;(</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"op"</span><span style="color: #007700">]&nbsp;==&nbsp;</span><span style="color: #DD0000">"visitorcheck"</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"&lt;table&nbsp;width=&#092;"700&#092;"&nbsp;border=&#092;"0&#092;"&nbsp;cellspacing=&#092;"1&#092;"&nbsp;cellpadding=&#092;"4&#092;"&nbsp;BGCOLOR=&#092;"#CCCCCC&#092;"&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"&lt;tr&gt;&lt;td&nbsp;width=&#092;"125&#092;"&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;CURRENT&nbsp;DATE:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;<br />&lt;p&nbsp;class=&#092;"text&#092;"&gt;</span><span style="color: #0000BB">&#36;date</span><span style="color: #DD0000">&nbsp;&lt;i&gt;at&lt;/i&gt;&nbsp;</span><span style="color: #0000BB">&#36;time</span><span style="color: #DD0000">&lt;/p&gt;&lt;/td&gt;<br />&lt;/tr&gt;&lt;tr&gt;<br />&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;YOUR&nbsp;IP&nbsp;NUMBER:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;<br />&lt;p&nbsp;class=&#092;"text&#092;"&gt;&lt;a&nbsp;target=new&nbsp;href=&#092;"http://</span><span style="color: #0000BB">&#36;IPnumber</span><span style="color: #DD0000">&#092;"&gt;</span><span style="color: #0000BB">&#36;IPnumber</span><span style="color: #DD0000">&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;<br />&lt;/tr&gt;<br />&lt;tr&gt;&nbsp;<br />&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;SERVER&nbsp;NAME:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;&lt;p&nbsp;class=&#092;"text&#092;"&gt;</span><span style="color: #0000BB">&#36;ServerName</span><span style="color: #DD0000">&lt;/p&gt;<br />&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&nbsp;<br />&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;SERVER&nbsp;SOFTWARE:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;&lt;p&nbsp;class=&#092;"text&#092;"&gt;</span><span style="color: #0000BB">&#36;ServerSoftware</span><span style="color: #DD0000">&lt;/p&gt;<br />&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&nbsp;<br />&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;YOUR&nbsp;BROWSER:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;&lt;p&nbsp;class=&#092;"text&#092;"&gt;</span><span style="color: #0000BB">&#36;Browser</span><span style="color: #DD0000">&lt;/p&gt;<br />&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;PAGE&nbsp;REFERRER:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;<br />&lt;p&nbsp;class=&#092;"text&#092;"&gt;&lt;a&nbsp;href=&#092;"</span><span style="color: #0000BB">&#36;ReferURL</span><span style="color: #DD0000">&#092;"&gt;</span><span style="color: #0000BB">&#36;ReferURL</span><span style="color: #DD0000">&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;<br />&lt;/table&gt;<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span>&lt;/p&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&nbsp;align&nbsp;=&nbsp;"center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Click&nbsp;the&nbsp;button&nbsp;below&nbsp;to&nbsp;see&nbsp;your&nbsp;Browser&nbsp;Statistics:&lt;/p&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form&nbsp;method&nbsp;=&nbsp;"post"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input&nbsp;name&nbsp;=&nbsp;"op"&nbsp;type&nbsp;=&nbsp;"hidden"&nbsp;value&nbsp;=&nbsp;"visitorcheck"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input&nbsp;type&nbsp;=&nbsp;"submit"&nbsp;value&nbsp;=&nbsp;"Click&nbsp;here&nbsp;to&nbsp;check&nbsp;your&nbsp;details"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/form&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&nbsp;align&nbsp;=&nbsp;"center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Software&nbsp;by&nbsp;&lt;a&nbsp;target&nbsp;=&nbsp;"new"&nbsp;href&nbsp;=&nbsp;"http://www.vwdesigns.co.uk"&gt;Virtual&nbsp;Web&nbsp;Designs&lt;/a&gt;&lt;/p&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/body&gt;<br />&lt;/html&gt;&nbsp;<br /></code></div></div></div>]]></description>
			<content:encoded><![CDATA[Find out what type of browser and their computer details are with this simple PHP script which informs you of your visitor Browser details. This is good information so you can improve your website for a more targeted audience.<br />
<br />
This is a simple script which will allow you to see what type of browser your website visitors are using. This can give you a better idea of your target audience.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*****************************************************<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Filename.....â€¦...:&nbsp;vistorcheck.php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Package&nbsp;Name.....:&nbsp;Free&nbsp;Version<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Client&nbsp;..........:&nbsp;N/A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Specification&nbsp;No.:&nbsp;SVWD-0005<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Author..â€¦.....â€¦..:&nbsp;Virtual&nbsp;Web&nbsp;Designs&nbsp;(Webnetics&nbsp;UK&nbsp;Ltd.)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Contact.....â€¦.â€¦..:&nbsp;support@vwdesigns.co.uk<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;File&nbsp;Version.....:&nbsp;1.0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Date&nbsp;.......â€¦â€¦...:&nbsp;12/04/2008<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Change&nbsp;No..&nbsp;.....:&nbsp;N/A&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Last&nbsp;Changed&nbsp;....:&nbsp;N/A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*****************************************************/<br />##&nbsp;GET&nbsp;THE&nbsp;DETAILS<br /></span><span style="color: #0000BB">&#36;date</span><span style="color: #007700">=(</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"F&nbsp;j,&nbsp;Y"</span><span style="color: #007700">));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;Current&nbsp;date<br /><br /></span><span style="color: #0000BB">&#36;time</span><span style="color: #007700">=(</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"H:i:s"</span><span style="color: #007700">));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;Current&nbsp;time<br /></span><span style="color: #0000BB">&#36;IPnumber</span><span style="color: #007700">=</span><span style="color: #0000BB">getenv</span><span style="color: #007700">(</span><span style="color: #DD0000">"REMOTE_ADDR"</span><span style="color: #007700">);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;IP&nbsp;Number&nbsp;assigned&nbsp;to&nbsp;your&nbsp;DUN<br /></span><span style="color: #0000BB">&#36;Browser</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">"HTTP_USER_AGENT"</span><span style="color: #007700">];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;Browser&nbsp;agent<br /></span><span style="color: #0000BB">&#36;ReferURL</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">"HTTP_REFERER"</span><span style="color: #007700">];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;Refferal&nbsp;URL<br /></span><span style="color: #0000BB">&#36;ServerName</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">"SERVER_NAME"</span><span style="color: #007700">];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##<br /></span><span style="color: #0000BB">&#36;ServerSoftware</span><span style="color: #007700">=</span><span style="color: #0000BB">&#36;_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">"SERVER_SOFTWARE"</span><span style="color: #007700">];&nbsp;</span><span style="color: #FF8000">##<br /></span><span style="color: #0000BB">?&gt;<br /></span><br />&lt;html&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;head&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;Visitor&nbsp;Browser&nbsp;Check&lt;/title&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;meta&nbsp;http-equiv&nbsp;=&nbsp;"Content-Type"&nbsp;content&nbsp;=&nbsp;"text/html;&nbsp;charset=iso-8859-1"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;style&nbsp;type&nbsp;=&nbsp;"text/css"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-family:&nbsp;Arial,&nbsp;Helvetica,&nbsp;sans-serif;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-size:&nbsp;11px;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:&nbsp;BOLD;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P.text<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-family:&nbsp;Arial,&nbsp;Helvetica,&nbsp;sans-serif;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-size:&nbsp;13px;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:&nbsp;NORMAL;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-family:&nbsp;Arial,&nbsp;Helvetica,&nbsp;sans-serif;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-size:&nbsp;13px;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:&nbsp;NORMAL;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color:&nbsp;#000099;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;INPUT<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FONT-SIZE:&nbsp;11;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FONT-FAMILY:&nbsp;Verdana;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;COLOR:&nbsp;#ffffff;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BACKGROUND:&nbsp;#a19797;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CURSOR:&nbsp;HAND;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;H1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-family:&nbsp;Arial,&nbsp;Helvetica,&nbsp;sans-serif;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-size:&nbsp;20px;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:&nbsp;NORMAL;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/style&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/head&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;body&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h1&gt;Visitor&nbsp;Browser&nbsp;Check&lt;/h1&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(isset(</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"op"</span><span style="color: #007700">])&nbsp;&amp;&amp;&nbsp;(</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"op"</span><span style="color: #007700">]&nbsp;==&nbsp;</span><span style="color: #DD0000">"visitorcheck"</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"&lt;table&nbsp;width=&#092;"700&#092;"&nbsp;border=&#092;"0&#092;"&nbsp;cellspacing=&#092;"1&#092;"&nbsp;cellpadding=&#092;"4&#092;"&nbsp;BGCOLOR=&#092;"#CCCCCC&#092;"&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"&lt;tr&gt;&lt;td&nbsp;width=&#092;"125&#092;"&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;CURRENT&nbsp;DATE:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;<br />&lt;p&nbsp;class=&#092;"text&#092;"&gt;</span><span style="color: #0000BB">&#36;date</span><span style="color: #DD0000">&nbsp;&lt;i&gt;at&lt;/i&gt;&nbsp;</span><span style="color: #0000BB">&#36;time</span><span style="color: #DD0000">&lt;/p&gt;&lt;/td&gt;<br />&lt;/tr&gt;&lt;tr&gt;<br />&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;YOUR&nbsp;IP&nbsp;NUMBER:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;<br />&lt;p&nbsp;class=&#092;"text&#092;"&gt;&lt;a&nbsp;target=new&nbsp;href=&#092;"http://</span><span style="color: #0000BB">&#36;IPnumber</span><span style="color: #DD0000">&#092;"&gt;</span><span style="color: #0000BB">&#36;IPnumber</span><span style="color: #DD0000">&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;<br />&lt;/tr&gt;<br />&lt;tr&gt;&nbsp;<br />&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;SERVER&nbsp;NAME:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;&lt;p&nbsp;class=&#092;"text&#092;"&gt;</span><span style="color: #0000BB">&#36;ServerName</span><span style="color: #DD0000">&lt;/p&gt;<br />&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&nbsp;<br />&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;SERVER&nbsp;SOFTWARE:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;&lt;p&nbsp;class=&#092;"text&#092;"&gt;</span><span style="color: #0000BB">&#36;ServerSoftware</span><span style="color: #DD0000">&lt;/p&gt;<br />&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&nbsp;<br />&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;YOUR&nbsp;BROWSER:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;&lt;p&nbsp;class=&#092;"text&#092;"&gt;</span><span style="color: #0000BB">&#36;Browser</span><span style="color: #DD0000">&lt;/p&gt;<br />&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&lt;td&nbsp;BGCOLOR=&#092;"#F3F3F3&#092;"&gt;&lt;p&gt;PAGE&nbsp;REFERRER:&lt;/p&gt;&lt;/td&gt;&lt;td&nbsp;BGCOLOR=&#092;"#FFFFFF&#092;"&gt;<br />&lt;p&nbsp;class=&#092;"text&#092;"&gt;&lt;a&nbsp;href=&#092;"</span><span style="color: #0000BB">&#36;ReferURL</span><span style="color: #DD0000">&#092;"&gt;</span><span style="color: #0000BB">&#36;ReferURL</span><span style="color: #DD0000">&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;<br />&lt;/table&gt;<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span>&lt;/p&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&nbsp;align&nbsp;=&nbsp;"center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Click&nbsp;the&nbsp;button&nbsp;below&nbsp;to&nbsp;see&nbsp;your&nbsp;Browser&nbsp;Statistics:&lt;/p&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;form&nbsp;method&nbsp;=&nbsp;"post"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input&nbsp;name&nbsp;=&nbsp;"op"&nbsp;type&nbsp;=&nbsp;"hidden"&nbsp;value&nbsp;=&nbsp;"visitorcheck"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input&nbsp;type&nbsp;=&nbsp;"submit"&nbsp;value&nbsp;=&nbsp;"Click&nbsp;here&nbsp;to&nbsp;check&nbsp;your&nbsp;details"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/form&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&nbsp;align&nbsp;=&nbsp;"center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Software&nbsp;by&nbsp;&lt;a&nbsp;target&nbsp;=&nbsp;"new"&nbsp;href&nbsp;=&nbsp;"http://www.vwdesigns.co.uk"&gt;Virtual&nbsp;Web&nbsp;Designs&lt;/a&gt;&lt;/p&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/body&gt;<br />&lt;/html&gt;&nbsp;<br /></code></div></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Robot Visit - Check when the search engines are visiting]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=88</link>
			<pubDate>Sun, 27 Apr 2008 10:50:16 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=88</guid>
			<description><![CDATA[Receive instant notification by email when a search engine spider has visited your website. This is a great way to monitor and manage your search engine submission plan.<br />
<br />
â€¢	Are you getting listed on search engines?<br />
â€¢	Do you want to know when your pages are getting indexed?<br />
â€¢	Do you want to know what search engines are visiting and when?<br />
â€¢	Are you an affiliate for many merchant programs and need to keep track of stats?<br />
<br />
Then this is the script for you. Simply copy and paste a one line code into your website and as soon as a search engine spider visits your website you will receive an email notification containing the following information:<br />
<br />
â€¢	Name of the Search Engine<br />
â€¢	Name of the Spider<br />
â€¢	Name of the page visited<br />
â€¢	Exact day and time of visit<br />
<br />
This gives you a great way to monitor if your website is being indexed by the major search engines. It also provides a great way of collecting stats of the habits of the search engine spiders. Giving you the opportunity to create search engine friendly pages which are correctly optimised for maximum search engine positioning.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Feature List</span><br />
<br />
â€¢	Supports all the major search engines<br />
â€¢	One step easy install<br />
â€¢	Email notification of Spider visits.<br />
â€¢	No database is required.<br />
â€¢	Easy and simple to use.<br />
â€¢	No special PHP knowledge required.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Currently supports the following search engines:</span><br />
<br />
â€¢	Googlebot - [Google] - <a href="http://www.google.com" target="_blank" rel="noopener" class="mycode_url">www.google.com</a><br />
â€¢	Alta Vita - [Scooter] - <a href="http://www.altavista.com" target="_blank" rel="noopener" class="mycode_url">www.altavista.com</a><br />
â€¢	Teoma - [Ask Jeeves/Teoma] - <a href="http://www.teoma.com" target="_blank" rel="noopener" class="mycode_url">www.teoma.com</a><br />
â€¢	Lycos - [Lycos_Spider_(T-Rex)] - <a href="http://www.lycos.com" target="_blank" rel="noopener" class="mycode_url">www.lycos.com</a><br />
â€¢	Inktomi - [Slurp] - <a href="http://www.inktomi.com" target="_blank" rel="noopener" class="mycode_url">www.inktomi.com</a><br />
â€¢	Mirago - [HenryTheMiragorobot] - <a href="http://www.mirago.com" target="_blank" rel="noopener" class="mycode_url">www.mirago.com</a><br />
â€¢	AlltheWeb - [FAST-WebCrawler] - <a href="http://www.alltheweb.com" target="_blank" rel="noopener" class="mycode_url">www.alltheweb.com</a><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">&lt;!</span><span style="color: #0000BB">DOCTYPE&nbsp;HTML&nbsp;</span><span style="color: #007700">PUBLIC&nbsp;</span><span style="color: #DD0000">"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">html</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">head</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">title</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">RobotVisit&nbsp;v1.0</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">title</span><span style="color: #007700">&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">meta&nbsp;http</span><span style="color: #007700">-</span><span style="color: #0000BB">equiv&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Content-Type"&nbsp;</span><span style="color: #0000BB">content&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"text/html;&nbsp;charset=iso-8859-1"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">head</span><span style="color: #007700">&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">body</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?</span><span style="color: #0000BB">PHP<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*****************************************************<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Filename.....â€¦...:&nbsp;robotvisit.php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Package&nbsp;Name.....:&nbsp;Free&nbsp;Version<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Client&nbsp;..........:&nbsp;N/A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Specification&nbsp;No.:&nbsp;SVWD-0004<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Author..â€¦.....â€¦..:&nbsp;Virtual&nbsp;Web&nbsp;Designs&nbsp;(Webnetics&nbsp;UK&nbsp;Ltd.)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Contact.....â€¦.â€¦..:&nbsp;support@vwdesigns.co.uk<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;File&nbsp;Version.....:&nbsp;1.0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Date&nbsp;.......â€¦â€¦...:&nbsp;1/04/2008<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Change&nbsp;No..&nbsp;.....:&nbsp;N/A&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Last&nbsp;Changed&nbsp;....:&nbsp;N/A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*****************************************************/<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;##############&nbsp;START&nbsp;OF&nbsp;CONFIG&nbsp;SECTION&nbsp;#############<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;##&nbsp;Change&nbsp;the&nbsp;following&nbsp;to&nbsp;suit&nbsp;your&nbsp;needs:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #007700">=</span><span style="color: #DD0000">""</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">##&nbsp;NOTIFICATION&nbsp;EMAIL&nbsp;ADDRESS<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #007700">=</span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">"/[&#092;n&#092;r]+/"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##############&nbsp;END&nbsp;OF&nbsp;CONFIG&nbsp;SECTION&nbsp;#############<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">=</span><span style="color: #DD0000">"------------------------------------------------------------------------------<br />RobotVisit&nbsp;v1.0&nbsp;-&nbsp;Virtual&nbsp;Web&nbsp;Designs<br />------------------------------------------------------------------------------"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">=</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"F&nbsp;j,&nbsp;Y,&nbsp;g:i&nbsp;a"</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">##&nbsp;GET&nbsp;THE&nbsp;TIME&nbsp;OF&nbsp;THE&nbsp;ROBOT&nbsp;VISIT<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">=<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"-----------------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SEARCH&nbsp;ENGINE&nbsp;ROBOT&nbsp;HAS&nbsp;VISITED&nbsp;YOUR&nbsp;WEBSITE<br />-----------------------------------------------------------------------------"</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;GOOGLE&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Googlebot"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;GoogleLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;GoogleLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;GoogleEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Googlebot&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Googlebot&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Googlebot&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;GoogleLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.google.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Google&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;GoogleEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Google&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;&nbsp;&nbsp;ALTAVISTA&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Scooter"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;AVLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;AVLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;AVEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Scooter&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Scooter&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Scooter&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;AVLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.altavista.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"AltaVista&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;AVEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Alta&nbsp;Vista&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;ALL&nbsp;THE&nbsp;WEB&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"FAST-WebCrawler"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;FASTLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;FASTLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;FASTEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;FAST-WebCrawler&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />FAST-WebCrawler&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />FAST-WebCrawler&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;FASTLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.alltheweb.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"AllTheWeb&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;FASTEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;FAST&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;ASK&nbsp;JEEVES&nbsp;-&nbsp;TEOMA<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Ask&nbsp;Jeeves/Teoma"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;ASKLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;ASKLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;ASKEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Ask&nbsp;Jeeves/Teoma&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Ask&nbsp;Jeeves/Teoma&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Ask&nbsp;Jeeves/Teoma&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;ASKLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.ask.com&nbsp;&amp;&nbsp;http://www.teoma.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Ask&nbsp;Jeeves-Teoma&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;ASKEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;ASK/Teoma&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;INKTOMI&nbsp;DIRECTORY<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Slurp"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;SLURPLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;SLURPLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;SLURPEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Slurp&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Slurp&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Slurp&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SLURPLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.inktomi.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Inktomi&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;SLURPEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Inktomi&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;MIRAGO&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"HenryTheMiragorobot"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;MiragoLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;MiragoLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;MiragoEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;HenryTheMiragorobot&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />HenryTheMiragorobot&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />HenryTheMiragorobot&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;MiragoLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.mirago.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Mirago&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;MiragoEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Mirago&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;LYCOS&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Lycos_Spider_(T-Rex)"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;LycosLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;LycosLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;LycosEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Lycos_Spider_(T-Rex)&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Lycos_Spider_(T-Rex)&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Lycos_Spider_(T-Rex)&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;LycosLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.lycos.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Lycos&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;LycosEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Lycos&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/body&gt;<br />&lt;/html&gt;&nbsp;<br /></code></div></div></div><br />
Installation<br />
<br />
To install the PHP RobotVisit to your website, simply add the code below to your webpage and upload the robotvisit.php file in the same directory as the pages the code below has been pasted into. Please note that the page extension needs to be .php or PHP equivalent. <br />
<br />
The nearer the top of the page the better as this will give a better indication of when you have been visited by one of the robots. The code can be added to as many or as few pages as you require. Ideally it should be inserted before the opening &lt;html&gt; tag. Paste the code below in as many pages on your website as required.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?PHP&nbsp;</span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">"robotvisit.php"&nbsp;</span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Warning (!): </span><span style="color: #FF0000;" class="mycode_color"></span>[/php]If you have a large traffic website, you may be wise to use this script sparingly, because if you have a good listing on the search engines you could end up receiving quite a few emails! I did this on one of my Affiliate script websites and ended up with over a 1000 emails that day!. But then at least you know your website has a good listing on the search engines.]]></description>
			<content:encoded><![CDATA[Receive instant notification by email when a search engine spider has visited your website. This is a great way to monitor and manage your search engine submission plan.<br />
<br />
â€¢	Are you getting listed on search engines?<br />
â€¢	Do you want to know when your pages are getting indexed?<br />
â€¢	Do you want to know what search engines are visiting and when?<br />
â€¢	Are you an affiliate for many merchant programs and need to keep track of stats?<br />
<br />
Then this is the script for you. Simply copy and paste a one line code into your website and as soon as a search engine spider visits your website you will receive an email notification containing the following information:<br />
<br />
â€¢	Name of the Search Engine<br />
â€¢	Name of the Spider<br />
â€¢	Name of the page visited<br />
â€¢	Exact day and time of visit<br />
<br />
This gives you a great way to monitor if your website is being indexed by the major search engines. It also provides a great way of collecting stats of the habits of the search engine spiders. Giving you the opportunity to create search engine friendly pages which are correctly optimised for maximum search engine positioning.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Feature List</span><br />
<br />
â€¢	Supports all the major search engines<br />
â€¢	One step easy install<br />
â€¢	Email notification of Spider visits.<br />
â€¢	No database is required.<br />
â€¢	Easy and simple to use.<br />
â€¢	No special PHP knowledge required.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Currently supports the following search engines:</span><br />
<br />
â€¢	Googlebot - [Google] - <a href="http://www.google.com" target="_blank" rel="noopener" class="mycode_url">www.google.com</a><br />
â€¢	Alta Vita - [Scooter] - <a href="http://www.altavista.com" target="_blank" rel="noopener" class="mycode_url">www.altavista.com</a><br />
â€¢	Teoma - [Ask Jeeves/Teoma] - <a href="http://www.teoma.com" target="_blank" rel="noopener" class="mycode_url">www.teoma.com</a><br />
â€¢	Lycos - [Lycos_Spider_(T-Rex)] - <a href="http://www.lycos.com" target="_blank" rel="noopener" class="mycode_url">www.lycos.com</a><br />
â€¢	Inktomi - [Slurp] - <a href="http://www.inktomi.com" target="_blank" rel="noopener" class="mycode_url">www.inktomi.com</a><br />
â€¢	Mirago - [HenryTheMiragorobot] - <a href="http://www.mirago.com" target="_blank" rel="noopener" class="mycode_url">www.mirago.com</a><br />
â€¢	AlltheWeb - [FAST-WebCrawler] - <a href="http://www.alltheweb.com" target="_blank" rel="noopener" class="mycode_url">www.alltheweb.com</a><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">&lt;!</span><span style="color: #0000BB">DOCTYPE&nbsp;HTML&nbsp;</span><span style="color: #007700">PUBLIC&nbsp;</span><span style="color: #DD0000">"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">html</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">head</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">title</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">RobotVisit&nbsp;v1.0</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">title</span><span style="color: #007700">&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">meta&nbsp;http</span><span style="color: #007700">-</span><span style="color: #0000BB">equiv&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Content-Type"&nbsp;</span><span style="color: #0000BB">content&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"text/html;&nbsp;charset=iso-8859-1"</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">head</span><span style="color: #007700">&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">body</span><span style="color: #007700">&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?</span><span style="color: #0000BB">PHP<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*****************************************************<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Filename.....â€¦...:&nbsp;robotvisit.php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Package&nbsp;Name.....:&nbsp;Free&nbsp;Version<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Client&nbsp;..........:&nbsp;N/A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Specification&nbsp;No.:&nbsp;SVWD-0004<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Author..â€¦.....â€¦..:&nbsp;Virtual&nbsp;Web&nbsp;Designs&nbsp;(Webnetics&nbsp;UK&nbsp;Ltd.)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Contact.....â€¦.â€¦..:&nbsp;support@vwdesigns.co.uk<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;File&nbsp;Version.....:&nbsp;1.0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Date&nbsp;.......â€¦â€¦...:&nbsp;1/04/2008<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Change&nbsp;No..&nbsp;.....:&nbsp;N/A&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**&nbsp;Last&nbsp;Changed&nbsp;....:&nbsp;N/A<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*****************************************************/<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;##############&nbsp;START&nbsp;OF&nbsp;CONFIG&nbsp;SECTION&nbsp;#############<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;##&nbsp;Change&nbsp;the&nbsp;following&nbsp;to&nbsp;suit&nbsp;your&nbsp;needs:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #007700">=</span><span style="color: #DD0000">""</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">##&nbsp;NOTIFICATION&nbsp;EMAIL&nbsp;ADDRESS<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #007700">=</span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">"/[&#092;n&#092;r]+/"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##############&nbsp;END&nbsp;OF&nbsp;CONFIG&nbsp;SECTION&nbsp;#############<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">=</span><span style="color: #DD0000">"------------------------------------------------------------------------------<br />RobotVisit&nbsp;v1.0&nbsp;-&nbsp;Virtual&nbsp;Web&nbsp;Designs<br />------------------------------------------------------------------------------"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">=</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"F&nbsp;j,&nbsp;Y,&nbsp;g:i&nbsp;a"</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">##&nbsp;GET&nbsp;THE&nbsp;TIME&nbsp;OF&nbsp;THE&nbsp;ROBOT&nbsp;VISIT<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">=<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"-----------------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SEARCH&nbsp;ENGINE&nbsp;ROBOT&nbsp;HAS&nbsp;VISITED&nbsp;YOUR&nbsp;WEBSITE<br />-----------------------------------------------------------------------------"</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;GOOGLE&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Googlebot"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;GoogleLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;GoogleLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;GoogleEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Googlebot&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Googlebot&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Googlebot&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;GoogleLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.google.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Google&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;GoogleEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Google&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;&nbsp;&nbsp;ALTAVISTA&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Scooter"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;AVLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;AVLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;AVEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Scooter&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Scooter&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Scooter&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;AVLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.altavista.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"AltaVista&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;AVEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Alta&nbsp;Vista&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;ALL&nbsp;THE&nbsp;WEB&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"FAST-WebCrawler"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;FASTLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;FASTLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;FASTEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;FAST-WebCrawler&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />FAST-WebCrawler&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />FAST-WebCrawler&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;FASTLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.alltheweb.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"AllTheWeb&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;FASTEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;FAST&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;ASK&nbsp;JEEVES&nbsp;-&nbsp;TEOMA<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Ask&nbsp;Jeeves/Teoma"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;ASKLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;ASKLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;ASKEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Ask&nbsp;Jeeves/Teoma&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Ask&nbsp;Jeeves/Teoma&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Ask&nbsp;Jeeves/Teoma&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;ASKLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.ask.com&nbsp;&amp;&nbsp;http://www.teoma.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Ask&nbsp;Jeeves-Teoma&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;ASKEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;ASK/Teoma&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;INKTOMI&nbsp;DIRECTORY<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Slurp"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;SLURPLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;SLURPLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;SLURPEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Slurp&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Slurp&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Slurp&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SLURPLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.inktomi.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Inktomi&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;SLURPEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Inktomi&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;MIRAGO&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"HenryTheMiragorobot"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;MiragoLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;MiragoLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;MiragoEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;HenryTheMiragorobot&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />HenryTheMiragorobot&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />HenryTheMiragorobot&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;MiragoLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.mirago.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Mirago&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;MiragoEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Mirago&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">##&nbsp;&nbsp;LYCOS&nbsp;SEARCH&nbsp;ENGINE<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eregi</span><span style="color: #007700">(</span><span style="color: #DD0000">"Lycos_Spider_(T-Rex)"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;HTTP_USER_AGENT</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;header</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;footer</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">&#36;today</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">&#36;QUERY_STRING&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;LycosLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'?'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;QUERY_STRING</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;LycosLink</span><span style="color: #007700">=</span><span style="color: #DD0000">"http://"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;SERVER_NAME&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;LycosEmail</span><span style="color: #007700">=</span><span style="color: #DD0000">"<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Hi&nbsp;There,<br />The&nbsp;Search&nbsp;Engine&nbsp;robot&nbsp;Lycos_Spider_(T-Rex)&nbsp;has&nbsp;been&nbsp;detected&nbsp;on&nbsp;your&nbsp;website.<br />Lycos_Spider_(T-Rex)&nbsp;has&nbsp;visited&nbsp;http://</span><span style="color: #0000BB">&#36;SERVER_NAME</span><span style="color: #DD0000"><br /><br />Lycos_Spider_(T-Rex)&nbsp;has&nbsp;crawled&nbsp;the&nbsp;page&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;LycosLink&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />Time&nbsp;of&nbsp;visit&nbsp;-&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;today&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br /><br />Search&nbsp;Engine&nbsp;Link:&nbsp;http://www.lycos.com<br />"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;footer&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mail</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Lycos&nbsp;Robot&nbsp;Visit"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;LycosEmail</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"From:&nbsp;&lt;Lycos&nbsp;Robot&gt;</span><span style="color: #0000BB">&#36;EmailAddress</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/body&gt;<br />&lt;/html&gt;&nbsp;<br /></code></div></div></div><br />
Installation<br />
<br />
To install the PHP RobotVisit to your website, simply add the code below to your webpage and upload the robotvisit.php file in the same directory as the pages the code below has been pasted into. Please note that the page extension needs to be .php or PHP equivalent. <br />
<br />
The nearer the top of the page the better as this will give a better indication of when you have been visited by one of the robots. The code can be added to as many or as few pages as you require. Ideally it should be inserted before the opening &lt;html&gt; tag. Paste the code below in as many pages on your website as required.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?PHP&nbsp;</span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">"robotvisit.php"&nbsp;</span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Warning (!): </span><span style="color: #FF0000;" class="mycode_color"></span>[/php]If you have a large traffic website, you may be wise to use this script sparingly, because if you have a good listing on the search engines you could end up receiving quite a few emails! I did this on one of my Affiliate script websites and ended up with over a 1000 emails that day!. But then at least you know your website has a good listing on the search engines.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Bug Reporting]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=86</link>
			<pubDate>Tue, 22 Apr 2008 18:39:47 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=86</guid>
			<description><![CDATA[Anybody who has written software for public use will probably have received at least one bad bug report. Virtual Web Designs are not exempted from this rule.<br />
<br />
Reports that say nothing ("It doesn't work!"); reports that make no sense; reports that don't give enough information; reports that give wrong information. Reports of problems that turn out to be user error; reports of problems that turn out to be the fault of somebody else's program; reports of problems that turn out to be network failures.<br />
<br />
There's a reason why technical support is seen as a horrible job to be in, and that reason is bad bug reports. However, not all bug reports are unpleasant: We currently maintain a lot of software, and we sometimes receive wonderfully clear, helpful, informative bug reports.<br />
<br />
I'll try to state clearly what makes a good bug report. Ideally I would like everybody in the world to read this blog before reporting any bugs to anybody. Certainly I would like every body who reports bugs to us to have read it.<br />
<br />
In a nutshell, the aim of a bug report is to enable the software developer to see the program failing in front of them. You can either show them in person (Not always possible), or give us careful and detailed instructions on how to make it fail. If they can make it fail, they will try to gather extra information until they know the cause. If we can't make it fail, we will have to ask you to gather that information for us.<br />
<br />
In bug reports, try to make very clear what are actual facts ("I was at the computer and this happened") and what are speculations ("I think the problem might be this"). Leave out speculations if you want to, but don't leave out facts.<br />
<br />
When you report a bug, you are doing so because you want the bug fixed. There is no point in swearing at us or being deliberately unhelpful: it may be their fault and your problem, and you might be right to be angry with them, but the bug will get fixed faster if you help us by supplying all the information we need. Remember also that if the software has been supplied free by us, then we are providing it out of kindness of our own heart.<br />
<br />
If you can find a list of known bugs, it's worth reading it to see if the bug you've just found is already known or not. If it's already known, it probably isn't worth reporting again, but if you think you have more information than the report in the bug list, you might want to contact us anyway. We might be able to fix the bug more easily if you can give us additional information.<br />
<br />
We are in the process of writing our bug reporting system called VrBugTracker.<br />
<br />
All our bug reports can be found at <a href="http://www.vrforge.net" target="_blank" rel="noopener" class="mycode_url">http://www.vrforge.net</a><br />
<br />
<span style="font-weight: bold;" class="mycode_b">Guide</span><br />
<br />
â€¢	The first aim of a bug report is to let the software developer see the failure with their own eyes. If you can't be with them to make it fail in front of them, give them detailed instructions so that they can make it fail for themselves.<br />
â€¢	In case the first aim doesn't succeed, and the programmer can't see it failing themselves, the second aim of a bug report is to describe what went wrong. Describe everything in detail. State what you saw, and also state what you expected to see. Write down the error messages, especially if they have numbers in.<br />
â€¢	When software does something unexpected. Do nothing until you're calm, and don't try and refresh the software.<br />
â€¢	By all means try to diagnose the fault yourself if you think you can, but if you do, you should still report the symptoms as well.<br />
â€¢	Be ready to provide extra information if we require it. We aren't being deliberately awkward. Have the software version number(s) ready, because we will we will need this. All software versions will be found at the footer of the page or in the admin side. If this is commercial software this will have vx.x, if this bespoke software it will have vwd-xxx vx.x.<br />
â€¢	Write clearly. Say what you mean, and make sure it can't be misinterpreted.<br />
â€¢	Above all, be precise. We like precision.]]></description>
			<content:encoded><![CDATA[Anybody who has written software for public use will probably have received at least one bad bug report. Virtual Web Designs are not exempted from this rule.<br />
<br />
Reports that say nothing ("It doesn't work!"); reports that make no sense; reports that don't give enough information; reports that give wrong information. Reports of problems that turn out to be user error; reports of problems that turn out to be the fault of somebody else's program; reports of problems that turn out to be network failures.<br />
<br />
There's a reason why technical support is seen as a horrible job to be in, and that reason is bad bug reports. However, not all bug reports are unpleasant: We currently maintain a lot of software, and we sometimes receive wonderfully clear, helpful, informative bug reports.<br />
<br />
I'll try to state clearly what makes a good bug report. Ideally I would like everybody in the world to read this blog before reporting any bugs to anybody. Certainly I would like every body who reports bugs to us to have read it.<br />
<br />
In a nutshell, the aim of a bug report is to enable the software developer to see the program failing in front of them. You can either show them in person (Not always possible), or give us careful and detailed instructions on how to make it fail. If they can make it fail, they will try to gather extra information until they know the cause. If we can't make it fail, we will have to ask you to gather that information for us.<br />
<br />
In bug reports, try to make very clear what are actual facts ("I was at the computer and this happened") and what are speculations ("I think the problem might be this"). Leave out speculations if you want to, but don't leave out facts.<br />
<br />
When you report a bug, you are doing so because you want the bug fixed. There is no point in swearing at us or being deliberately unhelpful: it may be their fault and your problem, and you might be right to be angry with them, but the bug will get fixed faster if you help us by supplying all the information we need. Remember also that if the software has been supplied free by us, then we are providing it out of kindness of our own heart.<br />
<br />
If you can find a list of known bugs, it's worth reading it to see if the bug you've just found is already known or not. If it's already known, it probably isn't worth reporting again, but if you think you have more information than the report in the bug list, you might want to contact us anyway. We might be able to fix the bug more easily if you can give us additional information.<br />
<br />
We are in the process of writing our bug reporting system called VrBugTracker.<br />
<br />
All our bug reports can be found at <a href="http://www.vrforge.net" target="_blank" rel="noopener" class="mycode_url">http://www.vrforge.net</a><br />
<br />
<span style="font-weight: bold;" class="mycode_b">Guide</span><br />
<br />
â€¢	The first aim of a bug report is to let the software developer see the failure with their own eyes. If you can't be with them to make it fail in front of them, give them detailed instructions so that they can make it fail for themselves.<br />
â€¢	In case the first aim doesn't succeed, and the programmer can't see it failing themselves, the second aim of a bug report is to describe what went wrong. Describe everything in detail. State what you saw, and also state what you expected to see. Write down the error messages, especially if they have numbers in.<br />
â€¢	When software does something unexpected. Do nothing until you're calm, and don't try and refresh the software.<br />
â€¢	By all means try to diagnose the fault yourself if you think you can, but if you do, you should still report the symptoms as well.<br />
â€¢	Be ready to provide extra information if we require it. We aren't being deliberately awkward. Have the software version number(s) ready, because we will we will need this. All software versions will be found at the footer of the page or in the admin side. If this is commercial software this will have vx.x, if this bespoke software it will have vwd-xxx vx.x.<br />
â€¢	Write clearly. Say what you mean, and make sure it can't be misinterpreted.<br />
â€¢	Above all, be precise. We like precision.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Choosing a Coding Standard]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=75</link>
			<pubDate>Wed, 26 Mar 2008 19:17:04 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=75</guid>
			<description><![CDATA[How many times have you reformatted a co-workerâ€™s (or former employeeâ€™s) code to make it more readable? How many times has someone done the same to your code? We can consider such actions to be a net loss of coding time. <br />
<br />
So we decide to use a coding standard within Virtual Web Designs. <br />
<br />
Taken from our own internal document <a href="http://www.vwdesigns.co.uk/vwd129.htm" target="_blank" rel="noopener" class="mycode_url">VWD-129 </a>Issue c<br />
<br />
Coding standards are very important:  <br />
<br />
	file naming and placement <br />
	variable, function, and class naming conventions <br />
	indentation rules <br />
	documentation and comment guidelines <br />
             â€¦ and much, much more. <br />
<br />
Rather than creating our own standard, we decided to adopt a public standard. <br />
<br />
The benefits of using a public standard are: <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Itâ€™s programmer-neutral. </span><br />
<br />
Instead of one programmer or group of programmers dictating their own preferences, choosing a public standard is a programmer-neutral solution. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">The issues have been settled. </span><br />
<br />
A public standard will have undergone heavy debate already. While not everyone will be able to agree that the outcome is the best one, everyone has agreed that the standards represent the best collective solutions. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Use it as hiring criterion. </span><br />
<br />
When adopting a public standard, you can use it as a criterion of employment: â€œApplicant must know and be able to use XYZ Coding Standards.â€ <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Itâ€™s better for code distribution. </span><br />
<br />
For instance, if youâ€™re following PEAR Coding Standards, your code will be in a formatâ€”both the physical, on-disk format, as well as the format in which the code is writtenâ€”that can easily be packaged and installed using the PEAR installer, or via a PEAR channel. <br />
<br />
So, what public standards are available? We decide to look at some of the most popular standards available:  <br />
<br />
PEAR, at <a href="http://pear.php.net/manual/en/standards.php" target="_blank" rel="noopener" class="mycode_url">http://pear.php.net/manual/en/standards.php</a> <br />
Zend Framework, at <a href="http://framework.zend.com/manual/en/coding-standard.html" target="_blank" rel="noopener" class="mycode_url">http://framework.zend.com/manual/en/codi...ndard.html</a> <br />
eZ Components, at <a href="http://svn.ez.no/svn/ezcomponents/docs/guidelines/" target="_blank" rel="noopener" class="mycode_url">http://svn.ez.no/svn/ezcomponents/docs/guidelines/</a> <br />
<br />
With some additions of their own, these coding standards were all originally derived from the Horde project.. Horde and PEAR coding standards are identical at this point. Zend Framework standards basically follow those of PEAR, with a few slight changes; all in all, however, Zend Framework remains compatible with PEAR. eZ Components standards are basically only used by the eZ Components project and those developers who code with it. <br />
<br />
PEAR coding standards are widely adopted, and are used in high-profile projects. Overall, when it came to a choosing a standard we decided on the PEARâ€™s standard, as we found this to be the best option and used with most software houses. <br />
<br />
The basics of PEAR coding standards are summarised as follows: <br />
<br />
â€¢	There is one class per file. <br />
â€¢	Underscores in class names map to the directory separator: for example, Net_SMTP maps to Net/SMTP.php. <br />
â€¢	There is One True Brace: class and function declarations have the opening brace on the following line at the same indentation level as the declaration; in other control structures, the opening brace remains on the same line as the statement. <br />
â€¢	Code indentation should equal four spaces per indentation level. <br />
â€¢	Variables, functions, and classes are named using camelCase or studlyCaps; variable and function names should begin lowercased, while classes should begin uppercased. <br />
â€¢	Private and protected properties and methods should be named with a leading underscore. <br />
â€¢	All classes, functions, and methods should have a docblock. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Summary</span><br />
<br />
Using a coding standard lets us ensure that youâ€™ll we are able to maintain the code of are fellow programmers, and vice versa.]]></description>
			<content:encoded><![CDATA[How many times have you reformatted a co-workerâ€™s (or former employeeâ€™s) code to make it more readable? How many times has someone done the same to your code? We can consider such actions to be a net loss of coding time. <br />
<br />
So we decide to use a coding standard within Virtual Web Designs. <br />
<br />
Taken from our own internal document <a href="http://www.vwdesigns.co.uk/vwd129.htm" target="_blank" rel="noopener" class="mycode_url">VWD-129 </a>Issue c<br />
<br />
Coding standards are very important:  <br />
<br />
	file naming and placement <br />
	variable, function, and class naming conventions <br />
	indentation rules <br />
	documentation and comment guidelines <br />
             â€¦ and much, much more. <br />
<br />
Rather than creating our own standard, we decided to adopt a public standard. <br />
<br />
The benefits of using a public standard are: <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Itâ€™s programmer-neutral. </span><br />
<br />
Instead of one programmer or group of programmers dictating their own preferences, choosing a public standard is a programmer-neutral solution. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">The issues have been settled. </span><br />
<br />
A public standard will have undergone heavy debate already. While not everyone will be able to agree that the outcome is the best one, everyone has agreed that the standards represent the best collective solutions. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Use it as hiring criterion. </span><br />
<br />
When adopting a public standard, you can use it as a criterion of employment: â€œApplicant must know and be able to use XYZ Coding Standards.â€ <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Itâ€™s better for code distribution. </span><br />
<br />
For instance, if youâ€™re following PEAR Coding Standards, your code will be in a formatâ€”both the physical, on-disk format, as well as the format in which the code is writtenâ€”that can easily be packaged and installed using the PEAR installer, or via a PEAR channel. <br />
<br />
So, what public standards are available? We decide to look at some of the most popular standards available:  <br />
<br />
PEAR, at <a href="http://pear.php.net/manual/en/standards.php" target="_blank" rel="noopener" class="mycode_url">http://pear.php.net/manual/en/standards.php</a> <br />
Zend Framework, at <a href="http://framework.zend.com/manual/en/coding-standard.html" target="_blank" rel="noopener" class="mycode_url">http://framework.zend.com/manual/en/codi...ndard.html</a> <br />
eZ Components, at <a href="http://svn.ez.no/svn/ezcomponents/docs/guidelines/" target="_blank" rel="noopener" class="mycode_url">http://svn.ez.no/svn/ezcomponents/docs/guidelines/</a> <br />
<br />
With some additions of their own, these coding standards were all originally derived from the Horde project.. Horde and PEAR coding standards are identical at this point. Zend Framework standards basically follow those of PEAR, with a few slight changes; all in all, however, Zend Framework remains compatible with PEAR. eZ Components standards are basically only used by the eZ Components project and those developers who code with it. <br />
<br />
PEAR coding standards are widely adopted, and are used in high-profile projects. Overall, when it came to a choosing a standard we decided on the PEARâ€™s standard, as we found this to be the best option and used with most software houses. <br />
<br />
The basics of PEAR coding standards are summarised as follows: <br />
<br />
â€¢	There is one class per file. <br />
â€¢	Underscores in class names map to the directory separator: for example, Net_SMTP maps to Net/SMTP.php. <br />
â€¢	There is One True Brace: class and function declarations have the opening brace on the following line at the same indentation level as the declaration; in other control structures, the opening brace remains on the same line as the statement. <br />
â€¢	Code indentation should equal four spaces per indentation level. <br />
â€¢	Variables, functions, and classes are named using camelCase or studlyCaps; variable and function names should begin lowercased, while classes should begin uppercased. <br />
â€¢	Private and protected properties and methods should be named with a leading underscore. <br />
â€¢	All classes, functions, and methods should have a docblock. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Summary</span><br />
<br />
Using a coding standard lets us ensure that youâ€™ll we are able to maintain the code of are fellow programmers, and vice versa.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How do I add a watermark to an image?]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=73</link>
			<pubDate>Tue, 25 Mar 2008 19:36:05 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=73</guid>
			<description><![CDATA[Here a simple routine to protect your photos with a watermark. If you want to place some identifying image or text within the original image to show that you own the copyright to it. <br />
<br />
With the GD library and PHP, watermarkingâ€™s itâ€™s easy as 123.<br />
<br />
The imagestring function can be used to place text within an image, while the imagecopymerge function can be used to place another image within your original image. Using either of these functions is extremely easy. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Displaying a Text Watermark </span><br />
<br />
Adding text to an image is the simplest form of watermarking. <br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Load&nbsp;the&nbsp;original&nbsp;image<br /></span><span style="color: #0000BB">&#36;image&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefromjpeg</span><span style="color: #007700">(</span><span style="color: #DD0000">'your&nbsp;image&nbsp;direcory/image.jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;a&nbsp;color&nbsp;and&nbsp;allocate&nbsp;to&nbsp;the&nbsp;image&nbsp;pallet<br /></span><span style="color: #0000BB">&#36;color&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">68</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">68</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">68</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Add&nbsp;the&nbsp;text&nbsp;to&nbsp;the&nbsp;image<br /></span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">90</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Virtual&nbsp;Web&nbsp;Designsâ€™"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;color</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Send&nbsp;the&nbsp;HTTP&nbsp;content&nbsp;header<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type:&nbsp;image/jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;the&nbsp;final&nbsp;image<br /></span><span style="color: #0000BB">imagejpeg</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div>The imagecolorallocate function allows you to create a new colour to use for drawing on the image by specifying the red, green, and blue components. This function returns a number, which identifies that color in the image. <br />
<br />
Once you have the color in hand, you can use the imagestring function to place the text over the image. The first of the functionâ€™s arguments is the image, and the second is a font numberâ€”the numbers 1â€“5 refer to built-in fonts. You can use imageloadfont to make other fonts available. The third and fourth arguments represent the horizontal and vertical coordinates at which the text should be drawn on the image. The fifth argument contains the text you wish to be placed in the image, and the last argument specifies the color of the text. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Displaying a Graphical Watermark </span><br />
<br />
A logo or some other identifiable graphic with a transparent background is easily placed over another image.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Load&nbsp;the&nbsp;original&nbsp;image<br /></span><span style="color: #0000BB">&#36;image&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefromjpeg</span><span style="color: #007700">(</span><span style="color: #DD0000">'your&nbsp;image&nbsp;directory/thumb_image.jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;image&nbsp;width<br /></span><span style="color: #0000BB">&#36;iWidth&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;the&nbsp;watermark&nbsp;image<br /></span><span style="color: #0000BB">&#36;watermark&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefrompng</span><span style="color: #007700">(</span><span style="color: #DD0000">'your&nbsp;image&nbsp;directory/vwd_logo.png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;the&nbsp;height&nbsp;and&nbsp;width<br /></span><span style="color: #0000BB">&#36;wmWidth&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;watermark</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#36;wmHeight&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagesy</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;watermark</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Find&nbsp;the&nbsp;far&nbsp;right&nbsp;position<br /></span><span style="color: #0000BB">&#36;xPos&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;iWidth&nbsp;</span><span style="color: #007700">-&nbsp;</span><span style="color: #0000BB">&#36;wmWidth</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;Copy&nbsp;the&nbsp;watermark&nbsp;to&nbsp;the&nbsp;top&nbsp;right&nbsp;of&nbsp;original&nbsp;image<br /></span><span style="color: #0000BB">imagecopymerge</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;watermark</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;xPos</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;wmWidth</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;wmHeight</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #FF8000">//&nbsp;Send&nbsp;the&nbsp;HTTP&nbsp;content&nbsp;header<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type:&nbsp;image/jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;the&nbsp;final&nbsp;image<br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
The process is a simple matter. Load the original image and the watermark image; then, once the original imageâ€™s height and width have been obtained, use imagecopymerge to place the watermark on the original image. The first two arguments to the imagecopymerge function are the original or destination image object, and the source image objectâ€”the watermark, in our case. The next four arguments represent the x and y coordinates of the destination image and source image respectively, starting from the top-left corner of the images. The following two arguments represent the width and height of the source image. The last argument represents the level of transparency desired for true color imagesâ€”an argument of 100 specifies no transparency, while an argument of 0 causes the original image to remain unmarked by the watermark.]]></description>
			<content:encoded><![CDATA[Here a simple routine to protect your photos with a watermark. If you want to place some identifying image or text within the original image to show that you own the copyright to it. <br />
<br />
With the GD library and PHP, watermarkingâ€™s itâ€™s easy as 123.<br />
<br />
The imagestring function can be used to place text within an image, while the imagecopymerge function can be used to place another image within your original image. Using either of these functions is extremely easy. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Displaying a Text Watermark </span><br />
<br />
Adding text to an image is the simplest form of watermarking. <br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Load&nbsp;the&nbsp;original&nbsp;image<br /></span><span style="color: #0000BB">&#36;image&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefromjpeg</span><span style="color: #007700">(</span><span style="color: #DD0000">'your&nbsp;image&nbsp;direcory/image.jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;a&nbsp;color&nbsp;and&nbsp;allocate&nbsp;to&nbsp;the&nbsp;image&nbsp;pallet<br /></span><span style="color: #0000BB">&#36;color&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">68</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">68</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">68</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Add&nbsp;the&nbsp;text&nbsp;to&nbsp;the&nbsp;image<br /></span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">90</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Virtual&nbsp;Web&nbsp;Designsâ€™"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;color</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Send&nbsp;the&nbsp;HTTP&nbsp;content&nbsp;header<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type:&nbsp;image/jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;the&nbsp;final&nbsp;image<br /></span><span style="color: #0000BB">imagejpeg</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div>The imagecolorallocate function allows you to create a new colour to use for drawing on the image by specifying the red, green, and blue components. This function returns a number, which identifies that color in the image. <br />
<br />
Once you have the color in hand, you can use the imagestring function to place the text over the image. The first of the functionâ€™s arguments is the image, and the second is a font numberâ€”the numbers 1â€“5 refer to built-in fonts. You can use imageloadfont to make other fonts available. The third and fourth arguments represent the horizontal and vertical coordinates at which the text should be drawn on the image. The fifth argument contains the text you wish to be placed in the image, and the last argument specifies the color of the text. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Displaying a Graphical Watermark </span><br />
<br />
A logo or some other identifiable graphic with a transparent background is easily placed over another image.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Load&nbsp;the&nbsp;original&nbsp;image<br /></span><span style="color: #0000BB">&#36;image&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefromjpeg</span><span style="color: #007700">(</span><span style="color: #DD0000">'your&nbsp;image&nbsp;directory/thumb_image.jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;image&nbsp;width<br /></span><span style="color: #0000BB">&#36;iWidth&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;the&nbsp;watermark&nbsp;image<br /></span><span style="color: #0000BB">&#36;watermark&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefrompng</span><span style="color: #007700">(</span><span style="color: #DD0000">'your&nbsp;image&nbsp;directory/vwd_logo.png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;the&nbsp;height&nbsp;and&nbsp;width<br /></span><span style="color: #0000BB">&#36;wmWidth&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;watermark</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#36;wmHeight&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagesy</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;watermark</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Find&nbsp;the&nbsp;far&nbsp;right&nbsp;position<br /></span><span style="color: #0000BB">&#36;xPos&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;iWidth&nbsp;</span><span style="color: #007700">-&nbsp;</span><span style="color: #0000BB">&#36;wmWidth</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;Copy&nbsp;the&nbsp;watermark&nbsp;to&nbsp;the&nbsp;top&nbsp;right&nbsp;of&nbsp;original&nbsp;image<br /></span><span style="color: #0000BB">imagecopymerge</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;watermark</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;xPos</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;wmWidth</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;wmHeight</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #FF8000">//&nbsp;Send&nbsp;the&nbsp;HTTP&nbsp;content&nbsp;header<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type:&nbsp;image/jpg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;the&nbsp;final&nbsp;image<br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;image</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
The process is a simple matter. Load the original image and the watermark image; then, once the original imageâ€™s height and width have been obtained, use imagecopymerge to place the watermark on the original image. The first two arguments to the imagecopymerge function are the original or destination image object, and the source image objectâ€”the watermark, in our case. The next four arguments represent the x and y coordinates of the destination image and source image respectively, starting from the top-left corner of the images. The following two arguments represent the width and height of the source image. The last argument represents the level of transparency desired for true color imagesâ€”an argument of 100 specifies no transparency, while an argument of 0 causes the original image to remain unmarked by the watermark.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Top 7 PHP Security Blunders]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=67</link>
			<pubDate>Fri, 29 Feb 2008 15:31:59 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=67</guid>
			<description><![CDATA[<span style="font-weight: bold;" class="mycode_b">SQL Injection Vulnerabilities</span><br />
<br />
SQL injection vulnerabilities are yet another class of input validation flaws. Specifically, they allow for the exploitation of a database query. For example, in your PHP script, you might ask the user for a user ID and password, then check for the user by passing the database a query and checking the result.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">SELECT&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">FROM&nbsp;users&nbsp;WHERE&nbsp;name</span><span style="color: #007700">=</span><span style="color: #DD0000">'&#36;username'&nbsp;</span><span style="color: #007700">AND&nbsp;</span><span style="color: #0000BB">pass</span><span style="color: #007700">=</span><span style="color: #DD0000">'&#36;password'</span><span style="color: #007700">;&nbsp;<br /></span></code></div></div></div><br />
However, if the user who's logging in is devious, he may enter the following as his password:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #DD0000">'&nbsp;OR&nbsp;'</span><span style="color: #0000BB">1</span><span style="color: #DD0000">'='</span><span style="color: #0000BB">1&nbsp;<br /></span></code></div></div></div><br />
This results in the query being sent to the database as:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">SELECT&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">FROM&nbsp;users&nbsp;WHERE&nbsp;name</span><span style="color: #007700">=</span><span style="color: #DD0000">'known_user'&nbsp;</span><span style="color: #007700">AND&nbsp;</span><span style="color: #0000BB">pass</span><span style="color: #007700">=</span><span style="color: #DD0000">''&nbsp;</span><span style="color: #007700">OR&nbsp;</span><span style="color: #DD0000">'1'</span><span style="color: #007700">=</span><span style="color: #DD0000">'1'</span><span style="color: #007700">;&nbsp;<br /></span></code></div></div></div><br />
This will return the username without validating the password -- the malicious user has gained entry to your application as a user of his choice. To alleviate this problem, you need to escape dangerous characters from the user-submitted values, most particularly the single quotes ('). The simplest way to do this is to use PHP's <span style="color: #FF0000;" class="mycode_color">addslashes()</span> function.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&#36;username&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">addslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"username"</span><span style="color: #007700">]);&nbsp;<br /></span><span style="color: #0000BB">&#36;password&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">addslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"password"</span><span style="color: #007700">]);&nbsp;<br /></span></code></div></div></div> <br />
But depending on your PHP configuration, this may not be necessary! PHP's much-reviled <span style="font-weight: bold;" class="mycode_b">magic quotes </span>feature is enabled by default in current versions of PHP. This feature, which can be disabled by setting the <span style="color: #FF0000;" class="mycode_color">magic_quotes_gpc php.ini</span> variable to <span style="color: #FF0000;" class="mycode_color">Off</span>, will automatically apply <span style="color: #FF0000;" class="mycode_color">addslashes </span>to all values submitted via GET, POST or cookies. This feature safeguards against inexperienced developers who might otherwise leave security holes like the one described above, but it has an unfortunate impact on performance when input values do not need to be escaped for use in database queries. Thus, most experienced developers elect to switch this feature off.<br />
<br />
If you're developing software that may be installed on shared servers where you might not be able to change the <span style="color: #FF0000;" class="mycode_color">php.ini </span>file, use code to check that status of <span style="color: #FF0000;" class="mycode_color">magic_quotes_gpc</span> and, if it is turned on, pass all input values through PHP's <span style="color: #FF0000;" class="mycode_color">stripslashes() </span>function. You can then apply <span style="color: #FF0000;" class="mycode_color">addslashes() </span>to any values destined for use in database queries as you would normally.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">get_magic_quotes_gpc</span><span style="color: #007700">()){&nbsp;<br />&nbsp;</span><span style="color: #0000BB">&#36;_GET&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'stripslashes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_GET</span><span style="color: #007700">);&nbsp;<br />&nbsp;</span><span style="color: #0000BB">&#36;_POST&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'stripslashes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">);&nbsp;<br />&nbsp;</span><span style="color: #0000BB">&#36;_COOKIE&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'stripslashes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_COOKIE</span><span style="color: #007700">);&nbsp;<br />}&nbsp;<br /></span></code></div></div></div><br />
SQL injection flaws do not always lead to privilege escalation. For instance, they can allow a malicious user to output selected database records if the result of the query is printed to your HTML output.<br />
<br />
You should always check user-provided data that will be used in a query for the characters <span style="color: #FF0000;" class="mycode_color">'",;() </span>and, possibly, for the keywords <span style="color: #FF0000;" class="mycode_color">"FROM"</span>, <span style="color: #FF0000;" class="mycode_color">"LIKE" </span>, and <span style="color: #FF0000;" class="mycode_color">"WHERE"</span> in a case-insensitive fashion. These are the characters and keywords that are useful in a SQL insertion attack, so if you strip them from user inputs in which they're unnecessary, you'll have much less to worry about from this type of flaw. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Error Reporting</span><br />
<br />
You should ensure that your <span style="color: #FF0000;" class="mycode_color">display_errors</span> php.ini value is set to "0". Otherwise, any errors that are encountered in your code, such as database connection errors, will be output to the end user's browser. A malicious user could leverage this flaw to gain information about the internal workings of your application, simply by providing bad input and reading the error messages that result.<br />
<br />
The <span style="color: #FF0000;" class="mycode_color">display_errors </span>value can be set at runtime using the <span style="color: #FF0000;" class="mycode_color">ini_set</span> function, but this is not as desirable as setting it in the ini file, since a fatal compilation error of your script will still be displayed: if the script has a fatal error and cannot run, the <span style="color: #FF0000;" class="mycode_color">ini_set</span> function is not run.<br />
<br />
Instead of displaying errors, set the <span style="color: #FF0000;" class="mycode_color">error_log</span> ini variable to "1" and check your PHP error log frequently for caught errors. Alternatively, you can develop your own error handling functions that are automatically invoked when PHP encounters an error, and can email you or execute other PHP code of your choice. <br />
<br />
This is a wise precaution to take, as you will be notified of an error and have it fixed possibly before malicious users even know the problem exists. Read the PHP manual pages on error handling and learn about the <span style="color: #FF0000;" class="mycode_color">set_error_handler() </span>function.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Data Handling Errors</span><br />
<br />
Data handling errors aren't specific to PHP per se, but PHP application developers still need to be aware of them. This class of error arises when data is handled in an insecure manner, which makes it available to possible interception or modification by malicious parties.<br />
<br />
The most common type of data handling error is in the unencrypted HTTP transmission of sensitive data that should be transmitted via HTTPS. Credit card numbers and customer information are the most common types of secured data, but if you transmit usernames and passwords over a regular HTTP connection, and those usernames and passwords allow access to sensitive material, you might as well transmit the sensitive material itself over an unencrypted connection. <br />
<br />
Use SSL security whenever you transmit sensitive data from your application to a user's browser. Otherwise, a malicious eavesdropper on any router between your server and the end user can very easily sniff the sensitive information out of the network packets.<br />
<br />
The same type of risk can occur when applications are updated using FTP, which is an insecure protocol. Transferring a PHP file that contains database passwords to your remote Webserver over an insecure protocol like FTP can allow an eavesdropper to sniff the packets and reveal your password. Always use a secure protocol like SFTP or SCP to transmit sensitive files. Never allow sensitive information to be sent by your application via email, either. An email message is readable by anyone who's capable of reading the network traffic. A good rule of thumb is that if you wouldn't write the information on the back of a postcard and put it through the mail, you shouldn't send it via email, either. The chance anyone will actually intercept the message may be low, but why risk it? <br />
<br />
It's important to minimize your exposure to data handling flaws. For example, if your application is an online store, is it necessary to save the credit card numbers attached to orders that are more than six months old? Archive the data and store it offline, limiting the amount of data that can be compromised if your Webserver is breached. It's basic security practice not only to attempt to prevent an intrusion or compromise, but also to mitigate the negative effects of a successful compromise. No security system is ever perfect, so don't assume that yours is. Take steps to minimize the fallout if you do suffer a penetration. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Configuring PHP For Security</span><br />
<br />
Generally, most new PHP installations that use recent PHP releases are configured with much stronger security defaults than was standard in past PHP releases. However, your application may be installed on a legacy server that has had its version of PHP upgraded, but not the php.ini file. In this case, the default settings may not be as secure as the default settings on a fresh install.<br />
<br />
You should create a page that calls the <span style="color: #FF0000;" class="mycode_color">phpinfo()</span> function to list your php.ini variables and scan them for insecure settings. Keep this page in a restricted place and do not allow public access to it. The output of <span style="color: #FF0000;" class="mycode_color">phpinfo() </span>contains information that a potential hacker might find extremely useful.<br />
<br />
Some settings to consider when configuring PHP for security include:<br />
<br />
1.	<span style="color: #FF0000;" class="mycode_color">register_globals:</span> The bad man of PHP security is <span style="color: #FF0000;" class="mycode_color">register_globals</span>, which used to default to "on" in older releases of PHP but has since been changed to default to "off". It exports all user input as global variables. Check this setting and disable it -- no buts, no exceptions. Just do it! This setting is possibly responsible for more PHP security flaws than any other single cause. If you're on a shared host, and they won't let you disable <span style="color: #FF0000;" class="mycode_color">register_globals</span>, get a new host! <br />
<br />
2.	<span style="color: #FF0000;" class="mycode_color">safe_mode:</span> The safe mode setting can be very useful to prevent unauthorized access to local system files. It works by only allowing the reading of files that are owned by the user account that owns the executing PHP script. If your application opens local files often, consider enabling this setting. <br />
<br />
3.	<span style="color: #FF0000;" class="mycode_color">disable_functions:</span> This setting can only be set in your php.ini file, not at runtime. It can be set to a list of functions that you would like disabled in your PHP installation. It can help prevent the possible execution of harmful PHP code. Some functions that are useful to disable if you do not use them are system and exec, which allow the execution of external programs. <br />
<br />
Read the security section of the PHP manual and get to know it well. Treat it as material for a test you'll take and get to know it backwards and forwards. You will be tested on the material by the hackers who will indubitably attempt to penetrate your site. You get a passing grade on the test if the hackers give up and move on to an easier target whose grasp of these concepts is insufficient.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Further Reading</span><br />
<br />
The following sites are recommended reading to maintain your security knowledge, as we use these sites a lot. New flaws and new forms of exploits are discovered all the time, so you cannot afford to rest on your laurels and assume you have all the bases covered. As I stated in the introduction to this blog, "Security is a process", but security education is also a process, and your knowledge must be maintained.<br />
<br />
<a href="http://www.owasp.org/index.php/Main_Page" target="_blank" rel="noopener" class="mycode_url">OWASP, The Open Web Application Security Project</a>, is a non-profit organisation dedicated to "finding and fighting the causes of insecure software". The resources it provides are invaluable and the group has many local chapters that hold regular meetings with seminars and roundtable discussions. Highly recommended.<br />
<br />
<a href="http://www.cgisecurity.net/" target="_blank" rel="noopener" class="mycode_url">CGISecurity.Net </a>is another good site dealing with Web application security. They have some interesting FAQs and more in-depth documentation on some of the types of flaws I've discussed in this blog.<br />
<br />
<a href="http://www.php.net/manual/en/security.php" target="_blank" rel="noopener" class="mycode_url">The security section of the PHP Manual</a> is a key resource that I mentioned above, but I include it here again, since it's full of great information that's directly applicable to PHP. Don't gloss over the comments at the bottom of each page: some of the best and most up-to-date information can be found in the user-contributed notes.<br />
<br />
<a href="http://phpsec.org/" target="_blank" rel="noopener" class="mycode_url">The PHP Security Consortium</a> offers a library with links to other helpful resources, PHP-specific summaries of the SecurityFocus newsletters, the PHP Security Guide, and a couple of articles.<br />
<br />
<a href="http://www.securityfocus.com/archive/1" target="_blank" rel="noopener" class="mycode_url">The BugTraq mailing list</a> is a great source of security related advisories that you should read if you're interested in security in general. You may be shocked by the number of advisories that involve popular PHP applications allowing SQL insertion, Cross Site Scripting and some of the other flaws I've discussed here.<br />
<br />
<a href="http://www.linuxsecurity.com/" target="_blank" rel="noopener" class="mycode_url">Linux Security</a> is another good site that is not necessarily restricted to PHP but, since you are likely running a Linux Webserver to host your PHP applications, it's useful to try to stay up to date on the latest advisories and news related to your chosen Linux distribution. Don't assume your hosting company is on top of these developments; be aware on your own -- your security is only as good as your weakest point. It does you no good to have a tightly secured PHP application running on a server with an outdated service that exposes a well-known and exploitable flaw. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Summary</span><br />
<br />
As I've shown in this blog, there are many things to be aware of when programming secure PHP applications, though this is true with any language, and any server platform. PHP is no less secure than many other common development languages. The most important thing is to develop a proper security mindset and to know your tools well. I hope you enjoyed this blog and learned something as well!]]></description>
			<content:encoded><![CDATA[<span style="font-weight: bold;" class="mycode_b">SQL Injection Vulnerabilities</span><br />
<br />
SQL injection vulnerabilities are yet another class of input validation flaws. Specifically, they allow for the exploitation of a database query. For example, in your PHP script, you might ask the user for a user ID and password, then check for the user by passing the database a query and checking the result.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">SELECT&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">FROM&nbsp;users&nbsp;WHERE&nbsp;name</span><span style="color: #007700">=</span><span style="color: #DD0000">'&#36;username'&nbsp;</span><span style="color: #007700">AND&nbsp;</span><span style="color: #0000BB">pass</span><span style="color: #007700">=</span><span style="color: #DD0000">'&#36;password'</span><span style="color: #007700">;&nbsp;<br /></span></code></div></div></div><br />
However, if the user who's logging in is devious, he may enter the following as his password:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #DD0000">'&nbsp;OR&nbsp;'</span><span style="color: #0000BB">1</span><span style="color: #DD0000">'='</span><span style="color: #0000BB">1&nbsp;<br /></span></code></div></div></div><br />
This results in the query being sent to the database as:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">SELECT&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">FROM&nbsp;users&nbsp;WHERE&nbsp;name</span><span style="color: #007700">=</span><span style="color: #DD0000">'known_user'&nbsp;</span><span style="color: #007700">AND&nbsp;</span><span style="color: #0000BB">pass</span><span style="color: #007700">=</span><span style="color: #DD0000">''&nbsp;</span><span style="color: #007700">OR&nbsp;</span><span style="color: #DD0000">'1'</span><span style="color: #007700">=</span><span style="color: #DD0000">'1'</span><span style="color: #007700">;&nbsp;<br /></span></code></div></div></div><br />
This will return the username without validating the password -- the malicious user has gained entry to your application as a user of his choice. To alleviate this problem, you need to escape dangerous characters from the user-submitted values, most particularly the single quotes ('). The simplest way to do this is to use PHP's <span style="color: #FF0000;" class="mycode_color">addslashes()</span> function.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&#36;username&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">addslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"username"</span><span style="color: #007700">]);&nbsp;<br /></span><span style="color: #0000BB">&#36;password&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">addslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"password"</span><span style="color: #007700">]);&nbsp;<br /></span></code></div></div></div> <br />
But depending on your PHP configuration, this may not be necessary! PHP's much-reviled <span style="font-weight: bold;" class="mycode_b">magic quotes </span>feature is enabled by default in current versions of PHP. This feature, which can be disabled by setting the <span style="color: #FF0000;" class="mycode_color">magic_quotes_gpc php.ini</span> variable to <span style="color: #FF0000;" class="mycode_color">Off</span>, will automatically apply <span style="color: #FF0000;" class="mycode_color">addslashes </span>to all values submitted via GET, POST or cookies. This feature safeguards against inexperienced developers who might otherwise leave security holes like the one described above, but it has an unfortunate impact on performance when input values do not need to be escaped for use in database queries. Thus, most experienced developers elect to switch this feature off.<br />
<br />
If you're developing software that may be installed on shared servers where you might not be able to change the <span style="color: #FF0000;" class="mycode_color">php.ini </span>file, use code to check that status of <span style="color: #FF0000;" class="mycode_color">magic_quotes_gpc</span> and, if it is turned on, pass all input values through PHP's <span style="color: #FF0000;" class="mycode_color">stripslashes() </span>function. You can then apply <span style="color: #FF0000;" class="mycode_color">addslashes() </span>to any values destined for use in database queries as you would normally.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">get_magic_quotes_gpc</span><span style="color: #007700">()){&nbsp;<br />&nbsp;</span><span style="color: #0000BB">&#36;_GET&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'stripslashes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_GET</span><span style="color: #007700">);&nbsp;<br />&nbsp;</span><span style="color: #0000BB">&#36;_POST&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'stripslashes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_POST</span><span style="color: #007700">);&nbsp;<br />&nbsp;</span><span style="color: #0000BB">&#36;_COOKIE&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'stripslashes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_COOKIE</span><span style="color: #007700">);&nbsp;<br />}&nbsp;<br /></span></code></div></div></div><br />
SQL injection flaws do not always lead to privilege escalation. For instance, they can allow a malicious user to output selected database records if the result of the query is printed to your HTML output.<br />
<br />
You should always check user-provided data that will be used in a query for the characters <span style="color: #FF0000;" class="mycode_color">'",;() </span>and, possibly, for the keywords <span style="color: #FF0000;" class="mycode_color">"FROM"</span>, <span style="color: #FF0000;" class="mycode_color">"LIKE" </span>, and <span style="color: #FF0000;" class="mycode_color">"WHERE"</span> in a case-insensitive fashion. These are the characters and keywords that are useful in a SQL insertion attack, so if you strip them from user inputs in which they're unnecessary, you'll have much less to worry about from this type of flaw. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Error Reporting</span><br />
<br />
You should ensure that your <span style="color: #FF0000;" class="mycode_color">display_errors</span> php.ini value is set to "0". Otherwise, any errors that are encountered in your code, such as database connection errors, will be output to the end user's browser. A malicious user could leverage this flaw to gain information about the internal workings of your application, simply by providing bad input and reading the error messages that result.<br />
<br />
The <span style="color: #FF0000;" class="mycode_color">display_errors </span>value can be set at runtime using the <span style="color: #FF0000;" class="mycode_color">ini_set</span> function, but this is not as desirable as setting it in the ini file, since a fatal compilation error of your script will still be displayed: if the script has a fatal error and cannot run, the <span style="color: #FF0000;" class="mycode_color">ini_set</span> function is not run.<br />
<br />
Instead of displaying errors, set the <span style="color: #FF0000;" class="mycode_color">error_log</span> ini variable to "1" and check your PHP error log frequently for caught errors. Alternatively, you can develop your own error handling functions that are automatically invoked when PHP encounters an error, and can email you or execute other PHP code of your choice. <br />
<br />
This is a wise precaution to take, as you will be notified of an error and have it fixed possibly before malicious users even know the problem exists. Read the PHP manual pages on error handling and learn about the <span style="color: #FF0000;" class="mycode_color">set_error_handler() </span>function.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Data Handling Errors</span><br />
<br />
Data handling errors aren't specific to PHP per se, but PHP application developers still need to be aware of them. This class of error arises when data is handled in an insecure manner, which makes it available to possible interception or modification by malicious parties.<br />
<br />
The most common type of data handling error is in the unencrypted HTTP transmission of sensitive data that should be transmitted via HTTPS. Credit card numbers and customer information are the most common types of secured data, but if you transmit usernames and passwords over a regular HTTP connection, and those usernames and passwords allow access to sensitive material, you might as well transmit the sensitive material itself over an unencrypted connection. <br />
<br />
Use SSL security whenever you transmit sensitive data from your application to a user's browser. Otherwise, a malicious eavesdropper on any router between your server and the end user can very easily sniff the sensitive information out of the network packets.<br />
<br />
The same type of risk can occur when applications are updated using FTP, which is an insecure protocol. Transferring a PHP file that contains database passwords to your remote Webserver over an insecure protocol like FTP can allow an eavesdropper to sniff the packets and reveal your password. Always use a secure protocol like SFTP or SCP to transmit sensitive files. Never allow sensitive information to be sent by your application via email, either. An email message is readable by anyone who's capable of reading the network traffic. A good rule of thumb is that if you wouldn't write the information on the back of a postcard and put it through the mail, you shouldn't send it via email, either. The chance anyone will actually intercept the message may be low, but why risk it? <br />
<br />
It's important to minimize your exposure to data handling flaws. For example, if your application is an online store, is it necessary to save the credit card numbers attached to orders that are more than six months old? Archive the data and store it offline, limiting the amount of data that can be compromised if your Webserver is breached. It's basic security practice not only to attempt to prevent an intrusion or compromise, but also to mitigate the negative effects of a successful compromise. No security system is ever perfect, so don't assume that yours is. Take steps to minimize the fallout if you do suffer a penetration. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Configuring PHP For Security</span><br />
<br />
Generally, most new PHP installations that use recent PHP releases are configured with much stronger security defaults than was standard in past PHP releases. However, your application may be installed on a legacy server that has had its version of PHP upgraded, but not the php.ini file. In this case, the default settings may not be as secure as the default settings on a fresh install.<br />
<br />
You should create a page that calls the <span style="color: #FF0000;" class="mycode_color">phpinfo()</span> function to list your php.ini variables and scan them for insecure settings. Keep this page in a restricted place and do not allow public access to it. The output of <span style="color: #FF0000;" class="mycode_color">phpinfo() </span>contains information that a potential hacker might find extremely useful.<br />
<br />
Some settings to consider when configuring PHP for security include:<br />
<br />
1.	<span style="color: #FF0000;" class="mycode_color">register_globals:</span> The bad man of PHP security is <span style="color: #FF0000;" class="mycode_color">register_globals</span>, which used to default to "on" in older releases of PHP but has since been changed to default to "off". It exports all user input as global variables. Check this setting and disable it -- no buts, no exceptions. Just do it! This setting is possibly responsible for more PHP security flaws than any other single cause. If you're on a shared host, and they won't let you disable <span style="color: #FF0000;" class="mycode_color">register_globals</span>, get a new host! <br />
<br />
2.	<span style="color: #FF0000;" class="mycode_color">safe_mode:</span> The safe mode setting can be very useful to prevent unauthorized access to local system files. It works by only allowing the reading of files that are owned by the user account that owns the executing PHP script. If your application opens local files often, consider enabling this setting. <br />
<br />
3.	<span style="color: #FF0000;" class="mycode_color">disable_functions:</span> This setting can only be set in your php.ini file, not at runtime. It can be set to a list of functions that you would like disabled in your PHP installation. It can help prevent the possible execution of harmful PHP code. Some functions that are useful to disable if you do not use them are system and exec, which allow the execution of external programs. <br />
<br />
Read the security section of the PHP manual and get to know it well. Treat it as material for a test you'll take and get to know it backwards and forwards. You will be tested on the material by the hackers who will indubitably attempt to penetrate your site. You get a passing grade on the test if the hackers give up and move on to an easier target whose grasp of these concepts is insufficient.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Further Reading</span><br />
<br />
The following sites are recommended reading to maintain your security knowledge, as we use these sites a lot. New flaws and new forms of exploits are discovered all the time, so you cannot afford to rest on your laurels and assume you have all the bases covered. As I stated in the introduction to this blog, "Security is a process", but security education is also a process, and your knowledge must be maintained.<br />
<br />
<a href="http://www.owasp.org/index.php/Main_Page" target="_blank" rel="noopener" class="mycode_url">OWASP, The Open Web Application Security Project</a>, is a non-profit organisation dedicated to "finding and fighting the causes of insecure software". The resources it provides are invaluable and the group has many local chapters that hold regular meetings with seminars and roundtable discussions. Highly recommended.<br />
<br />
<a href="http://www.cgisecurity.net/" target="_blank" rel="noopener" class="mycode_url">CGISecurity.Net </a>is another good site dealing with Web application security. They have some interesting FAQs and more in-depth documentation on some of the types of flaws I've discussed in this blog.<br />
<br />
<a href="http://www.php.net/manual/en/security.php" target="_blank" rel="noopener" class="mycode_url">The security section of the PHP Manual</a> is a key resource that I mentioned above, but I include it here again, since it's full of great information that's directly applicable to PHP. Don't gloss over the comments at the bottom of each page: some of the best and most up-to-date information can be found in the user-contributed notes.<br />
<br />
<a href="http://phpsec.org/" target="_blank" rel="noopener" class="mycode_url">The PHP Security Consortium</a> offers a library with links to other helpful resources, PHP-specific summaries of the SecurityFocus newsletters, the PHP Security Guide, and a couple of articles.<br />
<br />
<a href="http://www.securityfocus.com/archive/1" target="_blank" rel="noopener" class="mycode_url">The BugTraq mailing list</a> is a great source of security related advisories that you should read if you're interested in security in general. You may be shocked by the number of advisories that involve popular PHP applications allowing SQL insertion, Cross Site Scripting and some of the other flaws I've discussed here.<br />
<br />
<a href="http://www.linuxsecurity.com/" target="_blank" rel="noopener" class="mycode_url">Linux Security</a> is another good site that is not necessarily restricted to PHP but, since you are likely running a Linux Webserver to host your PHP applications, it's useful to try to stay up to date on the latest advisories and news related to your chosen Linux distribution. Don't assume your hosting company is on top of these developments; be aware on your own -- your security is only as good as your weakest point. It does you no good to have a tightly secured PHP application running on a server with an outdated service that exposes a well-known and exploitable flaw. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Summary</span><br />
<br />
As I've shown in this blog, there are many things to be aware of when programming secure PHP applications, though this is true with any language, and any server platform. PHP is no less secure than many other common development languages. The most important thing is to develop a proper security mindset and to know your tools well. I hope you enjoyed this blog and learned something as well!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[POD vs mysql_function?]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=66</link>
			<pubDate>Fri, 29 Feb 2008 15:17:36 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=66</guid>
			<description><![CDATA[PDO, the PHP Data Objects extension, is a data-access abstraction layer. Basically, itâ€™s a consistent interface for multiple databases. No longer will you have to use the mysql_* functions, the sqlite_* functions, or the pg_* functions, or write wrappers for them to work with your database. Instead, you can simply use the PDO interface to work with all three functions using the same methods. And, if you change databases, youâ€™ll only have to change the DSN (or Data Source Name) of the PDO to make your code work.<br />
<br />
PDO uses specific database drivers to interact with various databases, so you canâ€™t use PDO by itself. Youâ€™ll need to enable the drivers youâ€™ll use with PDO, so be sure to research how to do it for your specific host operating system on the PDO manual page.<br />
<br />
PDO is shipped with PHP 5.1 and is available from PECL for PHP 5.0. Unfortunately, as PDO requires the new PHP 5 object oriented features, itâ€™s not available for PHP 4. In this blog, all of our interactions with the database will use PDO to interact with the MySQL back end. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">How do I access a database? </span><br />
<br />
Before we can do anything with a database, we need to talk to it. And to talk to it, we must make a database connection. Logical, isnâ€™t it? <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Example</span><br />
<br />
Hereâ€™s how we connect to a MySQL database on the localhost: <br />
<br />
<span style="font-weight: bold;" class="mycode_b">mysqlConnect.php </span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#36;dsn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'mysql:host=localhost;dbname=world;'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;user&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'user'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;password&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'secret'</span><span style="color: #007700">;&nbsp;try&nbsp;<br />{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;dbh&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PDO</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;dsn</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;user</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;password</span><span style="color: #007700">);&nbsp;<br />}&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;catch&nbsp;(</span><span style="color: #0000BB">PDOException&nbsp;&#36;e</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Connection&nbsp;failed:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();&nbsp;<br />}&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
Weâ€™d use this code to connect to a SQLite database on the localhost: <br />
<br />
<span style="font-weight: bold;" class="mycode_b">sqliteConnect.php </span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;&nbsp;&nbsp;&#36;dsn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'sqlite2:"C:&#092;sqlite&#092;world.db"'</span><span style="color: #007700">;&nbsp;try&nbsp;<br />{&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;dbh&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PDO</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;dsn</span><span style="color: #007700">);<br />&nbsp;}&nbsp;<br />&nbsp;&nbsp;&nbsp;catch&nbsp;(</span><span style="color: #0000BB">PDOException&nbsp;&#36;e</span><span style="color: #007700">)&nbsp;<br />{&nbsp;<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Connection&nbsp;failed:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();&nbsp;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Summary </span><br />
<br />
Notice that in these two examples above, we simply create a new PDO object. Only the connection data for the PDO constructor differs in each case: for the SQLite connection, we need just the DSN; the MySQL connection also requires username and password arguments in order to connect to the database.]]></description>
			<content:encoded><![CDATA[PDO, the PHP Data Objects extension, is a data-access abstraction layer. Basically, itâ€™s a consistent interface for multiple databases. No longer will you have to use the mysql_* functions, the sqlite_* functions, or the pg_* functions, or write wrappers for them to work with your database. Instead, you can simply use the PDO interface to work with all three functions using the same methods. And, if you change databases, youâ€™ll only have to change the DSN (or Data Source Name) of the PDO to make your code work.<br />
<br />
PDO uses specific database drivers to interact with various databases, so you canâ€™t use PDO by itself. Youâ€™ll need to enable the drivers youâ€™ll use with PDO, so be sure to research how to do it for your specific host operating system on the PDO manual page.<br />
<br />
PDO is shipped with PHP 5.1 and is available from PECL for PHP 5.0. Unfortunately, as PDO requires the new PHP 5 object oriented features, itâ€™s not available for PHP 4. In this blog, all of our interactions with the database will use PDO to interact with the MySQL back end. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">How do I access a database? </span><br />
<br />
Before we can do anything with a database, we need to talk to it. And to talk to it, we must make a database connection. Logical, isnâ€™t it? <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Example</span><br />
<br />
Hereâ€™s how we connect to a MySQL database on the localhost: <br />
<br />
<span style="font-weight: bold;" class="mycode_b">mysqlConnect.php </span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#36;dsn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'mysql:host=localhost;dbname=world;'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;user&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'user'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;password&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'secret'</span><span style="color: #007700">;&nbsp;try&nbsp;<br />{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;dbh&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PDO</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;dsn</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;user</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;password</span><span style="color: #007700">);&nbsp;<br />}&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;catch&nbsp;(</span><span style="color: #0000BB">PDOException&nbsp;&#36;e</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Connection&nbsp;failed:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();&nbsp;<br />}&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
Weâ€™d use this code to connect to a SQLite database on the localhost: <br />
<br />
<span style="font-weight: bold;" class="mycode_b">sqliteConnect.php </span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;&nbsp;&nbsp;&#36;dsn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'sqlite2:"C:&#092;sqlite&#092;world.db"'</span><span style="color: #007700">;&nbsp;try&nbsp;<br />{&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;dbh&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PDO</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;dsn</span><span style="color: #007700">);<br />&nbsp;}&nbsp;<br />&nbsp;&nbsp;&nbsp;catch&nbsp;(</span><span style="color: #0000BB">PDOException&nbsp;&#36;e</span><span style="color: #007700">)&nbsp;<br />{&nbsp;<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Connection&nbsp;failed:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();&nbsp;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Summary </span><br />
<br />
Notice that in these two examples above, we simply create a new PDO object. Only the connection data for the PDO constructor differs in each case: for the SQLite connection, we need just the DSN; the MySQL connection also requires username and password arguments in order to connect to the database.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Whatâ€™s New in PHP 5.3]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=65</link>
			<pubDate>Fri, 29 Feb 2008 15:13:27 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=65</guid>
			<description><![CDATA[PHP 6 is just around the corner, but for developers who just can't wait, there's good news -- many of the features originally planned for PHP 6 have been back-ported to PHP 5.3, a final stable release of which is due in the first half of this year.<br />
<br />
This news might also be welcomed by those that wish to use some of the new features, but whose hosting providers will not be upgrading to version 6 for some time -- hosting providers have traditionally delayed major version updates while acceptance testing is performed (read: the stability has been proven elsewhere first). Many hosting companies will probably delay upgrading their service offerings until version 6.1 to be released. A minor upgrade from 5.2.x to 5.3, however, will be less of a hurdle for most hosting companies.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Autoloading Namespaced Classes</span><br />
<br />
If you're defining the magic <span style="color: #FF0000;" class="mycode_color">__autoload </span>function to include class definition files on demand, then you're probably making use of a directory that includes all your class files. Before we could use namespaces, this approach would suffice, as each class would be required to have a unique name. Now, though, it's possible to have multiple classes with the same name.<br />
<br />
Luckily, the <span style="color: #FF0000;" class="mycode_color">__autoload</span> function will be passed the fully namespaced reference to the class. So in the examples above, you might expect a call such as:<br />
 <br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">__autoload</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'MyCompany::Blog::User'&nbsp;</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
You can now perform a string replace operation on this parameter to convert the double colons to another character. The most obvious substitute would be a directory separator character:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">__autoload</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">str_replace</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'::'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">DIRECTORY_SEPARATOR</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require_once(&nbsp;</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">__FILE__&nbsp;</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'/'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'.class.php&nbsp;'&nbsp;</span><span style="color: #007700">);&nbsp;<br />}&nbsp;<br /></span></code></div></div></div><br />
This would take the expected call above and include the file <span style="color: #FF0000;" class="mycode_color">./classes/mycompany/blog/user.class.php</span>.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Late Static Binding</span><br />
<br />
Late static binding provides the ability for a parent class to use a static method that has been overridden in a child class. You might imagine this would be the default behaviour, but consider the following example:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br /><br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">ParentClass&nbsp;</span><span style="color: #007700">{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">say</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">self</span><span style="color: #007700">::</span><span style="color: #0000BB">do_print</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">do_print</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;p&gt;Parent&nbsp;says&nbsp;</span><span style="color: #0000BB">&#36;str</span><span style="color: #DD0000">&lt;/p&gt;"</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />}&nbsp;<br /><br />class&nbsp;</span><span style="color: #0000BB">ChildClass&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">ParentClass&nbsp;</span><span style="color: #007700">{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">do_print</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;p&gt;Child&nbsp;says&nbsp;</span><span style="color: #0000BB">&#36;str</span><span style="color: #DD0000">&lt;/p&gt;"</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />}&nbsp;<br /><br /></span><span style="color: #0000BB">ChildClass</span><span style="color: #007700">::</span><span style="color: #0000BB">say</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'Hello'&nbsp;</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
You would probably expect this to return "Child says Hello". While I understand why you might expect this, you'll be disappointed to see it return "Parent says Hello".<br />
<br />
The reason for this is that references to <span style="color: #FF0000;" class="mycode_color">self:: </span>and <span style="color: #FF0000;" class="mycode_color">__CLASS__ </span>resolve to the class in which these references are used. PHP 5.3 now includes a static:: reference that resolves to the static class called at runtime:<br />
<br />
      <div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">static&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">say</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static::</span><span style="color: #0000BB">do_print</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /></span></code></div></div></div><br />
With the addition of the <span style="color: #FF0000;" class="mycode_color">static:: </span>reference, the script will return the string "Child says Hello".<br />
<br />
<span style="color: #FF0000;" class="mycode_color">__callstatic</span><br />
Until now, PHP has supported a number of magic methods in classes that you'll already be familiar with, such as <span style="color: #FF0000;" class="mycode_color">__set</span>, <span style="color: #FF0000;" class="mycode_color">__get </span>and <span style="color: #FF0000;" class="mycode_color">__call</span>. PHP 5.3 introduces the <span style="color: #FF0000;" class="mycode_color">__callstatic </span>method, which acts exactly like the call method, but it operates in a static context. In other words, the method acts on unrecognized static calls directly on the class.<br />
<br />
The following example illustrates the concept:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br /><br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">Factory&nbsp;</span><span style="color: #007700">{&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">GetDatabaseHandle</span><span style="color: #007700">()&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;p&gt;Returns&nbsp;a&nbsp;database&nbsp;handle&lt;/p&gt;'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">__callstatic</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;methodname</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;args&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;p&gt;Unknown&nbsp;static&nbsp;method&nbsp;&lt;strong&gt;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;methodname&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'&lt;/strong&gt;'&nbsp;</span><span style="color: #007700">.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'&nbsp;called&nbsp;with&nbsp;parameters:&lt;/p&gt;'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;pre&gt;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;args</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true&nbsp;</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'&lt;/pre&gt;'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br />}&nbsp;<br /><br /></span><span style="color: #0000BB">Factory</span><span style="color: #007700">::</span><span style="color: #0000BB">GetDatabaseHandle</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #0000BB">Factory</span><span style="color: #007700">::</span><span style="color: #0000BB">CreateUser</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #0000BB">Factory</span><span style="color: #007700">::</span><span style="color: #0000BB">CreateBlogPost</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'Author'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Post&nbsp;Title'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Post&nbsp;Body'&nbsp;</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Variable Static Calls</span><br />
<br />
When is a static member or method not static? When it's dynamically referenced, of course!<br />
<br />
Once again, this is an enhancement that brings object functionality to your classes. In addition to having variable variables and variable method calls, you can now also have variable static calls. Taking the factory class defined in the previous section, we could achieve the same results by invoking the following code:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Factory'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;methodname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'CreateUser'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;classname</span><span style="color: #007700">::</span><span style="color: #0000BB">&#36;methodname</span><span style="color: #007700">();&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;methodname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'CreateBlogPost'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;author&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Author'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;posttitle&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Post&nbsp;Title'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;postbody&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Post&nbsp;Body'</span><span style="color: #007700">;&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;classname</span><span style="color: #007700">::</span><span style="color: #0000BB">&#36;methodname</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;author</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;posttitle</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;postbody&nbsp;</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">You&nbsp;can&nbsp;create&nbsp;dynamic&nbsp;namespaces&nbsp;like&nbsp;so</span><span style="color: #007700">:&nbsp;<br />&lt;?</span><span style="color: #0000BB">php&nbsp;<br /></span><span style="color: #007700">require_once(&nbsp;</span><span style="color: #DD0000">'lib/autoload.php'&nbsp;</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;class&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'MyCompany::Blog::User'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;user&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">&#36;class</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #0000BB">&#36;user</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'fullname'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Ben&nbsp;Balbo'</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">&#36;user</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">save</span><span style="color: #007700">();&nbsp;<br /></span></code></div></div></div><br />
These little touches can make your code more readable and allow you full flexibility in an object oriented sense.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">MySQL Native Driver</span><br />
<br />
Until version 5.3 of PHP, any interaction with MySQL usually occurred in conjunction with <span style="color: #FF0000;" class="mycode_color">libmysql</span> -- a MySQL database client library.<br />
<br />
PHP 5.3's native MySQL driver has been designed from the ground up for PHP and the ZEND engine, which brings about a number of advantages. Most obviously, the native driver is specific to PHP, and has therefore been optimised for the ZEND engine. This produces a client with a smaller footprint and faster execution times.<br />
<br />
Secondly, the native driver makes use of the ZEND engine's memory management and, unlike libmysql, it will obey the memory limit settings in PHP.<br />
<br />
The native driver has been licensed under the PHP license to avoid licensing issues.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Additional OpenSSL Functions</span><br />
<br />
If you've ever had to perform any OpenSSL-related actions in your scripts, (such as generating a Diffie Hellman key or encrypting content) you'll either have performed this operation in user-land, or passed the request to a system call.<br />
<br />
A patch to the OpenSSL functionality in PHP 5.3 provides the extra functions required to perform these actions through the OpenSSL library, which not only makes your life easier and your applications faster, but allows you to reuse the proven code that comes with OpenSSL.<br />
<br />
This will be great news for anyone that's currently working with OpenID.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Improved Command Line Parameter Support</span><br />
<br />
Hopefully, you'll be aware of the fact that PHP is more than just a scripting language for the Web. The command line version of PHP runs outside of the web server's environment and is useful for automating system and application processes.<br />
<br />
For example, the getopt function of PHP has been around for a while, but has been limited to a number of system types; most commonly, it didn't function under a Windows operating system environment.<br />
<br />
As of PHP 5.3, the getopt function is no longer system dependent. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">XSLT Profiling</span><br />
<br />
XSLT is a complex beast, and most users of this templating mechanism will be familiar with xsltproc's profiling option. As of PHP 5.3, you can profile the transforms from within your PHP scripts. <br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&#36;doc&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #0000BB">&#36;xsl&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">XSLTProcessor</span><span style="color: #007700">();&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">(</span><span style="color: #DD0000">'./lib/collection.xsl'</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">&#36;xsl</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">importStyleSheet</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;doc</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">(</span><span style="color: #DD0000">'./lib/collection.xml&nbsp;'</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">&#36;xsl</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProfiling</span><span style="color: #007700">(</span><span style="color: #DD0000">"/tmp/xslt-profiling.txt"</span><span style="color: #007700">);&nbsp;<br />echo&nbsp;</span><span style="color: #0000BB">&#36;xsl</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">transformToXML</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;doc</span><span style="color: #007700">);&nbsp;<br /><br />echo&nbsp;</span><span style="color: #DD0000">'&lt;h2&gt;Profile&nbsp;report&lt;/h2&gt;'</span><span style="color: #007700">;&nbsp;<br />echo&nbsp;</span><span style="color: #DD0000">'&lt;pre&gt;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'/tmp/xslt-profiling.txt'&nbsp;</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'&lt;/pre&gt;'</span><span style="color: #007700">;&nbsp;<br /></span></code></div></div></div><br />
The information produced by the profile will look something like this:<br />
<br />
<span style="color: #FF0000;" class="mycode_color">number    match    name   mode     Calls   Tot  100us  Avg <br />
0         collection                    1       4       4 <br />
1         cd                            2       1       0 <br />
<br />
          Total                         3       5</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">New Error Levels</span><br />
PHP is certainly a language that has a few, er, quirks. For example, why doesn't <span style="color: #FF0000;" class="mycode_color">E_ALL </span>include all error levels?<br />
<br />
Well now it does! Yes, PHP 5.3 now includes <span style="color: #FF0000;" class="mycode_color">E_STRICT </span>as part of <span style="color: #FF0000;" class="mycode_color">E_ALL.</span><br />
<br />
Furthermore, while <span style="color: #FF0000;" class="mycode_color">E_STRICT</span> used to report on both the usage of functionality that might become deprecated in the near future, and on bad programming practices such as defining an abstract static method, in PHP 5.3, these two errors are split into <span style="color: #FF0000;" class="mycode_color">E_DEPRECATED</span> and <span style="color: #FF0000;" class="mycode_color">E_STRICT</span> respectively, which makes a lot more sense.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Other Minor Improvements</span><br />
<br />
There's a handful of other improvements coming in PHP 5.3 that either don't warrant an entire section in this article, or were untestable at the time this article was written, such as:<br />
<br />
â€¢	Sqlite3 support via the <span style="color: #FF0000;" class="mycode_color">ext/sqlite </span>extension <br />
â€¢	SPL's <span style="color: #FF0000;" class="mycode_color">DirectoryIterator</span>, which now implements <span style="color: #FF0000;" class="mycode_color">ArrayAccess</span> <br />
â€¢	Two news functions: <span style="color: #FF0000;" class="mycode_color">array_replace</span> and <span style="color: #FF0000;" class="mycode_color">array_replace_recursive</span>. While these functions were undefined when tested under PHP 5.3.0, the C code that implements them suggests that they will contain similar functionality to <span style="color: #FF0000;" class="mycode_color">array_merge</span>. One exception, however, is that the <span style="color: #FF0000;" class="mycode_color">array_replace</span> function will only update values in the first array where the keys match in both arrays. Any keys that are present in the second array but don't appear in the first will be ignored. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Summary</span><br />
<br />
PHP 5.3 contains much functionality that was originally slated for inclusion in PHP 6, which takes it from being a minor upgrade to a significant release that every PHP developer should start thinking about. We touched on some of the new features in this blog, and looked at some code that demonstrates how you might go about using these new features.]]></description>
			<content:encoded><![CDATA[PHP 6 is just around the corner, but for developers who just can't wait, there's good news -- many of the features originally planned for PHP 6 have been back-ported to PHP 5.3, a final stable release of which is due in the first half of this year.<br />
<br />
This news might also be welcomed by those that wish to use some of the new features, but whose hosting providers will not be upgrading to version 6 for some time -- hosting providers have traditionally delayed major version updates while acceptance testing is performed (read: the stability has been proven elsewhere first). Many hosting companies will probably delay upgrading their service offerings until version 6.1 to be released. A minor upgrade from 5.2.x to 5.3, however, will be less of a hurdle for most hosting companies.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Autoloading Namespaced Classes</span><br />
<br />
If you're defining the magic <span style="color: #FF0000;" class="mycode_color">__autoload </span>function to include class definition files on demand, then you're probably making use of a directory that includes all your class files. Before we could use namespaces, this approach would suffice, as each class would be required to have a unique name. Now, though, it's possible to have multiple classes with the same name.<br />
<br />
Luckily, the <span style="color: #FF0000;" class="mycode_color">__autoload</span> function will be passed the fully namespaced reference to the class. So in the examples above, you might expect a call such as:<br />
 <br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">__autoload</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'MyCompany::Blog::User'&nbsp;</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
You can now perform a string replace operation on this parameter to convert the double colons to another character. The most obvious substitute would be a directory separator character:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">__autoload</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">str_replace</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'::'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">DIRECTORY_SEPARATOR</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require_once(&nbsp;</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">__FILE__&nbsp;</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'/'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'.class.php&nbsp;'&nbsp;</span><span style="color: #007700">);&nbsp;<br />}&nbsp;<br /></span></code></div></div></div><br />
This would take the expected call above and include the file <span style="color: #FF0000;" class="mycode_color">./classes/mycompany/blog/user.class.php</span>.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Late Static Binding</span><br />
<br />
Late static binding provides the ability for a parent class to use a static method that has been overridden in a child class. You might imagine this would be the default behaviour, but consider the following example:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br /><br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">ParentClass&nbsp;</span><span style="color: #007700">{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">say</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">self</span><span style="color: #007700">::</span><span style="color: #0000BB">do_print</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">do_print</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;p&gt;Parent&nbsp;says&nbsp;</span><span style="color: #0000BB">&#36;str</span><span style="color: #DD0000">&lt;/p&gt;"</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />}&nbsp;<br /><br />class&nbsp;</span><span style="color: #0000BB">ChildClass&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">ParentClass&nbsp;</span><span style="color: #007700">{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">do_print</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;p&gt;Child&nbsp;says&nbsp;</span><span style="color: #0000BB">&#36;str</span><span style="color: #DD0000">&lt;/p&gt;"</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />}&nbsp;<br /><br /></span><span style="color: #0000BB">ChildClass</span><span style="color: #007700">::</span><span style="color: #0000BB">say</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'Hello'&nbsp;</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
You would probably expect this to return "Child says Hello". While I understand why you might expect this, you'll be disappointed to see it return "Parent says Hello".<br />
<br />
The reason for this is that references to <span style="color: #FF0000;" class="mycode_color">self:: </span>and <span style="color: #FF0000;" class="mycode_color">__CLASS__ </span>resolve to the class in which these references are used. PHP 5.3 now includes a static:: reference that resolves to the static class called at runtime:<br />
<br />
      <div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">static&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">say</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static::</span><span style="color: #0000BB">do_print</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;str&nbsp;</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /></span></code></div></div></div><br />
With the addition of the <span style="color: #FF0000;" class="mycode_color">static:: </span>reference, the script will return the string "Child says Hello".<br />
<br />
<span style="color: #FF0000;" class="mycode_color">__callstatic</span><br />
Until now, PHP has supported a number of magic methods in classes that you'll already be familiar with, such as <span style="color: #FF0000;" class="mycode_color">__set</span>, <span style="color: #FF0000;" class="mycode_color">__get </span>and <span style="color: #FF0000;" class="mycode_color">__call</span>. PHP 5.3 introduces the <span style="color: #FF0000;" class="mycode_color">__callstatic </span>method, which acts exactly like the call method, but it operates in a static context. In other words, the method acts on unrecognized static calls directly on the class.<br />
<br />
The following example illustrates the concept:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br /><br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">Factory&nbsp;</span><span style="color: #007700">{&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">GetDatabaseHandle</span><span style="color: #007700">()&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;p&gt;Returns&nbsp;a&nbsp;database&nbsp;handle&lt;/p&gt;'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">__callstatic</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;methodname</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;args&nbsp;</span><span style="color: #007700">)&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;p&gt;Unknown&nbsp;static&nbsp;method&nbsp;&lt;strong&gt;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;methodname&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'&lt;/strong&gt;'&nbsp;</span><span style="color: #007700">.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'&nbsp;called&nbsp;with&nbsp;parameters:&lt;/p&gt;'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;pre&gt;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;args</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true&nbsp;</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'&lt;/pre&gt;'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br />}&nbsp;<br /><br /></span><span style="color: #0000BB">Factory</span><span style="color: #007700">::</span><span style="color: #0000BB">GetDatabaseHandle</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #0000BB">Factory</span><span style="color: #007700">::</span><span style="color: #0000BB">CreateUser</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #0000BB">Factory</span><span style="color: #007700">::</span><span style="color: #0000BB">CreateBlogPost</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'Author'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Post&nbsp;Title'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Post&nbsp;Body'&nbsp;</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Variable Static Calls</span><br />
<br />
When is a static member or method not static? When it's dynamically referenced, of course!<br />
<br />
Once again, this is an enhancement that brings object functionality to your classes. In addition to having variable variables and variable method calls, you can now also have variable static calls. Taking the factory class defined in the previous section, we could achieve the same results by invoking the following code:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&#36;classname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Factory'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;methodname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'CreateUser'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;classname</span><span style="color: #007700">::</span><span style="color: #0000BB">&#36;methodname</span><span style="color: #007700">();&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;methodname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'CreateBlogPost'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;author&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Author'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;posttitle&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Post&nbsp;Title'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;postbody&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Post&nbsp;Body'</span><span style="color: #007700">;&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;classname</span><span style="color: #007700">::</span><span style="color: #0000BB">&#36;methodname</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">&#36;author</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;posttitle</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;postbody&nbsp;</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">You&nbsp;can&nbsp;create&nbsp;dynamic&nbsp;namespaces&nbsp;like&nbsp;so</span><span style="color: #007700">:&nbsp;<br />&lt;?</span><span style="color: #0000BB">php&nbsp;<br /></span><span style="color: #007700">require_once(&nbsp;</span><span style="color: #DD0000">'lib/autoload.php'&nbsp;</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;class&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'MyCompany::Blog::User'</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB">&#36;user&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">&#36;class</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #0000BB">&#36;user</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'fullname'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Ben&nbsp;Balbo'</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">&#36;user</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">save</span><span style="color: #007700">();&nbsp;<br /></span></code></div></div></div><br />
These little touches can make your code more readable and allow you full flexibility in an object oriented sense.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">MySQL Native Driver</span><br />
<br />
Until version 5.3 of PHP, any interaction with MySQL usually occurred in conjunction with <span style="color: #FF0000;" class="mycode_color">libmysql</span> -- a MySQL database client library.<br />
<br />
PHP 5.3's native MySQL driver has been designed from the ground up for PHP and the ZEND engine, which brings about a number of advantages. Most obviously, the native driver is specific to PHP, and has therefore been optimised for the ZEND engine. This produces a client with a smaller footprint and faster execution times.<br />
<br />
Secondly, the native driver makes use of the ZEND engine's memory management and, unlike libmysql, it will obey the memory limit settings in PHP.<br />
<br />
The native driver has been licensed under the PHP license to avoid licensing issues.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Additional OpenSSL Functions</span><br />
<br />
If you've ever had to perform any OpenSSL-related actions in your scripts, (such as generating a Diffie Hellman key or encrypting content) you'll either have performed this operation in user-land, or passed the request to a system call.<br />
<br />
A patch to the OpenSSL functionality in PHP 5.3 provides the extra functions required to perform these actions through the OpenSSL library, which not only makes your life easier and your applications faster, but allows you to reuse the proven code that comes with OpenSSL.<br />
<br />
This will be great news for anyone that's currently working with OpenID.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Improved Command Line Parameter Support</span><br />
<br />
Hopefully, you'll be aware of the fact that PHP is more than just a scripting language for the Web. The command line version of PHP runs outside of the web server's environment and is useful for automating system and application processes.<br />
<br />
For example, the getopt function of PHP has been around for a while, but has been limited to a number of system types; most commonly, it didn't function under a Windows operating system environment.<br />
<br />
As of PHP 5.3, the getopt function is no longer system dependent. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">XSLT Profiling</span><br />
<br />
XSLT is a complex beast, and most users of this templating mechanism will be familiar with xsltproc's profiling option. As of PHP 5.3, you can profile the transforms from within your PHP scripts. <br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&#36;doc&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #0000BB">&#36;xsl&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">XSLTProcessor</span><span style="color: #007700">();&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">(</span><span style="color: #DD0000">'./lib/collection.xsl'</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">&#36;xsl</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">importStyleSheet</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;doc</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #0000BB">&#36;doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">(</span><span style="color: #DD0000">'./lib/collection.xml&nbsp;'</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">&#36;xsl</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProfiling</span><span style="color: #007700">(</span><span style="color: #DD0000">"/tmp/xslt-profiling.txt"</span><span style="color: #007700">);&nbsp;<br />echo&nbsp;</span><span style="color: #0000BB">&#36;xsl</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">transformToXML</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;doc</span><span style="color: #007700">);&nbsp;<br /><br />echo&nbsp;</span><span style="color: #DD0000">'&lt;h2&gt;Profile&nbsp;report&lt;/h2&gt;'</span><span style="color: #007700">;&nbsp;<br />echo&nbsp;</span><span style="color: #DD0000">'&lt;pre&gt;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'/tmp/xslt-profiling.txt'&nbsp;</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'&lt;/pre&gt;'</span><span style="color: #007700">;&nbsp;<br /></span></code></div></div></div><br />
The information produced by the profile will look something like this:<br />
<br />
<span style="color: #FF0000;" class="mycode_color">number    match    name   mode     Calls   Tot  100us  Avg <br />
0         collection                    1       4       4 <br />
1         cd                            2       1       0 <br />
<br />
          Total                         3       5</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">New Error Levels</span><br />
PHP is certainly a language that has a few, er, quirks. For example, why doesn't <span style="color: #FF0000;" class="mycode_color">E_ALL </span>include all error levels?<br />
<br />
Well now it does! Yes, PHP 5.3 now includes <span style="color: #FF0000;" class="mycode_color">E_STRICT </span>as part of <span style="color: #FF0000;" class="mycode_color">E_ALL.</span><br />
<br />
Furthermore, while <span style="color: #FF0000;" class="mycode_color">E_STRICT</span> used to report on both the usage of functionality that might become deprecated in the near future, and on bad programming practices such as defining an abstract static method, in PHP 5.3, these two errors are split into <span style="color: #FF0000;" class="mycode_color">E_DEPRECATED</span> and <span style="color: #FF0000;" class="mycode_color">E_STRICT</span> respectively, which makes a lot more sense.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Other Minor Improvements</span><br />
<br />
There's a handful of other improvements coming in PHP 5.3 that either don't warrant an entire section in this article, or were untestable at the time this article was written, such as:<br />
<br />
â€¢	Sqlite3 support via the <span style="color: #FF0000;" class="mycode_color">ext/sqlite </span>extension <br />
â€¢	SPL's <span style="color: #FF0000;" class="mycode_color">DirectoryIterator</span>, which now implements <span style="color: #FF0000;" class="mycode_color">ArrayAccess</span> <br />
â€¢	Two news functions: <span style="color: #FF0000;" class="mycode_color">array_replace</span> and <span style="color: #FF0000;" class="mycode_color">array_replace_recursive</span>. While these functions were undefined when tested under PHP 5.3.0, the C code that implements them suggests that they will contain similar functionality to <span style="color: #FF0000;" class="mycode_color">array_merge</span>. One exception, however, is that the <span style="color: #FF0000;" class="mycode_color">array_replace</span> function will only update values in the first array where the keys match in both arrays. Any keys that are present in the second array but don't appear in the first will be ignored. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Summary</span><br />
<br />
PHP 5.3 contains much functionality that was originally slated for inclusion in PHP 6, which takes it from being a minor upgrade to a significant release that every PHP developer should start thinking about. We touched on some of the new features in this blog, and looked at some code that demonstrates how you might go about using these new features.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rotating Banner System]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=34</link>
			<pubDate>Wed, 06 Feb 2008 11:11:59 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=34</guid>
			<description><![CDATA[When we create a eCommerce site for our clients, one of the many things we always get asked, can have a rotating banner system. We have decided to put together some information on how to create a rotating banner system with php &amp; MySQL. <br />
You will need a limited knowledge of mySQL including how to create a mySQL table.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Introduction</span><br />
<br />
Dynamic banner display means that the same banner advertisement changes with each refresh of the page, if ajax is used with php this can also be done in real time. This enables the display of ads on a Web site without having to clutter a single Web page.<br />
<br />
Banners can be a viable source of income. Statistical information reporting the number of "hits" (the number of times the banner is displayed) and "clicks" (times the banner is clicked on) can be generated to justify the use of each banner.<br />
<br />
This blog will provide instructions for developing a simple banner advertisement rotation system in PHP.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The banner advertisement script will enable you to:</span><br />
<br />
Â·	Automate rotation of a banner upon every refresh of the page. <br />
Â·	Keep track of banner statistics, including number of displays and actual clicks without the use of cookies, regardless of the banner destination. <br />
Â·	Switch banners in and out of active rotation without having to delete them from the database.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">To achieve these features:</span><br />
<br />
Â·	Identifying each banner uniquely by assigning it a unique 32 byte ID. <br />
Â·	Give you the option to select the order in which the banners will be displayed. <br />
Â·	Generating the necessary HTML to display the banner correctly and dynamically based on the data provided and associated with the unique ID. <br />
Â·	Providing a means of tracking banner hits without interfering with its original destination link.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Banner Details</span><br />
<br />
When structuring the database, the actual data associated with the banner follows a unique ID. The question is what data is really necessary and in what form should it take in the table?<br />
<br />
For example, should the actual banner graphic be included within the database, say as a BLOB field, or should only the filename to the graphic be provided? <br />
<br />
We have opted to include the banner graphic's filename as a string, represented by the column 'SRC'.<br />
<br />
Note: The 'SRC' Field can only store a limited sized URL or file path; it is defined as VARCHAR (255).<br />
<br />
The first field in our table structure is the ID field. This field serves as our unique banner identifier. Banner IDs can be defined using the statement below. In doing so, you can expect to receive a unique ID 32 characters in length:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;&#36;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">md5&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">uniqid&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">rand</span><span style="color: #007700">()));&nbsp;</span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">The next three fields represent their HTML counterparts.</span><br />
<br />
Â·	HREF: Banner's URL, used as part of the &lt;A HREF&gt; tag. <br />
Â·	SRC: Graphic to be displayed when using the &lt;IMG SRC&gt; tag. <br />
Â·	ALT: Alternative banner description, when using the &lt;IMG ALT&gt; tag.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> From the fields listed above, only the ALT field is not mandatory and can be set to NULL.<br />
<br />
The Hits and Clicks integer fields maintain display and click-through statistics respectively.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Two enumerated fields, Active and Pos, are used as follows:</span><br />
<br />
Â·	Pos field: Used as a flag field to indicate that this banner has already been displayed in this rotation cycle. <br />
Â·	Active field: Used to determine whether or not the banner is active.<br />
<br />
The b_order integer field rounds out the table shown below. b_order defines the order in which a banner will be displayed. If you choose to display your banners in a particular sequence then this field will be mandatory. You would assign each banner a position and record it here.<br />
<br />
Column	Descripton	Req'd?<br />
<br />
ID	Unique Banner ID, a MD5 32 Character String	Y<br />
HREF	The URL to use in the banner's &lt;A HREF&gt; tag	Y<br />
SRC	The Graphic to use in the banner's &lt;IMG SRC&gt; tag	Y<br />
ALT	The alternate description for the banner graphic. Used for &lt;IMG ALT&gt;	N<br />
hits	The Hit (or display) stetisticsfor the banner	N<br />
clicks	The Click statistics for the banner	N<br />
active	Is this banner currently in active rotation?	Y<br />
pos	This fields serves as a "last used" identifier for PHP to track what banner was last displayed	N<br />
b_order	The Order the banner will be displayed	Y<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The Database Definition</span><br />
<br />
Displayed below is the mySQL table definition for the set of banner records.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Banner Table Definitions</span><br />
<br />
Name	Type	Key<br />
ID	VARCHAR (32)	Primary Key<br />
HREF	VARCHAR (255)	<br />
SRC	VARCHAR (255)	<br />
ALT	VARCHAR (255)	<br />
hits	INT(10)	<br />
click	INT(10)	<br />
active	ENUM('T', 'F')	<br />
pos	ENUM('A',NULL)	<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> When defining your table ensure that the fields ID, URL and file are set with the NOT NULL Property (or similar).<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The mySQL Statement</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">The following CREATE TABLE statement may be used create the above table:</span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">CREATE&nbsp;TABLE&nbsp;banner</span><span style="color: #007700">(<br /></span><span style="color: #0000BB">ID&nbsp;VARCHAR</span><span style="color: #007700">(</span><span style="color: #0000BB">32</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL&nbsp;PRIMARY&nbsp;KEY</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">HREF&nbsp;VARCHAR</span><span style="color: #007700">(</span><span style="color: #0000BB">255</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">SRC&nbsp;VARCHAR</span><span style="color: #007700">(</span><span style="color: #0000BB">255</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">ALT&nbsp;VARCHAR</span><span style="color: #007700">(</span><span style="color: #0000BB">255</span><span style="color: #007700">),<br /></span><span style="color: #0000BB">hits&nbsp;INT</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">)&nbsp;DEFAULT&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">clicks&nbsp;INT</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">)&nbsp;DEFAULT&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">active&nbsp;ENUM</span><span style="color: #007700">(</span><span style="color: #DD0000">'T'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'F'</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL&nbsp;</span><span style="color: #007700">DEFAULT&nbsp;</span><span style="color: #DD0000">'T'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">pos&nbsp;ENUM</span><span style="color: #007700">(</span><span style="color: #DD0000">'A'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">),<br /></span><span style="color: #0000BB">b_order&nbsp;INT</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL&nbsp;</span><span style="color: #007700">DEFAULT&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><span style="font-weight: bold;" class="mycode_b">You can include your file before any output to the user is sent, using the following code:</span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">include(</span><span style="color: #DD0000">"/path/to/included.php"</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Example </span><br />
<br />
You have created a Web page and would like to generate some advertising revenue by inserting a rotating banner advertisement somewhere on that page.<br />
<br />
The script presented in this blog is a self-contained application. However, it must be included before any output is sent to the user. The entire script is contained within a single file (complete with the function to display the banner).<br />
<br />
<span style="font-weight: bold;" class="mycode_b">To add a rotating banner:</span><br />
<br />
Â·	Insert the following function call: display_banner(); Calling this function with no parameters will cause the script to simply pick the next appropriate banner (meaning the next active banner available) and display the HTML behind it. The two optional parameters, &#36;bannerID and &#36;query_extra are used under special-case circumstances outlined below.<br />
Â·	<br />
o	&#36;bannerID is used to force the script to display a specific banner based on its ID. When the specific banner is displayed, it does not affect the normal rotation pattern of the banners. <br />
o	&#36;query_extra is used to include specific, relevant variables along with the banner itself when a user clicks on it. &#36;query_extra is an array and must be formatted in the following way:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">array(</span><span style="color: #DD0000">"var1name"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"var1value"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"var2name"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"var2value"</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
This feature is for the case where you might want to display a banner that links to another section of your site. If you use Sessions on your site, a normal redirect could potentially lose the current session data (if a GET method is being used instead of cookies). To compensate for this, &#36;query_extra should be appended to the end of the banner's URL. This would enable you to keep your session data intact. This feature also could be used to transfer any extra required data regarding your banner to an external site if the situation warrants.<br />
<br />
o	display_banner() generates the proper HTML complete with a &lt;A HREF=""&gt; tag that points to &#36;PHP_SELF and passes the proper banner ID back to itself (which then triggers the redirect logic). <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Script Overview </span><br />
<br />
With the example firmly in mind, the remainder of this section presents the contents of the banner script. The basic code-flow of the script is outlined below:<br />
<br />
Step 1: Opening of page, Load pre-pended script file or execute include statement.<br />
Step 2: Is a banner ID been given? If so, go to step 7. Otherwise, step 3.<br />
Step 3: Load selected banner's data and add 1 to the banner's display statistics.<br />
Step 4: Display HTML for banner using loaded information.<br />
Step 5: Continue displaying page as normal.<br />
Step 6: Reload the Web page and pass itself the banner ID of given banner clicked.<br />
Step 7: Add 1 to the banner's click statistics.<br />
Step 8: Redirect User to page specified in database for given banner ID.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">What you need to do</span><br />
<br />
Â·	Open the page: Process a clicked banner if a banner ID is present. Otherwise, display the requested page as expected. <br />
Â·	Select a banner for display: Decide which banner to display. <br />
Â·	Generate the HTML: Output the required HTML. <br />
Â·	Special Case: Appending extra GET method data.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Open the Page</span><br />
<br />
To track banner clicks, it is necessary to include the required code at the beginning of every page that will display the banner.<br />
<br />
This code, nested within an if statement, is activated only when a banner has been clicked. Otherwise, the original page is displayed as expected.<br />
<br />
Be sure to call the Display_Banner() function within the original page's script to display the banner at that page's preferred location. It is not necessary to call Display_Banner() on every page you include the auto-prepend script, rather only where you want a banner displayed.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Code Flow</span><br />
<br />
Â·	Check for the existence of &#36;_bannerID (exists only if the user has clicked on a banner). <br />
Â·	Open a connection to the Database. <br />
Â·	Gather information about the banner from the database and validate the banner ID. <br />
Â·	Alter Statistics and re-direct user to the proper URL using the header() function.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if(isset(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">))&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DB_BANNER</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(uniqueid=</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">)"</span><span style="color: #007700">);<br />if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;!=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&lt;</span><span style="color: #0000BB">BRDBINCCLKS</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_BANNERID</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#36;url&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">f</span><span style="color: #007700">(</span><span style="color: #DD0000">"HREF"</span><span style="color: #007700">).&nbsp;</span><span style="color: #0000BB">&#36;_query_extra</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">Header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Location:&nbsp;</span><span style="color: #0000BB">&#36;url</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />}<br />}<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Select a Banner for Display </span><br />
<br />
Having already created an auto-prepend file (see Prerequisites), our task now is to process the data and generate the required HTML to display a given banner.<br />
<br />
In the Script Flow presented below, the &lt;A HREF&gt; tag of the banner is set to point to itself (i.e. the same page). It passes the ID of the banner that was just displayed. When the user clicks on the banner and the page is re-loaded (with the passed banner ID) the auto-prepended code is triggered and the appropriate action is taken.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note: </span>If we were not concerned with statistics, this step would have been a simple matter of putting the correct URL in the &lt;A HREF&gt; tag.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The script features two banner selection methods:</span><br />
<br />
Â·	Default method: Banners are displayed in a predefined order based on the b_order column in the table. <br />
Â·	Forced method: The script forces the display a specific banner based on it's banner ID.<br />
<br />
Both of these methods are accessed by calling the function display_banner(). This function takes two optional parameters - a string that would contain a specific banner ID and a second string for extra query parameters.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> If you would like the script to behave in the default manner but still pass extra parameters using &#36;query_extra, you must set the first parameter of display_banner() to the value "none" (case sensitive).<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Code Flow</span><br />
<br />
Â·	Check to see if a banner ID was provided <br />
Â·	Check for the existence of any banners in the database <br />
Â·	Check to see if there are banners that have not been displayed yet. If not, reset the database so that all the banners can be displayed. <br />
Â·	By default, retrieve all of the banners that have not yet been displayed, ordered by the b_order column. Otherwise, retrieve the banner based on the banner ID provided. <br />
Â·	Take the first row returned and use it as the next banner to be displayed <br />
Â·	Construct the proper HTML for the banner based on the database data and the &#36;query_extra array. <br />
<br />
The &#36;query_extra parameter of the display_banner() function is used to append extra GET method data to the end of the banner URL. This data should be an associative array representing the variables you would like to pass along with the banner ID when the banner is clicked (such as a session ID).<br />
<br />
Â·	If the banner was selected by rotation, meaning by default, flag the selected banner so that it will not be displayed twice in a row.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">Display_Banner</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">,&nbsp;<br /></span><span style="color: #0000BB">&#36;query_extra&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)&nbsp;{<br />global&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />if(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;WHERE&nbsp;pos=''&nbsp;LIMIT&nbsp;1"</span><span style="color: #007700">);<br />if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;pos=''&nbsp;WHERE(pos='A')"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;WHERE(pos='')&nbsp;<br />ORDER&nbsp;BY&nbsp;b_order&nbsp;LIMIT&nbsp;1"</span><span style="color: #007700">);&nbsp;<br />}&nbsp;else&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(ID='</span><span style="color: #0000BB">&#36;bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);&nbsp;<br />}<br />if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">next_record</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">&#36;ban_data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Record</span><span style="color: #007700">;&nbsp;<br /></span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Generate the HTML </span><br />
<br />
In this stage of the script, the HTML is generated. The following basic HTML format is used to display our banner â€“ the fields encased in '%' symbols define where PHP will fill in appropriate values:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">&lt;</span><span style="color: #0000BB">A&nbsp;HREF</span><span style="color: #007700">=</span><span style="color: #DD0000">"%HREF%"</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">IMG&nbsp;SRC</span><span style="color: #007700">=</span><span style="color: #DD0000">"%SRC%"&nbsp;</span><span style="color: #0000BB">ALT</span><span style="color: #007700">=</span><span style="color: #DD0000">"%ALT%"&nbsp;</span><span style="color: #0000BB">BORDER</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">&gt;<br />&lt;/</span><span style="color: #0000BB">A</span><span style="color: #007700">&gt;&nbsp;<br /></span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> Be aware that when extra data is passed along using the &#36;query_extra parameter, it is appended in the proper format to the HREF field.<br />
<br />
Once the banner has been displayed, the script ends unless the user clicks on the banner. In such a case, the variables &#36;_bannerID and any data brought along with the &#36;query_extra parameter is passed to itself (which in turn activates the source from the "Opening the page" section and takes the proper actions).<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Code Flow </span><br />
<br />
Â·	Construct the HTML for the GET method. <br />
Â·	Make the extra query string. <br />
Â·	Construct the HTML for the banner and include the GET we   constructed previously. <br />
Â·	Flag the banner. <br />
Â·	Echo the HTML.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"?_bannerid="</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">.=&nbsp;</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">]);<br />unset(</span><span style="color: #0000BB">&#36;query</span><span style="color: #007700">);<br />if(</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;query_extra</span><span style="color: #007700">))&nbsp;{<br />foreach(</span><span style="color: #0000BB">&#36;query_extra&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">&#36;key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">.=&nbsp;</span><span style="color: #DD0000">"&amp;</span><span style="color: #0000BB">&#36;key</span><span style="color: #DD0000">="</span><span style="color: #007700">.</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">);&nbsp;<br />}<br />}<br /></span><span style="color: #0000BB">&#36;html&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&lt;A&nbsp;HREF='</span><span style="color: #0000BB">&#36;PHP_SELF&#36;get</span><span style="color: #DD0000">'&gt;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;IMG&nbsp;SRC='</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">[</span><span style="color: #0000BB">srcpath</span><span style="color: #007700">]</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #0000BB">SRC</span><span style="color: #007700">]</span><span style="color: #DD0000">'&nbsp;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"ALT='</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #0000BB">ALT</span><span style="color: #007700">]</span><span style="color: #DD0000">&nbsp;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"BORDER='</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">[</span><span style="color: #0000BB">border</span><span style="color: #007700">]</span><span style="color: #DD0000">'&gt;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;/A&gt;"</span><span style="color: #007700">;<br />if(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;pos='A'&nbsp;<br />WHERE(ID='"</span><span style="color: #007700">.</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">].</span><span style="color: #DD0000">"')"</span><span style="color: #007700">);<br />}<br />echo&nbsp;</span><span style="color: #0000BB">&#36;html</span><span style="color: #007700">;<br />return&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Special Case: Appending Extra GET Method Data</span><br />
<br />
Sometimes it is necessary to pass data along with a banner that, although is important to a third party or script, is irrelvant to this particular banner script.<br />
<br />
For example, assume that in order to receive credit for the click-through (we'll call this ID parameter "tracker" with a value of "foo"), you need to pass an ID code to a URL that is being pointed to by the banner.<br />
<br />
In order to pass this ID, you would need to include it as the &#36;query_extra parameter when calling Display_Banner()as follows.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Code Flow </span><br />
<br />
Â·	Place the tracker ID code into a associative array with the key set as the parameter name (tracker) and the value set at it's value (foo). <br />
Â·	Pass the array to Display_Banner() as it's second parameter<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;a&nbsp;banner&nbsp;using&nbsp;default&nbsp;behavior<br />//&nbsp;But&nbsp;still&nbsp;passing&nbsp;the&nbsp;tracker&nbsp;parameter<br /></span><span style="color: #0000BB">&#36;trackerID&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">"tracker"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">Display_Banner</span><span style="color: #007700">(</span><span style="color: #DD0000">"none"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;trackerID</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;another&nbsp;banner&nbsp;specifically&nbsp;by<br />//&nbsp;passing&nbsp;it's&nbsp;ID&nbsp;and&nbsp;the&nbsp;tracker&nbsp;parameter<br /></span><span style="color: #0000BB">Display_Banner</span><span style="color: #007700">(</span><span style="color: #DD0000">"dka932ndksla2931kdn1ksla231na23k"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;trackerID</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">The Script </span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> The PHP elements are found within the &lt;?php and ?&gt; marks.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The code contains comments preceded by // or /* and */ marks.</span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Check&nbsp;to&nbsp;see&nbsp;if&nbsp;the&nbsp;banner&nbsp;ID&nbsp;flag&nbsp;is&nbsp;set<br /></span><span style="color: #007700">if(isset(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">))&nbsp;{<br /></span><span style="color: #FF8000">//&nbsp;Create&nbsp;an&nbsp;instance&nbsp;of&nbsp;the&nbsp;Database&nbsp;Layer&nbsp;<br /></span><span style="color: #0000BB">&#36;DB&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DB_BANNER</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;info&nbsp;about&nbsp;banner&nbsp;from&nbsp;DB&nbsp;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(uniqueid=</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">)"</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Check&nbsp;to&nbsp;see&nbsp;if&nbsp;Banner&nbsp;ID&nbsp;is&nbsp;valid&nbsp;before&nbsp;doing&nbsp;<br />//&nbsp;anything&nbsp;else&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;!=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Increment&nbsp;Click&nbsp;Counter&nbsp;<br /></span><span style="color: #0000BB">dbIncClks</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Redirect&nbsp;user&nbsp;to&nbsp;new&nbsp;location,&nbsp;&#36;_query_extra&nbsp;<br />//&nbsp;is&nbsp;the&nbsp;Extra&nbsp;parameters&nbsp;that&nbsp;were&nbsp;given&nbsp;to&nbsp;the&nbsp;<br />//&nbsp;script&nbsp;back&nbsp;in&nbsp;dbShowBan().&nbsp;This&nbsp;feature&nbsp;is&nbsp;<br />//&nbsp;for&nbsp;if&nbsp;you&nbsp;want&nbsp;a&nbsp;banner&nbsp;on&nbsp;your&nbsp;own&nbsp;site,&nbsp;to&nbsp;<br />//&nbsp;your&nbsp;own&nbsp;site,&nbsp;but&nbsp;use&nbsp;sessions&nbsp;and&nbsp;don't&nbsp;want&nbsp;<br />//&nbsp;the&nbsp;user&nbsp;to&nbsp;lose&nbsp;their&nbsp;session&nbsp;when&nbsp;they&nbsp;<br />//&nbsp;click.&nbsp;<br /></span><span style="color: #0000BB">&#36;url&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">f</span><span style="color: #007700">(</span><span style="color: #DD0000">"URL"</span><span style="color: #007700">).&nbsp;</span><span style="color: #0000BB">&#36;_query_extra</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">Header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Location:&nbsp;</span><span style="color: #0000BB">&#36;url</span><span style="color: #DD0000">"</span><span style="color: #007700">);&nbsp;<br />}&nbsp;<br />}&nbsp;<br />function&nbsp;</span><span style="color: #0000BB">Display_Banner</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">,&nbsp;<br /></span><span style="color: #0000BB">&#36;query_extra&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Grab&nbsp;the&nbsp;Database&nbsp;Layer&nbsp;and&nbsp;the&nbsp;Config&nbsp;options&nbsp;<br /></span><span style="color: #007700">global&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Did&nbsp;we&nbsp;pass&nbsp;a&nbsp;BannerID?&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;Not,&nbsp;Grab&nbsp;the&nbsp;next&nbsp;in&nbsp;rotation&nbsp;<br />//&nbsp;First,&nbsp;make&nbsp;sure&nbsp;that&nbsp;there&nbsp;is&nbsp;something&nbsp;to&nbsp;select<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;WHERE&nbsp;pos=''&nbsp;<br />LIMIT&nbsp;1"</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;there&nbsp;is&nbsp;nothing,&nbsp;then&nbsp;everything&nbsp;has&nbsp;<br />//&nbsp;been&nbsp;displayed<br />//&nbsp;Time&nbsp;to&nbsp;start&nbsp;from&nbsp;square&nbsp;1&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;pos=''&nbsp;WHERE(pos='A')"</span><span style="color: #007700">);&nbsp;<br />}<br /></span><span style="color: #FF8000">//&nbsp;Finally,&nbsp;select&nbsp;the&nbsp;next&nbsp;banner&nbsp;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;WHERE(pos='')&nbsp;<br />ORDER&nbsp;BY&nbsp;b_order&nbsp;LIMIT&nbsp;1"</span><span style="color: #007700">);&nbsp;<br />}&nbsp;else&nbsp;{<br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;so,&nbsp;Grab&nbsp;the&nbsp;requested&nbsp;Banner&nbsp;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(ID='</span><span style="color: #0000BB">&#36;bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />}&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Make&nbsp;sure&nbsp;we&nbsp;grabbed&nbsp;something&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&nbsp;<br />return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">next_record</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Saved&nbsp;the&nbsp;data&nbsp;we&nbsp;got&nbsp;in&nbsp;a&nbsp;separate&nbsp;array&nbsp;<br /></span><span style="color: #0000BB">&#36;ban_data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Record</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Construct&nbsp;the&nbsp;HTML&nbsp;for&nbsp;the&nbsp;GET&nbsp;<br /></span><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"?_bannerid="</span><span style="color: #007700">.</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">]);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Make&nbsp;the&nbsp;extra&nbsp;query&nbsp;string&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;query_extra</span><span style="color: #007700">))&nbsp;{&nbsp;<br />foreach(</span><span style="color: #0000BB">&#36;query_extra&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">&#36;key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">.=&nbsp;</span><span style="color: #DD0000">"&amp;</span><span style="color: #0000BB">&#36;key</span><span style="color: #DD0000">="</span><span style="color: #007700">.</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">);<br />}&nbsp;<br />}&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Construct&nbsp;the&nbsp;HTML&nbsp;for&nbsp;the&nbsp;banner&nbsp;and&nbsp;include&nbsp;the&nbsp;GET&nbsp;//&nbsp;we&nbsp;constructed&nbsp;previously.&nbsp;<br /></span><span style="color: #0000BB">&#36;html&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&lt;A&nbsp;HREF='</span><span style="color: #0000BB">&#36;PHP_SELF&#36;get</span><span style="color: #DD0000">'&gt;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;IMG&nbsp;SRC='</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">[</span><span style="color: #0000BB">srcpath</span><span style="color: #007700">]</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #0000BB">SRC</span><span style="color: #007700">]</span><span style="color: #DD0000">'&nbsp;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"ALT='</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #0000BB">ALT</span><span style="color: #007700">]</span><span style="color: #DD0000">&nbsp;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"BORDER='</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">[</span><span style="color: #0000BB">border</span><span style="color: #007700">]</span><span style="color: #DD0000">'&gt;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;/A&gt;"</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Increment&nbsp;the&nbsp;hits<br /></span><span style="color: #0000BB">dbIncHits</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">]);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Flag&nbsp;the&nbsp;banner&nbsp;used&nbsp;as&nbsp;displayed&nbsp;(if&nbsp;it&nbsp;was&nbsp;selected&nbsp;<br />//&nbsp;by&nbsp;rotation)&nbsp;In&nbsp;special&nbsp;cases,&nbsp;we're&nbsp;not&nbsp;going&nbsp;to&nbsp;flag&nbsp;<br />//&nbsp;anything&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;pos='A'&nbsp;<br />WHERE(ID='"</span><span style="color: #007700">.</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">].</span><span style="color: #DD0000">"')"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #FF8000">//&nbsp;Finally,&nbsp;echo&nbsp;the&nbsp;HTML<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">&#36;html</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//&nbsp;Return&nbsp;True<br /></span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br />}<br />function&nbsp;</span><span style="color: #0000BB">dbIncClks</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">)&nbsp;{<br />global&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;clicks&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(ID='</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />If(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;clicks="</span><span style="color: #007700">.(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">f</span><span style="color: #007700">(</span><span style="color: #DD0000">'clicks'</span><span style="color: #007700">)+</span><span style="color: #0000BB">1</span><span style="color: #007700">).</span><span style="color: #DD0000">"&nbsp;WHERE(ID='</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />}&nbsp;<br />function&nbsp;</span><span style="color: #0000BB">dbIncHits</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">)&nbsp;{<br />global&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;hits&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(ID='</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />If(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;hits="</span><span style="color: #007700">.(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">f</span><span style="color: #007700">(</span><span style="color: #DD0000">'clicks'</span><span style="color: #007700">)+</span><span style="color: #0000BB">1</span><span style="color: #007700">).</span><span style="color: #DD0000">"&nbsp;WHERE(ID='</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div>]]></description>
			<content:encoded><![CDATA[When we create a eCommerce site for our clients, one of the many things we always get asked, can have a rotating banner system. We have decided to put together some information on how to create a rotating banner system with php &amp; MySQL. <br />
You will need a limited knowledge of mySQL including how to create a mySQL table.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Introduction</span><br />
<br />
Dynamic banner display means that the same banner advertisement changes with each refresh of the page, if ajax is used with php this can also be done in real time. This enables the display of ads on a Web site without having to clutter a single Web page.<br />
<br />
Banners can be a viable source of income. Statistical information reporting the number of "hits" (the number of times the banner is displayed) and "clicks" (times the banner is clicked on) can be generated to justify the use of each banner.<br />
<br />
This blog will provide instructions for developing a simple banner advertisement rotation system in PHP.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The banner advertisement script will enable you to:</span><br />
<br />
Â·	Automate rotation of a banner upon every refresh of the page. <br />
Â·	Keep track of banner statistics, including number of displays and actual clicks without the use of cookies, regardless of the banner destination. <br />
Â·	Switch banners in and out of active rotation without having to delete them from the database.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">To achieve these features:</span><br />
<br />
Â·	Identifying each banner uniquely by assigning it a unique 32 byte ID. <br />
Â·	Give you the option to select the order in which the banners will be displayed. <br />
Â·	Generating the necessary HTML to display the banner correctly and dynamically based on the data provided and associated with the unique ID. <br />
Â·	Providing a means of tracking banner hits without interfering with its original destination link.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Banner Details</span><br />
<br />
When structuring the database, the actual data associated with the banner follows a unique ID. The question is what data is really necessary and in what form should it take in the table?<br />
<br />
For example, should the actual banner graphic be included within the database, say as a BLOB field, or should only the filename to the graphic be provided? <br />
<br />
We have opted to include the banner graphic's filename as a string, represented by the column 'SRC'.<br />
<br />
Note: The 'SRC' Field can only store a limited sized URL or file path; it is defined as VARCHAR (255).<br />
<br />
The first field in our table structure is the ID field. This field serves as our unique banner identifier. Banner IDs can be defined using the statement below. In doing so, you can expect to receive a unique ID 32 characters in length:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;&#36;foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">md5&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">uniqid&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">rand</span><span style="color: #007700">()));&nbsp;</span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">The next three fields represent their HTML counterparts.</span><br />
<br />
Â·	HREF: Banner's URL, used as part of the &lt;A HREF&gt; tag. <br />
Â·	SRC: Graphic to be displayed when using the &lt;IMG SRC&gt; tag. <br />
Â·	ALT: Alternative banner description, when using the &lt;IMG ALT&gt; tag.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> From the fields listed above, only the ALT field is not mandatory and can be set to NULL.<br />
<br />
The Hits and Clicks integer fields maintain display and click-through statistics respectively.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Two enumerated fields, Active and Pos, are used as follows:</span><br />
<br />
Â·	Pos field: Used as a flag field to indicate that this banner has already been displayed in this rotation cycle. <br />
Â·	Active field: Used to determine whether or not the banner is active.<br />
<br />
The b_order integer field rounds out the table shown below. b_order defines the order in which a banner will be displayed. If you choose to display your banners in a particular sequence then this field will be mandatory. You would assign each banner a position and record it here.<br />
<br />
Column	Descripton	Req'd?<br />
<br />
ID	Unique Banner ID, a MD5 32 Character String	Y<br />
HREF	The URL to use in the banner's &lt;A HREF&gt; tag	Y<br />
SRC	The Graphic to use in the banner's &lt;IMG SRC&gt; tag	Y<br />
ALT	The alternate description for the banner graphic. Used for &lt;IMG ALT&gt;	N<br />
hits	The Hit (or display) stetisticsfor the banner	N<br />
clicks	The Click statistics for the banner	N<br />
active	Is this banner currently in active rotation?	Y<br />
pos	This fields serves as a "last used" identifier for PHP to track what banner was last displayed	N<br />
b_order	The Order the banner will be displayed	Y<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The Database Definition</span><br />
<br />
Displayed below is the mySQL table definition for the set of banner records.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Banner Table Definitions</span><br />
<br />
Name	Type	Key<br />
ID	VARCHAR (32)	Primary Key<br />
HREF	VARCHAR (255)	<br />
SRC	VARCHAR (255)	<br />
ALT	VARCHAR (255)	<br />
hits	INT(10)	<br />
click	INT(10)	<br />
active	ENUM('T', 'F')	<br />
pos	ENUM('A',NULL)	<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> When defining your table ensure that the fields ID, URL and file are set with the NOT NULL Property (or similar).<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The mySQL Statement</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">The following CREATE TABLE statement may be used create the above table:</span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">CREATE&nbsp;TABLE&nbsp;banner</span><span style="color: #007700">(<br /></span><span style="color: #0000BB">ID&nbsp;VARCHAR</span><span style="color: #007700">(</span><span style="color: #0000BB">32</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL&nbsp;PRIMARY&nbsp;KEY</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">HREF&nbsp;VARCHAR</span><span style="color: #007700">(</span><span style="color: #0000BB">255</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">SRC&nbsp;VARCHAR</span><span style="color: #007700">(</span><span style="color: #0000BB">255</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">ALT&nbsp;VARCHAR</span><span style="color: #007700">(</span><span style="color: #0000BB">255</span><span style="color: #007700">),<br /></span><span style="color: #0000BB">hits&nbsp;INT</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">)&nbsp;DEFAULT&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">clicks&nbsp;INT</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">)&nbsp;DEFAULT&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">active&nbsp;ENUM</span><span style="color: #007700">(</span><span style="color: #DD0000">'T'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'F'</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL&nbsp;</span><span style="color: #007700">DEFAULT&nbsp;</span><span style="color: #DD0000">'T'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB">pos&nbsp;ENUM</span><span style="color: #007700">(</span><span style="color: #DD0000">'A'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">),<br /></span><span style="color: #0000BB">b_order&nbsp;INT</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">NOT&nbsp;NULL&nbsp;</span><span style="color: #007700">DEFAULT&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><span style="font-weight: bold;" class="mycode_b">You can include your file before any output to the user is sent, using the following code:</span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">include(</span><span style="color: #DD0000">"/path/to/included.php"</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Example </span><br />
<br />
You have created a Web page and would like to generate some advertising revenue by inserting a rotating banner advertisement somewhere on that page.<br />
<br />
The script presented in this blog is a self-contained application. However, it must be included before any output is sent to the user. The entire script is contained within a single file (complete with the function to display the banner).<br />
<br />
<span style="font-weight: bold;" class="mycode_b">To add a rotating banner:</span><br />
<br />
Â·	Insert the following function call: display_banner(); Calling this function with no parameters will cause the script to simply pick the next appropriate banner (meaning the next active banner available) and display the HTML behind it. The two optional parameters, &#36;bannerID and &#36;query_extra are used under special-case circumstances outlined below.<br />
Â·	<br />
o	&#36;bannerID is used to force the script to display a specific banner based on its ID. When the specific banner is displayed, it does not affect the normal rotation pattern of the banners. <br />
o	&#36;query_extra is used to include specific, relevant variables along with the banner itself when a user clicks on it. &#36;query_extra is an array and must be formatted in the following way:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">array(</span><span style="color: #DD0000">"var1name"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"var1value"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"var2name"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"var2value"</span><span style="color: #007700">);&nbsp;<br /></span></code></div></div></div><br />
This feature is for the case where you might want to display a banner that links to another section of your site. If you use Sessions on your site, a normal redirect could potentially lose the current session data (if a GET method is being used instead of cookies). To compensate for this, &#36;query_extra should be appended to the end of the banner's URL. This would enable you to keep your session data intact. This feature also could be used to transfer any extra required data regarding your banner to an external site if the situation warrants.<br />
<br />
o	display_banner() generates the proper HTML complete with a &lt;A HREF=""&gt; tag that points to &#36;PHP_SELF and passes the proper banner ID back to itself (which then triggers the redirect logic). <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Script Overview </span><br />
<br />
With the example firmly in mind, the remainder of this section presents the contents of the banner script. The basic code-flow of the script is outlined below:<br />
<br />
Step 1: Opening of page, Load pre-pended script file or execute include statement.<br />
Step 2: Is a banner ID been given? If so, go to step 7. Otherwise, step 3.<br />
Step 3: Load selected banner's data and add 1 to the banner's display statistics.<br />
Step 4: Display HTML for banner using loaded information.<br />
Step 5: Continue displaying page as normal.<br />
Step 6: Reload the Web page and pass itself the banner ID of given banner clicked.<br />
Step 7: Add 1 to the banner's click statistics.<br />
Step 8: Redirect User to page specified in database for given banner ID.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">What you need to do</span><br />
<br />
Â·	Open the page: Process a clicked banner if a banner ID is present. Otherwise, display the requested page as expected. <br />
Â·	Select a banner for display: Decide which banner to display. <br />
Â·	Generate the HTML: Output the required HTML. <br />
Â·	Special Case: Appending extra GET method data.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Open the Page</span><br />
<br />
To track banner clicks, it is necessary to include the required code at the beginning of every page that will display the banner.<br />
<br />
This code, nested within an if statement, is activated only when a banner has been clicked. Otherwise, the original page is displayed as expected.<br />
<br />
Be sure to call the Display_Banner() function within the original page's script to display the banner at that page's preferred location. It is not necessary to call Display_Banner() on every page you include the auto-prepend script, rather only where you want a banner displayed.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Code Flow</span><br />
<br />
Â·	Check for the existence of &#36;_bannerID (exists only if the user has clicked on a banner). <br />
Â·	Open a connection to the Database. <br />
Â·	Gather information about the banner from the database and validate the banner ID. <br />
Â·	Alter Statistics and re-direct user to the proper URL using the header() function.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if(isset(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">))&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DB_BANNER</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(uniqueid=</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">)"</span><span style="color: #007700">);<br />if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;!=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&lt;</span><span style="color: #0000BB">BRDBINCCLKS</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_BANNERID</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#36;url&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">f</span><span style="color: #007700">(</span><span style="color: #DD0000">"HREF"</span><span style="color: #007700">).&nbsp;</span><span style="color: #0000BB">&#36;_query_extra</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">Header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Location:&nbsp;</span><span style="color: #0000BB">&#36;url</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />}<br />}<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Select a Banner for Display </span><br />
<br />
Having already created an auto-prepend file (see Prerequisites), our task now is to process the data and generate the required HTML to display a given banner.<br />
<br />
In the Script Flow presented below, the &lt;A HREF&gt; tag of the banner is set to point to itself (i.e. the same page). It passes the ID of the banner that was just displayed. When the user clicks on the banner and the page is re-loaded (with the passed banner ID) the auto-prepended code is triggered and the appropriate action is taken.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note: </span>If we were not concerned with statistics, this step would have been a simple matter of putting the correct URL in the &lt;A HREF&gt; tag.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The script features two banner selection methods:</span><br />
<br />
Â·	Default method: Banners are displayed in a predefined order based on the b_order column in the table. <br />
Â·	Forced method: The script forces the display a specific banner based on it's banner ID.<br />
<br />
Both of these methods are accessed by calling the function display_banner(). This function takes two optional parameters - a string that would contain a specific banner ID and a second string for extra query parameters.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> If you would like the script to behave in the default manner but still pass extra parameters using &#36;query_extra, you must set the first parameter of display_banner() to the value "none" (case sensitive).<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Code Flow</span><br />
<br />
Â·	Check to see if a banner ID was provided <br />
Â·	Check for the existence of any banners in the database <br />
Â·	Check to see if there are banners that have not been displayed yet. If not, reset the database so that all the banners can be displayed. <br />
Â·	By default, retrieve all of the banners that have not yet been displayed, ordered by the b_order column. Otherwise, retrieve the banner based on the banner ID provided. <br />
Â·	Take the first row returned and use it as the next banner to be displayed <br />
Â·	Construct the proper HTML for the banner based on the database data and the &#36;query_extra array. <br />
<br />
The &#36;query_extra parameter of the display_banner() function is used to append extra GET method data to the end of the banner URL. This data should be an associative array representing the variables you would like to pass along with the banner ID when the banner is clicked (such as a session ID).<br />
<br />
Â·	If the banner was selected by rotation, meaning by default, flag the selected banner so that it will not be displayed twice in a row.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">Display_Banner</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">,&nbsp;<br /></span><span style="color: #0000BB">&#36;query_extra&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)&nbsp;{<br />global&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;<br />if(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;WHERE&nbsp;pos=''&nbsp;LIMIT&nbsp;1"</span><span style="color: #007700">);<br />if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;pos=''&nbsp;WHERE(pos='A')"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;WHERE(pos='')&nbsp;<br />ORDER&nbsp;BY&nbsp;b_order&nbsp;LIMIT&nbsp;1"</span><span style="color: #007700">);&nbsp;<br />}&nbsp;else&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(ID='</span><span style="color: #0000BB">&#36;bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);&nbsp;<br />}<br />if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">next_record</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">&#36;ban_data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Record</span><span style="color: #007700">;&nbsp;<br /></span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Generate the HTML </span><br />
<br />
In this stage of the script, the HTML is generated. The following basic HTML format is used to display our banner â€“ the fields encased in '%' symbols define where PHP will fill in appropriate values:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #007700">&lt;</span><span style="color: #0000BB">A&nbsp;HREF</span><span style="color: #007700">=</span><span style="color: #DD0000">"%HREF%"</span><span style="color: #007700">&gt;<br />&lt;</span><span style="color: #0000BB">IMG&nbsp;SRC</span><span style="color: #007700">=</span><span style="color: #DD0000">"%SRC%"&nbsp;</span><span style="color: #0000BB">ALT</span><span style="color: #007700">=</span><span style="color: #DD0000">"%ALT%"&nbsp;</span><span style="color: #0000BB">BORDER</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">&gt;<br />&lt;/</span><span style="color: #0000BB">A</span><span style="color: #007700">&gt;&nbsp;<br /></span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> Be aware that when extra data is passed along using the &#36;query_extra parameter, it is appended in the proper format to the HREF field.<br />
<br />
Once the banner has been displayed, the script ends unless the user clicks on the banner. In such a case, the variables &#36;_bannerID and any data brought along with the &#36;query_extra parameter is passed to itself (which in turn activates the source from the "Opening the page" section and takes the proper actions).<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Code Flow </span><br />
<br />
Â·	Construct the HTML for the GET method. <br />
Â·	Make the extra query string. <br />
Â·	Construct the HTML for the banner and include the GET we   constructed previously. <br />
Â·	Flag the banner. <br />
Â·	Echo the HTML.<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"?_bannerid="</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">.=&nbsp;</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">]);<br />unset(</span><span style="color: #0000BB">&#36;query</span><span style="color: #007700">);<br />if(</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;query_extra</span><span style="color: #007700">))&nbsp;{<br />foreach(</span><span style="color: #0000BB">&#36;query_extra&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">&#36;key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">.=&nbsp;</span><span style="color: #DD0000">"&amp;</span><span style="color: #0000BB">&#36;key</span><span style="color: #DD0000">="</span><span style="color: #007700">.</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">);&nbsp;<br />}<br />}<br /></span><span style="color: #0000BB">&#36;html&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&lt;A&nbsp;HREF='</span><span style="color: #0000BB">&#36;PHP_SELF&#36;get</span><span style="color: #DD0000">'&gt;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;IMG&nbsp;SRC='</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">[</span><span style="color: #0000BB">srcpath</span><span style="color: #007700">]</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #0000BB">SRC</span><span style="color: #007700">]</span><span style="color: #DD0000">'&nbsp;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"ALT='</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #0000BB">ALT</span><span style="color: #007700">]</span><span style="color: #DD0000">&nbsp;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"BORDER='</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">[</span><span style="color: #0000BB">border</span><span style="color: #007700">]</span><span style="color: #DD0000">'&gt;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;/A&gt;"</span><span style="color: #007700">;<br />if(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;pos='A'&nbsp;<br />WHERE(ID='"</span><span style="color: #007700">.</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">].</span><span style="color: #DD0000">"')"</span><span style="color: #007700">);<br />}<br />echo&nbsp;</span><span style="color: #0000BB">&#36;html</span><span style="color: #007700">;<br />return&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Special Case: Appending Extra GET Method Data</span><br />
<br />
Sometimes it is necessary to pass data along with a banner that, although is important to a third party or script, is irrelvant to this particular banner script.<br />
<br />
For example, assume that in order to receive credit for the click-through (we'll call this ID parameter "tracker" with a value of "foo"), you need to pass an ID code to a URL that is being pointed to by the banner.<br />
<br />
In order to pass this ID, you would need to include it as the &#36;query_extra parameter when calling Display_Banner()as follows.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Code Flow </span><br />
<br />
Â·	Place the tracker ID code into a associative array with the key set as the parameter name (tracker) and the value set at it's value (foo). <br />
Â·	Pass the array to Display_Banner() as it's second parameter<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;a&nbsp;banner&nbsp;using&nbsp;default&nbsp;behavior<br />//&nbsp;But&nbsp;still&nbsp;passing&nbsp;the&nbsp;tracker&nbsp;parameter<br /></span><span style="color: #0000BB">&#36;trackerID&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">"tracker"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">Display_Banner</span><span style="color: #007700">(</span><span style="color: #DD0000">"none"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;trackerID</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Display&nbsp;another&nbsp;banner&nbsp;specifically&nbsp;by<br />//&nbsp;passing&nbsp;it's&nbsp;ID&nbsp;and&nbsp;the&nbsp;tracker&nbsp;parameter<br /></span><span style="color: #0000BB">Display_Banner</span><span style="color: #007700">(</span><span style="color: #DD0000">"dka932ndksla2931kdn1ksla231na23k"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;trackerID</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div><br />
<span style="font-weight: bold;" class="mycode_b">The Script </span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note:</span> The PHP elements are found within the &lt;?php and ?&gt; marks.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">The code contains comments preceded by // or /* and */ marks.</span><br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Check&nbsp;to&nbsp;see&nbsp;if&nbsp;the&nbsp;banner&nbsp;ID&nbsp;flag&nbsp;is&nbsp;set<br /></span><span style="color: #007700">if(isset(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">))&nbsp;{<br /></span><span style="color: #FF8000">//&nbsp;Create&nbsp;an&nbsp;instance&nbsp;of&nbsp;the&nbsp;Database&nbsp;Layer&nbsp;<br /></span><span style="color: #0000BB">&#36;DB&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DB_BANNER</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;info&nbsp;about&nbsp;banner&nbsp;from&nbsp;DB&nbsp;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(uniqueid=</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">)"</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Check&nbsp;to&nbsp;see&nbsp;if&nbsp;Banner&nbsp;ID&nbsp;is&nbsp;valid&nbsp;before&nbsp;doing&nbsp;<br />//&nbsp;anything&nbsp;else&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;!=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Increment&nbsp;Click&nbsp;Counter&nbsp;<br /></span><span style="color: #0000BB">dbIncClks</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Redirect&nbsp;user&nbsp;to&nbsp;new&nbsp;location,&nbsp;&#36;_query_extra&nbsp;<br />//&nbsp;is&nbsp;the&nbsp;Extra&nbsp;parameters&nbsp;that&nbsp;were&nbsp;given&nbsp;to&nbsp;the&nbsp;<br />//&nbsp;script&nbsp;back&nbsp;in&nbsp;dbShowBan().&nbsp;This&nbsp;feature&nbsp;is&nbsp;<br />//&nbsp;for&nbsp;if&nbsp;you&nbsp;want&nbsp;a&nbsp;banner&nbsp;on&nbsp;your&nbsp;own&nbsp;site,&nbsp;to&nbsp;<br />//&nbsp;your&nbsp;own&nbsp;site,&nbsp;but&nbsp;use&nbsp;sessions&nbsp;and&nbsp;don't&nbsp;want&nbsp;<br />//&nbsp;the&nbsp;user&nbsp;to&nbsp;lose&nbsp;their&nbsp;session&nbsp;when&nbsp;they&nbsp;<br />//&nbsp;click.&nbsp;<br /></span><span style="color: #0000BB">&#36;url&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">f</span><span style="color: #007700">(</span><span style="color: #DD0000">"URL"</span><span style="color: #007700">).&nbsp;</span><span style="color: #0000BB">&#36;_query_extra</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">Header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Location:&nbsp;</span><span style="color: #0000BB">&#36;url</span><span style="color: #DD0000">"</span><span style="color: #007700">);&nbsp;<br />}&nbsp;<br />}&nbsp;<br />function&nbsp;</span><span style="color: #0000BB">Display_Banner</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">,&nbsp;<br /></span><span style="color: #0000BB">&#36;query_extra&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Grab&nbsp;the&nbsp;Database&nbsp;Layer&nbsp;and&nbsp;the&nbsp;Config&nbsp;options&nbsp;<br /></span><span style="color: #007700">global&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;PHP_SELF</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Did&nbsp;we&nbsp;pass&nbsp;a&nbsp;BannerID?&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;Not,&nbsp;Grab&nbsp;the&nbsp;next&nbsp;in&nbsp;rotation&nbsp;<br />//&nbsp;First,&nbsp;make&nbsp;sure&nbsp;that&nbsp;there&nbsp;is&nbsp;something&nbsp;to&nbsp;select<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;WHERE&nbsp;pos=''&nbsp;<br />LIMIT&nbsp;1"</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;there&nbsp;is&nbsp;nothing,&nbsp;then&nbsp;everything&nbsp;has&nbsp;<br />//&nbsp;been&nbsp;displayed<br />//&nbsp;Time&nbsp;to&nbsp;start&nbsp;from&nbsp;square&nbsp;1&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&nbsp;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;pos=''&nbsp;WHERE(pos='A')"</span><span style="color: #007700">);&nbsp;<br />}<br /></span><span style="color: #FF8000">//&nbsp;Finally,&nbsp;select&nbsp;the&nbsp;next&nbsp;banner&nbsp;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;WHERE(pos='')&nbsp;<br />ORDER&nbsp;BY&nbsp;b_order&nbsp;LIMIT&nbsp;1"</span><span style="color: #007700">);&nbsp;<br />}&nbsp;else&nbsp;{<br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;so,&nbsp;Grab&nbsp;the&nbsp;requested&nbsp;Banner&nbsp;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(ID='</span><span style="color: #0000BB">&#36;bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />}&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Make&nbsp;sure&nbsp;we&nbsp;grabbed&nbsp;something&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&nbsp;<br />return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">next_record</span><span style="color: #007700">();&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Saved&nbsp;the&nbsp;data&nbsp;we&nbsp;got&nbsp;in&nbsp;a&nbsp;separate&nbsp;array&nbsp;<br /></span><span style="color: #0000BB">&#36;ban_data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Record</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Construct&nbsp;the&nbsp;HTML&nbsp;for&nbsp;the&nbsp;GET&nbsp;<br /></span><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"?_bannerid="</span><span style="color: #007700">.</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">]);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Make&nbsp;the&nbsp;extra&nbsp;query&nbsp;string&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;query_extra</span><span style="color: #007700">))&nbsp;{&nbsp;<br />foreach(</span><span style="color: #0000BB">&#36;query_extra&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">&#36;key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;get&nbsp;</span><span style="color: #007700">.=&nbsp;</span><span style="color: #DD0000">"&amp;</span><span style="color: #0000BB">&#36;key</span><span style="color: #DD0000">="</span><span style="color: #007700">.</span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">);<br />}&nbsp;<br />}&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Construct&nbsp;the&nbsp;HTML&nbsp;for&nbsp;the&nbsp;banner&nbsp;and&nbsp;include&nbsp;the&nbsp;GET&nbsp;//&nbsp;we&nbsp;constructed&nbsp;previously.&nbsp;<br /></span><span style="color: #0000BB">&#36;html&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&lt;A&nbsp;HREF='</span><span style="color: #0000BB">&#36;PHP_SELF&#36;get</span><span style="color: #DD0000">'&gt;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;IMG&nbsp;SRC='</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">[</span><span style="color: #0000BB">srcpath</span><span style="color: #007700">]</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #0000BB">SRC</span><span style="color: #007700">]</span><span style="color: #DD0000">'&nbsp;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"ALT='</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #0000BB">ALT</span><span style="color: #007700">]</span><span style="color: #DD0000">&nbsp;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"BORDER='</span><span style="color: #0000BB">&#36;_bannercfg</span><span style="color: #007700">[</span><span style="color: #0000BB">border</span><span style="color: #007700">]</span><span style="color: #DD0000">'&gt;"<br /></span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;/A&gt;"</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Increment&nbsp;the&nbsp;hits<br /></span><span style="color: #0000BB">dbIncHits</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">]);&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Flag&nbsp;the&nbsp;banner&nbsp;used&nbsp;as&nbsp;displayed&nbsp;(if&nbsp;it&nbsp;was&nbsp;selected&nbsp;<br />//&nbsp;by&nbsp;rotation)&nbsp;In&nbsp;special&nbsp;cases,&nbsp;we're&nbsp;not&nbsp;going&nbsp;to&nbsp;flag&nbsp;<br />//&nbsp;anything&nbsp;<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">&#36;bannerID&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">"none"</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;pos='A'&nbsp;<br />WHERE(ID='"</span><span style="color: #007700">.</span><span style="color: #0000BB">&#36;ban_data</span><span style="color: #007700">[</span><span style="color: #DD0000">'ID'</span><span style="color: #007700">].</span><span style="color: #DD0000">"')"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #FF8000">//&nbsp;Finally,&nbsp;echo&nbsp;the&nbsp;HTML<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">&#36;html</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//&nbsp;Return&nbsp;True<br /></span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br />}<br />function&nbsp;</span><span style="color: #0000BB">dbIncClks</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">)&nbsp;{<br />global&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;clicks&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(ID='</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />If(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;clicks="</span><span style="color: #007700">.(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">f</span><span style="color: #007700">(</span><span style="color: #DD0000">'clicks'</span><span style="color: #007700">)+</span><span style="color: #0000BB">1</span><span style="color: #007700">).</span><span style="color: #DD0000">"&nbsp;WHERE(ID='</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />}&nbsp;<br />function&nbsp;</span><span style="color: #0000BB">dbIncHits</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #007700">)&nbsp;{<br />global&nbsp;</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;hits&nbsp;FROM&nbsp;banner&nbsp;<br />WHERE(ID='</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />If(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"UPDATE&nbsp;banner&nbsp;SET&nbsp;hits="</span><span style="color: #007700">.(</span><span style="color: #0000BB">&#36;DB</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">f</span><span style="color: #007700">(</span><span style="color: #DD0000">'clicks'</span><span style="color: #007700">)+</span><span style="color: #0000BB">1</span><span style="color: #007700">).</span><span style="color: #DD0000">"&nbsp;WHERE(ID='</span><span style="color: #0000BB">&#36;_bannerID</span><span style="color: #DD0000">')"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Why Use PHP?]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=32</link>
			<pubDate>Wed, 06 Feb 2008 10:58:24 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=32</guid>
			<description><![CDATA[If you need to embed dynamic text into static text, youâ€™ll find PHP extremely useful. It was designed for this, and it excels at it. PHP is also very useful for integrating web pages with databases.<br />
<br />
The PHP scripting language resembles JavaScript, Java, and Perl, These languages all share a common ancestor, the C programming language. PHP is most different from JavaScript and Java. PHP is a server-side scripting language. All of the â€œworkâ€ is done on the server. JavaScript (and Java) generally run on the client. They have little access to the information that the server has, and mediated access to information on the client. They can do lots of things on the client that PHP cannot. PHP has full access to the information that the server has, and very little access to information that the client has. In fact, it only has information that the client tells the server and that the server passes on to PHP.<br />
<br />
Because it is on the server, however, PHP cannot be modified by the client. While you cannot necessarily trust the information that the client gives to PHP, you can trust that your PHP is doing what you told it to do.<br />
<br />
Because PHP is on the server end, your PHP scripts can affect your server--such as by keeping an activity log or updating a database.<br />
<br />
PHP and Perl often work side-by-side. These are both server-side. Where PHP excels at embedding dynamic content, Perl excels at modifying (or â€œfilteringâ€) streams of text. PHP excels at putting things into documents, and Perl excels at finding things in documents. After you have learned PHP, you may well find Perl useful for many tasks, especially for command-line tasks. PHP has an advantage over Perl on most web sites because PHP is usually loaded as part of the web server. When scripting languages â€œrunâ€, the system has to first load the â€œinterpreterâ€ and then â€œcompileâ€ the language into code that the machine can understand. When you tell PHP to echo the current time to the web page, the computer needs to have your command translated into numbers that it can understand. Because the PHP interpreter is already loaded as part of the web serverâ€™s software, it is always running. This cuts out half of that process. The interpreter is already loaded, and it can go directly to compiling the language into code. When web servers see a request to run a Perl script, they usually have to first load the Perl interpreter. This happens very quickly, but when there are thousands or tens of thousands of requests coming every second, every â€œvery quicklyâ€ can add up.<br />
<br />
C programs are â€œpre-compiledâ€. They cut out both steps in that process: no interpreter is needed because the program is already compiled into code the machine understands. Because of this, however, C programs must be compiled every time you switch to a new machine. If you move to a different host, you will usually have to recompile your C programs.<br />
Sometimes youâ€™ll even have to recompile your C programs when your ISP upgrades their serverâ€™s system software. And many ISPs do not provide you with a C compiler. Youâ€™ll find that PHP is more â€œportableâ€ than C in this respect: if it works on one server, it will usually work on any other server that has it. Most ISPs that provide server-side scripting provide PHP.]]></description>
			<content:encoded><![CDATA[If you need to embed dynamic text into static text, youâ€™ll find PHP extremely useful. It was designed for this, and it excels at it. PHP is also very useful for integrating web pages with databases.<br />
<br />
The PHP scripting language resembles JavaScript, Java, and Perl, These languages all share a common ancestor, the C programming language. PHP is most different from JavaScript and Java. PHP is a server-side scripting language. All of the â€œworkâ€ is done on the server. JavaScript (and Java) generally run on the client. They have little access to the information that the server has, and mediated access to information on the client. They can do lots of things on the client that PHP cannot. PHP has full access to the information that the server has, and very little access to information that the client has. In fact, it only has information that the client tells the server and that the server passes on to PHP.<br />
<br />
Because it is on the server, however, PHP cannot be modified by the client. While you cannot necessarily trust the information that the client gives to PHP, you can trust that your PHP is doing what you told it to do.<br />
<br />
Because PHP is on the server end, your PHP scripts can affect your server--such as by keeping an activity log or updating a database.<br />
<br />
PHP and Perl often work side-by-side. These are both server-side. Where PHP excels at embedding dynamic content, Perl excels at modifying (or â€œfilteringâ€) streams of text. PHP excels at putting things into documents, and Perl excels at finding things in documents. After you have learned PHP, you may well find Perl useful for many tasks, especially for command-line tasks. PHP has an advantage over Perl on most web sites because PHP is usually loaded as part of the web server. When scripting languages â€œrunâ€, the system has to first load the â€œinterpreterâ€ and then â€œcompileâ€ the language into code that the machine can understand. When you tell PHP to echo the current time to the web page, the computer needs to have your command translated into numbers that it can understand. Because the PHP interpreter is already loaded as part of the web serverâ€™s software, it is always running. This cuts out half of that process. The interpreter is already loaded, and it can go directly to compiling the language into code. When web servers see a request to run a Perl script, they usually have to first load the Perl interpreter. This happens very quickly, but when there are thousands or tens of thousands of requests coming every second, every â€œvery quicklyâ€ can add up.<br />
<br />
C programs are â€œpre-compiledâ€. They cut out both steps in that process: no interpreter is needed because the program is already compiled into code the machine understands. Because of this, however, C programs must be compiled every time you switch to a new machine. If you move to a different host, you will usually have to recompile your C programs.<br />
Sometimes youâ€™ll even have to recompile your C programs when your ISP upgrades their serverâ€™s system software. And many ISPs do not provide you with a C compiler. Youâ€™ll find that PHP is more â€œportableâ€ than C in this respect: if it works on one server, it will usually work on any other server that has it. Most ISPs that provide server-side scripting provide PHP.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Do you want to implement your own search friendly url engine?]]></title>
			<link>https://www.webneticsuk.com/forum/showthread.php?tid=19</link>
			<pubDate>Wed, 05 Dec 2007 15:01:04 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.webneticsuk.com/forum/member.php?action=profile&uid=1">webnetics</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.webneticsuk.com/forum/showthread.php?tid=19</guid>
			<description><![CDATA[This is one version of URL rewrite engine, which is not dependent on Apache mod_rewrite. It is relatively easy to implement in other systems or to adapt to your specs. We currently use this version on some of our <br />
<br />
This is an evil url:  <a href="http://www.notfriendly.com/index.php?menuID=28&amp;type=article" target="_blank" rel="noopener" class="mycode_url">www.notfriendly.com/index.php?menuID=28&amp;type=article</a><br />
This is a good url: <a href="http://www.friendly.com/index/menuID_28-type_article" target="_blank" rel="noopener" class="mycode_url">www.friendly.com/index/menuID_28-type_article</a><br />
<br />
My solution is to the URL processing in PHP. If you follow these steps you will have your own Apache compatible URL rewrite engine in no time.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Step 1.</span><br />
<br />
In your .htaccess file (If you don't have one, then create a new one in the folder where your index.php resides) add the following:<br />
<br />
&lt;FilesMatch "index"&gt;<br />
    ForceType application/x-httpd-php<br />
&lt;/FilesMatch&gt;<br />
<br />
This simply tells your apache server to treat "index" in the url as "index.php". If you are using a server other than apache, then you will need to configure it to do this.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Step 2.</span><br />
<br />
Implement the class below so that an instance is create each time index.php is executed. What this does is it takes the special url <a href="http://www.friendly.com/index/menuID_28-type_article" target="_blank" rel="noopener" class="mycode_url">www.friendly.com/index/menuID_28-type_article</a> and splits it into <a href="http://www.friendly.com/index/" target="_blank" rel="noopener" class="mycode_url">www.friendly.com/index/</a> and menuID_28-type_article strings, then it creates an array:<br />
<br />
array['menuID'] = 28<br />
array['type'] = article<br />
<br />
You cannot use &#36;_GET['paramName'], instead call getItem(&#36;key) method in UrlFilter passing the name of the parameter you want, for exaple: &#36;this-&gt;urlFilter -&gt; getItem("menuID").<br />
<br />
You can use any number of parameters, and name them as you wish, all you have to do is use the getItem() method and you got yourself nice URLs. Ofcourse you will need to build your links correctly for this to work, use getOriginalUrl() for this, then add your parameters to it: /param_value-param2_value2-param3_value3  and so on... <br />
<br />
// constructs search friendly urls and create correct url paths for links and images<br />
<br />
class UrlFilter {<br />
    var &#36;origUrl;<br />
    var &#36;numOfItems;<br />
    var &#36;itemsMap;<br />
<br />
    function UrlFilter()<br />
    {<br />
        &#36;this-&gt;processURI();   <br />
        &#36;this-&gt;constructBaseUrl();<br />
    }<br />
<br />
    function processURI()<br />
    {<br />
        &#36;array = explode("index", &#36;_SERVER['PHP_SELF']);<br />
        &#36;newUrl = str_replace("/", "", &#36;array[count(&#36;array)-1]);<br />
        &#36;array = explode("-", &#36;newUrl);<br />
        &#36;num = count(&#36;array);<br />
        &#36;this-&gt;numOfItems = &#36;num;<br />
        &#36;url_array = array();<br />
<br />
        &#36;items = explode("-", &#36;newUrl);<br />
        &#36;num = count(&#36;items);<br />
        for (&#36;i = 0 ; &#36;i &lt; &#36;num ; &#36;i++) {<br />
            &#36;item = explode("_", &#36;items[&#36;i]);<br />
            &#36;this-&gt;itemsMap[&#36;item[0]] = &#36;item[1] ;<br />
        }<br />
    }<br />
<br />
    function constructBaseUrl()<br />
    {<br />
        // need to construct the original url<br />
        &#36;array = explode("index", &#36;_SERVER['PHP_SELF']);<br />
        &#36;num = count(&#36;array);<br />
        &#36;this-&gt;origUrl = "";<br />
        for (&#36;i = 0; &#36;i &lt; &#36;num-1 ; &#36;i++) {<br />
            &#36;this-&gt;origUrl = &#36;this-&gt;origUrl . &#36;array[&#36;i];<br />
        }<br />
    }<br />
<br />
    function getItem(&#36;key)<br />
    {<br />
        if (array_key_exists(&#36;key, &#36;this-&gt;itemsMap)) {<br />
            return &#36;this-&gt;itemsMap[&#36;key];<br />
        } else {<br />
            return null;<br />
        }<br />
    }<br />
<br />
    function getOriginalUrl()<br />
    {<br />
        return &#36;this-&gt;origUrl . "index";<br />
    }<br />
<br />
    function getBaseUrl()<br />
    {<br />
        return &#36;this-&gt;origUrl;<br />
    }<br />
<br />
}]]></description>
			<content:encoded><![CDATA[This is one version of URL rewrite engine, which is not dependent on Apache mod_rewrite. It is relatively easy to implement in other systems or to adapt to your specs. We currently use this version on some of our <br />
<br />
This is an evil url:  <a href="http://www.notfriendly.com/index.php?menuID=28&amp;type=article" target="_blank" rel="noopener" class="mycode_url">www.notfriendly.com/index.php?menuID=28&amp;type=article</a><br />
This is a good url: <a href="http://www.friendly.com/index/menuID_28-type_article" target="_blank" rel="noopener" class="mycode_url">www.friendly.com/index/menuID_28-type_article</a><br />
<br />
My solution is to the URL processing in PHP. If you follow these steps you will have your own Apache compatible URL rewrite engine in no time.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Step 1.</span><br />
<br />
In your .htaccess file (If you don't have one, then create a new one in the folder where your index.php resides) add the following:<br />
<br />
&lt;FilesMatch "index"&gt;<br />
    ForceType application/x-httpd-php<br />
&lt;/FilesMatch&gt;<br />
<br />
This simply tells your apache server to treat "index" in the url as "index.php". If you are using a server other than apache, then you will need to configure it to do this.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Step 2.</span><br />
<br />
Implement the class below so that an instance is create each time index.php is executed. What this does is it takes the special url <a href="http://www.friendly.com/index/menuID_28-type_article" target="_blank" rel="noopener" class="mycode_url">www.friendly.com/index/menuID_28-type_article</a> and splits it into <a href="http://www.friendly.com/index/" target="_blank" rel="noopener" class="mycode_url">www.friendly.com/index/</a> and menuID_28-type_article strings, then it creates an array:<br />
<br />
array['menuID'] = 28<br />
array['type'] = article<br />
<br />
You cannot use &#36;_GET['paramName'], instead call getItem(&#36;key) method in UrlFilter passing the name of the parameter you want, for exaple: &#36;this-&gt;urlFilter -&gt; getItem("menuID").<br />
<br />
You can use any number of parameters, and name them as you wish, all you have to do is use the getItem() method and you got yourself nice URLs. Ofcourse you will need to build your links correctly for this to work, use getOriginalUrl() for this, then add your parameters to it: /param_value-param2_value2-param3_value3  and so on... <br />
<br />
// constructs search friendly urls and create correct url paths for links and images<br />
<br />
class UrlFilter {<br />
    var &#36;origUrl;<br />
    var &#36;numOfItems;<br />
    var &#36;itemsMap;<br />
<br />
    function UrlFilter()<br />
    {<br />
        &#36;this-&gt;processURI();   <br />
        &#36;this-&gt;constructBaseUrl();<br />
    }<br />
<br />
    function processURI()<br />
    {<br />
        &#36;array = explode("index", &#36;_SERVER['PHP_SELF']);<br />
        &#36;newUrl = str_replace("/", "", &#36;array[count(&#36;array)-1]);<br />
        &#36;array = explode("-", &#36;newUrl);<br />
        &#36;num = count(&#36;array);<br />
        &#36;this-&gt;numOfItems = &#36;num;<br />
        &#36;url_array = array();<br />
<br />
        &#36;items = explode("-", &#36;newUrl);<br />
        &#36;num = count(&#36;items);<br />
        for (&#36;i = 0 ; &#36;i &lt; &#36;num ; &#36;i++) {<br />
            &#36;item = explode("_", &#36;items[&#36;i]);<br />
            &#36;this-&gt;itemsMap[&#36;item[0]] = &#36;item[1] ;<br />
        }<br />
    }<br />
<br />
    function constructBaseUrl()<br />
    {<br />
        // need to construct the original url<br />
        &#36;array = explode("index", &#36;_SERVER['PHP_SELF']);<br />
        &#36;num = count(&#36;array);<br />
        &#36;this-&gt;origUrl = "";<br />
        for (&#36;i = 0; &#36;i &lt; &#36;num-1 ; &#36;i++) {<br />
            &#36;this-&gt;origUrl = &#36;this-&gt;origUrl . &#36;array[&#36;i];<br />
        }<br />
    }<br />
<br />
    function getItem(&#36;key)<br />
    {<br />
        if (array_key_exists(&#36;key, &#36;this-&gt;itemsMap)) {<br />
            return &#36;this-&gt;itemsMap[&#36;key];<br />
        } else {<br />
            return null;<br />
        }<br />
    }<br />
<br />
    function getOriginalUrl()<br />
    {<br />
        return &#36;this-&gt;origUrl . "index";<br />
    }<br />
<br />
    function getBaseUrl()<br />
    {<br />
        return &#36;this-&gt;origUrl;<br />
    }<br />
<br />
}]]></content:encoded>
		</item>
	</channel>
</rss>