Hi, I need a simple PHP script but I can't code it properly. It's a thing with Apache2 with URL Rewrite but I don't know how to make it. The script have to perform this task: IF the visitor comes from[LIST OF SITES] THAN display something ELSE display something else For example: if the visitor comes from digital point serve <html> <head> <title>Page 1</title> </head> <body> --Something-- </body> </html> Else <html> <head> <title>Page 2</title> </head> <body> --Something else-- </body> </html> In the first html piece of code I will need to put also a javascript script. I've seen someone posted something similar http://forums.digitalpoint.com/showthread.php?t=283871 I'm willing to pay the get the work done.
It's doable, but not reliable. The referer is sent by the browser, and not all browsers send it by default. And/or it can be disabled and modified easily. So simply put, you can't trust it.
You can do a simple SQL to compare the visitor's referer with your list of sites ex: $query = mysql_query("SELECT * FROM `sites_table` WHERE `sites` = `".$_SERVER['HTTP_REFERRER']."`") or die (mysql_error()); if(mysql_num_rows($query)>0) {//if the referer is in our list of sites // Hello, you're from my list } else { // Hello, you're not from my list } PHP: I haven't tested the code, it's instructional...
<?php $match = false; $sites = array("google.com", "yahoo.com", "msn.com"); if(strlen($_SERVER['HTTP_REFERER'])) { $referer = parse_url($_SERVER['HTTP_REFERER']); $referer['host'] = str_replace("www.", "", strtolower($referer['host'])); $match = in_array($referer['host'], $sites); } if($match) { ?> <html> <head> <title>Page 1</title> </head> <body> --Something-- </body> </html> <?php } else { ?> <html> <head> <title>Page 2</title> </head> <body> --Something else-- </body> </html> <?php } ?> PHP:
How can you specify a specific url with sokickit's version. So it only cloaks 1 refering page on the whole domain, such as yoursite.com/thepageIwantRefererCloaked for only 1 page on the site
sorry...........basicly how do you cloak based on a specific refering page, without cloaking the whole domain.