Funktion für Global on auf global off umschreiben
hallo folgendes script ist für global on ausgelegt
wie kann ich das funktionsfähig machen bei globals off ****
leider weiss ich nicht wo ich da ansetzten soll
hallo folgendes script ist für global on ausgelegt
wie kann ich das funktionsfähig machen bei globals off ****
leider weiss ich nicht wo ich da ansetzten soll
PHP:
function DMStoDEC($deg,$min,$sec)
{
return $deg+((($min*60)+($sec))/3600);
}
function DECtoDMS($dec)
{
$vars = explode(".",$dec);
$deg = $vars[0];
$tempma = "0.".$vars[1];
$tempma = $tempma * 3600;
$min = floor($tempma / 60);
$sec = $tempma - ($min*60);
return array("deg"=>$deg,"min"=>$min,"sec"=>$sec);
}
// This script assumes register_globals is on ...
if(getenv("REQUEST_METHOD")=="POST")
{
if(!empty($conv_dec))
{
$dec_la = DMStoDEC($la_deg,$la_min,$la_sec);
$dec_lo = DMStoDEC($lo_deg,$lo_min,$lo_sec);
}
else if(!empty($conv_dms))
{
$la = DECtoDMS($dec_la);
$la_deg = $la["deg"];
$la_min = $la["min"];
$la_sec = $la["sec"];
$lo = DECtoDMS($dec_lo);
$lo_deg = $la["deg"];
$lo_min = $la["min"];
$lo_sec = $la["sec"];
}
}
?>
<html>
<body>
<table width="377" border="0" align="center" cellpadding="0" cellspacing="0" class="PHPSAMPLE">
<tr>
<td align="left" valign="top"><form name="form1" method="post" action="">
<table width="377" border="0" cellpadding="0" cellspacing="0" class="bodytext">
<tr>
<td width="88" valign="middle">Longitude</td>
<td width="289" valign="middle">Deg
<input name="lo_deg" type="text" class="bodytext" id="l_deg" value="<?php print($lo_deg);?>" size="5" maxlength="3">
Min
<input name="lo_min" type="text" class="bodytext" id="l_min" value="<?php print($lo_min);?>" size="5" maxlength="3">
Sec
<input name="lo_sec" type="text" class="bodytext" id="l_sec" value="<?php print($lo_sec);?>" size="15" maxlength="10">
N </td>
</tr>
<tr>
<td colspan="2" valign="middle"> </td>
</tr>
<tr>
<td valign="middle">Latitude</td>
<td valign="middle">Deg
<input name="la_deg" type="text" class="bodytext" id="la_deg" value="<?php print($la_deg);?>" size="5" maxlength="3">
Min
<input name="la_min" type="text" class="bodytext" id="la_min" value="<?php print($la_min);?>" size="5" maxlength="3">
Sec
<input name="la_sec" type="text" class="bodytext" id="la_sec" value="<?php print($la_sec);?>" size="15" maxlength="10">
W </td>
</tr>
<tr>
<td colspan="2" valign="middle"> </td>
</tr>
<tr>
<td colspan="2" valign="middle">
<input name="conv_dec" type="submit" class="PHPSAMPLE" id="Parse3" value="Convert to decimal">
</td>
</tr>
</table></form><form name="form2" method="post" action="">
<table width="377" border="0" cellpadding="0" cellspacing="0" class="bodytext">
<tr>
<td colspan="2" valign="middle"> </td>
</tr>
<tr>
<td valign="middle">Longitude</td>
<td valign="middle"><input name="dec_lo" type="text" class="bodytext" id="dec_lo3" value="<?php print($dec_lo);?>" size="20" maxlength="15"></td>
</tr>
<tr>
<td colspan="2" valign="middle"> </td>
</tr>
<tr>
<td valign="middle">Latitude</td>
<td valign="middle"><input name="dec_la" type="text" class="bodytext" id="dec_la2" value="<?php print($dec_la);?>" size="20" maxlength="15"></td>
</tr>
<tr>
<td colspan="2" valign="middle"> </td>
</tr>
<tr>
<td colspan="2" valign="middle"><input name="conv_dms" type="submit" class="PHPSAMPLE" id="conv_dms" value="Convert to DMS">
</td>
</tr>
</table>
<br>
</form></td>
</tr>
</table>
Zuletzt bearbeitet: