Skip to content

Instantly share code, notes, and snippets.

@zhpengg
Created February 6, 2012 09:33
Show Gist options
  • Save zhpengg/1751060 to your computer and use it in GitHub Desktop.
Save zhpengg/1751060 to your computer and use it in GitHub Desktop.
dyndns.php
<?php
$domain_list = array('deer', 'hippo', 'lion');
$domain = empty($_GET['domain']) ? '' : $_GET['domain'];
$address = empty($_GET['address']) ? '' : $_GET['address'];
if ($domain && $address && in_array($domain, $domain_list)) {
file_put_contents($domain.'.txt', $address);
echo 'OK';
} else {
echo 'Wrong parameters';
}
#!/bin/bash
domain='deer'
address=$(hostname -I | awk '{print $1}')
server="http://balblaaa.com/dyndns.php?domain=$domain&address=$address"
if curl $server; then
echo 'OK'
else
echo 'Error'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment