Advertisement
Guest User

Untitled

a guest
Jul 20th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "68.178.253.26";
  4. $username = "d8382639921729";
  5. $password = "tp#3JPSvW-u@";
  6.  
  7. try
  8. {
  9. //$conn = new PDO("mysql:host=$servername;dbname=$dbname;", $username, $password);
  10. $conn = new PDO("mysql:host=$servername;dbname=d8382639921729;port=3308", $username, $password);
  11. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  12. }
  13. catch(PDOException $e)
  14. {
  15. echo "Connection failed: " . $e->getMessage();
  16. exit;
  17. }
  18.  
  19. $from_user = $_POST["from_user"];
  20. $code = $_POST["code"];
  21. $description = $_POST["description"];
  22. $message = $_POST["message"];
  23.  
  24. $user_to = $conn->prepare("SELECT user_id FROM wp_58qqty3rx3_lostcode WHERE lostcode_code='".$code."'")
  25. $user_to->queryString();
  26.  
  27. //$id = mysqli_query($conn, "SELECT user_id FROM wp_lostcode WHERE lostcode_code='". $code ."'");
  28. //$result = mysqli_fetch_row($id);
  29.  
  30. //$user_id = $result[0];
  31.  
  32. $statement = $conn->prepare("INSERT INTO wp_58qqty3rx3_fep_messages
  33. (from_user, to_user, message_title, message_contents)
  34. VALUES (?,?,?,?)");
  35.  
  36. if ($statement->execute(array($from_user,$user_to,$description,$message)))
  37. {
  38. echo "New record created successfully";
  39. } else {
  40. echo "Error: " . $sql . "<br>" . mysqli_error($conn);
  41. }
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement