daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Apr 29th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. require "init.php";
  3. $name = $_POST["user"];
  4. $username = $_POST["email"];
  5. $password = $_POST["password"];
  6.  
  7. $sql_query = "insert into userLogin values ('$name', '$username', '$password');";
  8. $result = mysqli_query($con, $sql_query);
  9.  
  10. //if(mysqli_query($con, $sql_query))
  11.  
  12. if (!$result) {
  13.     $response = array();
  14.     $code = "registration_error";
  15.     $message = "Account not registered. Try again.";
  16.     array_push($response, array("code" => $code, "message" => $message));
  17.     echo json_encode(array("server_response" => $response));
  18. }
  19.  
  20. else {
  21.     $response = array();
  22.     $code = "registration_sucess";
  23.     $message = "Account registered.";
  24.     array_push($response, array("code" => $code, "message" => $message));
  25.     echo json_encode(array("server_response" => $response));
  26.  
  27. }
  28. echo "DB connection successful!";
  29. mysqli_close($con);
  30. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top