Location: PHPKode > projects > Wiki-Map > htdocs/wbpage.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!
#*********************************************************************************/
#*********************************************************************************/
if (isset($_POST[save])){
	echo <<<hd1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<META NAME="Keywords" CONTENT="Map, wikimap, wikipedia, sharing, Google Map">
	<META NAME="Description" CONTENT="Collaborative Map building tool based on Google Map to share your location and other geo-information. A knowledge repository and collection of planning tools. Allows sharing and imbedding to other website.">
   <META NAME="Author" CONTENT="hide@address.com">   
   <title>WikiMap: The map YOU made</title>
   <link rel="stylesheet" type="text/css" href="wikimap.css">    

hd1;
	echo "<div id=map>";
	include 'openDB.php';
	
	$sa = array("sp"=>300, "mp"=>480, "sl"=>240, "ml"=>480);
	$sb = array("sp"=>240, "mp"=>352, "sl"=>300, "ml"=>600);
	$km = $_POST[msize].$_POST[mlay];
	$ht = $sa[$km];
	$wt = $sb[$km];


	$rkey = rand(10,3);
	$key = md5($rkey);
	$title = addslashes($_POST[title]);
	$desc = addslashes($_POST[desc]);
	$sql = "INSERT INTO `shtags` ( `key` , `title` , `type` , `Description` ,"
				."`long` , `lat` ,`z`,`l`,`s`, `user` ) VALUES ("
				."'$key', '$title', '$_POST[type]', '$desc', '$_POST[long]',"
				." '$_POST[lat]','$_POST[z]','$_POST[mlay]','$_POST[msize]',"
				."'$COOKIE[user]')";
	$result = mysql_query($sql);
	
	if (!$result){
			echo '** Creation falied ** '.mysql_error().'<BR>\n';
	} else {
		$id = mysql_insert_id();
		$sql2 = "SELECT f_name,l_name,e_mail FROM user WHERE logname='$COOKIE[user]'";
		$result=mysql_query($sql2);
		$qv = mysql_fetch_assoc($result);
		$sub = "WikiMap code for your site";
		$body = "Hi! $qv[f_name] $qv[l_name],<BR>";
		$body .= "<P>";
		$body .= "You had opted to display a map at your website with title: $_POST[title]\n";
		$body .= "You will find the HTML code to do that below. </P>";
		$body .= "Simply copy the code from the box below and paste it in\n";
		$body .= "the HTML page to display the map.<BR>";
		$body .= "<FORM><TEXTAREA cols=100 rows=7>";
		$body .= "<!-- ############### WIKIMAP CODE STARTS ########### -->\n";
		$body .= "&lt;IFRAME src='http://www.wikimap.biz/wiki.php?id=$id&amp;key=$key' height = $ht width=$wt &gt;\n";
		$body .= "This page uses IFRAME but your browser does not support it<br>\n";
		$body .= "Its high time you change to a better browser.\n";
		$body .= "&lt;/IFRAME &gt;\n";
		$body .= "<!-- ############### WIKIMAP CODE ENDS ########### -->\n";
		$body .= "</TEXTAREA></FORM>";
		$body .= "<P>Please note: Some ad-driven free web-site does not allow IFRAME tags in their web-site.</P>";
		$body .= "If you are facing such problem your best option is to select a good Web Hosting service provider. <P>DeciGen Solutions offers some web hosting options with excellent value. You may select one of them. <br>\n<A HREF='http://www.decigen.biz/hosting.php'>Click here to check the web hosting option from <u>DeciGen Solutions</u></A>\n\n\n</P>";
		echo $body;
		//echo "<H4>Code to insert the map has been mailed to your e-mail address.</H4>";
	}
	echo "</div>";
	include "wikifoot.php"; 
	exit;
}
	//--------------------- end of data posting ------------------
if (isset($_GET[edit]) && !isset($_COOKIE[name])){
	header("Cache-Control:no-cache");
	$go = "login.php?st=require&rt=addlocn.php";
	header("Location:".$go);
	exit();
	}
	$x = (isset($_COOKIE[x]))?$_COOKIE[x]:0;
	$y = (isset($_COOKIE[y]))?$_COOKIE[y]:0;
	$z = (isset($_COOKIE[z]))?$_COOKIE[z]:1;
	$x = (isset($_GET[x]))?$_GET[x]:$x;
	$y = (isset($_GET[y]))?$_GET[y]:$y;
	$z = (isset($_GET[z]))?$_GET[z]:$z;
	$_COOKIE[x] = $x;
	$_COOKIE[y] = $y;
	$_COOKIE[z] = $z;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<META NAME="Keywords" CONTENT="Map, wikimap, wikipedia, sharing, Google Map">
	<META NAME="Description" CONTENT="Collaborative Map building tool based on Google Map to share your location and other geo-information. A knowledge repository and collection of planning tools. Allows sharing and imbedding to other website.">
   <META NAME="Author" CONTENT="hide@address.com">   
   <title>WikiMap: The map YOU made</title>
   <link rel="stylesheet" type="text/css" href="wikimap.css">    
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAApL1hGE-KNQcfWmK-4HpMHRSAsL_rpfnb7R6YjdHmXm9ZuwilPhTw9DUGZeCNDTsWftNOHtjvtQkLCQ"
      type="text/javascript"></script>
    <script src="wikistd.js" type="text/javascript"></script>
	<script src="icondef.js" type="text/javascript"></script>
	<script type="text/javascript">		
    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("smap"));
		<?	echo "map.setCenter(new GLatLng($y, $x), $z);\n";?>
		}
		
       map.addControl(new GSmallMapControl());
       map.addControl(new GMapTypeControl());
       map.setMapType(G_HYBRID_MAP);
       map.addControl(new GScaleControl());
       //map.addControl(new GOverviewMapControl());
		map.enableDoubleClickZoom(); // New addn ----------------
		var bounds = map.getBounds();
		var southWest = bounds.getSouthWest();
		var northEast = bounds.getNorthEast();
		var zlevel = map.getZoom();
		var omarker = new Object();
		GDownloadUrl("points.php", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
			show_icon(map,point,markers[i].getAttribute("type"),markers[i].getAttribute("desc"));
          }
        });
	  
		GEvent.addListener(map, "moveend", function() {
			var p = map.getCenter();
			setCookie('x',p.x);
			setCookie('y',p.y);
			setCookie('z',map.getZoom());
		});
	
		GEvent.addListener(map, "click", function(overlay, point) {
          if (overlay) {
            map.removeOverlay(overlay);
			window.status = '';
			svisibility('info','hidden');
          } else {
			if (omarker){map.removeOverlay(omarker);}  
			var tmarker =   new GMarker(point);
            map.addOverlay(tmarker);
			omarker = tmarker;
			
			document.np.lat.value=point.lat();
			document.np.long.value=point.lng();
			document.np.z.value = map.getZoom();
			}
        });
	/*	*/
    }
    //]]>
    </script>
  </head>

  <body onload="load()" onunload="GUnload()">
		<div id='map'><H2 align=center>Put a map at your web-page</H2>
		<? if (isset($_POST[save])){ 
			
			echo "Code to include map in your page has been mailed.";
			echo "<FORM><INPUT type=button value=OK></FORM>";
		} else {
		?>
		</div>
		<div id="smap"></div>
		<FORM id='shinp' method=POST name=np action='#'>
			Title: <br>
			<INPUT type=text name=title SIZE=50><P>
			Type: 
			<select name='type' 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='Temple' >Religious</option>
				<option value='play' >Play Ground</option>
				<option value='Cbldg' >Comm Bldg</option>
				<option value='Shop' >Shopping Mall</option>
				<option value='Movie' >Movie</option>
				<option value='Hosp.'>Hospital</option>
				<option value='Monmt'>Monument</option>
				<option value='Airpt' >Airport</option>
				<option value='Other' >Other</option>
			</select></P>
			<P>
			Details:<BR>
			<TEXTAREA name=desc rows=5 cols=50></TEXTAREA>
			</P>
			<P>Map size:
			Small <INPUT type=radio name=msize value=s>
			Medium <INPUT type=radio name=msize value=m>
			</P><P>
			Layout: 
			Portrait<INPUT type=radio name=mlay value=p>
			Landscape <INPUT type=radio name=mlay value=l>
			</P>
			<INPUT type=hidden name=lat SIZE=20> 
			<INPUT type=hidden name=long SIZE=20>
			<INPUT type=hidden name=z>
			
			<P>Position the map correctly and select the zoom level you 
			want to show your	map initially. Click on the map to position your
			message.	 Code to display the map at your website will be
			mailed to you.</P>
			<INPUT type=submit name=save value='Send Code'>
			<INPUT type=reset name=reset Value='RESET'>
		</FORM>
		
<? }

include "wikifoot.php"; 

?>
</body>
</html>
Return current item: Wiki-Map