Projet

Général

Profil

Révision f3b307af

Voir les différences:

htdocs/epack/export/checksum.md5
1
676ed0ea17e7a0d447c12fb66a6b5a89  checksum
1
0e6ed8b377037fd0c21c7216548a25dc  checksum
htdocs/mac/contract.php
2 2
/*
3 3
  gestion des contrats - affichage et rappel
4 4
  http://www.abuledu.net/mac/contract.php/view=toto/mac=08:D8:34:B8:90:CD
5
  
6
  Code retour:
7
  timestampfincontrat:CODE:nom du contrat:texte informatif:hashcode pour mise a jour(tabuledu):
5 8
*/
6 9

  
7 10
$g_http_request = $_SERVER['REQUEST_URI'];
......
11 14
preg_match("/.*view=(.*)\/mac=/",$_SERVER['REQUEST_URI'],$regs);
12 15
$view = addslashes($regs[1]);
13 16

  
17
$hash = hash("md5", time() + "abuledu.net");
18

  
14 19
//print "on a $mac et $view";
15 20

  
21
function insert_hash_allow_upgrade() {
22
  global $hash, $DB;
23
  $version = "0.0";
24
  $ip = $_SERVER['REMOTE_ADDR'];
25
  //Insere le hash dans la table
26
  $query = "INSERT INTO glpi_plugin_anet_upgrade_hash VALUES('',NOW(),'$ip','$hash','$version')";
27
  $result = $DB->query($query);
28
}
29

  
16 30
//Ou du POST
17 31
if(trim($mac) == "") {
18 32
  $mac = addslashes(strtoupper($_POST['mac']));
......
59 73
      exit;
60 74
    }
61 75
    else {
62
      print $endc . ":" . "DIRECT:" . $data2['name'] . ":";
76
      insert_hash_allow_upgrade();
77
      print $endc . ":" . "DIRECT:" . $data2['name'] . ":none:$hash";
63 78
    }
64 79
  }
65 80
  //Reconduction automatique ...
......
69 84
      exit;
70 85
    }
71 86
    else {
72
      print mktime(0,0,0, date("m",$endc)+$data2['periodicity'], date("d",$endc), date("Y",$endc)) . ":" . "DIRECT:" . $data2['name'] . ":" . "Renouvellement automatique";
87
      print mktime(0,0,0, date("m",$endc)+$data2['periodicity'], date("d",$endc), date("Y",$endc)) . ":" . "DIRECT:" . $data2['name'] . ":" . "Renouvellement automatique:$hash";
73 88
    }
74 89
  }
75 90
  else {
......
91 106
	exit;
92 107
      }
93 108
      else {
94
	print $endc . ":PARTNER" . ":" . $data3['name'] . ":" . "Avenant pour ce serveur manquant";
109
	insert_hash_allow_upgrade();
110
	print $endc . ":PARTNER" . ":" . $data3['name'] . ":" . "Avenant pour ce serveur manquant:$hash";
95 111
      }
96 112
    }
97 113
    else{
......
101 117
	exit;
102 118
      }
103 119
      else {
104
	print "000:WAITING:000:";
120
	print "000:WAITING:000:none:$hash";
105 121
      }
106 122
    }
107 123
  }
......
112 128
     exit;
113 129
   }
114 130
   else {
115
     print "000:FORBIDDEN:000:NOT";
131
     print "000:FORBIDDEN:000:NOT:$hash";
116 132
   }
117 133
 }
118 134

  

Formats disponibles : Unified diff

Redmine Appliance - Powered by TurnKey Linux