commit e213dd82124dbc7cbb4b08ad13066132841b2f18
Author: root <root@anet>
Date:   Mon Mar 23 19:41:06 2015 +0100

    pas commite depuis trop longtemps, et ajout du debut de support epack pour tabuledu

diff --git a/htdocs/epack/register.php b/htdocs/epack/register.php
index df5439f..c40307b 100644
--- a/htdocs/epack/register.php
+++ b/htdocs/epack/register.php
@@ -3,6 +3,7 @@
 
 $commande = "";
 $message = "";
+$debug = "";
 $send_mail = 0; //flag pour savoir s'il faut envoyer un mail (en bref a toute insertion ou update de base)
 
 function make_pdf($pass,$code,$datapost) {
@@ -294,13 +295,13 @@ function add_user_and_update_link($usermail,$identity,$userlastname,$userfirstna
 
   $query = "SELECT * from glpi_users WHERE email='$usermail'";
   $result = $DB->query($query);
-  //$message .= "<p>nb ; " . $DB->numrows($result) . " req : $query</p>";
+  $debug .= "<p>nb ; " . $DB->numrows($result) . " req : $query</p>";
   if($DB->numrows($result)>0) {
     $data = $DB->fetch_assoc($result);
     $iduser = $data['ID'];
     //existe dejà on fait juste le lien s'il n'existe pas déjà
     $query2 = "SELECT * FROM glpi_users_profiles WHERE FK_users='$iduser' AND FK_entities='$identity'";
-    //$message .= "$query2";
+    //$debug .= "$query2";
     $result2 = $DB->query($query2);
     if($DB->numrows($result2)<=0) {
       //pour eviter qu'un utilisateur se retrouve dans l'entite racine ...
@@ -355,7 +356,7 @@ if(trim($_GET['reset']) != "") {
 //print_r($_SESSION);
 //recupration des variables de l'url
 $g_http_request = $_SERVER['REQUEST_URI'];
-//$message .= "<p>Du cote abuledu.net ...</p>";
+
 if($_SESSION['epack_session'] > 1) {
   $pass    = strtoupper($_SESSION['epack_pass']);
   $code    = strtoupper($_SESSION['epack_code']);
@@ -369,16 +370,20 @@ if($_SESSION['epack_session'] > 1) {
   }
 }
 else {
+  $debug .= "Pas de session\n";
   //Si on est sur un formulaire POST (on casse la limite de la taille de la requete GET)
   if(isset($_POST["pass"])) {
-    //$message .= "Passage en POST";
+    $debug .= "Passage en POST\n";
+
     $pass = $_POST["pass"];
     $code = strtoupper($_POST["code"]);
     $datapost = array();
-    //$message .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>";
+
+    $debug .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>\n";
+
     foreach($_POST as $key=>$value) {
       $datapost[$key]=$value;
-      //$message .= "<p>" . $key . " -> " . $value . "</p>";
+      $debug .= "<p>" . $key . " -> " . $value . "</p>\n";
     }
   }
   else {
@@ -387,17 +392,18 @@ else {
     $code = strtoupper(addslashes($regs[2]));
     $keyvalue_list=explode("&",base64_decode($regs[3]));
     $datapost = array();
-    //$message .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>";
+
+    $debug .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>\n";
     foreach($keyvalue_list as $key=>$value) {
       // Explode each individual key/value into an array
       $keyvalue=explode("=",$value);
       // Make sure we have a "key=value" array
       if(count($keyvalue)==2) {
 	$datapost[$keyvalue[0]]=$keyvalue[1];
-	//$message .= "<p>" . $keyvalue[0] . " -> " . $keyvalue[1] . "</p>";
+	$debug .= "<p>" . $keyvalue[0] . " -> " . $keyvalue[1] . "</p>\n";
       }
       else {
-	//$message .= "<p>XXX:" . $value . "</p>";
+	$debug .= "<p>XXX:" . $value . "</p>\n";
       }
     }
   }
@@ -408,8 +414,10 @@ else {
     $code = addslashes(strtoupper($_POST['code']));
   }
 }
+
 $_SERVER['REQUEST_URI'] = "";
 $_SERVER['HTTP_REFERER'] = "";
+
 define('GLPI_ROOT', '..');
 include (GLPI_ROOT . "/inc/includes.php");
 
@@ -433,11 +441,15 @@ if(isset($datapost["MINIWEBADMIN"]) && stripos($code, "-TESTS-")) {
   $commande .= "\n touch /tmp/epack.ok \n";
  }
 
-if(trim($debug) != "" ) {
+/*
+  if(trim($debug) != "" ) {
   $message .= "<pre>
-$debug
-</pre>";
- }
+  $debug
+  </pre>";
+  }
+*/
+
+$debug .= "<p>Du cote abuledu.net ... $g_http_request</p>\n7";
 
 //On ne fait pas tout le bazaaar, on teste / valide la procedure uniquement
 if(stripos($code, "-TESTS-")) {
@@ -468,12 +480,13 @@ if(trim($pass) != "" && trim($code) != "") {
 LEFT JOIN glpi_entities AS g ON FK_client=g.ID
 WHERE code='$code' AND password='$pass'";
   $result = $DB->query($query);
+  //$message = "$query";
   $mac0 = trim(strtolower($datapost['MAC0']));
   $mac1 = trim(strtolower($datapost['MAC1']));
   //$data=$DB->fetch_assoc($result);
   //$nbresultat = $DB->numrows($result);
-  //  print_r($data);
-  //  exit;
+  //print_r($data);
+  //exit;
   if($DB->numrows($result)>0) {
     $data=$DB->fetch_assoc($result);
 
