当前位置: 首页>>代码示例>>PHP>>正文


PHP users::save方法代码示例

本文整理汇总了PHP中users::save方法的典型用法代码示例。如果您正苦于以下问题:PHP users::save方法的具体用法?PHP users::save怎么用?PHP users::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在users的用法示例。


在下文中一共展示了users::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postsignup

 public function postsignup($data)
 {
     $user = new users('mvc', 'user');
     $result = $user->where('roll', '=', $data["roll"]);
     $row = $result->fetch_assoc();
     if ($row !== null) {
         echo 'user registered already';
         exit;
     } else {
         $user->name = $data["name"];
         $user->roll = $data["roll"];
         $user->save();
         echo 'user registered successfully';
     }
 }
开发者ID:sriranganathan,项目名称:Minimalistic_MVC,代码行数:15,代码来源:user_controller.php

示例2: createaccountAction

 public function createaccountAction()
 {
     $request = new \Phalcon\Http\Request();
     if ($request->isPost()) {
         $user = new users();
         $user->name = $this->request->getPost("name");
         $user->email = $this->request->getPost("email");
         $user->password = $this->request->getPost("password");
         $user->apiKey = $this->generateAPIKey();
         $user->regID = "NULL";
         if ($user->save()) {
             echo 'success';
         } else {
             echo 'An error occured';
         }
     } else {
         echo "\n                    <form action=\"/users/createaccount\" method=\"post\">\n                        Name:<br>\n                        <input type=\"text\" id=\"name\" name=\"name\"><br>\n                        Email:<br>\n                        <input type=\"text\" name=\"email\"><br>\n                        Password:<br>\n                        <input type=\"password\" name=\"password\"><br>\n                        <br>\n                        <input type=\"submit\" value=\"Submit\">\n                    </form>\n\n\n        ";
     }
 }
开发者ID:ben-freke,项目名称:ChatLongerWebAPI,代码行数:19,代码来源:UsersController.php

示例3: fbLogin

 /**
  * Function get login with the Facebook
  * and save the session of the logged in user
  */
 public function fbLogin()
 {
     //load the models
     $this->load->model(array('users', 'userprofile', 'userprofilequery', 'usersquery'));
     //get the Facebook appId and app secret from facebook.php which located in config directory for the creating the object for Facebook class
     $facebook = new Facebook(array('appId' => $this->config->item('appID'), 'secret' => $this->config->item('appSecret'), 'access_token' => $this->config->item('appID') . '|' . $this->config->item('appSecret')));
     $user = $facebook->getUser();
     // Get the facebook user id
     if ($user) {
         try {
             $userData = $facebook->api('/me');
             //Get the facebook user profile data
             $auth = $this->encrypt->encode(strrev(random_string('unique', 16)) . '_' . strrev(now()));
             //Set the values of the user
             $checkUser = $this->userprofilequery->filterByemail($userData['email'])->findOne();
             if (empty($checkUser)) {
                 $data['fb_user_data'] = base64_encode(json_encode($userData));
                 //set the rules for the form validation
                 $this->form_validation->set_rules('username', $this->lang->line('username'), 'trim|required|min_length[6]|xss_clean|callback_check_whitespaces|callback_check_user');
                 $this->form_validation->set_rules('password', $this->lang->line('password'), 'trim|required|min_length[6]|max_length[32]');
                 $this->form_validation->set_rules('confirm_password', $this->lang->line('confirm_password'), 'trim|required|matches[password]');
                 //Form validation
                 if ($this->form_validation->run() == FALSE) {
                     $this->stencil->title($this->lang->line('create_account'));
                     $this->stencil->paint('user/fblogin');
                 } else {
                     $post = $this->input->post();
                     $auth = $this->encrypt->encode(strrev(random_string('unique', 16)) . '_' . strrev(now()));
                     //save the user detail
                     $user = new users();
                     $user->setusername($post['username']);
                     $user->setpassword($this->encrypt->encode($post['password']));
                     $user->setusertype('0');
                     $user->setstatus('0');
                     $user->setauthtoken($auth);
                     $user->save();
                     //User profile data
                     $userprofile = new userprofile();
                     $userprofile->setuserid($user->getid());
                     $userprofile->setfirstname($userData['first_name']);
                     $userprofile->setlastname($userData['last_name']);
                     $userprofile->setemail($userData['email']);
                     $userprofile->setdob($userData['birthday']);
                     $userprofile->setregisteron(now());
                     $userprofile->setlastlogin(now());
                     $userprofile->setlastip($_SERVER['SERVER_ADDR']);
                     $userprofile->save();
                     //send the verification mail
                     $this->sendVerificationMail($userData['email'], $user->getusername(), $auth);
                     //redirect to thanks page
                     $this->thanks($userData['email']);
                 }
             } else {
                 $profile = userprofilequery::create()->filterByemail($userData['email'])->findOne();
                 $users = usersquery::create()->filterByPrimaryKey($profile->getuserid())->findOne();
                 //Set the session data
                 $data['username'] = $users->getusername();
                 $data['user_id'] = $profile->getuserid();
                 $data['auth'] = $users->getauthtoken();
                 $data['valid'] = $users->getstatus();
                 $data['first_name'] = $profile->getfirstname();
                 $data['last_name'] = $profile->getlastname();
                 $data['email'] = $profile->getemail();
                 $data['last_login'] = $profile->getlastlogin();
                 $data['ip'] = $_SERVER['SERVER_ADDR'];
                 $data['is_logged_in'] = TRUE;
                 //Set the session of the user
                 $this->session->set_userdata($data);
                 $this->session->set_flashdata('info', '<div class="alert alert-info top_buffer">Hi ' . $this->users->getUsername() . '! you have logged in successfully.</div>');
                 redirect('user/dashboard', 'refresh');
             }
         } catch (FacebookApiException $e) {
             error_log($e);
         }
     }
 }
开发者ID:robdmat,项目名称:sport.net,代码行数:80,代码来源:loginajax.php

示例4: executeAdd_person_to_place

 public function executeAdd_person_to_place(sfWebRequest $request)
 {
     $nome = $request->getParameter('name');
     $cognome = $request->getParameter('surname');
     $state = $request->getParameter('status');
     $avatar = $request->getParameter('avatar');
     $place_id = $request->getParameter('place_id');
     foreach ($request->getFiles() as $uploadedFile) {
         $pi = pathinfo($uploadedFile["name"]);
         $tmpFile = uniqid($pi["filename"] . '-', true) . '.' . $pi['extension'];
         $tmpFullFile = realpath('images/avatar') . '/' . $tmpFile;
         $chkUplodedFile = move_uploaded_file($uploadedFile["tmp_name"], $tmpFullFile);
     }
     $pi = pathinfo($tmpFile);
     $user = new users();
     $user['name'] = $nome;
     $user['surname'] = $cognome;
     $user['state'] = $state;
     $user['avatar'] = $tmpFile;
     $user['place_id'] = $place_id;
     $user->save();
     return $this->renderText(json_encode(array('save' => 'ok')));
 }
开发者ID:redandpink,项目名称:h-emergenze,代码行数:23,代码来源:actions.class.php

示例5:

      $user->maulid = $_POST['maulid'];
   } else {
      $user->maulid = 0;
   }
   
   if(array_key_exists('username', $_POST)) {
      $user->name = $_POST['username'];
   }
   
   if(array_key_exists('password', $_POST)) {
      if(($_POST['password'] != "********") && ($_POST['password'] != "")) 
         $user->password = $_POST['password'];
   }
   
   if($request == "Add") {
      $result = $user->save($user->maulid);
   } else {
      $result = $user->save();
   }
   
   if($result == TRUE) {
      print "UPDATE OK!";
   } else {
      print "UPDATE FAILED!";
   }
   
}
?>
<h3>Existing Users</h3>
<table border=1 width=100%>
<tr><td>Name</td><td>Access</td><td>Password</td><td>Save</td></tr>
开发者ID:nationgaming,项目名称:openmaul,代码行数:31,代码来源:user_admin.php


注:本文中的users::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。