|
Aug
16
24
|
SimpleCloak v2 PHP Implementation |
||||||
Note: I didn't realize WP changes quotes to curly quotes to look "pretty" since version 2.1. I turned that feature off. Cut and pasting should work.Below is the main class necessary for the cloaking functionality, "SimpleCloakV2:" $__metaRobotsExcludeProxiesCallbackHTML = "; /* // load configuration file class SimpleCloakV2 // Connect to the seophp database $dbLink = SimpleCloakV2::_connect(); // if no updated version information was retrieved, abort // close connection // return true to indicate a successful update // lock the cloack_data table to avoid concurrency problems // insert the list of user agents for the spider // insert the list of IPs for the spider // inserts a new row of data to the cloaking table // build and execute the INSERT query // build and execute the DELETE query Save this file as "simple_cloak_v2.php." You will also need the configuration file (it is referenced in "simple_cloak_v2.php"):
Save this as "config.inc.php." Then, to implement:Use this SQL to create the database tables needed for the SimpleCloakV2 classRun the following queries in your mySQL database (using the mysql binary or phpmysqladmin): CREATE TABLE `cloak_data` ( CREATE TABLE `cloak_update` ( Only if you already have a "cloak_data" table (from our book or a previous version of SimpleCloak on the blog), run this SQL: ALTER TABLE cloak_data ADD `is_user_defined` ENUM('N','Y') NOT NULL; Populate the Cloaking database with the data from IPLists.comNote: This should be run periodically from a cron job to keep the data updated. It will update only once a week regardless. However, you may also put it in the footer of an application.
// load the SimpleCloakV2 library // update cloaking data and indicate the success status ?> Then pick *1* of the following methods.Note: Method #2 is a bit of a kludge, as the RewriteMap directive of Apache cannot be used in .htaccess. *It has not been tested extensively yet!* METHOD NUMBER 1 — PHP ImplementationPlace this code at the top of your application (or relevant parts thereof):
The code automatically inserts the meta tag using PHP output buffering. If you want a more custom/efficient solution, that is also possible. See the first parameter of function "metaRobotsExcludeProxies." Set to false, it will not use the output buffering, and you may use the result to effect changes in your application as desired. METHOD NUMBER 2 — .htaccess ImplementationPlace this in your .htaccess file RewriteEngine On And this is the code for proxy.php:
include ('simple_cloak_v2.inc.php'); // construct the original URL Done!
| |||||||
"24 Wise Comments Banged Out Somewhere On The Internet ..."
Hey Jamie, thanks for posting this, but I'd need the config.inc.php as well to run it. Also I wonder what the "proxy.php" is actually… that one seems to be missing too thanks
Jamie, I just figured that you cannot copy/paste the code from his blog since all those quote characters are replaced by non-code quotes … i.e. they don't work in PHP… any clue on how to copy the code to a php source? christoph
I get this error when i run the sql querie in phpmysqladmin MySQL said: Documentation what did i miss?
"SELECT cloak_data.* FROM cloak_data WHERE TRUE" Last I checked, you don't need a where clause just to always return true… Thanks for your altruistic contribution to the community here though. I don't administer any sites, so none of this applies to me, but it was nice of you to dive in and help with all this.
addendum: rewrite itself is working. However; the script isn't rewriting the html to include noindex/nofollow
Got it working thanks for making the changes
I am wondering if you could answer a few concerns brought up at this forum here are a few of them • This other site (iplists) — where does their information come from? I noticed some of the "bots" they have listed there, are not even real search engine bots. A few of them are bad bots like Naverbot more are at the forum thanks
Thanks so much for the help with this problem. I've been using some PHP tricks to deal with bad bots, but nothing this extensive. I do have a problem with implementing this script though. I get an error (Unknown column 'TRUE' in 'where clause') when it queries the database (SELECT cloak_data.* FROM cloak_data WHERE TRUE AND spider_name…) Is this related to the fact that I'm not using the latest and greatest MySQL?
Jamie, great script - just having two problem and thought I would post the question. I copied everything you said exactly. There is a descrepancy: 1. You write "Save this file as 'simple_cloak_v2.php.'" but the PHP Implementation refers to the file as simple_cloak_v2.inc.php "" So I'm confused and tried things naming both ways - no help. 2. I cannot get the update process to populate my database even though the connection is good (no errors) and the script spits back "Cloaking database updated!" - there's still no data populated in the tables. 3. I added the "" to my header.php file (hope that is supposed to work). The site renders fine only up to the first line (include_once…, etc.) but dies at $_x = SimpleCloaV2, etc… (remarking that line out allows the site to render ok) Can you help point me in the right place to look for the cause? I am at my witts end! Thanks in advance, Taylor
Don't you mean to say that the first script (above) should be saved as "simple_cloak_v2.inc.php"?
Since the user is claiming to be a SE USER AGENT and is not, would it be better to just simply show no content whatsoever or display a sitemap with links back to the site pages.
Careful when using on a Wordpress site as the database definitions clash. I got it working by changing them to this: define("USE_CUSTOM_CONNECT_CODE", 0); in the config.inc.php and then this in the main simple_cloak.v2.php file function _connect() // Connect to the seophp database return $dbLink; To use on wordpress just add the lines include_once('simple_cloak_v2.php'); to the top of the index.php file in your wordpress directory, after the
I did this on just one of my site's front page & as of today there is no cache in google searching from Canada. Dammit.
Sandy asked, "How I can check that the Cloaking is working with my application?" I just set this up on my site, and wanted to test it out… Any thoughts? Martin
I've read Dan's post too and wondered how he implemented his proxy-hack-solution. Thanks Jaimie for sharing yours
Thanks for the advice and code.I'm stuck with the auto updater. Its not allowing bots LOL. "Forbidden Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request." I'd prefer not to copy and paste into the database.
I think he got sick of everyone automating it. So add a USER_AGENT setting to cURL and I think it'll work. Let me know and I'll repost the code saying MSIE 6.0 or something.
I have been trying for a couple of days to get this to work by copy pasting it into a php file in dreamweaver. I am not sure what is wrong but i cant get the code to work out of the box. Foe example it seems that the php syntax doesn't highlight correctly and when saved and run it has parsing errors. Can you help me out with getting this working? Any help would be appreciated. Thanks
Jaimie, Re. UA, yes that works. As this is v2 of SimpleCloak and I've yet to find some elsewhere, can you please provide more context as to this upgrade? Looks like it's for adding proxies supports, however v1 is what's still linked from the "software" section hence v2's still in development(?)… all correct? Also, question for back on v1: if upon updates the table cloak)update is getting populated OK yet cloak_data isn't, how to troubleshoot? Cheers, SEO Egghead by Jaimie Sirovich » How To Guide: Prevent Google Proxy Hacking[...] Well that's where I come in. I have 2 implementations in beta (read: they work according to my tests, but I'm going to be testing more) that address the problem based on the methods the search engines cite. Then, essentially, we're using a benign form of cloaking (yes, cloaking!) to make it more difficult for bad bots, proxies, etc. to exploit us. They are located here: [...] refugeenet.org Blog » Bug en Google: tu sitio web puede ser penalizado en el buscador mediante un ‘ataque proxy’[...] esta vulnerabilidad, Google publicó un post para ayudarnos a detectar falsos robots. Además, en este post tenéis una implementación de esta detección utilizando código [...] The Binary Cult Blog » Blog Archive » Google SEO DoS Exploit[...] one needs not be a proxy to mirror and attempt to de-index, but that is the current trend. The counter, offered by Thies and designed by Jaimie Sirovich, is a PHP script that must be inserted every page [...]
|


















