Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <HTML>
  3. <HEAD>
  4. <META charset="utf-8">
  5. <TITLE> TABLE FORM </TITLE>
  6. <style>
  7. body {
  8. text-align:center;
  9. background-color:orange;
  10. }
  11. fieldset{
  12. width:100px;
  13. }
  14. form {
  15. margin:auto;
  16. width:100px;
  17. }
  18. img {
  19. width:400px;
  20. height:200px;
  21. }
  22. </style>
  23. </HEAD>
  24. <BODY>
  25. <h2> ΠΑΙΞΕ ΤΖΟΚΕΡ ΤΩΡΑ online </h2>
  26. <img src="tzoker.jpg"/>
  27. <form action="result.php" method="POST">
  28. <fieldset>
  29. <legend> Διάλεξε 5 αριθμούς από το 1-45 </legend>
  30. <input type="number" min="1" max="45" name="num1" required/>
  31. <input type="number" min="1" max="45" name="num2" required/>
  32. <input type="number" min="1" max="45" name="num3" required/>
  33. <input type="number" min="1" max="45" name="num4" required/>
  34. <input type="number" min="1" max="45" name="num5" required/>
  35. </fieldset>
  36. <fieldset>
  37.  
  38. <legend> Διάλεξε 1 αριθμό Τζοκερ από το 1-20 </legend>
  39. <input type="number" min="1" max="20" name="tzoker" required/>
  40. </fieldset>
  41. <input type="submit" value="PLAY"/>
  42. </form>
  43.  
  44. </BODY>
  45. </HTML>
  46.  
  47.  
  48.  
  49. <?php
  50.  
  51. $pinakas = array($_POST["num1"],$_POST["num2"],$_POST["num3"],$_POST["num4"],$_POST["num5"]);
  52. $tzoker = $_POST["tzoker"];
  53.  
  54. sort($pinakas);
  55.  
  56. if( count(array_unique($pinakas)) < count($pinakas) ) {
  57. echo "Διάλεξες ίδια νούμερα <a href='18_11.php'> ΠΑΙΞΕ ΞΑΝΑ </a>";
  58. }
  59. else {
  60.  
  61. echo "<table border='1'>
  62. <tr><th colspan='5'>Οι αριθμοί που έπαιξες είναι:</th>
  63. <th> Ο τζοκερ ειναι</th></tr><tr>";
  64. for ($i=0;$i<5;$i++){
  65. echo "<td>".$pinakas[$i]."</td>";
  66. }
  67. echo "<td style='background-color:grey'>".$tzoker."</td>";
  68. echo "</tr></table>";
  69. }
  70.  
  71. $tzoker2 = rand(1,20);
  72. $pinakas2 = array(rand(1,45),rand(1,45),rand(1,45),rand(1,45),rand(1,45));
  73.  
  74. while( count(array_unique($pinakas2)) < count($pinakas2) ){
  75. $pinakas2 = array(rand(1,45),rand(1,45),rand(1,45),rand(1,45),rand(1,45));
  76. }
  77. sort($pinakas2);
  78.  
  79. echo "<table border='1'>
  80. <tr><th colspan='5'>Οι αριθμοί που κληρώθηκαν:</th>
  81. <th> Ο τζοκερ ειναι</th></tr><tr>";
  82. for ($i=0;$i<5;$i++){
  83. echo "<td>".$pinakas2[$i]."</td>";
  84. }
  85. echo "<td style='background-color:grey'>".$tzoker2."</td>";
  86. echo "</tr></table>";
  87.  
  88. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement