Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. <?php
  2. include '../../cfg.php';
  3. include '../../ini.php';
  4.  
  5. $postdata = file_get_contents("php://input");
  6. $request = json_decode($postdata);
  7. $email = $request->email;
  8. $pass = $request->password;
  9. $repass = $request->repass;
  10.  
  11. $email = trim($email);
  12. $email = htmlspecialchars($email, ENT_QUOTES, 'UTF-8');
  13. $email = mysql_escape_string($email);
  14.  
  15. $yes = intval($yes);
  16.  
  17. if($pass != $repass) {
  18. $arr = array('msg' => "", 'error' => 'Passwords do not match.');
  19. $jsn = json_encode($arr);
  20. print_r($jsn);
  21. }elseif(!$yes){
  22. $arr = array('msg' => "", 'error' => 'Please read and agree to the type of service.');
  23. $jsn = json_encode($arr);
  24. print_r($jsn);
  25. }
  26. options = [
  27. 'salt' => blowfishSalt(),
  28. 'cost' => 13
  29. ];
  30. $hash = password_hash($pass, PASSWORD_DEFAULT, $options);
  31.  
  32. $sql = 'INSERT INTO users (pass, mail) VALUES ("'.$hash.'", "'.$email.'")';
  33. mysql_query($sql);
  34.  
  35. if (password_verify($pass, $user_password)) {
  36. $arr = array('msg' => "Successfully logged in", 'error' => '');
  37. $jsn = json_encode($arr);
  38. print_r($jsn);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement