Traffic Umrechner
[include file=sol-includes/trafficcalc.php iframe=true width=300 height=170 scrolling=no]

Source-Code

$xajax = new xajax();

$xajax->configure("javascript URI","/xajax/");
$xajax->registerFunction("mbit2traffic");
$xajax->registerFunction("traffic2mbit");

function mbit2traffic($arg)
{
    $objResponse = new xajaxResponse();
	if( ! ereg("^[0-9]{1,12}$",$arg['d']) )	{
		$objResponse->alert("Specified Value for day is invalid!");
		return $objResponse;
	}
	if( ! ereg("^[0-9\.]{1,12}$",$arg['m']) )	{
		$objResponse->alert("Specified Value for Mbit is invalid!");
		return $objResponse;
	}
	$traffic = round(10.5466667*$arg['d']*$arg['m']);
	#$objResponse->alert(var_export($arg,1));
    $objResponse->assign("traffic","value", $traffic);
    return $objResponse;
}

function traffic2mbit($arg)
{
    $objResponse = new xajaxResponse();
	if( ! ereg("^[0-9]{1,12}$",$arg['d']) )	{
		$objResponse->alert("Specified Value for day is invalid!");
		return $objResponse;
	}
	if( ! ereg("^[0-9]{1,12}$",$arg['t']) )	{
		$objResponse->alert("Specified Value for Traffic is invalid!");
		return $objResponse;
	}
	$traffic = round( $arg['t']/$arg['d']/10.5466667, 2 );
	#$objResponse->alert(var_export($arg,1));
    $objResponse->assign("mbit","value", $traffic);
    return $objResponse;
}

$xajax->processRequest();
 

Amazon Logo Diesen Blog unterstützen?
Bestell dir doch etwas bei Amazon. Nutze diesen speziellen Link, es kostet dich nichts extra und für jeden Kauf darüber erhalte ich eine kleine Gutschrift. Danke!
✉ Marco Götze//

Kommentare

noch 0 Einträge