Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Jak coś takiego zrobic, Jak coś takiego zrobić
wolacinio
post
Post #1





Grupa: Zarejestrowani
Postów: 85
Pomógł: 1
Dołączył: 2.06.2009

Ostrzeżenie: (0%)
-----


witam
Jak zrobić skrypt taki sam jak na tej stronie

http://wykrywarka.pl/

tzn. ze wybieram liczby po czym daje losuj i losuje mi byle jakie liczby
jak mozna to prosze o link do skryptu a jak nie dostane to prosze teoretycznie jak napisac taki skrypt

Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Klycior
post
Post #2





Grupa: Zarejestrowani
Postów: 116
Pomógł: 2
Dołączył: 31.05.2009

Ostrzeżenie: (0%)
-----


Może się przyda:

  1. <?php
  2.  
  3. if(!isSet($_POST['i'][0]) || !isSet($_POST['i'][1]) || !isSet($_POST['i'][2]) || !isSet($_POST['i'][3]) ||
  4. !isSet($_POST['i'][4]) || !isSet($_POST['i'][5]) || isSet($_POST['i'][6]) || isSet($_POST['i'][7])
  5. || isSet($_POST['i'][7]) || isSet($_POST['i'][8]) || isSet($_POST['i'][9]) || isSet($_POST['i'][10])
  6. || isSet($_POST['i'][11]) || isSet($_POST['i'][12]) || isSet($_POST['i'][13]) || isSet($_POST['i'][14])
  7. || isSet($_POST['i'][15]) || isSet($_POST['i'][16]) || isSet($_POST['i'][17]) || isSet($_POST['i'][18])
  8. || isSet($_POST['i'][19]) || isSet($_POST['i'][20]) || isSet($_POST['i'][21]) || isSet($_POST['i'][22])
  9. || isSet($_POST['i'][23]) || isSet($_POST['i'][24]) || isSet($_POST['i'][25]) || isSet($_POST['i'][26])
  10. || isSet($_POST['i'][27]) || isSet($_POST['i'][28]) || isSet($_POST['i'][29]) || isSet($_POST['i'][30])
  11. || isSet($_POST['i'][31]) || isSet($_POST['i'][32]) || isSet($_POST['i'][33]) || isSet($_POST['i'][34])
  12. || isSet($_POST['i'][35]) || isSet($_POST['i'][36]) || isSet($_POST['i'][37]) || isSet($_POST['i'][38])
  13. || isSet($_POST['i'][39]) || isSet($_POST['i'][40]) || isSet($_POST['i'][41]) || isSet($_POST['i'][42])
  14. || isSet($_POST['i'][43]) || isSet($_POST['i'][44]) || isSet($_POST['i'][45]) || isSet($_POST['i'][46])
  15. || isSet($_POST['i'][47]) || isSet($_POST['i'][48])){
  16. $komunikat2 = "Nie znasz zasad! Aby wziąść udział w losowaniu musisz wytypować 6 liczb!<br /><a href='java script:history.go(-1)'>powrót</a>";
  17. }
  18. else {
  19. $g[1] = rand(1,49);
  20. $g[2] = rand(1,49);
  21. $g[3] = rand(1,49);
  22. $g[4] = rand(1,49);
  23. $g[5] = rand(1,49);
  24. $g[6] = rand(1,49);
  25. if($g[1] == $g[2] || $g[1] == $g[3] || $g[1] == $g[4] || $g[1] == $g[5] || $g[1] == $g[6] ||
  26. $g[2] == $g[1] || $g[2] == $g[3] || $g[2] == $g[4] || $g[2] == $g[5] || $g[2] == $g[6] ||
  27. $g[3] == $g[1] || $g[3] == $g[2] || $g[3] == $g[4] || $g[3] == $g[5] || $g[3] == $g[6] ||
  28. $g[4] == $g[1] || $g[4] == $g[2] || $g[4] == $g[3] || $g[4] == $g[5] || $g[4] == $g[6] ||
  29. $g[5] == $g[1] || $g[5] == $g[2] || $g[5] == $g[3] || $g[5] == $g[4] || $g[5] == $g[6] ||
  30. $g[6] == $g[1] || $g[6] == $g[2] || $g[6] == $g[3] || $g[6] == $g[4] || $g[6] == $g[5]){
  31. while($g[1] == $g[2] || $g[1] == $g[3] || $g[1] == $g[4] || $g[1] == $g[5] || $g[1] == $g[6] ||
  32. $g[2] == $g[1] || $g[2] == $g[3] || $g[2] == $g[4] || $g[2] == $g[5] || $g[2] == $g[6] ||
  33. $g[3] == $g[1] || $g[3] == $g[2] || $g[3] == $g[4] || $g[3] == $g[5] || $g[3] == $g[6] ||
  34. $g[4] == $g[1] || $g[4] == $g[2] || $g[4] == $g[3] || $g[4] == $g[5] || $g[4] == $g[6] ||
  35. $g[5] == $g[1] || $g[5] == $g[2] || $g[5] == $g[3] || $g[5] == $g[4] || $g[5] == $g[6] ||
  36. $g[6] == $g[1] || $g[6] == $g[2] || $g[6] == $g[3] || $g[6] == $g[4] || $g[6] == $g[5]){
  37. $g[1] = rand(1,49);
  38. $g[2] = rand(1,49);
  39. $g[3] = rand(1,49);
  40. $g[4] = rand(1,49);
  41. $g[5] = rand(1,49);
  42. $g[6] = rand(1,49);
  43. }
  44. }
  45.  
  46. $u[1] = (int)round($_POST['i'][0], 0);
  47. $u[2] = (int)round($_POST['i'][1], 0);
  48. $u[3] = (int)round($_POST['i'][2], 0);
  49. $u[4] = (int)round($_POST['i'][3], 0);
  50. $u[5] = (int)round($_POST['i'][4], 0);
  51. $u[6] = (int)round($_POST['i'][5], 0);
  52.  
  53. $trafione = 0;
  54. for($k=1; $k <= 6; $k++){
  55. for($j=1; $j <= 6; $j++){
  56. if($g[$k] == $u[$j]){
  57. $trafione++;
  58. }
  59. }
  60. }
  61. if($trafione == 6){
  62. $wygrana = $kumulacja[0];
  63. $kasa = $wygrana + $kierowca['kasa'];
  64. $komunikat = "Gratulacje. Trafiłeś wszystkie liczby! Otrzymujesz nagrodę główną w wysokości ".$wygrana." zł !";
  65. }
  66. else if($trafione == 5){
  67. $wygrana = $kumulacja[0] * 0.1;
  68. $wygrana = round($wygrana, '0');
  69. $kasa = $wygrana + $kierowca['kasa'];
  70. $komunikat = "Było naprawdę blisko. Trafiłeś pięć liczb. Wygrywasz ".$wygrana." zł";
  71. else if($trafione == 4){
  72. $wygrana = $kumulacja[0] * 0.02;
  73. $wygrana = round($wygrana, '0');
  74. $kasa = $wygrana + $kierowca['kasa'];
  75. $komunikat = "Jeszcze troche brakuje. Trafiłeś cztery liczby i wygrywasz ".$wygrana." zł";
  76. }
  77. else if($trafione == 3){
  78. $wygrana = $kumulacja[0] * 0.0001;
  79. $wygrana = round($wygrana, '0');
  80. $kasa = $wygrana + $kierowca['kasa'];
  81. $komunikat = "Trafiłeś trzy liczby i wygrywasz ".$wygrana." zł";
  82. }
  83. else if($trafione == 2){
  84. $komunikat = "Trafiłeś dwie liczby. Spróbuj ponownie";
  85. }
  86. else if($trafione == 1){
  87. $komunikat = "Trafiłeś jedną liczbę. Spróbuj ponownie";
  88. }
  89. else if($trafione == 0){
  90. $komunikat = "Nic nie trafiłeś. Spróbuj ponownie";
  91. }
  92. }
  93. }
  94. }
  95.  
  96. if(isSet($komunikat)){
  97. echo "Wylosowane liczby to: ".$g[1]." ".$g[2]." ".$g[3]." ".$g[4]." ".$g[5]." ".$g[6]."<br />
  98. Twoje liczby to: ".$u[1]." ".$u[2]." ".$u[3]." ".$u[4]." ".$u[5]." ".$u[6]."<br /><br />";
  99. echo $komunikat;
  100. }
  101. else if(isSet($komunikat2)){
  102. echo $komunikat2;
  103. }
  104. else{
  105. ?>
  106. <form name="lotekk" action="lotek.php" method="post">
  107. <table>
  108. <tr>
  109. <td><input type="checkbox" name="i[]" value="1" />1</td>
  110. <td><input type="checkbox" name="i[]" value="2" />2</td>
  111. <td><input type="checkbox" name="i[]" value="3" />3</td>
  112. <td><input type="checkbox" name="i[]" value="4" />4</td>
  113. <td><input type="checkbox" name="i[]" value="5" />5</td>
  114. <td><input type="checkbox" name="i[]" value="6" />6</td>
  115. <td><input type="checkbox" name="i[]" value="7" />7</td>
  116. <td><input type="checkbox" name="i[]" value="8" />8</td>
  117. <td><input type="checkbox" name="i[]" value="9" />9</td>
  118. <td><input type="checkbox" name="i[]" value="10" />10</td>
  119. </tr>
  120. <tr>
  121. <td><input type="checkbox" name="i[]" value="11" />11</td>
  122. <td><input type="checkbox" name="i[]" value="12" />12</td>
  123. <td><input type="checkbox" name="i[]" value="13" />13</td>
  124. <td><input type="checkbox" name="i[]" value="14" />14</td>
  125. <td><input type="checkbox" name="i[]" value="15" />15</td>
  126. <td><input type="checkbox" name="i[]" value="16" />16</td>
  127. <td><input type="checkbox" name="i[]" value="17" />17</td>
  128. <td><input type="checkbox" name="i[]" value="18" />18</td>
  129. <td><input type="checkbox" name="i[]" value="19" />19</td>
  130. <td><input type="checkbox" name="i[]" value="20" />20</td>
  131. </tr>
  132. <tr>
  133. <td><input type="checkbox" name="i[]" value="21" />21</td>
  134. <td><input type="checkbox" name="i[]" value="22" />22</td>
  135. <td><input type="checkbox" name="i[]" value="23" />23</td>
  136. <td><input type="checkbox" name="i[]" value="24" />24</td>
  137. <td><input type="checkbox" name="i[]" value="25" />25</td>
  138. <td><input type="checkbox" name="i[]" value="26" />26</td>
  139. <td><input type="checkbox" name="i[]" value="27" />27</td>
  140. <td><input type="checkbox" name="i[]" value="28" />28</td>
  141. <td><input type="checkbox" name="i[]" value="29" />29</td>
  142. <td><input type="checkbox" name="i[]" value="30" />30</td>
  143. </tr>
  144. <tr>
  145. <td><input type="checkbox" name="i[]" value="31" />31</td>
  146. <td><input type="checkbox" name="i[]" value="32" />32</td>
  147. <td><input type="checkbox" name="i[]" value="33" />33</td>
  148. <td><input type="checkbox" name="i[]" value="34" />34</td>
  149. <td><input type="checkbox" name="i[]" value="35" />35</td>
  150. <td><input type="checkbox" name="i[]" value="36" />36</td>
  151. <td><input type="checkbox" name="i[]" value="37" />37</td>
  152. <td><input type="checkbox" name="i[]" value="38" />38</td>
  153. <td><input type="checkbox" name="i[]" value="39" />39</td>
  154. <td><input type="checkbox" name="i[]" value="40" />40</td>
  155. </tr>
  156. <tr>
  157. <td><input type="checkbox" name="i[]" value="41" />41</td>
  158. <td><input type="checkbox" name="i[]" value="42" />42</td>
  159. <td><input type="checkbox" name="i[]" value="43" />43</td>
  160. <td><input type="checkbox" name="i[]" value="44" />44</td>
  161. <td><input type="checkbox" name="i[]" value="45" />45</td>
  162. <td><input type="checkbox" name="i[]" value="46" />46</td>
  163. <td><input type="checkbox" name="i[]" value="47" />47</td>
  164. <td><input type="checkbox" name="i[]" value="48" />48</td>
  165. <td><input type="checkbox" name="i[]" value="49" />49</td>
  166. <td> </td>
  167. </tr>
  168. <tr>
  169. <td colspan="10" align="right" /><input type="submit" name="start" value="rozpocznij losowanie" /></td>
  170. </tr>
  171. </table>
  172. </form>
  173. <?php
  174. }
  175. ?>




Ten post edytował Klycior 14.03.2010, 22:51:24
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 07:12