WebQuartet Directory philippines Text Link Ads


IP Catching

Just for educational purpose. You can limit number of IPs to get your offer or catch thieves on downloading. I don’t know where you will use this but this is simple but powerful.

Here’s the code:

<?php
$v_ip = "$REMOTE_ADDR";

$fd = fopen("visitorIPs.log", "r");
$value = "";
while(!feof($fd)){
	$value .= fread($fd, 4096);
}
fclose($fd);
$value=explode("|",$value);

if (count($value)<300) {

	$result = -1;
	for ($i = 0; $i <= count($value); $i++) {
		if (strcmp($value[$i], $v_ip) == 0) {
			$result = $i;
		}
	}

	if ($result == -1) {
		$file = fopen("visitorIPs.log", "a");
		fputs($file, $v_ip."|", strlen($v_ip."|"));
		fclose($file);

		echo "Congratulations, you made on one of the first 300 limit!";
	} else {
		echo "Thanks for visiting again!";
	}

} else {

echo "Sorry, the 300 limit is already used! Better luck on the next offer.";

}
 
?>

Save it as .php file.

Leave a Reply

You must be logged in to post a comment.

Latest News


TeliaSonera: France Télécom hangs up on Swedish operator France Télécom walks away from its bid as TeliaSonera board demand a higher price

Telecoms: Thus soars after C&W buys stake
Cable & Wireless snapped up a 29.9% stake in Thus, but fails to secure a full recommendation


Vodafone and MySpace to launch a joint mobile music platform Vodafone has struck a deal with MySpace to launch a mobile music platform, giving users the chance to present an MTV show. By Mark Sweney

C&W raises bid for Thus
Smaller telecoms company gives improved offer an unenthusiastic welcome


Bad science: Suicides, Aids, and a masts campaigner Ben Goldacre: Remarkably, suicide is not the first problem Mr Coghill has attributed to electromagnetic waves

T-Mobile ads launch in Euro 2008 semi-final
T-Mobile is using the Euro 2008 semi-final between Spain and Russia to launch a £17m ad campaign. By Mark Sweney


A Ross Dalangin's Network