Advertisement
Guest User

Untitled

a guest
Aug 27th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html lang="en">
  4.  
  5. <head>
  6.  
  7. <meta charset="UTF-8">
  8.  
  9. <title>Add Record Form</title>
  10.  
  11. </head>
  12.  
  13. <body>
  14.  
  15. <form action="/joomla_31/insert.php" method="post">
  16.  
  17.  
  18. <label for="MGMT_IP">MGMT IP</label>
  19.  
  20. <input type="text" name="MGMT_IP" id="MGMT_IP">
  21.  
  22. </p>
  23.  
  24. <p>
  25.  
  26. <label for="Vendor">Vendor</label>
  27.  
  28. <input type="text" name="Vendor" id="Vendor">
  29.  
  30. </p>
  31.  
  32. <p>
  33.  
  34. <label for="Version">Version</label>
  35.  
  36. <input type="text" name="Version" id="Version">
  37.  
  38. </p>
  39.  
  40. <p>
  41.  
  42. <label for="GUI_User">GUI User</label>
  43.  
  44. <input type="text" name="GUI_User" id="GUI_User">
  45.  
  46. </p>
  47.  
  48. <p>
  49.  
  50. <label for="GUI_Pass">GUI Pass</label>
  51.  
  52. <input type="text" name="GUI_Pass" id="GUI_Pass">
  53.  
  54. </p>
  55.  
  56.  
  57. <input type="submit" value="submit">
  58.  
  59. </form>
  60.  
  61. </body>
  62.  
  63. </html>
  64.  
  65. <?php
  66.  
  67.  
  68. $link = mysqli_connect("localhost", "root", "", "mysql");
  69.  
  70.  
  71.  
  72. // Check connection
  73.  
  74. if($link === false){
  75.  
  76. die("ERROR: Could not connect. " . mysqli_connect_error());
  77.  
  78. }
  79.  
  80.  
  81.  
  82. // Escape user inputs for security
  83.  
  84. $MGMT_IP = mysqli_real_escape_string($link, $_REQUEST['MGMT IP']);
  85. $Vendor = mysqli_real_escape_string($link, $_REQUEST['Vendor']);
  86. $Version = mysqli_real_escape_string($link, $_REQUEST['Version']);
  87. $GUI_User = mysqli_real_escape_string($link, $_REQUEST['GUI User']);
  88. $GUI_Pass = mysqli_real_escape_string($link, $_REQUEST['GUI Pass']);
  89.  
  90.  
  91.  
  92. // attempt insert query execution
  93.  
  94. $sql = "INSERT INTO `cloud_team` (MGMT IP, Vendor, Version, GUI User, GUI Pass) VALUES (`$customer_number`, `$customer_name`, `$MGMT_IP`, `$Vendor`, `$Version`, `$GUI_User`, `$GUI_Pass`)";
  95.  
  96. if(mysqli_query($link, $sql)){
  97.  
  98. echo "Records added successfully.";
  99.  
  100. } else{
  101.  
  102. echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
  103.  
  104. }
  105.  
  106.  
  107. // close connection
  108.  
  109. mysqli_close($link);
  110.  
  111. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement