WebQuartet Directory philippines Text Link Ads


Archive for February, 2008

IP Catching

Saturday, February 16th, 2008

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.

Latest News


Barratt Set To Cut 1,000 Jobs Around 1,000 jobs are expected to be axed at housebuilder Barratt Developments as it struggles with a slowing housing market.

YouTube Must Release User Details
Google has been ordered to hand over details of the viewing habits of YouTube users by a USjudge.


'Home Loans Will Be Harder To Get' It will become harder to get a mortage in the coming months as lenders tighten their criteria, the Bank of England has said.

Oil Prices Hit An All-Time High
Oil prices have set a new record above $146 a barrel - as the Prime Minister warned they could carry on rising for years to come.


Illegal File-Sharers Warned Hundreds of letters have been sent to Virgin Media customers warning them against downloading illegal music files.


A Ross Dalangin's Network