Guest User

Untitled

a guest
Jan 19th, 2019
1,051
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. public function register($name,$email,$password) {
  2. $data = array(
  3. 'name' => $name,
  4. 'email' => $email,
  5. 'password' => $password
  6. );
  7. $this->db->insert("users",$data);
  8. return true;
  9. }
  10.  
  11. public function verifyUser() {
  12. $emailAdrees = $this->input->post('email');
  13. $password = $this->input->post('password');
  14.  
  15. $isExistingUser = $this->AuthenticationModel->authecticateUser($emailAdrees, $password);
  16. if ($isExistingUser === TRUE) {
  17. $data['messages'] = '';
  18. $data['success'] = true;
  19. } else {
  20. $data['messages'] = 'Unable to login';
  21. $data['success'] = false;
  22. }
  23.  
  24. echo json_encode($data);
  25. }
  26.  
  27. var registerUserModel = Backbone.Model.extend({
  28. urlRoot: "http://localhost/Sample/index.php/MainController/addUser",
  29. defaults: {
  30. name: '',
  31. email: '',
  32. password: ''
  33. }
  34. });
  35.  
  36.  
  37.  
  38. var newRegisteredUser = function (name, email, password) {
  39. var newUser = new registerUserModel();
  40. var newUserDetails = {
  41. name: name,
  42. email: email,
  43. password: password
  44. };
  45. console.log(newUserDetails.name);
  46.  
  47.  
  48.  
  49. newUser.save(newUserDetails,{
  50.  
  51. success: function () {
  52. alert("success");
  53.  
  54.  
  55. },
  56. error: function () {
  57.  
  58. console.log("fail") //Always error
  59. }
  60.  
  61. });
  62. };
Add Comment
Please, Sign In to add comment