Ajax software
Free javascripts
↑
Main Page
Figure 11-2
Let’s write some code, then!
Implementing Cloaking
1.
This example uses the cURL library. If you’ve prepared Apache and PHP as instructed in
Chapter 1, you should have cURL installed, otherwise it may not be enabled. To enable cURL,
open the
php.ini
configuration file (located by default in
\xampp\apache\bin
), uncomment
the following line by removing the leading semicolon, and then restart Apache:
extension=php_curl.dll
2.
You need to prepare the
simple_cloak
database table, which still store the search engine IPs.
Make sure you’ve configured your MySQL database as described in Chapter 1. Then open a
Command Prompt window, and navigate to the
mysql\bin
folder using a command like this:
cd \Program Files\xampp\mysql\bin
3.
Connect to your MySQL server using the following command, and type the
seomaster
pass-
word when asked. (If you chose another password when creating the user, type that password
instead.)
mysql -u seouser –p
Note that you can use your tool of choice to connect to the database server, instead of the command-line
utility. For example, you can use phpMyAdmin, which in a default XAMPP installation is accessible
via
http://localhost/phpmyadmin/
. The following steps will have the same effect no matter how
you’ve connected to MySQL.
4.
Type the following command to connect to the
seophp
database:
use seophp;
5.
Create the
cloak_data
and
cloak_update
tables by typing the following SQL command:
CREATE TABLE `cloak_data` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`spider_name` VARCHAR(255) NOT NULL DEFAULT ‘’,
`record_type` ENUM(‘UA’,’IP’) NOT NULL DEFAULT ‘UA’,
`value` varchar(255) NOT NULL DEFAULT ‘’,
PRIMARY KEY (`id`),
KEY `value` (`value`)
224
Chapter 11: Cloaking, Geo-Targeting, and IP Delivery
c11.qxd:c11 11:01 224
Ajax software
Free javascripts
→