- Details
- Written by: Administrator
- Category: Uncategorised
- Hits: 829
Currently I'm working on an IIS and logfile parser (For my php Project - IP Data Logger) Progress is a little slow due to the fact that the last time I built a computer program it was in Visual Basic 6, so I'm basically teaching myself with this project.
- Details
- Written by: Administrator
- Category: Uncategorised
- Hits: 798
So September 26th it'll be a full year since my gastric sleeve surgery. I just wanted to add a couple pics. The one from the day after surgery, and one from today. As of today I'm 'down to 200lbs. 7/17/23
07/29/23 I weighed today and am down to 195lbs.
- Details
- Written by: Administrator
- Category: Uncategorised
- Hits: 18567
Figure it out. forward.php (Updated 04/25/2023)
Note: Make sure to set your correct default timezone in your php.ini file. Otherwise the time defaults to GMT. I designed it for IIS, but a few modifications should make it work on apache. To see this code in use go to http://98.168.104.21/
<?php
function RetrieveUserIP()
{
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$address=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif(!empty($_SERVER['HTTP_CLIENT_IP']))
{
$address=$_SERVER['HTTP_CLIENT_IP'];
}
else
{
$address=$_SERVER['REMOTE_ADDR'];
}
return $address;
}
function doesExist($checkurl): bool
{ // Use get_headers() function
$headers = @get_headers($checkurl);
// Use condition to check the existence of URL
if(!$headers || strpos( $headers[0], '200'))
{
return true;
}
else
{
return false;
}
}
$ip = RetrieveUserIP();
$query = @unserialize(file_get_contents('http://ip-api.com/php/'.$ip));
if($query && $query['status'] == 'success')
{
$city = $query['city'];
$state = $query['region'];
$country = $query['country'];
$coords = $query['lat'] . ', ' . $query['lon'];
$proxy = $query['proxy'];
}
if (empty($city)) {
$city = "NA";
}
if (empty($state)) {
$state = "NA";
}
if (empty($country)) {
$country = "NA";
}
if (empty($coords)) {
$coords = "NA" . "," . "NA";
}
if (empty($proxy)) {
$proxy = "NA";
}
$today = (date('mdY'));
$a = "c:\\inetpub\\logs\\ips\\" . $today . ".log";
$myfile = fopen($a, "a") or die("Unable to open file!");
$date = date("m-d-Y");
$time = date("H:i:s");
$txt = $date ."," . $time . "," . $ip . "," . $city . "," . $state . "," .$country . "," . $coords . "," . $proxy . "\r\n";
fwrite($myfile, $txt );
fclose($myfile);
$url = "https://" .retrieveuserip();
$url1 = "http://" .retrieveuserip();
if (doesExist($url)==true && doesExist($url1)==false)
{
if (!headers_sent())
header('Location: https://' .retrieveuserip());
exit();
}
elseif (doesExist($url1)==true && doesExist($url)==false)
{
if(!headers_sent())
{
header('Location: http://' .retrieveuserip());
exit();
}
}
elseif (doesExist($url1)==true && doesExist($url)==true)
{
if(!headers_sent())
{
header('Location: https://' .retrieveuserip());
exit();
}
}
else
if(!headers_sent())
{
header ('Location: http://www.google.com');
exit();
}
?>
Here's a sample Log File. I changed the ip addresses for privacy reasons. If I was behind a vpn or proxy, the final NA would be the Proxy, VPN or Tor exit address.
04-21-2023,14:42:19,192.168.231.2,NA,NA,NA,NA,NA,NA
04-21-2023,14:43:15,0.0.0.0,San Diego,CA,United States,32.7449, -117.165,NA
04-21-2023,14:45:49,0.0.0.0,San Diego,CA,United States,32.7449, -117.165,NA
04-21-2023,14:46:46,0.0.0.0,San Diego,CA,United States,32.7449, -117.165,NA
04-21-2023,14:47:04,192.168.231.2,NA,NA,NA,NA,NA,NA
04-21-2023,14:48:01,0.0.0.0,San Diego,CA,United States,32.7449, -117.165,NA
04-21-2023,14:52:17,0.0.0.0,San Diego,CA,United States,32.6917, -117.1151,NA
04-21-2023,14:52:19,0.0.0.0,San Diego,CA,United States,32.6917, -117.1151,NA
04-21-2023,14:57:25,192.168.231.2,NA,NA,NA,NA,NA,NA
04-21-2023,15:08:10,0.0.0.0,San Diego,CA,United States,32.7449, -117.165,NA
04-21-2023,15:09:06,192.168.231.2,NA,NA,NA,NA,NA,NA
- Details
- Written by: Administrator
- Category: Uncategorised
- Hits: 2043