Advertisement
zero50x

Программа для лотерей ВикЛот

Aug 22nd, 2016
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.99 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL | E_STRICT);
  3. // Добавлять сообщения обо всех ошибках, кроме E_NOTICE
  4. //error_reporting(E_ALL & ~E_NOTICE);
  5. ini_set('display_errors', TRUE);
  6. ini_set('display_startup_errors', TRUE);
  7. header('Content-type: text/html; charset=UTF-8');
  8. ?>
  9.  
  10. <!DOCTYPE html>
  11. <html>
  12. <head>
  13. <title>Виклот скрипт</title>
  14.  
  15. <style>
  16.   .container { width: 1000px; margin: 0 auto; }
  17.   .container .col_left   { float: left;  width: 283px; background: white; font-size: 20px;}
  18.   .container .col_center { float: left;  width: 283px; background: white; font-size: 20px;}
  19.   .container .col_right  { float: left;  width: 283px; background: white; font-size: 20px;}
  20.   .clear { clear: both; }
  21. </style>
  22.  
  23. </head>
  24. <body>
  25.  
  26.  
  27. <?php
  28. $g5 = microtime(true);
  29. $writefile = 0;
  30. $titlechange = 0;
  31. $k1 = "";
  32. $k2 = "";
  33. $k3 = "";
  34. $titlelot = "";
  35. if (isset($_POST['text']) && isset($_POST['titlelot'])) {
  36.    
  37. $text = htmlspecialchars(strip_tags(trim($_POST['text'])));
  38. $titlelot = htmlspecialchars(strip_tags(trim($_POST['titlelot'])));
  39.  
  40.  
  41.  
  42. $AllArr = explode("\n", $text); // разбиваем на массив
  43. $CountAllArr = count($AllArr);  // считаем
  44. //echo "Строк: $CountAllArr";
  45.  
  46.  
  47. for ($i = 0; $i < $CountAllArr; $i++) {
  48.     $AllArr[$i] = preg_replace("/^[0-9]{1,}(\s|\t)/ism", "", $AllArr[$i]);
  49.     $AllArr[$i] = trim($AllArr[$i]);
  50.     $AllArr[$i] = preg_replace("/\s/ism", " - ", $AllArr[$i]);
  51. }
  52.  
  53. //echo "<pre>";
  54. //var_dump($AllArr);
  55. //echo "</pre>";
  56.  
  57. $CountAllArr3 = ceil($CountAllArr/3);
  58. echo "CountAllArr3 = $CountAllArr3<br>";
  59.  
  60.  
  61. for ($i1 = 0; $i1 < $CountAllArr3; $i1++) {
  62.     $k1 .= "$AllArr[$i1]<br>";
  63. }
  64.  
  65. $twoFin = $CountAllArr3+$CountAllArr3;
  66.  
  67. for ($i1 = $CountAllArr3; $i1 < $twoFin; $i1++) {
  68.     $k2 .= "$AllArr[$i1]<br>";
  69. }
  70.  
  71. //$threeStart = $twoFin+1;
  72.  
  73. for ($i1 = $twoFin; $i1 < $CountAllArr; $i1++) {
  74.     $k3 .= "$AllArr[$i1]<br>";
  75. }
  76.  
  77. //echo "k1 = $k1";
  78.  
  79.  
  80.  
  81. }
  82.  
  83. /*
  84.  
  85. <table border="0" width="850" cellspacing="0" cellpadding="0">
  86.     <tr>
  87.         <td>
  88.  
  89. <table align="center" border="0" width="100%" cellspacing="0" cellpadding="0">
  90.     <tr>
  91.         <td>&nbsp;</td>
  92.         <td>&nbsp;</td>
  93.         <td>&nbsp;</td>
  94.     </tr>
  95. </table>
  96.  
  97.         </td>
  98.     </tr>
  99. </table>
  100.  
  101. */
  102.  
  103.  
  104. //$g6 = microtime(true);
  105. //$timescript = $g6 - $g5; echo $timescript; // время всех фраз
  106.  
  107. ?>
  108.  
  109. <h2 align="center"><?php echo "$titlelot"; ?></h2>
  110. <div class="container">
  111. <div class="col_left"><?php echo "$k1"; ?></div>
  112. <div class="col_center"><?php echo "$k2"; ?></div>
  113. <div class="col_right"><?php echo "$k3"; ?></div>
  114. <div class="clear"></div>
  115. </div>
  116.  
  117. <form action="lotnn2.php" method="POST">
  118.     Введите тираж и название лотереи:<br>
  119.     <input type="text" name="titlelot" value="" size="40" /><br><br>
  120.     Введите данные билетов:<br>
  121.     <textarea type="text" name="text" COLS="41" ROWS="10"></TEXTAREA></br>
  122.     <button type="submit" name="add">Пуск!</button>
  123. </form>
  124.  
  125. </body>
  126. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement