Index: /extensions/event_cats/admin/template/autolog_new.js
===================================================================
--- /extensions/event_cats/admin/template/autolog_new.js	(revision 4162)
+++ /extensions/event_cats/admin/template/autolog_new.js	(revision 4163)
@@ -23,7 +23,5 @@
 var ec_selected_old_entry       = '-1';
 var ec_selected_old_code        = '-1';
-// var ec_selected_old_code2       = '-1';
 var ec_selected_old_user        = '-1';
-// var ec_selected_old_user2       = '-1';
 var ec_selected_AP              = '-1';
 var ec_selected_cat             = '-1';
@@ -160,4 +158,5 @@
       de('ec_in_up_usr_txt_id').disabled   = t1;
       de('ec_in_up_psd_txt_id').disabled   = t1;
+      de('ec_confirm_psd_txt_id').disabled = t1;
       de('ec_in_up_newgroup_id').disabled  = t1;
       de('ec_in_up_grp_txt_id').disabled   = t1;
@@ -196,4 +195,5 @@
           de('ec_in_up_usr_txt_id').value          = '';
           de('ec_in_up_psd_txt_id').value          = '';
+          de('ec_confirm_psd_txt_id').value        = '';
           de('ec_in_up_grp_txt_id').value          = '';
           de('ec_in_up_newgroup_id').checked       = '';
@@ -205,4 +205,5 @@
           de('ec_in_up_usr_txt_id').value          = ec_new_user_text;
           de('ec_in_up_psd_txt_id').value          = ec_new_psd_text;
+          de('ec_confirm_psd_txt_id').value        = '';
           de('ec_in_up_grp_txt_id').value          =
            (ec_selected_old_group) ? ec_new_grp_text : '';
@@ -216,4 +217,5 @@
           de('ec_in_up_usr_txt_id').value    = '';
           de('ec_in_up_psd_txt_id').value    = '';
+          de('ec_confirm_psd_txt_id').value  = '';
           de('ec_in_up_grp_txt_id').value    = '';
           de('ec_in_up_newgroup_id').checked = '';
@@ -385,5 +387,6 @@
 
 function ec_gen_user() {
-  var t           = '';
+  var t1          = '';
+  var t2          = '';
   var ec_word     = '';
   var ec_cat_sel  = '';
@@ -402,6 +405,6 @@
   }
   else {
-    t = ec_gen_txt('8');
-    if (t == '') {
+    t1 = ec_gen_txt('8');
+    if (t1 == '') {
       alert("Failed :\n" + ec_err);
       ec_new_psd_text = 'Failed...';
@@ -409,5 +412,5 @@
     }
     else {
-      ec_new_psd_text = t;
+      ec_new_psd_text = t1;
       ec_old_new_psd_text = ec_new_psd_text;
       switch (ec_selected_action) {
@@ -418,4 +421,5 @@
            ].label
           );
+          t2 = ec_new_user_text;
         break;
         case 'ec_input_action_cat': // Category
@@ -427,4 +431,5 @@
            ec_reg_cat1.exec(ec_cat_sel)[1] : ec_cat_sel;
           ec_new_user_text = ec_new_user_text.replace(/\s/, '_');
+          t2 = ec_new_user_text;
         if (ec_selected_action == 'ec_input_action_img') {
           ec_new_user_text +=  '_' + d.ec_new_code.ec_in_up_imgs_id.value;
@@ -432,14 +437,15 @@
         break;
         case 'ec_input_action_home': // Home
-          t = ec_gen_txt('3');
-          if (t == '') {
+          t1 = ec_gen_txt('3');
+          if (t1 == '') {
             alert("Failed :\n" + ec_err);
             ec_new_psd_text = 'Failed...';
             return false;
           }
-          ec_new_user_text = ec_JS_message['ec_up_code_lbl_home'] + '_' + t;
-        break;
-      }
-      if (ec_selected_old_group) ec_new_grp_text = 'EC_' + ec_new_user_text;
+          t2 = ec_JS_message['ec_up_code_lbl_home'];
+          ec_new_user_text = t2 + '_' + t1;
+        break;
+      }
+      if (ec_selected_old_group) ec_new_grp_text = 'EC_' + t2;
       ec_flag1 = true;
       ec_mark_user('ec_sel_user_new');
@@ -611,5 +617,4 @@
 
 function ec_change_user_list(ec_id) {
-  // ec_selected_old_user2 = ec_selected_old_user;
   ec_selected_old_user = ec_id;
   ec_mark_user('ec_sel_user_old');
@@ -617,14 +622,6 @@
 
 function ec_change_code_list(ec_id) {
-  // ec_selected_old_code2 = ec_selected_old_code;
   ec_selected_old_code = ec_id;
   ec_mark_code('ec_sel_code_old');
-}
-
-function ec_mark_type(ec_id) {
-  de('ec_act1_id').value = ec_id;
-  de('ec_act2_id').value = '-1';
-  ec_dont_check = true;
-  d.ec_new_code.submit();
 }
 
@@ -658,8 +655,6 @@
   ec_selected_old_user                            = '-1';
   ec_selected_old_code                            = '-1';
-  // ec_selected_old_code2                           = '-1';
   ec_selected_AP                                  = '-1';
   ec_selected_cat                                 = '-1';
-  // ec_selected_old_user2                           = '-1';
   ec_selected_user                                = '-1';
   ec_selected_code                                = '-1';
@@ -669,4 +664,5 @@
   de('ec_in_up_usr_txt_id').value                 = '';
   de('ec_in_up_psd_txt_id').value                 = '';
+  de('ec_confirm_psd_txt_id').value               = '';
   de('ec_in_up_grp_txt_id').value                 = '';
   de('ec_in_up_newgroup_id').checked              = '';
@@ -705,4 +701,5 @@
       de('ec_in_up_usr_txt_id').disabled          = '';
       de('ec_in_up_psd_txt_id').disabled          = '';
+      de('ec_confirm_psd_txt_id').disabled        = '';
       de('ec_in_up_newgroup_id').disabled         = '';
       de('ec_in_up_grp_txt_id').disabled          = '';
@@ -724,4 +721,5 @@
       de('ec_in_up_usr_txt_id').disabled          = 'disabled';
       de('ec_in_up_psd_txt_id').disabled          = 'disabled';
+      de('ec_confirm_psd_txt_id').disabled        = 'disabled';
       de('ec_in_up_newgroup_id').disabled         = 'disabled';
       de('ec_in_up_grp_txt_id').disabled          = 'disabled';
@@ -754,4 +752,5 @@
       de('ec_in_up_usr_txt_id').disabled          = '';
       de('ec_in_up_psd_txt_id').disabled          = '';
+      de('ec_confirm_psd_txt_id').disabled        = '';
       de('ec_in_up_newgroup_id').disabled         = '';
       de('ec_in_up_grp_txt_id').disabled          = '';
@@ -774,5 +773,5 @@
       de('ec_in_up_usr_txt_id').disabled          = 'disabled';
       de('ec_in_up_psd_txt_id').disabled          = 'disabled';
-      de('ec_in_up_psd_txt_id').disabled          = 'disabled';
+      de('ec_confirm_psd_txt_id').disabled        = 'disabled';
       de('ec_in_up_newgroup_id').disabled         = 'disabled';
       de('ec_in_up_grp_txt_id').disabled          = 'disabled';
Index: /extensions/event_cats/include/evntcats_funcs.inc.php
===================================================================
--- /extensions/event_cats/include/evntcats_funcs.inc.php	(revision 4162)
+++ /extensions/event_cats/include/evntcats_funcs.inc.php	(revision 4163)
@@ -157,6 +157,6 @@
 
 /*
- * ec_end()
- * Process repetitive task when error in database modifying fucntions.
+ * ec_end1()
+ * Process repetitive task when error in database modifying functions.
  *
  * @param
@@ -166,5 +166,5 @@
  *   false as this function is used when there is a problem
  */
-function ec_end($pst, $msg) {
+function ec_end1($pst, $msg) {
   global $page;
   $page['errors'][] =
@@ -172,4 +172,23 @@
    '$_POST[\''.$pst.'\'] = '.
    $_POST[$pst]
+  ;
+  return false;
+}
+
+/*
+ * ec_end2()
+ * Process repetitive task when error in database modifying functions.
+ *
+ * @param
+ *   $msg : message
+ *   $num : number precising the point where the error occurred
+ * @return
+ *   false as this function is used when there is a problem
+ */
+function ec_end2($msg, $num) {
+  global $page;
+  $page['errors'][] =
+   l10n($msg).' ('.$num.') '.
+   'MySQL error '.mysql_errno().', "'.mysql_error().'"'
   ;
   return false;
@@ -414,18 +433,90 @@
   global $page, $ec_lists;
   
+/*
+
+(
+    [ec_act1] => create
+    [ec_entry_sel] => -1
+    [ec_sel_code] => new
+    [ec_in_up_auto_code_length] => 10
+    [ec_in_up_code] => 94q0V1067D
+    [ec_sel_user] => new
+    [ec_in_up_usr_txt] => san_gimi
+    [ec_in_up_psd_txt] => 7Mv8QxZV
+    [ec_in_up_newgroup] => on
+    [ec_in_up_grp_txt] => EC_san_gimi
+    [ec_input_action] => cat
+    [ec_in_up_cat] => 6
+    [ec_in_up_img] => 
+)
+
+*/
   /* foreach ($ec_lists['ec_table'] as $ec_entry) {
     if ($_POST['ec_in_up_code'] == $ec_entry['code'])
-      return ec_end('ec_in_up_code', 'ec_bad_argument2');
-  }
+      return ec_end1('ec_in_up_code', 'ec_bad_argument2');
+  }
+  if ($t1 = (in_array($_POST['ec_in_up_usr_txt'], $ec_lists['user_ids'])))
+   $ec_user_id = $_POST['ec_in_up_usr_txt'];
   if ($_POST['ec_sel_user'] == 'new') {
-    if (in_array(
-     $_POST['ec_in_up_usr_txt'],
-     $ec_lists['user_ids']
-    )) return ec_end('ec_in_up_usr_txt', 'ec_bad_argument3');
+    if ($t1) return ec_end1('ec_in_up_usr_txt', 'ec_bad_argument3');
     else { // New user account creation
       $page['errors'] = register_user(
        $_POST['ec_in_up_usr_txt'], $_POST['ec_in_up_psd_txt'], '', false
       );
-    }
+      if (
+        count($page['errors']) != 0 or
+        !($ec_user_id = get_userid($_POST['ec_in_up_usr_txt'])) or
+        !pwg_query("
+          UPDATE `".USER_INFOS_TABLE."`
+          SET `status` = 'generic'
+          WHERE `user_id` = ".$ec_user_id.";
+        ")
+      ) {
+        array_unshift($page['errors'], l10n('ec_user_create_pb'));
+        return false;
+      }
+      if (
+        isset($_POST['ec_in_up_newgroup']) and
+        isset($_POST['ec_in_up_grp_txt']) and
+        $_POST['ec_in_up_grp_txt'] != ''
+      ) { // New group creation, and association with user_id at the same time
+        if (
+          !($t = mysql_fetch_row(pwg_query("
+            SELECT `id`
+            FROM `".GROUPS_TABLE."`
+            WHERE `name` = '".$_POST['ec_in_up_grp_txt']."';
+          ")))
+        ) {
+          if (
+            !pwg_query("
+              INSERT INTO `".GROUPS_TABLE."` (`name`, `is_default`)
+              VALUES ('".$_POST['ec_in_up_grp_txt']."', 'false');
+            ")
+          ) return ec_end2('ec_group_create_pb', '1');
+          if (
+            !($t = mysql_fetch_row(pwg_query("
+              SELECT `id`
+              FROM `".GROUPS_TABLE."`
+              WHERE `name` = '".$_POST['ec_in_up_grp_txt']."';
+            ")))
+          ) return ec_end2('ec_group_create_pb', '2');
+        }
+        if (
+          !(pwg_query("
+            INSERT INTO `".USER_GROUP_TABLE."` (`user_id `, `group_id`)
+            VALUES ('".$ec_user_id."', '".$t['id']."');
+          "))
+        ) return ec_end2('ec_group_create_pb', '3');
+      }
+    }
+  }
+  else {
+    if ($t1) {
+      if (ereg('^[a-zA-Z0-9_-]{4,32}$',$_POST['ec_in_up_code'])) {
+        if 
+      }
+      else return ec_end1('ec_in_up_code', 'ec_bad_argument7');
+    }
+    else return ec_end1('ec_in_up_usr_txt', 'ec_bad_argument6');
   }
   */
@@ -455,5 +546,5 @@
         if (array_key_exists($_POST['ec_in_up_aps'],$ec_lists['add_pages'])) {
          $arg2 = $_POST['ec_in_up_aps']; }
-        else return ec_end('ec_in_up_aps', 'ec_bad_argument1');
+        else return ec_end1('ec_in_up_aps', 'ec_bad_argument4');
       case 'home':
       break;
@@ -466,11 +557,11 @@
              ec_image_exists($_POST['ec_in_up_cat'], $_POST['ec_in_up_img'])
             ) $arg2 = $_POST['ec_in_up_img'];
-            else return ec_end('ec_in_up_img', 'ec_bad_argument1');
+            else return ec_end1('ec_in_up_img', 'ec_bad_argument4');
           }
           $arg1 = $_POST['ec_in_up_cat'];
         }
-        else return ec_end('ec_in_up_cat', 'ec_bad_argument1');
+        else return ec_end1('ec_in_up_cat', 'ec_bad_argument4');
       break;
-      default: return ec_end('ec_input_action', 'ec_bad_argument1');
+      default: return ec_end1('ec_input_action', 'ec_bad_argument1');
     }
     if (pwg_query("
@@ -504,7 +595,5 @@
     }
   }
-  else return ec_end('ec_entry_sel', 'ec_bad_argument1');
-  $page['errors'][] = '?!';
-  return false;
+  else return ec_end1('ec_entry_sel', 'ec_bad_argument5');
 }
 
@@ -572,5 +661,5 @@
     }
   }
-  else ec_end('ec_entry_sel', 'ec_bad_argument1');
+  else ec_end1('ec_entry_sel', 'ec_bad_argument1');
 }
 
Index: /extensions/event_cats/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/event_cats/language/fr_FR/plugin.lang.php	(revision 4162)
+++ /extensions/event_cats/language/fr_FR/plugin.lang.php	(revision 4163)
@@ -111,7 +111,13 @@
 $lang['ec_entry_dis_nok_pre3']    = 'Problème avec tentative de rendre périmée entrée ';
 $lang['ec_entry_dis_nok_end3']    = ' (arg1 = NULL)';
+$lang['ec_user_create_pb']        = 'Création nouvel utilisateur impossible';
+$lang['ec_group_create_pb']       = 'Création nouveau groupe impossible : ';
 $lang['ec_bad_argument1']         = 'Mauvais argument : ';
 $lang['ec_bad_argument2']         = 'Code déjà existant : ';
 $lang['ec_bad_argument3']         = 'Utilisateur déjà existant : ';
+$lang['ec_bad_argument4']         = 'Additional Page, catégorie, ou image, inexistante : ';
+$lang['ec_bad_argument5']         = 'Code inexistant ou non duplicable : ';
+$lang['ec_bad_argument6']         = 'Utilisateur inexistant : ';
+$lang['ec_bad_argument7']         = 'Code non conforme : ';
 // Infos
 $lang['ec_entry_del_ok_pre']      = 'Entrée ';
