HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/xampp/htdocs/phpmailer/ipfinal.php
<html><head><meta http-equiv="refresh" content="600;url=ip2final.php"></head><body>
<?

//code has been updated to only send email if the ip has changed.  no more full mailboxes.
//you must enable read and write permission on the ipcheck.txt file

$url = 'http://checkip.dyndns.org/';

$raw = file_get_contents($url);

//$newlines = array("\t","\n","\r","\x20\x20","\0","\x0B");

//$content = str_replace($newlines, "", html_entity_decode($raw));

//$start = strpos($content,'^');

//$end = strpos($content,'?',$start) + 8;

//$ip = substr($content,$start,$end-$start);

echo "{$raw}"; //this is the external ip you can pop in anywhere.
//echo "{$ip}";
$myFile = "ipcheck.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 1000);
fclose($fh);
if ($raw == $theData) { die; } 
else { $fw = fopen($myFile, "w");
fwrite ($fw, $raw);
fclose ($fw); 
include("phpmailer/class.phpmailer.php");
//ini_set("include_path", ".:/var/www/phpmailer/");
//require("class.phpmailer.php");
//require("class.smtp.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "smtp.gmail.com";  // specify main and backup server
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->SMTPSecure = "ssl";
$mail->Username = "[email protected]";  // SMTP username
$mail->Password = "YOURPASSWORD"; // SMTP password
$mail->Port       = 465;
$mail->From = "[email protected]";
$mail->FromName = "YOURNAME";
$mail->AddAddress("[email protected]", "villain");
//$mail->AddAddress("[email protected]");                  // name is optional
$mail->AddReplyTo("[email protected]", "Information");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = "ip update";
$mail->Body    = "{$raw}";
$mail->AltBody = "({$raw})";
//$mail->Body    = "{$ip}";
//$mail->AltBody = "({$ip})";

if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}
echo "<br><br>";
echo "Message has been sent";
}}
//echo $myFile; for testing.
//echo $raw;
//echo $theData;

?>

<br>

<br>


<?php



?>
</body></html><?
?>