php文档:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>您的IP地址</title> </head> <body> <?php error_reporting (E_ERROR | E_WARNING | E_PARSE); if($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]){ $ip = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; } elseif($HTTP_SERVER_VARS["HTTP_CLIENT_IP"]){ $ip = $HTTP_SERVER_VARS["HTTP_CLIENT_IP"]; } elseif ($HTTP_SERVER_VARS["REMOTE_ADDR"]){ $ip = $HTTP_SERVER_VARS["REMOTE_ADDR"]; } elseif (getenv("HTTP_X_FORWARDED_FOR")){ $ip = getenv("HTTP_X_FORWARDED_FOR"); } elseif (getenv("HTTP_CLIENT_IP")){ $ip = getenv("HTTP_CLIENT_IP"); } elseif (getenv("REMOTE_ADDR")){ $ip = getenv("REMOTE_ADDR"); } else{ $ip = "Unknown"; } echo $ip; ?> </body> </html>
脚本(采用VBS发送):
Loop { URLDownloadToFile, http://thinkai.net/, ip.html FileReadLine, ip, ip.html, 10 StringSplit, var, ip, `, ip = %var1% if ip <> %old% { old = %ip% FileDelete, mail.vbs fileappend, NameSpace = `"http://schemas.microsoft.com/cdo/configuration/`"`n, mail.vbs fileappend, Set Email = CreateObject(`"CDO.Message`")`n, mail.vbs fileappend, Email.From = `"xxxxx@163.com`" `n, mail.vbs fileappend, Email.To = `"xxxxx@qq.com`" `n, mail.vbs fileappend, Email.Subject = `"IP变动邮件`"`n, mail.vbs fileappend, Email.Htmlbody = `"IP:%ip%`"`n, mail.vbs fileappend, With Email.Configuration.Fields`n, mail.vbs fileappend, .Item(NameSpace&`"sendusing`") = 2`n, mail.vbs fileappend, .Item(NameSpace&`"smtpserver`") = `"smtp.163.com`" 'SMTP服务器地址`n, mail.vbs fileappend, .Item(NameSpace&`"smtpserverport`") = 25`n, mail.vbs fileappend, .Item(NameSpace&`"smtpauthenticate`") = 1`n, mail.vbs fileappend, .Item(NameSpace&`"sendusername`") = `"xxxxx`" '邮箱账号`n, mail.vbs fileappend, .Item(NameSpace&`"sendpassword`") = `"xxxxx`"'邮箱密码`n, mail.vbs fileappend, .update`n, mail.vbs fileappend, End With`n, mail.vbs fileappend, Email.Send`n, mail.vbs run, mail.vbs } Sleep, 60000 }
49 queries in 1.277 seconds |