KimChoJapFan

Rock, Paper, Scissors: index.php

Sep 28th, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. <?php
  2. require('required.php');
  3. $database = new database;
  4. if(isset($_POST["submit"])){
  5.     $result = $_POST["game"];
  6.     $username = (string)$_POST["username"];
  7.     $passcode = sha1($_POST["code"]);
  8.     $conn = $database->conn();
  9.     $database->query($conn,$passcode,$username,$result);
  10. }
  11. ?>
  12. <html>
  13. <head>
  14. <title>Rock, Paper, Scissors</title>
  15. </head>
  16. <body>
  17. <center>
  18. <table border="0px" cellspacing="5px" cellpadding="0px">
  19. <tr><td align="center"><h2>How this works:</h2></td></tr>
  20. <tr><td><p>1. Type in a username to identify yourself.</p></td></tr>
  21. <tr><td><p>2. Type in a passcode that matches your opponent's passcode.</p></td></tr>
  22. <tr><td><p>3. Make a choice between Rock, Paper, and Scissors.</p></td></tr>
  23. <tr><td><p>4. Click the submit button and you'll see the results of the match.</p></td></tr>
  24. </table><br>
  25. <form method="POST">
  26. <table border="0px" cellspacing="5px" cellpadding="0px">
  27. <tr><td colspan=1><label>Username: </label></td><td><input type="text" name="username" /></td></tr>
  28. <tr><td colspan=1><label>Passcode: </label></td><td><input type="text" name="code" /></td></tr>
  29. <tr /><tr />
  30. <tr><td align="center"><input type="radio" name="game" value="1">Rock</input></td><td align="center"><input type="radio" name="game" value="2">Paper</input></td><td align="center"><input type="radio" name="game" value="3">Scissors</input></td></tr>
  31. <tr /><tr />
  32. <tr><td colspan=2 align="center"><input type="submit" name="submit" value="Submit" /></td></tr>
  33. </table>
  34. </form>
  35. </center>
  36. </body>
  37. </html>
Add Comment
Please, Sign In to add comment