Location: PHPKode > scripts > PHP GPS Locator > php-gps-locator/exec.php
<?

require_once("cls.nmeaParser.php");

$task=$_GET['task'];

?>
<html>
<head>
<link href="css/_stile.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3 align="center">GPS Server - Cultural Luggage</h3>
<form name="controller" id="controller" action="?task=start" method="POST">
<div align="center">
	<input type="submit" name="ctrl_start" id="ctrl_start" class="" value="Start" />
	&nbsp;&nbsp;
	<input type="button" name="ctrl_stop" id="ctrl_stop" class="" value="Stop" onClick="top.location='<?=$_SERVER['PHP_SELF']?>?task=stop';"/>
</div>
</form>
<?	

switch($task){

	case "start":

	set_time_limit(0); 
	
	$nmea=new nmeaParser();
	$nmea->unsetGpsLog();
	$ua=$nmea->getUserAgent();
	
	
	if(eregi("Win",$ua)) {
		$nmea->initWinSerialPort();
		$gpslog=$nmea->openWinSerialPort();
	}
	
	if(eregi("Macintosh",$ua)){
		$nmea->initBSDSerialPort();
		$gpslog=$nmea->openBSDSerialPort();
	}
	 
		while(!feof($nmea->gpslog)){
		 $buffer=fgets($nmea->gpslog);
		 $nmea->nmeaSwitcher($buffer);
		 $nmea->checkCollectionData();
		}
		
	break;
	
	case "stop":
	
		$nmea=new nmeaParser();
		$nmea->closeSerialPort();
		echo "<p>&nbsp;</p><p align=\"center\"><a href=\"".$_SERVER['PHP_SELF']."\">RESET</a></p>";
	
	break;
	
}
	
?>
</body>
</html>
Return current item: PHP GPS Locator