PageRenderTime 70ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 1ms

/includes/ogs.php

https://bitbucket.org/capi/ogspy
PHP | 1213 lines | 795 code | 170 blank | 248 comment | 211 complexity | de59e177258f4ec0012d5d3954643911 MD5 | raw file
  1. <?php
  2. /**
  3. * ogs.php
  4. * Fonctions concernant le protocole de communication ogstratege / ogspy
  5. *
  6. * @author Kyser
  7. * @package OGSpy
  8. * @subpackage External communications API
  9. * @copyright Copyright &copy; 2007, http://ogsteam.fr/
  10. * @modified $Date: 2012-07-09 16:44:26 +0200 (lun., 09 juil. 2012) $
  11. * @author Kyser
  12. * @link $HeadURL: http://svn.ogsteam.fr/trunk/ogspy/includes/ogs.php $
  13. * @version 3.1.0 ( $Rev: 7665 $ )
  14. */
  15. if (!defined('IN_SPYOGAME')) {
  16. die("Hacking attempt");
  17. }
  18. /**
  19. * Verification des droits OGSpy
  20. *
  21. * @param string $action Droit interroge
  22. * @global array $user_data
  23. * @global array $user_auth
  24. */
  25. function galaxy_check_auth($action)
  26. {
  27. global $user_data, $user_auth;
  28. switch ($action) {
  29. case "import_planet":
  30. if ($user_auth["ogs_set_system"] != 1 && $user_data["user_admin"] != 1 && $user_data["user_coadmin"] !=
  31. 1)
  32. die("<!-- [AccessDenied] Accès refusé -->" . "\n" .
  33. "<!-- Vous n'avez pas les droits pour exporter des systèmes solaires -->" . "\n");
  34. break;
  35. case "export_planet":
  36. if ($user_auth["ogs_get_system"] != 1 && $user_data["user_admin"] != 1 && $user_data["user_coadmin"] !=
  37. 1)
  38. die("<!-- [AccessDenied] Accès refusé -->" . "\n" .
  39. "<!-- Vous n'avez pas les droits pour importer des systèmes solaires -->" . "\n");
  40. break;
  41. case "import_spy":
  42. if ($user_auth["ogs_set_spy"] != 1 && $user_data["user_admin"] != 1 && $user_data["user_coadmin"] !=
  43. 1)
  44. die("<!-- [AccessDenied] Accès refusé -->" . "\n" .
  45. "<!-- Vous n'avez pas les droits pour exporter des rapports d'espionnage -->" .
  46. "\n");
  47. break;
  48. case "export_spy":
  49. if ($user_auth["ogs_get_spy"] != 1 && $user_data["user_admin"] != 1 && $user_data["user_coadmin"] !=
  50. 1)
  51. die("<!-- [AccessDenied] Accès refusé -->" . "\n" .
  52. "<!-- Vous n'avez pas les droits pour importer des rapports d'espionnage -->" .
  53. "\n");
  54. break;
  55. case "import_ranking":
  56. if ($user_auth["ogs_set_ranking"] != 1 && $user_data["user_admin"] != 1 && $user_data["user_coadmin"] !=
  57. 1)
  58. die("<!-- [AccessDenied] Accès refusé -->" . "\n" .
  59. "<!-- Vous n'avez pas les droits pour exporter des classements -->" . "\n");
  60. break;
  61. case "export_ranking":
  62. if ($user_auth["ogs_get_ranking"] != 1 && $user_data["user_admin"] != 1 && $user_data["user_coadmin"] !=
  63. 1)
  64. die("<!-- [AccessDenied] Accès refusé -->" . "\n" .
  65. "<!-- Vous n'avez pas les droits pour importer des classements -->" . "\n");
  66. break;
  67. case "drop_ranking":
  68. if ($user_data["user_admin"] != 1 && $user_data["user_coadmin"] != 1 && $user_data["management_ranking"] !=
  69. 1)
  70. redirection("index.php?action=message&id_message=forbidden&info");
  71. break;
  72. case "set_ranking":
  73. if (($user_auth["server_set_ranking"] != 1) && $user_data["user_admin"] != 1 &&
  74. $user_data["user_coadmin"] != 1)
  75. redirection("index.php?action=message&id_message=forbidden&info");
  76. break;
  77. case "set_rc":
  78. if (($user_auth["server_set_rc"] != 1) && $user_data["user_admin"] != 1 && $user_data["user_coadmin"] !=
  79. 1)
  80. redirection("index.php?action=message&id_message=forbidden&info");
  81. break;
  82. default:
  83. die("<!-- [ErrorFatal=18] Données transmises incorrectes -->");
  84. }
  85. }
  86. /**
  87. * Envoi des donnees vers OGS
  88. * @todo Query : "select galaxy, system, row, moon, name, ally, player, status, user_name, last_update" .
  89. " from " . TABLE_UNIVERSE . " left join " . TABLE_USER .
  90. " on last_update_user_id = user_id" . $request_galaxy . $request_date .
  91. " order by galaxy, system, row"
  92. * @todo Query : "update " . TABLE_STATISTIC .
  93. " set statistic_value = statistic_value + " . $i;
  94. $request .= " where statistic_name = 'planetexport_ogs'"
  95. * @todo Query : "insert ignore into " . TABLE_STATISTIC .
  96. " values ('planetexport_ogs', '" . $i . "')";
  97. */
  98. function galaxy_ExportPlanets()
  99. {
  100. global $db, $user_data, $server_config, $user_auth;
  101. global $pub_galnum, $pub_sincedate;
  102. galaxy_check_auth("export_planet");
  103. $request_galaxy = "";
  104. $request_date = "";
  105. if (isset($pub_galnum)) {
  106. if (!check_var($pub_galnum, "Num")) {
  107. die("<!-- [ErrorFatal=01] Données transmises incorrectes -->");
  108. }
  109. if ($pub_galnum != "") {
  110. log_("get_system_OGS", intval($pub_galnum));
  111. $request_galaxy = " where galaxy = " . intval($pub_galnum);
  112. } else
  113. log_("get_system_OGS");
  114. } else
  115. log_("get_system_OGS");
  116. if (isset($pub_sincedate)) {
  117. if (!check_var($pub_sincedate, "Special", "#^(\d){4}-(\d){2}-(\d){2}\s(\d){2}:(\d){2}:(\d){2}$#")) {
  118. die("<!-- [ErrorFatal=02] Données transmises incorrectes -->");
  119. }
  120. if ($pub_sincedate != "") {
  121. list($day, $hour) = explode(" ", $pub_sincedate);
  122. list($year, $month, $day) = explode("-", $day);
  123. list($hour, $minute, $seconde) = explode(":", $hour);
  124. $timestamp = mktime($hour, $minute, $seconde, $month, $day, $year);
  125. $request_date = isset($request_galaxy) ? " and " : " where ";
  126. $request_date .= "last_update >= " . $timestamp;
  127. }
  128. }
  129. $ally_protection = array();
  130. if ($server_config["ally_protection"] != "")
  131. $ally_protection = explode(",", $server_config["ally_protection"]);
  132. $request = "select galaxy, system, row, moon, name, ally, player, status, user_name, last_update" .
  133. " from " . TABLE_UNIVERSE . " left join " . TABLE_USER .
  134. " on last_update_user_id = user_id" . $request_galaxy . $request_date .
  135. " order by galaxy, system, row";
  136. $result = $db->sql_query($request);
  137. $i = 0;
  138. echo "galaxy=1,system=2,row=3,moon=4,planetname=5,playername=6,allytag=7,status=8,datetime=9,sendername=10<->";
  139. while (list($galaxy, $system, $row, $moon, $name, $ally, $player, $status, $user_name,
  140. $last_update) = $db->sql_fetch_row($result)) {
  141. if ($name == "")
  142. $name = " ";
  143. if ($ally == "")
  144. $ally = " ";
  145. if ($player == "")
  146. $player = " ";
  147. if (is_null($user_name))
  148. $user_name = "Inconnu";
  149. if (!in_array($ally, $ally_protection) || $ally == "" || $user_auth["server_show_positionhided"] ==
  150. 1 || $user_data["user_admin"] == 1 || $user_data["user_coadmin"] == 1) {
  151. $texte = $galaxy . "<||>";
  152. $texte .= $system . "<||>";
  153. $texte .= $row . "<||>";
  154. $texte .= ($moon == 1) ? "M" : "";
  155. $texte .= "<||>";
  156. $texte .= utf8_decode($name) . "<||>";
  157. $texte .= utf8_decode($player) . "<||>";
  158. $texte .= utf8_decode($ally) . "<||>";
  159. $texte .= $status . "<||>";
  160. $texte .= date("Y-m-d H:i:s", $last_update) . "<||>";
  161. $texte .= utf8_decode($user_name);
  162. $texte .= "<->";
  163. echo $texte;
  164. $i++;
  165. }
  166. }
  167. user_set_stat(null, null, null, null, null, null, null, $i);
  168. //Statistiques serveur
  169. $db->sql_query($request);
  170. /*//Incompatible MySQL 4.0
  171. $request = "insert into ".TABLE_STATISTIC." values ('planetexport_ogs', '".$i."')";
  172. $request .= " on duplicate key update statistic_value = statistic_value + ".$i."";*/
  173. $request = "update " . TABLE_STATISTIC .
  174. " set statistic_value = statistic_value + " . $i;
  175. $request .= " where statistic_name = 'planetexport_ogs'";
  176. $db->sql_query($request);
  177. if ($db->sql_affectedrows() == 0) {
  178. $request = "insert ignore into " . TABLE_STATISTIC .
  179. " values ('planetexport_ogs', '" . $i . "')";
  180. $db->sql_query($request);
  181. }
  182. //Statistiques joueur
  183. exit();
  184. }
  185. /**
  186. * Envoi du classement alliance vers OGS
  187. * @todo Query : "select rank, ally, number_member, points, points_per_member, user_name";
  188. $request .= " from " . $ranktable . " left join " . TABLE_USER;
  189. $request .= " on sender_id = user_id";
  190. $request .= " where datadate = " . $timestamp;
  191. $request .= " order by rank"
  192. * @todo Query : "update " . TABLE_STATISTIC .
  193. " set statistic_value = statistic_value + " . $i;
  194. $request .= " where statistic_name = 'rankexport_ogs'";
  195. */
  196. function galaxy_ExportRanking_ally()
  197. {
  198. global $db, $user_data;
  199. global $pub_date, $pub_type;
  200. galaxy_check_auth("export_ranking");
  201. if (!isset($pub_date) || !isset($pub_type)) {
  202. die("<!-- [ErrorFatal=03] Données transmises incorrectes -->");
  203. }
  204. switch ($pub_type) {
  205. case "points":
  206. $ranktable = TABLE_RANK_ALLY_POINTS;
  207. break;
  208. case "flotte":
  209. $ranktable = TABLE_RANK_ALLY_FLEET;
  210. break;
  211. case "research":
  212. $ranktable = TABLE_RANK_ALLY_RESEARCH;
  213. break;
  214. default:
  215. die("<!-- [ErrorFatal=04] Données transmises incorrectes -->");
  216. ;
  217. }
  218. if (!check_var($pub_date, "Special", "#^(\d){4}-(\d){2}-(\d){2}\s(\d){2}:(\d){2}:(\d){2}$#")) {
  219. die("<!-- [ErrorFatal=04] Données transmises incorrectes -->");
  220. }
  221. list($day, $hour) = explode(" ", $pub_date);
  222. list($year, $month, $day) = explode("-", $day);
  223. list($hour, $minute, $seconde) = explode(":", $hour);
  224. $timestamp = mktime($hour, 0, 0, $month, $day, $year);
  225. $request = "select rank, ally, number_member, points, points_per_member, user_name";
  226. $request .= " from " . $ranktable . " left join " . TABLE_USER;
  227. $request .= " on sender_id = user_id";
  228. $request .= " where datadate = " . $timestamp;
  229. $request .= " order by rank";
  230. $result = $db->sql_query($request);
  231. $i = 0;
  232. echo "rank=1,allytag=2,number_member=3,points=4,points_per_member=5,sendername=6,datetime=" .
  233. $pub_date . "<->";
  234. while (list($rank, $ally, $number_member, $points, $points_per_member, $user_name) =
  235. $db->sql_fetch_row($result)) {
  236. $texte .= $rank . "<||>";
  237. $texte .= utf8_decode($ally) . "<||>";
  238. $texte .= $number_member . "<||>";
  239. $texte .= $points . "<||>";
  240. $texte .= $points_per_member . "<||>";
  241. $texte .= utf8_decode($user_name) . "<||>";
  242. $texte .= "<->";
  243. echo $texte;
  244. $i++;
  245. }
  246. user_set_stat(null, null, null, null, null, null, null, null, null, $i);
  247. log_("get_rank", array($pub_type, $timestamp));
  248. //Statistiques serveur
  249. $request = "update " . TABLE_STATISTIC .
  250. " set statistic_value = statistic_value + " . $i;
  251. $request .= " where statistic_name = 'rankexport_ogs'";
  252. $db->sql_query($request);
  253. if ($db->sql_affectedrows() == 0) {
  254. $request = "insert ignore into " . TABLE_STATISTIC .
  255. " values ('rankexport_ogs', '" . $i . "')";
  256. $db->sql_query($request);
  257. }
  258. exit();
  259. }
  260. /**
  261. * Envoi du classement joueur vers OGS
  262. * @todo Query : "select rank, player, ally, points, user_name";
  263. $request .= " from " . $ranktable . " left join " . TABLE_USER;
  264. $request .= " on sender_id = user_id";
  265. $request .= " where datadate = " . $timestamp;
  266. $request .= " order by rank";
  267. * @todo Query : "update " . TABLE_STATISTIC .
  268. " set statistic_value = statistic_value + " . $i;
  269. $request .= " where statistic_name = 'rankexport_ogs'";
  270. * @todo Query : "insert ignore into " . TABLE_STATISTIC .
  271. " values ('rankexport_ogs', '" . $i . "')";
  272. */
  273. function galaxy_ExportRanking_player()
  274. {
  275. global $db, $user_data;
  276. global $pub_date, $pub_type;
  277. galaxy_check_auth("export_ranking");
  278. if (!isset($pub_date) || !isset($pub_type)) {
  279. die("<!-- [ErrorFatal=05] Données transmises incorrectes -->");
  280. }
  281. switch ($pub_type) {
  282. case "points":
  283. $ranktable = TABLE_RANK_PLAYER_POINTS;
  284. break;
  285. case "flotte":
  286. $ranktable = TABLE_RANK_PLAYER_FLEET;
  287. break;
  288. case "research":
  289. $ranktable = TABLE_RANK_PLAYER_RESEARCH;
  290. break;
  291. default:
  292. die("<!-- [ErrorFatal=06] Données transmises incorrectes -->");
  293. ;
  294. }
  295. if (!check_var($pub_date, "Special", "#^(\d){4}-(\d){2}-(\d){2}\s(\d){2}:(\d){2}:(\d){2}$#")) {
  296. die("<!-- [ErrorFatal=07] Données transmises incorrectes -->");
  297. }
  298. list($day, $hour) = explode(" ", $pub_date);
  299. list($year, $month, $day) = explode("-", $day);
  300. list($hour, $minute, $seconde) = explode(":", $hour);
  301. $timestamp = mktime($hour, 0, 0, $month, $day, $year);
  302. $request = "select rank, player, ally, points, user_name";
  303. $request .= " from " . $ranktable . " left join " . TABLE_USER;
  304. $request .= " on sender_id = user_id";
  305. $request .= " where datadate = " . $timestamp;
  306. $request .= " order by rank";
  307. $result = $db->sql_query($request);
  308. $i = 0;
  309. echo "playername=1,allytag=2,rank=3,points=4,sendername=5,datetime=" . $pub_date .
  310. "<->";
  311. while (list($rank, $player, $ally, $points, $user_name) = $db->sql_fetch_row($result)) {
  312. $texte = utf8_decode($player) . "<||>";
  313. $texte .= utf8_decode($ally) . "<||>";
  314. $texte .= $rank . "<||>";
  315. $texte .= $points . "<||>";
  316. $texte .= utf8_decode($user_name) . "<||>";
  317. $texte .= "<->";
  318. echo $texte;
  319. $i++;
  320. }
  321. user_set_stat(null, null, null, null, null, null, null, null, null, $i);
  322. log_("get_rank", array($pub_type, $timestamp));
  323. //Statistiques serveur
  324. $request = "update " . TABLE_STATISTIC .
  325. " set statistic_value = statistic_value + " . $i;
  326. $request .= " where statistic_name = 'rankexport_ogs'";
  327. $db->sql_query($request);
  328. if ($db->sql_affectedrows() == 0) {
  329. $request = "insert ignore into " . TABLE_STATISTIC .
  330. " values ('rankexport_ogs', '" . $i . "')";
  331. $db->sql_query($request);
  332. }
  333. exit();
  334. }
  335. /**
  336. * Recuperation des donnees transmises par OGS
  337. * @todo Query : "update " . TABLE_STATISTIC .
  338. " set statistic_value = statistic_value + " . ($totalinserted + $totalupdated);
  339. $request .= " where statistic_name = 'planetimport_ogs'";
  340. * @todo Query : "insert ignore into " . TABLE_STATISTIC .
  341. " values ('planetimport_ogs', '" . ($totalinserted + $totalupdated) . "')";
  342. */
  343. function galaxy_ImportPlanets()
  344. {
  345. global $db, $user_data, $server_config;
  346. global $pub_data;
  347. galaxy_check_auth("import_planet");
  348. $files = array();
  349. $start = benchmark();
  350. // $test_ogs = file("test/Exp_Imp-planet.txt");
  351. // $test_ogs = implode($test_ogs);
  352. // $datas = explode("<->", $test_ogs);
  353. $datas = explode("<->", $pub_data);
  354. $files = $datas;
  355. $totalplanet = 0;
  356. $totalupdated = 0;
  357. $totalinserted = 0;
  358. $totalfailed = 0;
  359. $totalcanceled = 0;
  360. $require = array("galaxy", "system", "row", "datetime", "moon", "planetname",
  361. "allytag", "playername", "status", "sendername");
  362. $head = current($datas);
  363. $head = explode(",", $head);
  364. $structure = array();
  365. foreach ($head as $value) {
  366. @list($info, $position) = explode("=", $value);
  367. if (in_array($info, $require)) {
  368. $structure[$info] = $position;
  369. }
  370. }
  371. next($datas);
  372. while ($planetdata = current($datas)) {
  373. $totalplanet++;
  374. $arr = explode("<||>", $planetdata);
  375. $galaxy = trim($arr[($structure["galaxy"] - 1)]);
  376. $system = trim($arr[($structure["system"] - 1)]);
  377. $row = trim($arr[($structure["row"] - 1)]);
  378. if (isset($structure["datetime"])) {
  379. $datetime = trim($arr[($structure["datetime"] - 1)]);
  380. list($day, $hour) = explode(" ", $datetime);
  381. list($year, $month, $day) = explode("-", $day);
  382. list($hour, $minute, $seconde) = explode(":", $hour);
  383. $timestamp = mktime($hour, $minute, $seconde, $month, $day, $year);
  384. } else
  385. $timestamp = 0;
  386. if (isset($structure["moon"])) {
  387. $moon = intval(trim($arr[$structure["moon"] - 1]));
  388. if ($moon != 0 && $moon != 1)
  389. $moon = 0;
  390. } else
  391. $moon = 0;
  392. if (isset($structure["planetname"])) {
  393. $planetname = trim($arr[$structure["planetname"] - 1]);
  394. } else
  395. $planetname = "";
  396. if (isset($structure["allytag"])) {
  397. $allytag = trim($arr[$structure["allytag"] - 1]);
  398. } else
  399. $allytag = "";
  400. if (isset($structure["playername"])) {
  401. $playername = trim($arr[$structure["playername"] - 1]);
  402. } else
  403. $playername = "";
  404. if (isset($structure["status"])) {
  405. $status = trim($arr[$structure["status"] - 1]);
  406. } else
  407. $status = "";
  408. if (!check_var($galaxy, "Num") || !check_var($system, "Num") || !check_var($row,
  409. "Num") || !check_var($planetname, "Galaxy") || !check_var($allytag, "Galaxy") ||
  410. !check_var($playername, "Galaxy") || !check_var($status, "Char") || !check_var($timestamp,
  411. "Num")) {
  412. die("<!-- [ErrorFatal=12] Données transmises incorrectes -->");
  413. }
  414. $result = galaxy_add_system($galaxy, $system, $row, $moon, $planetname, $allytag,
  415. $playername, $status, $timestamp, true);
  416. if ($result) {
  417. list($inserted, $updated, $canceled) = $result;
  418. if ($inserted)
  419. $totalinserted++;
  420. if ($updated)
  421. $totalupdated++;
  422. if ($canceled)
  423. $totalcanceled++;
  424. } else {
  425. $totalfailed++;
  426. }
  427. next($datas);
  428. }
  429. if ($server_config["debug_log"] == "1") {
  430. //Sauvegarde données transmises
  431. $nomfichier = PATH_LOG_TODAY . date("ymd_His") . "_ID" . $user_data["user_id"] .
  432. "_sys_OGS.txt";
  433. write_file($nomfichier, "w", $files);
  434. }
  435. galaxy_add_system_ally();
  436. $end = benchmark();
  437. $totaltime = ($end - $start);
  438. $totaltime = round($totaltime, 2);
  439. //Statistiques serveur
  440. /*//Incompatible MySQL 4.0
  441. $request = "insert into ".TABLE_STATISTIC." values ('planetimport_ogs', '".($totalinserted+$totalupdated)."')";
  442. $request .= " on duplicate key update statistic_value = statistic_value + ".($totalinserted+$totalupdated)."";
  443. $db->sql_query($request);*/
  444. $request = "update " . TABLE_STATISTIC .
  445. " set statistic_value = statistic_value + " . ($totalinserted + $totalupdated);
  446. $request .= " where statistic_name = 'planetimport_ogs'";
  447. $db->sql_query($request);
  448. if ($db->sql_affectedrows() == 0) {
  449. $request = "insert ignore into " . TABLE_STATISTIC .
  450. " values ('planetimport_ogs', '" . ($totalinserted + $totalupdated) . "')";
  451. $db->sql_query($request);
  452. }
  453. echo "Merci " . $user_data["user_name"] . "\n";
  454. echo "Nb de planètes soumises : " . $totalplanet . "\n";
  455. echo "Nb de planètes insérées : " . $totalinserted . "\n";
  456. echo "Nb de planètes mise à jour : " . $totalupdated . "\n";
  457. echo "Nb de planètes obsolètes : " . $totalcanceled . "\n";
  458. echo "Nb d'échec : " . $totalfailed . "\n";
  459. echo "Durée de traitement : $totaltime sec" . "\n";
  460. log_("load_system_OGS", array($totalplanet, $totalinserted, $totalupdated, $totalcanceled,
  461. $totalfailed, $totaltime));
  462. exit();
  463. }
  464. /**
  465. * Recuperation des rapports d'espionnage provenant de OGS
  466. * @todo Query : "update " . TABLE_STATISTIC .
  467. " set statistic_value = statistic_value + " . ($totalinserted + $totalupdated);
  468. $request .= " where statistic_name = 'planetimport_ogs'";
  469. * @todo Query : "insert ignore into " . TABLE_STATISTIC .
  470. " values ('planetimport_ogs', '" . ($totalinserted + $totalupdated) . "')";
  471. */
  472. function galaxy_ImportSpy()
  473. {
  474. global $db, $user_data, $server_config;
  475. global $pub_data;
  476. galaxy_check_auth("import_spy");
  477. // $test_ogs = file("test/spy-import.txt");
  478. // $test_ogs = implode($test_ogs);
  479. // $datas = explode("<->", $test_ogs);
  480. $datas = explode("<->", $pub_data);
  481. $files = $datas;
  482. $require = array("coordinates", "planet", "datatime", "report");
  483. $head = current($datas);
  484. $head = explode(",", $head);
  485. $structure = array();
  486. foreach ($head as $value) {
  487. @list($info, $position) = explode("=", $value);
  488. if (in_array($info, $require)) {
  489. $structure[$info] = $position;
  490. }
  491. }
  492. $spy_added = 0;
  493. next($datas);
  494. while ($spyreportdata = current($datas)) {
  495. $arr = explode("<||>", $spyreportdata);
  496. $coordinates = $arr[($structure["coordinates"] - 1)];
  497. list($galaxy, $system, $row) = explode(":", $coordinates);
  498. $galaxy = intval($galaxy);
  499. $system = intval($system);
  500. $row = intval($row);
  501. if (isset($structure["planet"])) {
  502. $planet = trim($arr[($structure["planet"] - 1)]);
  503. } else
  504. $planet = "";
  505. if (isset($structure["datatime"])) {
  506. $datatime = trim($arr[($structure["datatime"] - 1)]);
  507. list($day, $hour) = explode(" ", $datatime);
  508. list($year, $month, $day) = explode("-", $day);
  509. list($hour, $minute, $seconde) = explode(":", $hour);
  510. $timestamp = mktime($hour, $minute, $seconde, $month, $day, $year);
  511. } else
  512. $timestamp = 0;
  513. $report = $arr[($structure["report"] - 1)];
  514. if (!check_var($galaxy, "Num") || !check_var($system, "Num") || !check_var($row,
  515. "Num") || !check_var($planet, "Galaxy") || !check_var($timestamp, "Num") || !
  516. check_var($report, "Spyreport")) {
  517. die("<!-- [ErrorFatal=17] Données transmises incorrectes -->");
  518. }
  519. // if (galaxy_add_spy($galaxy, $system, $row, $planet, $timestamp, $report, 0, 0)) { // modif pour les noms de lunes http://ogsteam.fr/forums/sujet-1652-correctif-bug-phalange-porte-saut
  520. $pos = strpos($report, "Phalange de capteur") + strlen("Phalange de capteur") +
  521. 1;
  522. $phalanx = "'" . substr("$report", $pos, $pos + 1) . "'";
  523. $pos2 = strpos($report, "Porte de saut spatial") + strlen("Porte de saut spatial") +
  524. 1;
  525. $gate = substr("$report", $pos2, $pos2 + 1);
  526. if (galaxy_add_spy($galaxy, $system, $row, $planet, $timestamp, $report, $phalanx,
  527. $gate[0])) {
  528. $spy_added++;
  529. }
  530. next($datas);
  531. }
  532. if ($server_config["debug_log"] == "1") {
  533. //Sauvegarde données transmises
  534. $nomfichier = PATH_LOG_TODAY . date("ymd_His") . "_ID" . $user_data["user_id"] .
  535. "_spy_OGS.txt";
  536. write_file($nomfichier, "w", $files);
  537. }
  538. user_set_stat(null, null, null, null, $spy_added);
  539. log_("load_spy_OGS", $spy_added);
  540. //Statistiques serveur
  541. /*//Incompatible MySQL 4.0
  542. $request = "insert into ".TABLE_STATISTIC." values ('spyimport_ogs', '".$spy_added."')";
  543. $request .= " on duplicate key update statistic_value = statistic_value + ".$spy_added."";*/
  544. $request = "update " . TABLE_STATISTIC .
  545. " set statistic_value = statistic_value + " . $spy_added;
  546. $request .= " where statistic_name = 'spyimport_ogs'";
  547. $db->sql_query($request);
  548. if ($db->sql_affectedrows() == 0) {
  549. $request = "insert ignore into " . TABLE_STATISTIC .
  550. " values ('spyimport_ogs', '" . $spy_added . "')";
  551. $db->sql_query($request);
  552. }
  553. die("Merci " . $user_data["user_name"] . "\n" . "Nb de rapports chargés : " . $spy_added .
  554. "\n");
  555. }
  556. /**
  557. * Renvoi des rapports d'espionnage vers OGS
  558. */
  559. /*
  560. function galaxy_ExportSpy()
  561. {
  562. global $db, $user_data;
  563. global $pub_galnum, $pub_sysnum;
  564. galaxy_check_auth("export_spy");
  565. if (!isset($pub_galnum) || !isset($pub_sysnum)) {
  566. die("<!-- [ErrorFatal=08] Données transmises incorrectes -->");
  567. }
  568. if (!check_var($pub_galnum, "Num") || !check_var($pub_sysnum, "Num")) {
  569. die("<!-- [ErrorFatal=09] Données transmises incorrectes -->");
  570. }
  571. $galaxy = intval($pub_galnum);
  572. $system = intval($pub_sysnum);
  573. $request = "select max(spy_id), un.name, s.rawdata, us.user_name" . " from " .
  574. TABLE_UNIVERSE . " un, " . TABLE_SPY . " s left join " . TABLE_USER . " us" .
  575. " on s.sender_id = us.user_id" . " where active = '1'" .
  576. " and un.galaxy = s.spy_galaxy" . " and un.system = s.spy_system" .
  577. " and un.row = s.spy_row" . " and galaxy = " . $galaxy . " and system = " . $system .
  578. " group by s.spy_galaxy, s.spy_system, s.spy_row";
  579. $result = $db->sql_query($request);
  580. $i = 0;
  581. echo "sendername=1,report=2<->";
  582. while (list($spy_id, $name, $data, $user_name) = $db->sql_fetch_row($result)) {
  583. $texte = $user_name . "<||>";
  584. $texte .= stripslashes($data) . "<->";
  585. echo $texte;
  586. $i++;
  587. }
  588. user_set_stat(null, null, null, null, null, null, null, null, $i);
  589. log_("export_spy_sector", array($i, $galaxy, $system));
  590. //Statistiques serveur
  591. //Incompatible MySQL 4.0
  592. //$request = "insert into ".TABLE_STATISTIC." values ('spyexport_ogs', '".$i."')";
  593. //$request .= " on duplicate key update statistic_value = statistic_value + ".$i."";
  594. $request = "update " . TABLE_STATISTIC .
  595. " set statistic_value = statistic_value + " . $i;
  596. $request .= " where statistic_name = 'spyexport_ogs'";
  597. $db->sql_query($request);
  598. if ($db->sql_affectedrows() == 0) {
  599. $request = "insert ignore into " . TABLE_STATISTIC .
  600. " values ('spyexport_ogs', '" . $i . "')";
  601. $db->sql_query($request);
  602. }
  603. exit();
  604. }
  605. */
  606. /**
  607. * Envoi des rapports d'espionnage vers OGS à partir d'une date
  608. */
  609. /*
  610. function galaxy_ExportSpy_since()
  611. {
  612. global $db, $user_data;
  613. global $pub_since;
  614. galaxy_check_auth("export_spy");
  615. if (!isset($pub_since)) {
  616. die("<!-- [ErrorFatal=10] Données transmises incorrectes -->");
  617. }
  618. if (!check_var($pub_since, "Special", "#^(\d){4}-(\d){2}-(\d){2}\s(\d){2}:(\d){2}:(\d){2}$#")) {
  619. die("<!-- [ErrorFatal=11] Données transmises incorrectes -->");
  620. }
  621. list($day, $hour) = explode(" ", $pub_since);
  622. list($year, $month, $day) = explode("-", $day);
  623. list($hour, $minute, $seconde) = explode(":", $hour);
  624. $timestamp = mktime($hour, $minute, $seconde, $month, $day, $year);
  625. $request = "select s.rawdata, us.user_name" . " from " . TABLE_SPY .
  626. " s left join " . TABLE_USER . " us" . " on s.sender_id = us.user_id" .
  627. " where active = '1'";
  628. " and datadate >= " . $timestamp;
  629. $result = $db->sql_query($request);
  630. $i = 0;
  631. echo "sendername=1,report=2<->";
  632. while (list($data, $user_name) = $db->sql_fetch_row($result)) {
  633. $texte = $user_name . "<||>";
  634. $texte .= stripslashes($data) . "<->";
  635. echo $texte;
  636. $i++;
  637. }
  638. user_set_stat(null, null, null, null, null, null, null, null, $i);
  639. log_("export_spy_date", array($i, $timestamp));
  640. //Statistiques serveur
  641. $request = "update " . TABLE_STATISTIC .
  642. " set statistic_value = statistic_value + " . $i;
  643. $request .= " where statistic_name = 'spyexport_ogs'";
  644. $db->sql_query($request);
  645. if ($db->sql_affectedrows() == 0) {
  646. $request = "insert ignore into " . TABLE_STATISTIC .
  647. " values ('spyexport_ogs', '" . $i . "')";
  648. $db->sql_query($request);
  649. }
  650. exit();
  651. }
  652. */
  653. /**
  654. * Recuperation du classement joueur via OGS
  655. * @param string $ranktype Ranking type
  656. * @todo Query : "update " . TABLE_STATISTIC .
  657. " set statistic_value = statistic_value + " . ($totalinserted + $totalupdated);
  658. $request .= " where statistic_name = 'rankimport_ogs'";
  659. * @todo Query : "insert ignore into " . TABLE_STATISTIC .
  660. " values ('rankimport_ogs', '" . ($totalinserted + $totalupdated) . "')";
  661. */
  662. function galaxy_ImportRanking_player($ranktype)
  663. {
  664. global $db, $user_data, $server_config;
  665. global $pub_data;
  666. galaxy_check_auth("import_ranking");
  667. // $test_ogs = file("test/Exp_Imp-ranking.txt");
  668. // $ranking=explode("<->", $test_ogs[0]);
  669. $ranking = explode("<->", $pub_data);
  670. $files = $ranking;
  671. $countrank = 0;
  672. switch ($ranktype) {
  673. case "points":
  674. $ranktable = TABLE_RANK_PLAYER_POINTS;
  675. $ranktype = "general";
  676. break;
  677. case "flotte":
  678. $ranktable = TABLE_RANK_PLAYER_FLEET;
  679. $ranktype = "fleet";
  680. break;
  681. case "research":
  682. $ranktable = TABLE_RANK_PLAYER_RESEARCH;
  683. $ranktype = "research";
  684. break;
  685. default:
  686. die("<!-- [ErrorFatal=15] Données transmises incorrectes -->");
  687. break;
  688. }
  689. $require = array("datetime", "playername", "allytag", "rank", "points",
  690. "sendername");
  691. $head = current($ranking);
  692. $head = explode(",", $head);
  693. $structure = array();
  694. foreach ($head as $value) {
  695. @list($info, $position) = explode("=", $value);
  696. if (in_array($info, $require)) {
  697. $structure[$info] = $position;
  698. }
  699. }
  700. @$datadate = $structure["datetime"];
  701. @list($day, $hour) = explode(" ", $datadate);
  702. @list($year, $month, $day) = explode("-", $day);
  703. @list($hour, $minute, $seconde) = explode(":", $hour);
  704. @$timestamp = mktime($hour, 0, 0, $month, $day, $year);
  705. next($ranking);
  706. while ($RankLine = current($ranking)) {
  707. if ($RankLine) {
  708. $arr = explode("<||>", $RankLine);
  709. $countrank = $countrank + 1;
  710. $rank = intval($arr[$structure["rank"] - 1]);
  711. if (isset($structure["playername"])) {
  712. $playername = trim($arr[$structure["playername"] - 1]);
  713. } else
  714. $playername = "";
  715. if (isset($structure["allytag"])) {
  716. $allytag = trim($arr[$structure["allytag"] - 1]);
  717. } else
  718. $allytag = "";
  719. if (isset($structure["points"])) {
  720. $points = intval($arr[$structure["points"] - 1]);
  721. } else
  722. $points = "";
  723. if (!check_var($rank, "Num") || !check_var($allytag, "Galaxy") || !check_var($playername,
  724. "Galaxy") || !check_var($points, "Num") || !check_var($timestamp, "Num")) {
  725. die("<!-- [ErrorFatal=16] Données transmises incorrectes -->");
  726. }
  727. $request = "insert ignore into " . $ranktable;
  728. $request .= " (datadate, rank, player, ally, points, sender_id)";
  729. $request .= " values ('" . $timestamp . "', '" . $rank . "', '" . $db->
  730. sql_escape_string($playername) . "', '" . $db->sql_escape_string($allytag) .
  731. "','" . $points . "', '" . $user_data["user_id"] . "')";
  732. $db->sql_query($request);
  733. }
  734. next($ranking);
  735. }
  736. user_set_stat(null, null, null, null, null, null, $countrank);
  737. if ($server_config["debug_log"] == "1") {
  738. //Sauvegarde données transmises
  739. $nomfichier = PATH_LOG_TODAY . date("ymd_His") . "_ID" . $user_data["user_id"] .
  740. "_ranking_" . $ranktype . ".txt";
  741. write_file($nomfichier, "w", $files);
  742. }
  743. if ($countrank > 0) {
  744. log_("load_rank", array("OGS", $ranktype, "player", $timestamp, $countrank));
  745. }
  746. //Statistiques serveur
  747. $request = "update " . TABLE_STATISTIC .
  748. " set statistic_value = statistic_value + " . $countrank;
  749. $request .= " where statistic_name = 'rankimport_ogs'";
  750. $db->sql_query($request);
  751. if ($db->sql_affectedrows() == 0) {
  752. $request = "insert ignore into " . TABLE_STATISTIC .
  753. " values ('rankimport_ogs', '" . $countrank . "')";
  754. $db->sql_query($request);
  755. }
  756. die("\nMerci " . $user_data["user_name"] . "\n" . "Nb de lignes soumises : " . $countrank .
  757. "\n");
  758. }
  759. /**
  760. * Recuperation du classement alliance via OGS
  761. * @param string $ranktype Ranking type
  762. * @todo Query : "update " . TABLE_STATISTIC .
  763. " set statistic_value = statistic_value + " . ($totalinserted + $totalupdated);
  764. $request .= " where statistic_name = 'rankimport_ogs'";
  765. * @todo Query : "insert ignore into " . TABLE_STATISTIC .
  766. " values ('rankimport_ogs', '" . ($totalinserted + $totalupdated) . "')";
  767. */
  768. function galaxy_ImportRanking_ally($ranktype)
  769. {
  770. global $db, $user_data, $server_config;
  771. global $pub_data;
  772. galaxy_check_auth("import_ranking");
  773. $ranking = explode("<->", $pub_data);
  774. $files = $ranking;
  775. $countrank = 0;
  776. switch ($ranktype) {
  777. case "points":
  778. $ranktable = TABLE_RANK_ALLY_POINTS;
  779. $ranktype = "general";
  780. break;
  781. case "flotte":
  782. $ranktable = TABLE_RANK_ALLY_FLEET;
  783. $ranktype = "fleet";
  784. break;
  785. case "research":
  786. $ranktable = TABLE_RANK_ALLY_RESEARCH;
  787. $ranktype = "research";
  788. break;
  789. default:
  790. die("<!-- [ErrorFatal=13] Données transmises incorrectes -->");
  791. break;
  792. }
  793. $require = array("rank", "allytag", "number_member", "points",
  794. "points_per_member", "sendername", "datetime");
  795. $head = current($ranking);
  796. $head = explode(",", $head);
  797. $structure = array();
  798. foreach ($head as $value) {
  799. @list($info, $position) = explode("=", $value);
  800. if (in_array($info, $require)) {
  801. $structure[$info] = $position;
  802. }
  803. }
  804. @$datadate = $structure["datetime"];
  805. @list($day, $hour) = explode(" ", $datadate);
  806. @list($year, $month, $day) = explode("-", $day);
  807. @list($hour, $minute, $seconde) = explode(":", $hour);
  808. @$timestamp = mktime($hour, 0, 0, $month, $day, $year);
  809. next($ranking);
  810. while ($RankLine = current($ranking)) {
  811. if ($RankLine) {
  812. $arr = explode("<||>", $RankLine);
  813. $countrank = $countrank + 1;
  814. $rank = intval($arr[$structure["rank"] - 1]);
  815. if (isset($structure["allytag"])) {
  816. $allytag = trim($arr[$structure["allytag"] - 1]);
  817. } else
  818. $allytag = "";
  819. if (isset($structure["number_member"])) {
  820. $number_member = trim($arr[$structure["number_member"] - 1]);
  821. } else
  822. $number_member = "";
  823. if (isset($structure["points"])) {
  824. $points = intval($arr[$structure["points"] - 1]);
  825. } else
  826. $points = "";
  827. if (isset($structure["points_per_member"])) {
  828. $points_per_member = intval($arr[$structure["points_per_member"] - 1]);
  829. } else
  830. $points_per_member = "";
  831. if (!check_var($rank, "Num") || !check_var($allytag, "Galaxy") || !check_var($number_member,
  832. "Num") || !check_var($points, "Num") || !check_var($points_per_member, "Num") ||
  833. !check_var($timestamp, "Num")) {
  834. die("<!-- [ErrorFatal=14] Données transmises incorrectes -->");
  835. }
  836. $request = "insert ignore into " . $ranktable;
  837. $request .= " (datadate, rank, ally, number_member, points, points_per_member, sender_id)";
  838. $request .= " values ('" . $timestamp . "', '" . $rank . "', '" . $db->
  839. sql_escape_string($allytag) . "','" . $number_member . "','" . $points . "','" .
  840. $points_per_member . "', '" . $user_data["user_id"] . "')";
  841. $db->sql_query($request);
  842. }
  843. next($ranking);
  844. }
  845. user_set_stat(null, null, null, null, null, null, $countrank);
  846. if ($server_config["debug_log"] == "1") {
  847. //Sauvegarde données transmises
  848. $nomfichier = PATH_LOG_TODAY . date("ymd_His") . "_ID" . $user_data["user_id"] .
  849. "_ranking_" . $ranktype . ".txt";
  850. write_file($nomfichier, "w", $files);
  851. }
  852. if ($countrank > 0) {
  853. log_("load_rank", array("OGS", $ranktype, "ally", $timestamp, $countrank));
  854. }
  855. //Statistiques serveur
  856. $request = "update " . TABLE_STATISTIC .
  857. " set statistic_value = statistic_value + " . $countrank;
  858. $request .= " where statistic_name = 'rankimport_ogs'";
  859. $db->sql_query($request);
  860. if ($db->sql_affectedrows() == 0) {
  861. $request = "insert ignore into " . TABLE_STATISTIC .
  862. " values ('rankimport_ogs', '" . $countrank . "')";
  863. $db->sql_query($request);
  864. }
  865. die("\nMerci " . $user_data["user_name"] . "\n" . "Nb de lignes soumises : " . $countrank .
  866. "\n");
  867. }
  868. /**
  869. * Listing des classements disponibles sur le serveur pour envoi vers OGS
  870. * @param string $type Player or Ally
  871. * @todo Query: "select distinct datadate from " . $table_points .
  872. " order by datadate desc";
  873. * @todo Query: "select distinct datadate from " . $table_fleet .
  874. " order by datadate desc";
  875. * @todo Query: "select distinct datadate from " . $table_research .
  876. " order by datadate desc";
  877. */
  878. function galaxy_ShowAvailableRanking($type)
  879. {
  880. global $db;
  881. $ranking = array();
  882. switch ($type) {
  883. case "player":
  884. $table_points = TABLE_RANK_PLAYER_POINTS;
  885. $table_fleet = TABLE_RANK_PLAYER_POINTS;
  886. $table_research = TABLE_RANK_PLAYER_POINTS;
  887. break;
  888. case "ally":
  889. $table_points = TABLE_RANK_ALLY_POINTS;
  890. $table_fleet = TABLE_RANK_ALLY_POINTS;
  891. $table_research = TABLE_RANK_ALLY_POINTS;
  892. break;
  893. }
  894. $request = "select distinct datadate from " . $table_points .
  895. " order by datadate desc";
  896. $result = $db->sql_query($request);
  897. while (list($datadate) = $db->sql_fetch_row($result)) {
  898. $ranking[$datadate]["points"] = true;
  899. }
  900. $request = "select distinct datadate from " . $table_fleet .
  901. " order by datadate desc";
  902. $result = $db->sql_query($request);
  903. while (list($datadate) = $db->sql_fetch_row($result)) {
  904. $ranking[$datadate]["fleet"] = true;
  905. }
  906. $request = "select distinct datadate from " . $table_research .
  907. " order by datadate desc";
  908. $result = $db->sql_query($request);
  909. while (list($datadate) = $db->sql_fetch_row($result)) {
  910. $ranking[$datadate]["research"] = true;
  911. }
  912. while ($value = current($ranking)) {
  913. echo date("Y-m-d H:i:s", key($ranking) + 4) . "=";
  914. if (isset($value["points"]))
  915. echo "P";
  916. if (isset($value["fleet"]))
  917. echo "F";
  918. if (isset($value["research"]))
  919. echo "R";
  920. echo "<|>";
  921. next($ranking);
  922. }
  923. exit();
  924. }
  925. /**
  926. * Login d'un utilisateur OGS
  927. */
  928. function user_ogs_login()
  929. {
  930. global $db, $user_data, $user_auth, $server_config;
  931. global $pub_name, $pub_pass, $pub_ogsversion;
  932. if (!check_var($pub_name, "Pseudo_Groupname") || !check_var($pub_pass,
  933. "Password") || !check_var($pub_ogsversion, "Num")) {
  934. die("<!-- [ErrorFatal=19] Données transmises incorrectes -->");
  935. }
  936. //Refus des version OGS antérieure à 060601
  937. if (strcasecmp($pub_ogsversion, "060601") < 0) {
  938. die("<!-- [Login=0] La version d'Ogame Stratege utilisé n'est pas compatible avec ce serveur -->");
  939. }
  940. if (isset($pub_name, $pub_pass)) {
  941. $request = "select user_id, user_active from " . TABLE_USER .
  942. " where user_name = '" . $db->sql_escape_string($pub_name) .
  943. "' and user_password = '" . md5(sha1($pub_pass)) . "'";
  944. $result = $db->sql_query($request);
  945. if (list($user_id, $user_active) = $db->sql_fetch_row($result)) {
  946. session_set_user_id($user_id);
  947. if ($user_auth["ogs_connection"] != 1 && $user_data["user_admin"] != 1 && $user_data["user_coadmin"] !=
  948. 1) {
  949. die("<!-- [Login=0] [AccessDenied] Accès refusé -->");
  950. }
  951. if ($user_active == 1) {
  952. $request = "update " . TABLE_USER . " set user_lastvisit = " . time() .
  953. " where user_id = " . $user_id;
  954. $db->sql_query($request);
  955. /*//Incompatible MySQL 4.0
  956. $request = "insert into ".TABLE_STATISTIC." values ('connection_ogs', '1')";
  957. $request .= " on duplicate key update statistic_value = statistic_value + 1";
  958. $db->sql_query($request);*/
  959. $request = "update " . TABLE_STATISTIC .
  960. " set statistic_value = statistic_value + 1";
  961. $request .= " where statistic_name = 'connection_ogs'";
  962. $db->sql_query($request);
  963. if ($db->sql_affectedrows() == 0) {
  964. $request = "insert ignore into " . TABLE_STATISTIC .
  965. " values ('connection_ogs', '1')";
  966. $db->sql_query($request);
  967. }
  968. log_('login_ogs');
  969. echo "<!-- [Login=1] OGame Stratege SharingDB -->" . "\n";
  970. echo "<!-- Servername = OGSPY -->" . "\n";
  971. echo "<!-- ServerVersion = " . $server_config["version"] . " -->" . "\n";
  972. echo "<!-- ServerInfo = By Kyser , http://www.ogsteam.fr -->" . "\n\n";
  973. if ($user_auth["ogs_set_system"] == 1 || $user_data["user_admin"] == 1 || $user_data["user_coadmin"] ==
  974. 1)
  975. echo "<!-- [ExportSysAuth=1] You are authorised to export Solar System -->" . "\n";
  976. else
  977. echo "<!-- [ExportSysAuth=0] You are not authorised to export Solar System -->" .
  978. "\n";
  979. if ($user_auth["ogs_get_system"] == 1 || $user_data["user_admin"] == 1 || $user_data["user_coadmin"] ==
  980. 1)
  981. echo "<!-- [ImportSysAuth=1] You are authorised to import Solar System -->" . "\n";
  982. else
  983. echo "<!-- [ImportSysAuth=0] You are not authorised to import Solar System -->" .
  984. "\n";
  985. echo "\n";
  986. if ($user_auth["ogs_set_spy"] == 1 || $user_data["user_admin"] == 1 || $user_data["user_coadmin"] ==
  987. 1)
  988. echo "<!-- [ExportSpyAuth=1] You are authorised to export Spy Reports -->" . "\n";
  989. else
  990. echo "<!-- [ExportSpyAuth=0] You are not authorised to export Spy Reports -->" .
  991. "\n";
  992. if ($user_auth["ogs_get_spy"] == 1 || $user_data["user_admin"] == 1 || $user_data["user_coadmin"] ==
  993. 1)
  994. echo "<!-- [ImportSpyAuth=1] You are authorised to import Spy Reports -->" . "\n";
  995. else
  996. echo "<!-- [ImportSpyAuth=0] You are not authorised to import Spy Reports -->" .
  997. "\n";
  998. echo "\n";
  999. if ($user_auth["ogs_set_ranking"] == 1 || $user_data["user_admin"] == 1 || $user_data["user_coadmin"] ==
  1000. 1)
  1001. echo "<!-- [ExportRankAuth=1] You are authorised to export Ranking -->" . "\n";
  1002. else
  1003. echo "<!-- [ExportRankAuth=0] You are not authorised to export Ranking -->" . "\n";
  1004. if ($user_auth["ogs_get_ranking"] == 1 || $user_data["user_admin"] == 1 || $user_data["user_coadmin"] ==
  1005. 1)
  1006. echo "<!-- [ImportRankAuth=1] You are authorised to import Ranking -->" . "\n";
  1007. else
  1008. echo "<!-- [ImportRankAuth=0] You are not authorised to import Ranking -->" . "\n";
  1009. exit();
  1010. }
  1011. }
  1012. }
  1013. die("<!-- [ErrorFatal=20] Données transmises incorrectes -->");
  1014. }
  1015. ?>