/ Published in: PHP
Serverside script for a personal DynDNS service.
Works together with a clientside script written in ruby [ http://snipplr.com/view/55484/own-dyndns-service-clientside-script/ ] .
Redirect to current saved IP(http, port 80):
http://dynDns.yourveryownhost.com/
Update with current IP:
http://dynDns.yourveryownhost.com/?updateIp
Show saved IP:
http://dynDns.yourveryownhost.com/?showIp
The getIpAddr-function is based on a blog-post written by Roshan Bhattarai [ http://roshanbh.com.np/2007/12/getting-real-ip-address-in-php.html ]
Works together with a clientside script written in ruby [ http://snipplr.com/view/55484/own-dyndns-service-clientside-script/ ] .
Redirect to current saved IP(http, port 80):
http://dynDns.yourveryownhost.com/
Update with current IP:
http://dynDns.yourveryownhost.com/?updateIp
Show saved IP:
http://dynDns.yourveryownhost.com/?showIp
The getIpAddr-function is based on a blog-post written by Roshan Bhattarai [ http://roshanbh.com.np/2007/12/getting-real-ip-address-in-php.html ]
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* Setup */ $ipFile = "storeFile.txt"; { echo 'IP set.'; } else { $ip = $content[0]; echo showIpAddr($ip); else redirectIpAddr($ip, 'http','80'); } function redirectIpAddr($ip, $protocol, $port) { echo "No IP set."; else } function showIpAddr($ip) { $ipInfo = '<h1>IP Status</h1>'. return $ipInfo; } function getIpAddr() { # function based on [ http://roshanbh.com.np/2007/12/getting-real-ip-address-in-php.html ] return $_SERVER['HTTP_CLIENT_IP']; return $_SERVER['HTTP_X_FORWARDED_FOR']; else return $_SERVER['REMOTE_ADDR']; }
URL: http://madcity.at/