Guest User

Untitled

a guest
May 14th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <?php
  2. error_log("imploding post " . implode(", " , $_POST) . "\n\n");
  3. // error_log("imploding request " . implode(", " , $_REQUEST));
  4.  
  5. if (empty($_POST)) {
  6. $return['error'] = true;
  7. $return['msg'] = 'no POST';
  8. error_log("||||||| post empty");
  9. }
  10. else {
  11. error_log("|||||||| no error |||||||");
  12.  
  13. $return['error'] = false;
  14. $return['msg'] = "";
  15.  
  16. foreach ($_POST as $key => $value){
  17. $return['msg'] .= $return["msg"] .
  18. "key: " . $key . "\nvalue : " . $value ;
  19. }
  20.  
  21. }
  22. error_log("|||||||| MADE IT PAST THE BREAK |||||||");
  23.  
  24. //$return = "gotcha";
  25.  
  26.  
  27. $username="root";
  28. $password="ddddd";
  29. $database="lazyDB";
  30.  
  31. $connection = mysqli_connect("localhost",$username,$password) or
  32. die(mysqli_error($connection));
  33.  
  34. error_log("|||||||| connection successful ! ||||||||| " );
  35.  
  36. mysqli_select_db($connection, 'lazyDB') or
  37. die(mysqli_error($connection));
  38.  
  39. error_log("|||||||||| database selected! |||||||||");
  40.  
  41. $password = 'asdf';
  42. $salt = 'sweet is better then salty'; // whatever string
  43. $password_hash = sha1($salt.sha1($password.$salt));
  44. // ID , username, password, email , profilePicURL, facebookID, googleID
  45. $ID = "";
  46. $username = "fotoflo";
  47. $email = "fotoflo@mailinator.com";
  48. $profilePicURL = '';
  49. $facebookID = '';
  50. $googleID = '';
  51.  
  52. $query = "INSERT INTO contacts VALUES ('','$username','$email','$profilePicURL','$facebookID','$googleID')";
  53. $result = mysqli_query( $connection, $query) or
  54. die(mysqli_error($connection));
  55.  
  56. error_log("||||||||query successful!|||||||||");
  57.  
  58. mysqli_close();
  59.  
  60. echo json_encode($return);
  61. ?>
Add Comment
Please, Sign In to add comment