svn commit: r876 - trunk/mapbender/http/php/mod_editUser.php

christoph at osgeo.org christoph at osgeo.org
Mon Nov 20 09:49:55 EST 2006


Author: christoph
Date: 2006-11-20 14:49:55+0000
New Revision: 876

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

Log:
* include via dirname(__FILE__)
* added function setPassword

Modified: trunk/mapbender/http/php/mod_editUser.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_editUser.php?view=diff&rev=876&p1=trunk/mapbender/http/php/mod_editUser.php&p2=trunk/mapbender/http/php/mod_editUser.php&r1=875&r2=876
==============================================================================
--- trunk/mapbender/http/php/mod_editUser.php	(original)
+++ trunk/mapbender/http/php/mod_editUser.php	2006-11-20 14:49:55+0000
@@ -19,10 +19,10 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 import_request_variables("PG");
-require_once("../../conf/mapbender.conf");
-$con = db_connect(DBSERVER,OWNER,PW);
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+$con = db_connect($DBSERVER,$OWNER,$PW);
 db_select_db(DB,$con);
-require_once("../php/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
 $self = $PHP_SELF . "?".SID."&guiID=".$_REQUEST["guiID"]."&elementID=".$_REQUEST["elementID"];
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@@ -95,6 +95,23 @@
 </head>
 <body>
 <?php
+function setPassword($password){
+	if($password != ""){
+		if (SYS_DBTYPE=="mysql"){
+			$pw = "password('".$password."')";
+		}else{
+			if (MD5 == 'false'){
+				$pw = $password;
+			}else{
+				$pw = "md5('".$password."')";
+			}
+		}
+		return $pw;
+	}
+	else{
+		return false;	
+	}
+}
 #delete
 if($action == 'delete'){
    $sql = "DELETE FROM mb_user WHERE mb_user_id = $1";
@@ -147,7 +164,7 @@
 		$res = db_prep_query($sql,$v,$t);		
 		if($password != ''){
 			$sql = "UPDATE mb_user SET mb_user_password = $1 WHERE mb_user_name = $2 AND mb_user_id = $3";
-			$v = array(md5($password), $name, $selected_user);
+			$v = array(setPassword($password), $name, $selected_user);
 			$t = array('s','s','i');
 			$res = db_prep_query($sql,$v,$t);
 			if($password && $res){




More information about the Mapbender_commits mailing list