Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  1. <?php
  2. SESSION_start() ;
  3.  
  4. $p1 = mt_rand(1,6) ;
  5. $p2 = mt_rand(1,6) ;
  6.  
  7. $i1 = "1.png";
  8. $i2 = "2.png";
  9. $i3 = "3.png";
  10. $i4 = "4.png";
  11. $i5 = "5.png";
  12. $i6 = "6.png";
  13.  
  14. //IMAGE SWITCH
  15. switch($p1) {
  16. case "1":
  17. $p1=$i1;
  18. break;
  19. case "2":
  20. $p1=$i2;
  21. break;
  22. case "3":
  23. $p1=$i3;
  24. break;
  25. case "4":
  26. $p1=$i4;
  27. break;
  28. case "5":
  29. $p1=$i5;
  30. break;
  31. case "6":
  32. $p1=$i6;
  33. }
  34.  
  35. switch($p2) {
  36. case "1":
  37. $p2=$i1;
  38. break;
  39. case "2":
  40. $p2=$i2;
  41. break;
  42. case "3":
  43. $p2=$i3;
  44. break;
  45. case "4":
  46. $p2=$i4;
  47. break;
  48. case "5":
  49. $p2=$i5;
  50. break;
  51. case "6":
  52. $p2=$i6;
  53. }
  54.  
  55. function diceroll($p1,$p2) {
  56. if ($p1>$p2) {
  57. echo "The winner of this round is " .$Player1. ".";
  58. }
  59. if ($p1<$p2) {
  60. echo "The winner of this round is " .$Player2. ".";
  61. }
  62.  
  63. { echo "This round is a tie." ; }
  64.  
  65. }
  66.  
  67. if (isset($_POST['RollRound'])) {
  68. }
  69.  
  70. ?>
  71.  
  72. <form name="diceroll" method="post"  action="DiceRollAct.php">
  73. <style>
  74. Table,TH,TD
  75. {
  76. padding:6px;
  77. }
  78. </style>
  79. <Table border="0" style="text/css" bgcolor="black">
  80. <TR>
  81. <TD align="center"><?php echo "<img src='1.png' width='80' height='80' alt='1'>";?></TD>
  82. <TD align="center"><?php echo "<img src='2.png' width='80' height='80' alt='2'>";?></TD>
  83. <TD align="center"><?php echo "<img src='3.png' width='80' height='80' alt='3'>";?></TD>
  84. <TD align="center"><?php echo "<img src='4.png' width='80' height='80' alt='4'>";?></TD>
  85. <TD align="center"><?php echo "<img src='5.png' width='80' height='80' alt='5'>";?></TD>
  86. <TD align="center"><?php echo "<img src='6.png' width='80' height='80' alt='6'>";?></TD>
  87. </TR>
  88. <TR>
  89. <TD colspan="5" align="center"><input type="Submit" name="Roll" value="RollRound"></TD>
  90. </TR>
  91. </Table>
  92. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement