Advertisement
Guest User

Untitled

a guest
Aug 15th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. // Demo access credentials
  3. $host = "app.comet-server.ru";
  4. $user = "15";
  5. $password = "lPXBFPqNg3f661JcegBY0N0dPXqUBdHXqj2cHf04PZgLHxT6z55e20ozojvMRvB8";
  6.  
  7. // Connecting to CppComet (this is not MySQL database)
  8. $comet = mysqli_connect($host, $user, $password, "CometQL_v1");
  9. if(mysqli_errno($comet))
  10. {
  11. echo "Error:".mysqli_error($link);
  12. }
  13. $msg = Array( "name" => $_POST["name"], "text" => $_POST["text"] );
  14. $msg = json_encode($msg);
  15. $msg = mysqli_real_escape_string($comet, $msg);
  16. $query = "INSERT INTO pipes_messages (name, event, message)" .
  17. "VALUES('simplechat', 'newMessage', '".$msg."')";
  18.  
  19. // Sending message to CppComet (this is not MySQL database)
  20. mysqli_query($comet, $query);
  21. if(mysqli_errno($comet))
  22. {
  23. echo "Error:".mysqli_error($comet);
  24. }
  25. else
  26. {
  27. echo "ok";
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement