Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.44 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. $css = "none";
  6. $x = "";
  7. $coin="";
  8. $coins = array("Coin 1", "Coin 2", "Coin 3", "Coin 4");
  9.  
  10.  
  11.  
  12.  
  13.  
  14. if (isset($_POST['start'])) {
  15.    unset($_POST['stop']);
  16.    $css ="";
  17. }
  18. if (isset($_POST['stop'])) {
  19.    $x = "x";
  20.    $css = "";
  21.    unset($_POST['stop']);
  22.    $coin = $coins[array_rand($coins)];
  23.    
  24. }
  25.  
  26.  
  27.  
  28.  
  29. ?>
  30.  
  31. <html>
  32. <head>
  33. <!-- Latest compiled and minified CSS -->
  34. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  35.  
  36. <!-- jQuery library -->
  37. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  38.  
  39. <!-- Latest compiled JavaScript -->
  40. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  41. <link rel="stylesheet" href="css/wheel.css">
  42. <script>
  43. var r = 50;    
  44.  
  45. var x = setInterval(function() {
  46.     var item = ['Coin 1', 'Coin 2', 'Coin 3', 'Coin 4'].find((_, i, ar) => Math.random() < 1 / (ar.length - i));
  47.    document.getElementById("counter").innerHTML = item;
  48. }, r);
  49. clearInterval(<?php echo $x ?>)
  50.  
  51. </script>
  52.  
  53. </head>
  54.    
  55. <body>
  56.  
  57. <div >
  58.     <form method="post">
  59.     <input type="submit" name="start" value="start">
  60.     <input type="submit"  name="stop" value="stop">
  61.     <input type="submit" name="reset" value="reset">
  62.     </form>  
  63. </div>
  64. <div class="spacer"></div>    
  65. <div style="display:<?php echo $css ?>;" id="counter"><?php echo $coin ?></div>    
  66. </body>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement