Advertisement
Guest User

Untitled

a guest
Jun 28th, 2021
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <?php
  2. echo '<form style="text-align: center; width: 100%"; id="rsaid" action="" method="post"><h2 style="color: orange; font-size: 2.4rem;">RSA ID Number</h2><input style="text-align:center; margin-right: 10px; width: 100%; margin-bottom: 10px; padding: 10px;" type="text" name="ID" placeholder="Enter your 13 Digit RSA ID Number" maxlength="13" minlength="13"></br><input style="background-color: #FB8C00; color: white; border-radius: 30px; border-color: white; margin-top: 20px;" type="submit" name="submit" value="Submit"></form>';
  3.  
  4.  
  5. //Database Information
  6. $dbServername = "xxx";
  7. $dbUsername = "xxx";
  8. $dbPassword = "xxx";
  9. $dbName = "xxx";
  10.  
  11. //Link to database
  12. $link = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName);
  13.  
  14. // Check connection
  15. if($link === false){
  16.     die("ERROR: Could not connect. " . mysqli_connect_error());
  17. }
  18.  
  19. // Escape user inputs for security
  20. $identity = mysqli_real_escape_string($link, $_REQUEST['ID']);
  21.  
  22. // Attempt insert query execution
  23. $sql = "INSERT INTO idNumbers (ID) VALUES ('$identity')";
  24. if(mysqli_query($link, $sql)){
  25.     echo "Records added successfully.";
  26. } else{
  27.     echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
  28. }
  29.  
  30. // Close connection
  31. mysqli_close($link);
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement