daily pastebin goal
15%
SHARE
TWEET

Untitled

a guest Apr 27th, 2016 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $username = 'ADMIN';
  3. $pass = 'ADMIN';
  4. $db = "pym";
  5. $FDeviceType = $_POST["deviceType"];
  6. $Flocation = $_POST["location"];
  7. $Foptions = $_POST["options"];
  8.  
  9. $link = mysqli_connect("localhost", $username, $pass);
  10. if (!$link) {
  11.     die("Could not connect: " . mysqli_connect_error());
  12. }
  13. //echo "Connected successfully";
  14.  
  15. $db_selected = mysqli_select_db($link, "pym");
  16. if (!$db_selected) {
  17.     die ("Can't use pym : " . mysqli_connect_error());
  18. }
  19. //echo "<br />Selected successfully";
  20.  
  21.  
  22. $FDeviceType = mysqli_real_escape_string($link, $FDeviceType); //protects agienst SQL injection
  23. $Flocation = mysqli_real_escape_string($link,$Flocation);  //protects agienst SQL injection
  24. $Foptions = mysqli_real_escape_string($link,$Foptions);  //protects agienst SQL injection
  25. $sql = "INSERT INTO `device` (`DEV_ID`, `DEV_Type`, `DEV_location`, `DEV_optinos`) VALUES (NULL, '$FDeviceType', '$Flocation', '$Foptions')";
  26. if (mysqli_query($link, $sql)) {
  27.      echo "<br>record added!";
  28. } else {
  29.     echo "<br>something went wrong";
  30. }
  31. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top