Guest User

Untitled

a guest
May 14th, 2018
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 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="PASTEBIN";
  29.     $database="lazyDB";
  30.    
  31.     if(!($connection = @ mysqli_connect(localhost,$username,$password)))
  32.         die( "|||||||||   Unable to connect to database  |||||||||");
  33.    
  34.     error_log("||||||||  connection successful ! ||||||||| " );
  35.        
  36.     if(!(mysqli_select_db($connection, 'lazyDB')))
  37.         die( "||||||||| Unable to select database");
  38.    
  39.     error_log("||||||||||   database selected!   |||||||||");
  40.    
  41.     $password = 'asdf';
  42.     $salt = '@#@#$@#%#$%'; // 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.     $facbeookID = '';
  50.     $googleID = '';
  51.    
  52.     $query = "INSERT INTO contacts VALUES ('','$username','$email','$profilePicURL','$facebookID','$googleID')";
  53.     if(!($result = mysqli_query($query)))
  54.         die("unable to run query");
  55.    
  56.     error_log("query successful!\nresult: " . $results . "\n");
  57.    
  58.     mysqli_close();
  59.    
  60.     echo json_encode($return);
  61. ?>
Add Comment
Please, Sign In to add comment