Maybe there is another way so I will clarify my goal to make sure the above question is the right path to take.
The situation is quite standard I gues. I have a Lan with some pc's. One of them is running as a linux server (php, mysql, ... stuff like that)
All pc's are connected to a router which grands access to the internet.
All fine so far...
Shitty thing is my ISP has dynamic IP. I like the advantages, but I need to be able to access my Lan (read: server) from the outside.
Right now I'm doing:
A shell script:
(I got this script somewhere... It's like a black box to me. I know what it does... That's all)
The php script:
Code:
<?PHP
MYSQL_CONNECT("mysql.frandt.com","[username]","[password]") OR DIE ("database benadering is mislukt.");
$db = MYSQL_SELECT_DB("ipaddress") OR DIE ("database benadering is mislukt");
$file = fopen ("http://www.whatismyip.com/", "r");
while (!feof ($file)) {
$line = fgets ($file, 1024);
/* This only works if the title and its tags are on one line */
if (eregi ("<title>(.*)</title>", $line, $out)) {
$title = $out[1];
break;
}
}
fclose($file);
$ipaddress = "";
$teller = 11;
while($title{$teller}!=' ')
{
$ipaddress=$ipaddress.$title{$teller};
$teller++;
}
$het_nu = getdate();
MYSQL_QUERY("UPDATE ipaddress SET ipaddress='".$ipaddress."', date_year=".$het_nu["year"].", date_month='".$het_nu["month"]."', date_day=".$het_nu["mday"].", date_hour=".$het_nu["hours"].", date_minute=".$het_nu["minutes"].", date_second=".$het_nu["seconds"].";")
?>
----------------------------------------------------------------------
All works, but I think there should be a better way to solve my IP problem. Can anyone help?
Thnx in advance
Paulvl