noDynDns.php
bearbeitet von Jörg ReinholzMoin!
> ja das Problem ist die IP :)
Na dann:
~~~php
<?php
# file: noDynDns.php
# Konfiguration:
$GeheimnisIPAbholen = 'foobar';
$GeheimnisIPSetzen = 'barfoo';
# Datei (besser außerhalb docroot):
$home_ip_file='.ht_home_ip.txt';
# Programm:
if ( $_GET['p'] == $GeheimnisIPSetzen ) {
@$old = file_get_contents($home_ip_file);
$new = $_SERVER['REMOTE_ADDR'];
if ( $old == $new ) {
header ('Content-type: text/plain');
echo "bleibt:" . $old;
exit;
} else {
file_put_contents($home_ip_file, $new);
header ('Content-type: text/plain');
echo "gesetzt:" . $new;
exit;
}
} elseif ( $_GET['p'] == $GeheimnisIPAbholen ) {
@$old = file_get_contents($home_ip_file);
header ('Content-type: text/plain');
echo $old;
exit;
} else {
header ('Content-type: text/plain');
header('HTTP/1.0 404 Not Found');
exit;
}
~~~
cronjob, aller 5 Minuten reicht
wget http[s]://example.com/noDynDns.php?p=Geheimnis1
Abhol-URL:
http[s]://example.com/noDynDns.php?p=Geheimnis2
Jörg Reinholz
noDynDns.php
bearbeitet von Jörg ReinholzMoin!
> ja das Problem ist die IP :)
Na dann:
~~~php
<?php
# file: noDynDns.php
# Konfiguration:
$GeheimnisIPAbholen = 'foobar';
$GeheimnisIPSetzen = 'barfoo';
# Datei (besser außerhalb docroot):
$home_ip_file='.ht_home_ip.txt';
# Programm:
if ( $_GET['p'] == $GeheimnisIPSetzen ) {
@$old = file_get_contents($home_ip_file);
$new = $_SERVER['REMOTE_ADDR'];
if ( $old == $new ) {
header ('Content-type: text/plain');
echo "bleibt:" . $old;
exit;
} else {
file_put_contents($home_ip_file, $new);
header ('Content-type: text/plain');
echo "gesetzt:" . $new;
exit;
}
} elseif ( $_GET['p'] == $GeheimnisIPAbholen ) {
@$old = file_get_contents($home_ip_file);
header ('Content-type: text/plain');
echo $old;
exit;
} else {
header ('Content-type: text/plain');
header('HTTP/1.0 404 Not Found');
exit;
}
~~~
cronjob, aller 5 Minuten reicht
wget http[s]://example.com/noDynDns.php?p=Geheimnis1
Abhol-URL:
http[s]://example.com/noDynDns.php?p=Geheimnis2
Jörg Reinholz
noDynDns.php
bearbeitet von Jörg ReinholzMoin!
> ja das Problem ist die IP :)
Na dann:
~~~php
<?php
# file: noDynDns.php
# Konfiguration:
$GeheimnisIPAbholen='foobar';
$GeheimnisIPSetzen='barfoo';
# Datei (besser außerhalb docroot):
$home_ip_file='.ht_home_ip.txt';
# Programm:
if ($_GET['p'] == $GeheimnisIPSetzen) {
@$old=file_get_contents($home_ip_file);
$new=$_SERVER['REMOTE_ADDR'];
if ($old==$new) {
header ('Content-type: text/plain');
echo "bleibt:" . $old;
exit;
} else {
file_put_contents($home_ip_file, $new);
header ('Content-type: text/plain');
echo "gesetzt:" . $new;
exit;
}
} elseif ($_GET['p'] == $GeheimnisIPAbholen) {
@$old=file_get_contents($home_ip_file);
header ('Content-type: text/plain');
echo $old;
exit;
} else {
header ('Content-type: text/plain');
header('HTTP/1.0 404 Not Found');
exit;
}
~~~
cronjob, aller 5 Minuten reicht
wget http[s]://example.com/noDynDns.php?p=Geheimnis1
Abhol-URL:
http[s]://example.com/noDynDns.php?p=Geheimnis2
Jörg Reinholz