Advertisement
Guest User

Untitled

a guest
Mar 26th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_errors', 1);
  4. ini_set('display_startup_errors', 1);
  5. error_reporting(E_ALL);
  6.  
  7. if( $_POST["usrName"] || $_POST["usrPass"])
  8. {
  9. echo "Welcome ". $_POST['usrName']. "<br />";
  10. echo "Your password is ". $_POST['usrPass']. "<br />";
  11. echo "You are on team ". $_POST['radBox']. "<br />";
  12.  
  13.  
  14. echo "Welcome" . $POST["usrName"]."<br />";
  15. echo "You are team " . $_POST["radBox"] . ".";
  16.  
  17. $servername = "localhost";
  18. $username = "webUser";
  19. $password = "davedog";
  20. $dbName = "webData";
  21.  
  22. $conn = new mysqli($servername, $username, $password, $dbName);
  23.  
  24. if($conn->connect_error)
  25. {
  26. die("Connection Failed :/ " . $conn->connect_error);
  27. }
  28.  
  29. echo "Connected!";
  30.  
  31. $sql = "SELECT * FROM webData.username;";
  32. $result = $conn->query($sql); //Execute
  33. $theUrl = "Login.php?usrName=".$_POST["usrName"]."&usrPass=".$_POST["usrPass"]."&radBox=".$_POST["radBox"];
  34.  
  35. $count = mysqli_num_rows($result);
  36.  
  37.  
  38. echo "result: ".$count;
  39.  
  40. if($count >= 1)
  41. {
  42. header('Location: '.'Welcome.php');
  43. exit();
  44. }
  45.  
  46. exit();
  47. }
  48.  
  49. //action='<?php $_SERVER['PHP_SELF']
  50. ?>
  51.  
  52. <html>
  53.  
  54. <h2>Login dot pea aytch pea</h2>
  55.  
  56. <br /><form id='myForm' action='Welcome.php' method = 'POST'>
  57.  
  58. <label for='usrName'>Username:</label><input type='text' name='usrName' id='usrName'><br />
  59. <label for='usrPass'>Password:</label><input type='password' name='usrPass' id='usrPass'><br />
  60.  
  61. <br /><label for='radBox'>Who shot first?</label>
  62. <br /><input type='radio' name='radBox' value='Han' checked>Han<br />
  63. <input type='radio' name='radBox' value='Greedo'>Greedo<br />
  64.  
  65. <input type='submit'/>
  66.  
  67. </form>
  68.  
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement