ip=$1
nmblookup -A $ip
<?php
echo '<form method="POST" action="index.php?">
<textarea name="data" style=\'width:550px;height:200px;resize:none;border:4px solid #8f8f8f\'>';
$data=$_POST['data'];
echo htmlentities($data);
echo '</textarea><br><input type="submit" name="accion" value="enviar"></form>';
if ($_POST[accion]=='enviar'){
$data=highlight_string($data,true);
echo "<br>$data<br><br>";
$data=htmlspecialchars($data);
$data="<div style='background:#F5FDF4;padding:6px'>$data</div>";
echo "<textarea cols=80 rows=40>".($data)."</textarea>";
}
#!/usr/bin/php
#fix elevation of gpxfile from another gpx file with barometer
<?php
$file_in="La_Estancita_Race_2017_.gpx"; // gpx to fix
$file_in_ok="strava_full_seba.gpx"; // gpx to extract correct elevation
$file_out=substr($file_in,0,-4).'_fixed.gpx';
if (!file($file_in)) {echo "Error\n$file_in no existe.";die;}
if (!file($file_in_ok)) {echo "Error\n$file_in no existe.";die;}
$gpx1 = simplexml_load_file($file_in);
$gpx2 = simplexml_load_file($file_in_ok);
$i=0;
foreach ($gpx1->trk->trkseg->children() as $trk1) {
$lat = (string) $trk1['lat'];
$lon = (string) $trk1['lon'];
$ele = (string) $trk1->ele;
$name = (string) $trk1->name;
$newele=find_ele($lat,$lon);
if ($newele) {
<------>$gpx1->trk->trkseg->trkpt[$i]->ele=$newele;
}
$i++;
}
echo "writing $file_out\n";
file_put_contents($file_out, $gpx1->asXML());
unset($gpx1);
unset($gpx2);
die;
function find_ele($lat1,$lon1) {
$gpx2=$GLOBALS['gpx2'];
$newele=false;
$mindist=5000;
foreach ($gpx2->trk->trkseg->children() as $trk2) {
<------>$lat2 = (string) $trk2['lat'];
<------>$lon2 = (string) $trk2['lon'];
<------>$grados = rad2deg(acos((sin(deg2rad($lat1))*sin(deg2rad($lat2)))+
<------><------>(cos(deg2rad($lat1))*cos(deg2rad($lat2))*cos(deg2rad($lon1-$lon2)))));
<------>$d = round($grados * 111133.84,6);
<------>if ($d<$mindist) {
<------> $mindist=$d;
<------> $newele=(string) $trk2->ele;
<------>}
}
echo ".";
return $newele;
}