Location: PHPKode > projects > Wiki-Map > htdocs/add_waypoints.php
<?
/******************************************************************************
#   Copyright notice                                                                
#   
#   This file is part of Wiki-Map project [http://wiki-map.sourceforge.net/] 
#   Wiki-Map is free software; you can redistribute it and/or 
#   modify it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or (at your 
#   option) any later version.                                    
#
#   The GNU General Public License can be found at                        
#   http://www.gnu.org/copyleft/gpl.html.                                 
#   A copy is found in the textfile GPL and important notices to the      
#   license from the team is found in the textfile LICENSE distributed    
#   with these scripts.                                                    
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#   This copyright notice MUST APPEAR in all copies and derivatives of the script!
#*********************************************************************************
# $Source: /cvsroot/wiki-map/htdocs/add_waypoints.php,v $
# $Header: /cvsroot/wiki-map/htdocs/add_waypoints.php,v 1.3 2005/11/29 06:31:43 soumya42 Exp $
# $Author: soumya42 $

# All PHP scripts requires

dss.php          # DSS has global variables setup, and some common scripts
codepage.php     # Includes all user prompts declared as variable string for internatiolization
authorize.php    # Check authorization for running the program

All these scripts are referenced from /htdocs/ directory

# Global database variables (Defined in dss.php)
#
# 	$host      	- Database host
# 	$db_base    	- Database name
# 	$db_owner  	- Database user
# 	$db_passwd	- Database password
#
# ------------------- Your program should come below this --------------------------- -->
*/
	
 header("Cache-Control:no-cache");
 
 if ( !isset($_COOKIE["login"])){
//	echo " You have to log in to access this page<br>";
        header("Location:login.php?st=require&rt=".$_SERVER[PHP_SELF]); 
	exit();
 }

?>
<?
require_once('config.php');
require_once('codepage.php');
//require_once('authorize.php');
echo $login;
if (!isset($_POST[desc1])) {
?>
<HTML><HEAD>
<style type="text/css">
     @import url(wikimap.css);
</style>
</HEAD>
<BODY>
<H3> Add New Reference Points [User: <? echo $_COOKIE['name']; ?>] </H3>
<FORM method=POST action="">
<table><tr><th>Description</th><th>Type</th><th>Longitude</th><th>Latitude</th></tr>
<?
for ($i=0; $i<10; $i++){
echo "<tr><td><input type=text name=desc$i size=60></td>";
echo ("<td>
<select name=\"type$i\" default=null>
<option value=\"null\"	  >- Select -</option>
<option value=\"RdJnc\" >Road Jn</option>
<option value=\"FlyOv\" >Fly over</option>
<option value=\"Bridg\" >Bridge</option>
<option value=\"PetPu\" >Petrol Pump</option>
<option value=\"MetSt\" >Metro Stn</option>
<option value=\"RlySt\" >Rly. Station</option>
<option value=\"Park \" >Park</option>
<option value=\"Collg\" >College</option>
<option value=\"Schol\" >School</option>
<option value=\"Hotel\" >Hotel</option>
<option value=\"Cbldg\" >Comm Bldg</option>
<option value=\"Hosp.\">Hospital</option>
<option value=\"Monmt\">Monument</option>
<option value=\"Airpt\" >Airport</option>
<option value=\"Other\" >Other</option>
</td>");
echo "<td> <input type=text name=longt$i size=10 value='xx.xxxxxxx'></td>";
echo "<td> <input type=text name=lat$i size=10 value='xx.xxxxxxx'></td>
</tr>";
}
?>
</table>
Valid From: <input type=text name=v_fr size=11 value='YYYY-MM-DD'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Valid Upto: <input type=text name=v_upto size=10 value='2099-12-31'>
Data reliability:
<select name=reliab default=0>
<option value='0'> - Select - </option>;
<option value='1'>Guess</option>;
<option value='2'>Eye estimation</option>;
<option value='3'>Measured from a map</option>;
<option value='4'>Converted from dist scale</option>";
<option value='5'>Read out of web map</option>;
<option value='6'>Published figure</option>;
<option value='7'>Reading from hand held GPS</option>;
<option value='8'>GPS reading cross validated</option>;
<option value='9'>Accurate Survey</option>;
</select>
Datum:
<select name=datum default=0>
<option value='0'> - Select - </option>;
<option value='NA'> - Do not know - </option>;
<option value=\'	AIRY	'>	Airy 1830	</option>
<option value=\'	MAIRY	'>	Modified Airy	</option>
<option value=\'	AUNAT	'>	Australian National	</option>
<option value=\'	NAMB	'>	Bessel 1841 (Namibia)	</option>
<option value=\'	BESSEL	'>	Bessel 1841  	</option>
<option value=\'	CLARKE41	'>	Clarke 1866	</option>
<option value=\'	CLARKE80	'>	Clarke 1880	</option>
<option value=\'	EVST30	'>	Everest (India 1830)	</option>
<option value=\'	EVST30	'>	Everest (Sabah Sarawak)   	</option>
<option value=\'	EVST56	'>	Everest (India 1956)  	</option>
<option value=\'	EVST69	'>	Everest (Malaysia 1969)   	</option>
<option value=\'	EVSTMY	'>	Everest (Malay. & Sing)   	</option>
<option value=\'	EVSTPK	'>	Everest (Pakistan)  	</option>
<option value=\'	FISC60	'>	Modified Fischer 1960  	</option>
<option value=\'	HELM06	'>	Helmert 1906 	</option>
<option value=\'	HUGH60	'>	Hough 1960 	</option>
<option value=\'	INDO74	'>	Indonesian 1974 	</option>
<option value=\'	INTL24	'>	International 1924  	</option>
<option value=\'	KRAS40	'>	Krassovsky 1940 	</option>
<option value=\'	GRS80	'>	GRS 80 	</option>
<option value=\'	SAM69	'>	South American 1969  	</option>
<option value=\'	WGS72	'>	WGS 72 	</option>
<option value=\'	WGS84	'>	WGS 84 	</option>

</select>
<br><br>
Remarks:<br>
<textarea name=comm rows=8 cols=90>Enter data source and other information</textarea><br>

<input type=submit name=submit value=SAVE>
</FORM>
</BODY>
</HTML>

<? } else { ?>

<? 
$db = mysql_connect($db_host, $db_owner, $db_passwd);
if (!$db) {

   die('Could not connect: ' . mysql_error());
   exit;
}	
$sdb = mysql_select_db($db_base,$db)  or die("Err:DB ".mysql_error()."<BR>");
$dt = date('Y-m-d h:m');
for ($i=0;$i < 10; $i++){
		$id = "desc".$i;
		$it = "type".$i;
		$ilong = "longt".$i;
		$ilat = "lat".$i;

	if ($_POST[$id] != null){
		$desc = $_POST[$id];
		$type = $_POST[$it];
		$long = $_POST[$ilong];
		$lat  = $_POST[$ilat];
		$comm = 'Datum:'.$_POST[datum].'\n '.$_POST[comm];

		$sql = "INSERT INTO waypoints values ('',";
		$sql .= "'$desc','$desc','$desc',";
		$sql .= "'$type','$_POST[v_fr]','$_POST[v_upto]','$long','$lat',";
		$sql .= "'$_COOKIE[login]','$_POST[reliab]','$dt',";
		$sql .= "'$comm');";

		$result = mysql_query($sql);

		if (!$result){
			echo '** Creation falied ** '.mysql_error().'<BR>';
		} 
	}
}
mysql_close($db);
echo "<P> Processing completed </P><A HREF='index.html'>Home</A>";
exit();

} ?>
<!--
#---------------------------- End of program --------------------------------------------
# $Log: add_waypoints.php,v $
# Revision 1.3  2005/11/29 06:31:43  soumya42
# Datum field added
#
# Revision 1.2  2005/11/21 03:37:00  soumya42
# path for css corrected
#
# Revision 1.1  2005/11/19 09:43:25  soumya42
# New addition
#
# 
-->
Return current item: Wiki-Map