<?php
if($_POST['submit']){
$ip = $_SERVER['REMOTE_ADDR'];
$db = file_get_contents("ip2.txt");
if(!strpos("$db",$ip)){
$fp = fopen("ip2.txt","w");
fwrite($fp,$db."\n".$ip);
echo 'IP Khong bi trung !!! '.$ip;
}else echo 'IP nay da bi trung';
}else{
?>
<form method="post" name= "new_add" action="ip2.php">
<br>
<input class="submit" type="submit" name="submit" value="Kiem Tra" />
</form>
<?
}
?>
php .