svn commit: r314 - trunk/mapbender/http/php/mod_changeEPSG_dynamic.php

uli at osgeo.org uli at osgeo.org
Tue May 16 08:25:38 EDT 2006


Author: uli
Date: 2006-05-16 12:25:38+0000
New Revision: 314

Modified:
   trunk/mapbender/http/php/mod_changeEPSG_dynamic.php

Log:
db_prep_query included

Modified: trunk/mapbender/http/php/mod_changeEPSG_dynamic.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_changeEPSG_dynamic.php?view=diff&rev=314&p1=trunk/mapbender/http/php/mod_changeEPSG_dynamic.php&p2=trunk/mapbender/http/php/mod_changeEPSG_dynamic.php&r1=313&r2=314
==============================================================================
--- trunk/mapbender/http/php/mod_changeEPSG_dynamic.php	(original)
+++ trunk/mapbender/http/php/mod_changeEPSG_dynamic.php	2006-05-16 12:25:38+0000
@@ -45,51 +45,59 @@
 $gui_id = $_SESSION["mb_user_gui"];
 $con = db_connect($DBSERVER,$OWNER,$PW);
 db_select_db(DB,$con);
-$sql = "SELECT e_target FROM gui_element WHERE e_id = 'changeEPSG' AND fkey_gui_id = '".$gui_id."'";
-$res = db_query($sql);
+$sql = "SELECT e_target FROM gui_element WHERE e_id = 'changeEPSG' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql,$v,$t);
 $cnt_gui_wms = 0;
 $cnt_epsg_wms = 0;
 $cnt_layer_wms = 0;
 
-/*get allocated wms from allocated gui  ********************************************************************************************/
-$sql_gui_wms = "SELECT fkey_wms_id FROM gui_wms WHERE fkey_gui_id IN (";
-$sql_gui_wms .= "'".$gui_id."'";
-$sql_gui_wms.= ") ORDER BY fkey_wms_id";
-# echo"$sql_gui_wms";
-$res_gui_wms = db_query($sql_gui_wms);
+/*get allocated wms from allocated gui  ***********************************************************/
+$sql_gui_wms = "SELECT fkey_wms_id FROM gui_wms WHERE fkey_gui_id = $1 ORDER BY fkey_wms_id";
+$v = array($gui_id);
+$t = array('s');
+$res_gui_wms = db_prep_query($sql_gui_wms,$v,$t);
 while(db_fetch_row($res_gui_wms)){
 	$fkey_gui_id[$cnt_gui_wms] = db_result($res_gui_wms,$cnt_gui_wms,"fkey_gui_id");
 	$fkey_wms_id_1[$cnt_gui_wms] = db_result($res_gui_wms,$cnt_gui_wms,"fkey_wms_id");
 	$cnt_gui_wms++;
 }					 
-/*get allocated wms from allocated gui  ********************************************************************************************/
-/*get allocated layer_id from allocated gui  ********************************************************************************************/
+/*get allocated wms from allocated gui  ***********************************************************/
+/*get allocated layer_id from allocated gui  ******************************************************/
+$v = array();
+$t = array();
 $sql_layer_wms = "SELECT  layer_id FROM layer WHERE fkey_wms_id IN (";
 for($i=0; $i<count($fkey_wms_id_1); $i++){
 	if($i>0){ $sql_layer_wms .= ",";}
-	$sql_layer_wms .= "'".$fkey_wms_id_1[$i]."'";
+	$sql_layer_wms .= "$".($i+1);
+	array_push($v,$fkey_wms_id_1[$i]);
+	array_push($t,'i');
 }
 $sql_layer_wms.= ") ORDER BY layer_id";
 
-$res_layer_wms = db_query($sql_layer_wms);
+$res_layer_wms = db_prep_query($sql_layer_wms,$v,$t);
 while($row = db_fetch_array($res_layer_wms)){
 	$layer_id[$cnt_layer_wms] = $row["layer_id"];
 	$fkey_wms_id[$cnt_layer_wms] = $row["fkey_wms_id"];
 	$cnt_layer_wms++;
 }
-/*get allocated wms from allocated gui  ********************************************************************************************/
+/*get allocated wms from allocated gui  ***********************************************************/
 
-/*get allocated epsg-code from allocated wms  ********************************************************************************************/
+/*get allocated epsg-code from allocated wms  *****************************************************/
 
-#$sql_epsg_layer = "SELECT DISTINCT epsg FROM layer_epsg WHERE fkey_layer_id IN (";
+$v = array();
+$t = array();
 $sql_epsg_wms = "SELECT DISTINCT wms_srs FROM wms_srs WHERE fkey_wms_id IN (";
 for($i=0; $i<count($fkey_wms_id_1); $i++){
 	if($i>0){ $sql_epsg_wms .= ",";}
-	$sql_epsg_wms .= "'".$fkey_wms_id_1[$i]."'";
+	$sql_epsg_wms .= "$".($i+1);
+	array_push($v,$fkey_wms_id_1[$i]);
+	array_push($t,'i');
 }
 $sql_epsg_wms.= ") ORDER BY wms_srs";
 
-$res_epsg_wms = db_query($sql_epsg_wms);
+$res_epsg_wms = db_prep_query($sql_epsg_wms,$v,$t);
 while($row = db_fetch_array($res_epsg_wms)){
 	$fkey_wms_id_2[$cnt_epsg_wms] = $row["fkey_wms_id"];
 	$epsg_code[$cnt_epsg_wms] = $row["wms_srs"];




More information about the Mapbender_commits mailing list