Max DDNS: Router soll IP auf eigenen Webspace senden anstatt DynDns

Beitrag lesen

Hi,

bitte keine sinnlosen Fullquotes!

Hallo Forum wer kennt ein simples Script für den Webspace.

ps Bitte keine Antworten warum ich nicht diesen oder anderen Dienst nehmen möchte, ganz einfach es ist eine Interresante Sache die es nachzbauen gilt Danke.

Ja was denn jetzt, willst du was "nachbauen", oder suchst du ein fertiges Script?

Wenn ersteres - dann zeig, was du bisher hast, und wo dein Problem damit liegt.

Wenn zweiteres - beim Suchen hilft eine Suchmaschine.

MfG ChrisB

Also ich empfang den router hiermit nicht

<?php

$name = 'daten.txt'; // file for datastoring

$reloadlock = 0; // ReloadLoggingLock. If activated counter does not increase if reloading $useronlinetime = 1000; // Set the range in seconds while a user is regarded as online

$splitmode = 1; // Enable split mode to avoid getting a huge datastoringfile. Make sure that chmod 777 is set on the whole directory! $splitsize = 500000; // Split  datastoringfile when splitsize (bytes) has been reached

$showcounter = 1; // Show visits $showdayvisits = 1; // Show visits per day $showlastvisit = 1; // Show last visit $showyestvisit = 1; // Show visits of yesterday $showbrowsertyp = 1; // Show browsertyp of the user $showip = 1; // Show IP addresse of the user $showdnsn = 1; // Show DNS name of the user $showuseronline = 1; // Show useronline $hidecounter = 1; // Makes the counter invisible $show_average_users_day = 1; // Show average users per day $show_average_users_month = 1; // Show average users per month

// END CONFIGUARATION

// Get global variables (command >= PHP 4.23)

$action = $_GET['action']; if ($action == 'html') {$showhtml = TRUE; }

$agent = getenv("HTTP_USER_AGENT");

// CREATE FILE

if ( file_exists( $name) == FALSE) {

$didmakefile = TRUE;

$file = fopen($name, "w"); if($file) {

fputs($file, "0#########"); fputs($file, "\r\n"); fputs($file, "\r\n");

fclose($file); } }

// END CREATE FILE

// RELOAD PROTECTION AND COUNTING LOOP

$dayusers = -3; $useronline = 1; $visitsaday = 1; $ipok = 1; $datum = date("d.m.Y"); $datumyester = $last_week = date("d.m.Y", mktime(0,0,0, date(m), date(d)-1,date(Y)));

if(getenv("HTTP_CLIENT_IP")) { $ipad = getenv("HTTP_CLIENT_IP"); } elseif(getenv("HTTP_X_FORWARDED_FOR")) { $ipad = getenv("HTTP_X_FORWARDED_FOR"); } else { $ipad = getenv("REMOTE_ADDR"); } $ipad = substr($ipad, 0,14);

// DATAFILE2SPLIT INSERT

if (filesize ($name) >= $splitsize && $splitmode == 1)

{

$file = fopen ($name, "r"); while (!feof($file)) {     $i++;     $buffer = fgets($file);     if ($i == 1 ) {$countrebuild = $buffer; }     $fsarray[$i] = $buffer; } fclose($file);

$nettoarray = sizeof($fsarray); $divarrays = floor($nettoarray/2);

$layout = array_slice ($fsarray, 1, $divarrays); $layin = array_slice ($fsarray, $divarrays, $divarrays);

for ($i = 1; $i <= sizeof($layin); $i++) { $layin[$i]; $layinF .= $layin[$i]; }

for ($i = 1; $i <= sizeof($layout); $i++) { $layoutF .= $layout[$i]; }

$datumB  = date("d-m-y-H-i");

$fileB = fopen ('Router_Auswertung'.$datumB.'.txt', "w"); fputs($fileB, $layoutF); fclose($fileB);

$file = fopen ($name, "w"); fputs($file,  trim($countrebuild)); fputs($file, "\r\n"); fputs($file, "\r\n"); fputs($file, $layinF); fclose($file);

}

// END DATAFILE2SPLIT INSERT

$file = fopen ($name, "r"); while (!feof($file)) {     $buffer = fgets($file);

// USRERONLINE INSTERT

if (strpos($buffer, 'T') == 15 ) {

$dayof = substr($buffer, 21,2); $monthof = substr($buffer, 24,2); $yearof = substr($buffer, 27,4);

$hourof = substr($buffer, 34,2); $minof = substr($buffer, 37,2); $secof = substr($buffer, 40,2);

$timerec =  mktime($hourof, $minof, $secof , $monthof, $dayof, $yearof); $realtime = time();

if (($realtime-$timerec) <= $useronlinetime) { if (strpos($buffer, $ipad) == false) {$useronline++;}} // refresh-counting protection

}

// END USRERONLINE INSTERT

// DAYCOUNTER INSTERT

if ($buffer <> '' ) {$lastline = $buffer;} if (strpos($buffer, $datum) <> false) { if (strpos($buffer, $ipad) <> false) {$ipok = 0;} if (strpos($buffer, $ipad) == false) {$visitsaday++;} }

if (strpos($buffer, $datumyester) <> false) {$visitsyester++; }

// END DAYCOUNTER INSTERT

// RELATIVE COUNTING INSERT

$dayusers++;

if ($oneoftwo == FALSE) { if ($sameday <> $dayof) {$days++;} if ($samemonth <> $monthof) {$months++;} $sameday = $dayof; $samemonth = $monthof; $oneoftwo = TRUE; }

else { if ($sameday <> $dayof) {$days++;} if ($samemonth <> $monthof) {$months++;} $sameday = $dayof; $samemonth = $monthof; $oneoftwo = FALSE; }

}

if ($didmakefile ==  FALSE) { $average_users_day = round(($dayusers/$days),0); $average_users_month = round(($dayusers/$months),0); } else { $average_users_day = 0; $average_users_month = 0; }

// END RELATIVE COUNTING INSERT

fclose ($file);

// HTML LIST OUTPUT

if ($showhtml) {

$bgs = 0;

echo '<html> <head> <title>Auswertung</title>

<style type="text/css"> <!-- td { font-family : verdana, arial; font-size : 11px; color : #000000; } //--> </style> </head> <body>  (please wait while loading...)<br><br> <table border="0" cellpadding="0" cellspacing="2"  width="1800">   <tr>     <td width="75"><b>Visitor</b></td>     <td width="129"><b>Time</b></td>     <td width="100"><b>Router-IP</b></td>     <td width="300"><b>DNS-NAME</b></td>     <td width="590"><b>Browser</b></td>     <td width="400"><b>Referer</b></td>   </tr>   <table>';

$file = fopen ($name, "r");

$buffer = fgets($file, 4096);

while (!feof($file)) { $hr++;

$buffer = fgets($file, 4096);

if ($hr > 1 )

{

if ($bgs == 0 ) {$BGC = '#eaeaea'; $BGC2 = '#d4d4d4'; $bgs = 1; } else { $BGC = '#ffffff'; $BGC2 = '#e9e9e9'; $bgs = 0; }

$buffer= eregi_replace("<", " ", $buffer); $buffer= eregi_replace(">", " ", $buffer);

echo '<table border="0" cellpadding="0" cellspacing="2"  width="1800">   <tr>';

$f1 =  substr($buffer, 2,13); echo '<td  width="85" bgcolor='.$BGC.'>'.$f1.'</td>';

$f2 =  substr($buffer, 23,24); echo '<td width="129" bgcolor='.$BGC2.'>'.$f2.'</td>';

$f3 =  trim(substr($buffer, 51,18)); echo '<td width="100" bgcolor='.$BGC.'>'.$f3.'</td>';

$f4 =  trim(substr($buffer, 79,47)); echo '<td width="300"bgcolor='.$BGC2.'>'.$f4.'</td>';

$f5 =  substr($buffer, 127,92); echo '<td width="590"bgcolor='.$BGC.'>'.$f5.'</td>';

$f6 =  substr($buffer, 225,strlen($buffer));

if (strlen($f6) >= 5  ) { $f6b = $f6; if (strlen($f6) >= 75 ) { $f6 = substr($f6, 0, 75); $f6 = $f6.'<b>...</b>'; } echo '<td width="400" bgcolor='.$BGC2.'><a href="'.$f6b.'"  target="_new">'.$f6.'</a></td>'; } else { echo '<td width="400" bgcolor='.$BGC2.'></td>';}

echo '</tr></table>'; } } fclose ($file); echo '<br>Users: ';

}

// END HTML LIST OUTPUT

// WRITE COUNTERVALUE

$file = fopen($name, "r+"); $count = fgets($file, 4096); $count = trim($count);

if ($ipok == 1) { $count = $count+1;} $count = $count+0;

rewind($file);

if ($showhtml == FALSE ) { fputs($file, $count);  }

fclose($file);

if ($showhtml == FALSE )  {

// END WRITE COUNTERVALUE

// LOGGING

if ($reloadlock == 0) { $ipok = 1;}

if ($ipok == 1) {

$datum =date("d.m.Y - H:i:s ");; $from = $HTTP_REFERER; $dns = @gethostbyaddr($ipad); if ($dns == '') {$dns = @gethostbyaddr(getenv("REMOTE_ADDR"));}

if ($from == '') {$from = '';}

$lange = strlen($ipad);

for ($i = 1; $i <= (16-$lange); $i++) {    $leer= $leer." "; }

$lange =  strlen($agent); if (strlen($agent) > 90 ) { $agent = substr($agent, 0,90); }

if ($lange < 91) { for ($i = 1; $i <= (90-$lange); $i++) {    $leer2= $leer2." "; } }

$lange =  strlen($dns); if (strlen($dns) > 46 ) { $dns = substr($dns, 1,46); }

if ($lange < 47) { for ($i = 1; $i <= (46-$lange); $i++) {    $leer3= $leer3." "; } }

// MAKE ZEROS

for ($i = 1; $i <= 10-strlen($count); $i++) {     $null = $null.'0'; }

$zeile= "# $null$count - TIME: $datum IP: $ipad $leer DNS-Name: $dns $leer3 $agent $leer2 FROM: $from";

$file = fopen($name, "a"); if($file) {

fputs($file, $zeile);        fputs($file,  "\r\n");        fclose($file); } } }

// END LOGGING

// OUTPUT THE COUNTERVALUES

if ($showhtml) { $hidecounter = 0; $showcounter = 1; $showdayvisits = 1; $showlastvisit = 1; $showyestvisit = 1; $showbrowsertyp = 1; $showip = 1; $showdnsn = 1; $showuseronline = 1; $show_average_users_day = 1; $show_average_users_month = 1; }

if ($hidecounter == 0 )  {

if ($showcounter == 1) { echo $count;} if ($showdayvisits == 1) { echo ' - '.$visitsaday.' today';} if ($showyestvisit   == 1) { echo ' - '.$visitsyester.' yesterday';} if ($showlastvisit   == 1) { echo ' - last visit '.substr($lastline,33,6);} if ($showdnsn   == 1) { echo ' - Your DNS: '.@gethostbyaddr(getenv("REMOTE_ADDR"));} if ($showip  == 1) { echo ' - Your IP: '.$ipad;} if ($showbrowsertyp   == 1) { echo ' - Your Browsertyp: '.$agent;} if ($showuseronline   == 1) { echo ' - '.$useronline.' user online';} if ($show_average_users_day == 1) { echo ' - '.$average_users_day.' average per day';} if ($show_average_users_month == 1) { echo ' - '.$average_users_month.' average per month';}

} ?>