Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <?php
  2. $host =
  3. $userName =
  4. $password =
  5. $dbName =
  6.  
  7.  
  8. $con = mysqli_connect($host, $userName, $password, $dbName);
  9. mysqli_query("SET NAMES utf8");
  10.  
  11. $name = $_POST['name'];
  12. $surname = $_POST['surname'];
  13. $age = $_POST['age'];
  14. $sex = $_POST['sex'];
  15. $height = $_POST['height'];
  16. $weight = $_POST['weight'];
  17. $look = $_POST['look'];
  18. $personality = $_POST['personality'];
  19. $history = $_POST['history'];
  20. $img = $_POST['img'];
  21. $token = $_POST['token'];
  22.  
  23. $query2 = mysqli_query($con, "SELECT userDISID FROM tokens WHERE token='".$token."'");
  24. $userDISID = mysqli_fetch_row($query2);
  25. $mysqli = new mysqli($host, $userName, $password, $dbName);
  26. $mysqli->set_charset("utf8");
  27.  
  28.  
  29. $query = mysqli_query($con, "SELECT * FROM tokens WHERE token='".$token."'");
  30.  
  31.  
  32. if (!$query)
  33. {
  34. die('Error: ' . mysqli_error($con));
  35. }
  36.  
  37. else if(mysqli_num_rows($query) == 0){
  38.  
  39. echo "Nieprawidłowy token.";
  40. }
  41.  
  42. else{
  43. $userDISID2 = implode("|",$userDISID);
  44. $sql3 = "INSERT INTO kartyPostaci (token, userDISID, isVerified, name, surname, age, sex, height, weight, look, personality, history, img) VALUES ('$token', '$userDISID2', 'Nie', '$name', '$surname', '$age', '$sex', '$height', '$weight', '$look', '$personality', '$history', '$img')";
  45.  
  46. $query3 = mysqli_query($con, $sql3);
  47.  
  48.  
  49. $sql4 = "DELETE FROM tokens WHERE token = '$token'";
  50. $query4 = mysqli_query($con, $sql4);
  51.  
  52. $sql5 = "SET CHARSET utf8";
  53. $query5 = mysqli_query($con, $sql5);
  54. echo "Dodano kartę.";
  55.  
  56. }
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement