index.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. function secondsToTime($seconds_time)
  3. {
  4. // if ($seconds_time < 24 * 60 * 60) {
  5. // return gmdate('H:i:s', $seconds_time);
  6. // } else {
  7. $hours = floor($seconds_time / 3600);
  8. $minutes = floor(($seconds_time - $hours * 3600) / 60);
  9. $seconds = floor($seconds_time - ($hours * 3600) - ($minutes * 60));
  10. return $hours."h ".$minutes."m ".$seconds."s";
  11. // }
  12. }
  13. ?>
  14. <!doctype html>
  15. <html lang="en">
  16. <head>
  17. <meta charset="utf-8">
  18. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  19. <meta name="description" content="">
  20. <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
  21. <meta name="generator" content="Jekyll v3.8.5">
  22. <title>Lost in Ark Queue</title>
  23. <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
  24. <link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
  25. <link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
  26. <link rel="manifest" href="site.webmanifest">
  27. <link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
  28. <meta name="msapplication-TileColor" content="#da532c">
  29. <meta name="theme-color" content="#ffffff">
  30. <meta property="og:type" content="website">
  31. <meta property="og:url" content="https://bester.dahwa.fr/lostark/">
  32. <meta property="og:title" content="Lost Paper - Estimation du désespoir">
  33. <meta property="og:description" content="Si tu veux estimer combien de temps tu vas attendre">
  34. <meta property="og:image" content="https://bester.dahwa.fr/lostark/la.png">
  35. <!-- Bootstrap core CSS -->
  36. <link href="bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  37. <style>
  38. .bd-placeholder-img {
  39. font-size: 1.125rem;
  40. text-anchor: middle;
  41. -webkit-user-select: none;
  42. -moz-user-select: none;
  43. -ms-user-select: none;
  44. user-select: none;
  45. }
  46. @media (min-width: 768px) {
  47. .bd-placeholder-img-lg {
  48. font-size: 3.5rem;
  49. }
  50. }
  51. </style>
  52. <!-- Custom styles for this template -->
  53. <link href="signin.css" rel="stylesheet">
  54. </head>
  55. <?php
  56. $init_ts=mktime();
  57. if(isset($_POST['init_ts'])) $init_ts=$_POST['init_ts'];
  58. ?>
  59. <body class="text-center">
  60. <form class="form-signin" method=post name=init action="">
  61. <img class="mb-4" src="la.png" alt="" width="72" height="72">
  62. <h1 class="h3 mb-3 font-weight-normal">Estimation du désespoir <small>(<?= date("d/m/Y H:i:s") ?>)</small></h1>
  63. <div class="form-group row">
  64. <?php
  65. $disable='';
  66. $readonly='';
  67. if(isset($_POST['init_val'])) {
  68. $disable='DISABLED';
  69. $readonly='READONLY';
  70. }
  71. ?>
  72. <label for="staticEmail" class="col-sm-4 col-form-label">Position initiale<br><small><?= date("d/m/Y H:i:s",$init_ts)?></small></label>
  73. <input type="number" class="col-sm-4 form-control-number" name=init_val required value="<?= $_POST['init_val'] ?>" <?= $readonly ?>>
  74. <input type="hidden" name=init_ts value="<?= $init_ts ?>">
  75. <button class="col-sm-4 btn btn-lg btn-block" type="submit" name=init value="stage1" <?= $disable ?>> Set</button>
  76. </div>
  77. </div>
  78. <?php
  79. if(isset($_POST['init_val']))
  80. if(is_int(intval($_POST['init_val']))) {
  81. echo '
  82. <div class="form-group row">
  83. <label for="staticEmail" class="col-sm-4 col-form-label">Position actuelle<br><small>'.date("d/m/Y H:i:s").'</small></label>';
  84. $v='';
  85. if(isset($_POST['current_val'])) $v='value="'.$_POST['current_val'].'"';
  86. echo ' <input type="number" class="col-sm-4 form-control-number" name=current_val required '.$v.'>';
  87. echo ' <button class="col-sm-4 btn btn-lg btn-block" type="submit" name=init value="stage2">Set</button>
  88. <input type="hidden" name=current_ts value="'.mktime().'">
  89. </div>
  90. </div>';
  91. if(isset($_POST['current_val'])) {
  92. if($_POST['current_val']>=$_POST['init_val']) {
  93. echo '
  94. <div class="form-group row">
  95. <label for="staticEmail" class="col-sm-12 col-form-label">Mmmmh. Tu sembles avoir un problème de doigts, ou de vue ;)</label>
  96. </div>
  97. </div>';
  98. } else {
  99. $delta_pos=$_POST['init_val']-$_POST['current_val'];
  100. $delta_ts=$_POST['current_ts']-$_POST['init_ts'];
  101. $sPos=($delta_ts/$delta_pos);
  102. $eta=$sPos*$_POST['current_val'];
  103. $ts=mktime()+$eta;
  104. $date=date("d/m/Y H:i:s",$ts);
  105. echo '
  106. <div class="form-group row">
  107. <label for="staticEmail" class="col-sm-6 col-form-label">Estimation de la fin de la douleur </label>
  108. <label for="staticEmail" class="col-sm-6 col-form-label"><b>'.$date.' - soit, dans '.secondsToTime($eta).'</b></label>
  109. </div>
  110. </div>';
  111. }
  112. }
  113. }
  114. ?>
  115. <?php
  116. ?>
  117. </form>
  118. <?php
  119. /*
  120. echo "<pre>";
  121. print_r($_POST);
  122. echo "</pre>";
  123. */
  124. ?>
  125. </body>
  126. </html>