Projet

Général

Profil

Révision e213dd82 htdocs/epack/register.php

Voir les différences:

htdocs/epack/register.php
3 3

  
4 4
$commande = "";
5 5
$message = "";
6
$debug = "";
6 7
$send_mail = 0; //flag pour savoir s'il faut envoyer un mail (en bref a toute insertion ou update de base)
7 8

  
8 9
function make_pdf($pass,$code,$datapost) {
......
294 295

  
295 296
  $query = "SELECT * from glpi_users WHERE email='$usermail'";
296 297
  $result = $DB->query($query);
297
  //$message .= "<p>nb ; " . $DB->numrows($result) . " req : $query</p>";
298
  $debug .= "<p>nb ; " . $DB->numrows($result) . " req : $query</p>";
298 299
  if($DB->numrows($result)>0) {
299 300
    $data = $DB->fetch_assoc($result);
300 301
    $iduser = $data['ID'];
301 302
    //existe dejà on fait juste le lien s'il n'existe pas déjà
302 303
    $query2 = "SELECT * FROM glpi_users_profiles WHERE FK_users='$iduser' AND FK_entities='$identity'";
303
    //$message .= "$query2";
304
    //$debug .= "$query2";
304 305
    $result2 = $DB->query($query2);
305 306
    if($DB->numrows($result2)<=0) {
306 307
      //pour eviter qu'un utilisateur se retrouve dans l'entite racine ...
......
355 356
//print_r($_SESSION);
356 357
//recupration des variables de l'url
357 358
$g_http_request = $_SERVER['REQUEST_URI'];
358
//$message .= "<p>Du cote abuledu.net ...</p>";
359

  
359 360
if($_SESSION['epack_session'] > 1) {
360 361
  $pass    = strtoupper($_SESSION['epack_pass']);
361 362
  $code    = strtoupper($_SESSION['epack_code']);
......
369 370
  }
370 371
}
371 372
else {
373
  $debug .= "Pas de session\n";
372 374
  //Si on est sur un formulaire POST (on casse la limite de la taille de la requete GET)
373 375
  if(isset($_POST["pass"])) {
374
    //$message .= "Passage en POST";
376
    $debug .= "Passage en POST\n";
377

  
375 378
    $pass = $_POST["pass"];
376 379
    $code = strtoupper($_POST["code"]);
377 380
    $datapost = array();
378
    //$message .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>";
381

  
382
    $debug .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>\n";
383

  
379 384
    foreach($_POST as $key=>$value) {
380 385
      $datapost[$key]=$value;
381
      //$message .= "<p>" . $key . " -> " . $value . "</p>";
386
      $debug .= "<p>" . $key . " -> " . $value . "</p>\n";
382 387
    }
383 388
  }
384 389
  else {
......
387 392
    $code = strtoupper(addslashes($regs[2]));
388 393
    $keyvalue_list=explode("&",base64_decode($regs[3]));
389 394
    $datapost = array();
390
    //$message .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>";
395

  
396
    $debug .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>\n";
391 397
    foreach($keyvalue_list as $key=>$value) {
392 398
      // Explode each individual key/value into an array
393 399
      $keyvalue=explode("=",$value);
394 400
      // Make sure we have a "key=value" array
395 401
      if(count($keyvalue)==2) {
396 402
	$datapost[$keyvalue[0]]=$keyvalue[1];
397
	//$message .= "<p>" . $keyvalue[0] . " -> " . $keyvalue[1] . "</p>";
403
	$debug .= "<p>" . $keyvalue[0] . " -> " . $keyvalue[1] . "</p>\n";
398 404
      }
399 405
      else {
400
	//$message .= "<p>XXX:" . $value . "</p>";
406
	$debug .= "<p>XXX:" . $value . "</p>\n";
401 407
      }
402 408
    }
403 409
  }
......
408 414
    $code = addslashes(strtoupper($_POST['code']));
409 415
  }
410 416
}
417

  
411 418
$_SERVER['REQUEST_URI'] = "";
412 419
$_SERVER['HTTP_REFERER'] = "";
420

  
413 421
define('GLPI_ROOT', '..');
414 422
include (GLPI_ROOT . "/inc/includes.php");
415 423

  
......
433 441
  $commande .= "\n touch /tmp/epack.ok \n";
434 442
 }
435 443

  
436
if(trim($debug) != "" ) {
444
/*
445
  if(trim($debug) != "" ) {
437 446
  $message .= "<pre>
438
$debug
439
</pre>";
440
 }
447
  $debug
448
  </pre>";
449
  }
450
*/
451

  
452
$debug .= "<p>Du cote abuledu.net ... $g_http_request</p>\n7";
441 453

  
442 454
//On ne fait pas tout le bazaaar, on teste / valide la procedure uniquement
443 455
if(stripos($code, "-TESTS-")) {
......
468 480
LEFT JOIN glpi_entities AS g ON FK_client=g.ID
469 481
WHERE code='$code' AND password='$pass'";
470 482
  $result = $DB->query($query);
483
  //$message = "$query";
471 484
  $mac0 = trim(strtolower($datapost['MAC0']));
472 485
  $mac1 = trim(strtolower($datapost['MAC1']));
473 486
  //$data=$DB->fetch_assoc($result);
474 487
  //$nbresultat = $DB->numrows($result);
475
  //  print_r($data);
476
  //  exit;
488
  //print_r($data);
489
  //exit;
477 490
  if($DB->numrows($result)>0) {
478 491
    $data=$DB->fetch_assoc($result);
479 492

  

Formats disponibles : Unified diff

Redmine Appliance - Powered by TurnKey Linux