svn commit: r225 - trunk/mapbender/http/php/mod_gui_user.php
uli at osgeo.org
uli at osgeo.org
Thu May 11 02:25:36 EDT 2006
Author: uli
Date: 2006-05-11 06:25:35+0000
New Revision: 225
Modified:
trunk/mapbender/http/php/mod_gui_user.php
Log:
db_prep_query included
verification of user permissions
Modified: trunk/mapbender/http/php/mod_gui_user.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_gui_user.php?view=diff&rev=225&p1=trunk/mapbender/http/php/mod_gui_user.php&p2=trunk/mapbender/http/php/mod_gui_user.php&r1=224&r2=225
==============================================================================
--- trunk/mapbender/http/php/mod_gui_user.php (original)
+++ trunk/mapbender/http/php/mod_gui_user.php 2006-05-11 06:25:35+0000
@@ -17,14 +17,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import_request_variables("PG");
-session_start();
-
require_once("../php/mb_validateSession.php");
require_once("../../conf/mapbender.conf");
$con = db_connect($DBSERVER,$OWNER,$PW);
db_select_db(DB,$con);
$gui_id = $_SESSION["mb_user_gui"];
+import_request_variables('PG');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
@@ -60,7 +58,6 @@
}
}
</script>
-
</head>
<body>
<?php
@@ -79,17 +76,21 @@
$gui_id_array = array();
$exists = false;
-/*handle remove, update and insert**************************************************************************************/
+/*handle remove, update and insert*****************************************************************/
if($insert){
if(count($selected_user)>0){
for($i=0; $i<count($selected_user); $i++){
$exists = false;
- $sql_insert = "SELECT * from gui_mb_user where fkey_gui_id = '".$selected_gui."' and fkey_mb_user_id = '".$selected_user[$i]."'";
- $res_insert = db_query($sql_insert);
+ $sql_insert = "SELECT * from gui_mb_user where fkey_gui_id = $1 and fkey_mb_user_id = $2";
+ $v = array($selected_gui,$selected_user[$i]);
+ $t = array('s','i');
+ $res_insert = db_prep_query($sql_insert,$v,$t);
while(db_fetch_row($res_insert)){$exists = true;}
if($exists == false){
- $sql_insert = "INSERT INTO gui_mb_user(fkey_gui_id, fkey_mb_user_id) VALUES('$selected_gui', '".$selected_user[$i]."');";
- $res_insert = db_query($sql_insert);
+ $sql_insert = "INSERT INTO gui_mb_user(fkey_gui_id, fkey_mb_user_id) VALUES($1, $2)";
+ $v = array($selected_gui,$selected_user[$i]);
+ $t = array('s','i');
+ $res_insert = db_prep_query($sql_insert,$v,$t);
}
}
}
@@ -97,8 +98,10 @@
if($remove){
if(count($remove_user)>0){
for($i=0; $i<count($remove_user); $i++){
- $sql_remove = "DELETE FROM gui_mb_user WHERE fkey_mb_user_id = '".$remove_user[$i]."' and fkey_gui_id = '$selected_gui'";
- db_query($sql_remove);
+ $sql_remove = "DELETE FROM gui_mb_user WHERE fkey_mb_user_id = $1 and fkey_gui_id = $2";
+ $v = array($remove_user[$i],$selected_gui);
+ $t = array('i','s');
+ db_prep_query($sql_remove,$v,$t);
}
}
}
@@ -122,15 +125,15 @@
$cnt_user++;
}
-/*get all user from selected gui******************************************************************************/
+/*get all user from selected gui*******************************************************************/
$sql_gui_mb_user = "SELECT mb_user.mb_user_id, mb_user.mb_user_name, gui_mb_user.fkey_gui_id FROM gui_mb_user ";
$sql_gui_mb_user .= "INNER JOIN mb_user ON gui_mb_user.fkey_mb_user_id = mb_user.mb_user_id ";
-$sql_gui_mb_user .= "WHERE gui_mb_user.fkey_gui_id= '";
-
-if(!$selected_gui){$sql_gui_mb_user .= $gui_id_array[0];}
-if($selected_gui){$sql_gui_mb_user .= $selected_gui;}
-$sql_gui_mb_user .= "' ORDER BY mb_user.mb_user_name";
-$res_gui_mb_user = db_query($sql_gui_mb_user);
+$sql_gui_mb_user .= "WHERE gui_mb_user.fkey_gui_id= $1 ";
+$sql_gui_mb_user .= " ORDER BY mb_user.mb_user_name";
+if(!$selected_gui){$v = array($gui_id_array[0]);}
+if($selected_gui){$v = array($selected_gui);}
+$t = array('s');
+$res_gui_mb_user = db_prep_query($sql_gui_mb_user,$v,$t);
while($row = db_fetch_array($res_gui_mb_user)){
$user_id_gui[$cnt_gui_user] = $row["mb_user_id"];
$user_name_gui[$cnt_gui_user] = $row["mb_user_name"];
@@ -139,9 +142,9 @@
/*INSERT HTML*/
-echo "<form name='form1' action='" . $PHP_SELF . "?".SID."&e_id_css=".$_REQUEST["e_id_css"]."' method='post'>";
+echo "<form name='form1' action='" . $self ."' method='post'>";
-/*insert projects in selectbox*************************************************************************************/
+/*insert projects in selectbox*********************************************************************/
echo "<div class='text1'>GUI: </div>";
echo "<select style='background:#ffffff' class='select1' name='selected_gui' onchange='submit()' size='10'>";
for($i=0; $i<$cnt_gui; $i++){
@@ -153,7 +156,7 @@
}
echo "</select>";
-/*insert all profiles in selectbox**************************************************************************/
+/*insert all profiles in selectbox*****************************************************************/
echo "<div class='text2'>USER:</div>";
echo "<select style='background:#ffffff' class='select2' multiple='multiple' name='selected_user[]' size='$fieldHeight' >";
for($i=0; $i<$cnt_user; $i++){
@@ -161,7 +164,7 @@
}
echo "</select>";
-/*Button****************************************************************************************************/
+/*Button******************************************************************************************/
echo "<div class='button1'><input type='button' value='==>' onClick='validate(\"insert\")'></div>";
echo "<input type='hidden' name='insert'>";
@@ -169,7 +172,7 @@
echo "<div class='button2'><input type='button' value='<==' onClick='validate(\"remove\")'></div>";
echo "<input type='hidden' name='remove'>";
-/*insert container_profile_dependence and container_group_dependence in selectbox**************************************************/
+/*insert container_profile_dependence and container_group_dependence in selectbox******************/
echo "<div class='text3'>SELECTED USER:</div>";
echo "<select style='background:#ffffff' class='select3' multiple='multiple' name='remove_user[]' size='$fieldHeight' >";
for($i=0; $i<$cnt_gui_user; $i++){
More information about the Mapbender_commits
mailing list