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


PHP User::addUser方法代码示例

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


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

示例1: _index

 public function _index()
 {
     $post = Input::post();
     if (!empty($post)) {
         $validate = Validate::register($post);
         $token = Token::check($post['token']);
         if ($validate === TRUE && $token === TRUE) {
             User::addUser($post);
             echo 'Registered';
         } else {
             if (!$token) {
                 echo 'Security Token is missing';
             }
             echo '<pre>';
             print_r($validate);
             echo '</pre>';
         }
     } else {
         if (Session::exists('user_id')) {
             header('Location: /');
             exit;
         }
         self::init('RegisterModel', 'register', $arg);
     }
 }
开发者ID:ncube,项目名称:edu,代码行数:25,代码来源:register.php

示例2: adduser

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function adduser()
 {
     $currentPage = "ADD_USERS";
     $mainMenu = "USERS_MAIN";
     $Users = User::getUsersByFranchisee();
     $inputs = Input::all();
     if (isset($inputs['userType'])) {
         $inputs['franchiseeId'] = Session::get('franchiseId');
         $randomPassword = str_random(6);
         $encryptedPassword = Hash::make($randomPassword);
         $inputs['password'] = $encryptedPassword;
         $addUserResult = User::addUser($inputs);
         $userFullName = $inputs['firstName'] . ' ' . $inputs['lastName'];
         $UserDetails = array('password' => $randomPassword, 'userName' => $userFullName, 'email' => $inputs['email']);
         if ($UserDetails) {
             Mail::send('emails.account.usercreation', $UserDetails, function ($msg) use($UserDetails) {
                 $msg->from(Config::get('constants.EMAIL_ID'), Config::get('constants.EMAIL_NAME'));
                 $msg->to($UserDetails['email'], $UserDetails['userName'])->subject('The Little Gym - User account created');
             });
         }
         if ($addUserResult) {
             Session::flash('msg', "User account created successfully.");
         } else {
             Session::flash('error', "User account could not be created at the moment.");
         }
         return Redirect::to('admin/users/view/' . $addUserResult->id);
     }
     //$data = array('Users','currentPage', 'mainMenu');
     return View::make('pages.users.useradd', compact('Users', 'currentPage', 'mainMenu'));
 }
开发者ID:Headrun-php,项目名称:TLG,代码行数:35,代码来源:FranchiseeAdministration.php

示例3: _newUser

function _newUser()
{
    $user = new User(getdbh());
    $email = $user->checkEmail($_POST['email']);
    if (isset($email['ID'])) {
        $data['msg'][] = " Acest email nu este disponibil! Va rugam alegeti altul!";
        $data['redirect'][] = 'main/new';
        View::do_dump(VIEW_PATH . 'layout.php', $data);
    } else {
        $result = $user->addUser($_POST['email'], $_POST['password1'], $_POST['nume'], $_POST['prenume']);
        if ($result > 0) {
            $setToken = $user->newUserToken($result);
            if ($setToken != false) {
                $body = 'Pentru a activa contul apasa   <a href="' . WEB_DOMAIN . WEB_FOLDER . 'ops/newUserToken/' . $setToken . '"> AICI </a>';
                if (sendEmail('Email confirmare cont', $body, 'ulbsPlatform@ebs.ro', $_POST['email'])) {
                    $data['msg'][] = "Emailul cu linkul de confirmare cont a fost trimis";
                    $data['redirect'][] = 'main/index';
                    View::do_dump(VIEW_PATH . 'layout.php', $data);
                } else {
                    $data['msg'][] = "Emailul cu linkul de confirmare nu a fost trimis";
                    $data['redirect'][] = 'main/index';
                    View::do_dump(VIEW_PATH . 'layout.php', $data);
                }
            } else {
                $data['msg'][] = "Eroare la generarea tokenului";
                $data['redirect'][] = 'main/index';
                View::do_dump(VIEW_PATH . 'layout.php', $data);
            }
        } else {
            $data['msg'][] = "Eroare la crearea contului!";
            $data['redirect'][] = 'main/index';
            View::do_dump(VIEW_PATH . 'layout.php', $data);
        }
    }
}
开发者ID:laiello,项目名称:ebs-academy-at-ulbs-2014,代码行数:35,代码来源:newUser.php

示例4: action_add

 public function action_add()
 {
     $success = false;
     if (isset($_POST["add"])) {
         $user = new User($_POST);
         $success = $user->addUser();
         $success = $user->success($success);
     }
     $this->view->generate('add.php', ["success" => $success]);
 }
开发者ID:Rid65,项目名称:rid65.github.io,代码行数:10,代码来源:controller_site.php

示例5: actionRegUser

 public function actionRegUser()
 {
     $login = $_POST['loginReg'];
     $password = $_POST['passwordReg'];
     if (User::CheckLogin($login)) {
         echo "<h3> Используйте другой логин, этот уже существует!</h3>";
     } else {
         if (User::addUser($login, $password)) {
             echo "<h3>Вы успешно зарегистрировались!</h3>";
         }
     }
     require_once ROOT . '/views/Avtorisation.php';
     return true;
 }
开发者ID:cfycfysx,项目名称:testSite,代码行数:14,代码来源:AdminController.php

示例6: registration

 public function registration()
 {
     if (!empty($_POST)) {
         $user = new User();
         if ($user->unique($_POST) == 0) {
             $user->addUser($_POST);
             return $this->renderView('user/registration', array('result' => $user->result));
         } else {
             header('Refresh: 5');
             return $this->renderView('user/registration', array('result' => "Данный E-mail занят! Через 5 сек Вы будете перенаправлены на страницу " . "регистрации. <a href='index.php?r=user&a=registration'>Не ждать!</a>"));
         }
     }
     $this->renderView('user/registration');
 }
开发者ID:schulz-brander,项目名称:vk.loc.mvc,代码行数:14,代码来源:UserController.php

示例7: go

 public function go()
 {
     $this->setViewTemplate('adduser.tpl');
     if (isset($_POST['submit'])) {
         if ($_POST['username'] == '') {
             $this->addErrorMessage("Username should not be empty");
         } elseif ($_POST['full_name'] == '') {
             $this->addErrorMessage("Full name should not be empty");
         } elseif ($_POST['password'] == '') {
             $this->addErrorMessage("Password should not be empty");
         } elseif ($_POST['confirmpassword'] == '') {
             $this->addErrorMessage("Please confirm password");
         } elseif (!isset($_POST['is_activated'])) {
             $this->addErrorMessage("Is the user activated?");
         } elseif (!isset($_POST['type'])) {
             $this->addErrorMessage("Select the type of user");
         } elseif ($_POST['email'] == '') {
             $this->addErrorMessage("please enter ur email id");
         } else {
             $username = $_POST['username'];
             $password = $_POST['password'];
             $confirmpassword = $_POST['confirmpassword'];
             $full_name = $_POST['full_name'];
             $email = $_POST['email'];
             $is_activated = $_POST['is_activated'];
             $type = $_POST['type'];
             if (User::doesUserExist($username)) {
                 $this->addErrorMessage("Username already exists");
             } elseif (!($password == $confirmpassword)) {
                 $this->addErrorMessage("The two passwords dont match!");
             } elseif (!Utils::validateEmail($email)) {
                 $this->addErrorMessage("Please enter a valid email id");
             } else {
                 $subject = "Hackademic new account";
                 $message = "Hackademic account created succesfully";
                 //Mailer::mail($email,$subject,$message);
                 $joined = date("Y-m-d H-i-s");
                 $result = User::addUser($username, $full_name, $email, $password, $joined, $is_activated, $type);
                 $this->addSuccessMessage("User has been added succesfully");
                 header('Location:' . SOURCE_ROOT_PATH . "admin/pages/usermanager.php?source=add");
             }
         }
     }
     return $this->generateView();
 }
开发者ID:JoffreyO,项目名称:hackademic,代码行数:45,代码来源:class.AddUserController.php

示例8: createWeiboUser

 public static function createWeiboUser()
 {
     if (!self::$_config) {
         self::$_config = (require_once WEIBO_PATH . 'config/config.php');
     }
     //获取用户的资料
     if (!$_SESSION['token']['uid']) {
         return false;
     }
     $uid = $_SESSION['token']['uid'];
     //获取用户的信息
     $c = new SaeTClientV2(self::$_config['WB_AKEY'], self::$_config['WB_SKEY'], self::$_config['WB_ACCESS_TOKEN']);
     $info = $c->request_with_uid('https://api.weibo.com/2/users/show.json', $uid);
     if ($info) {
         //检查是否已经建立过用户了
         $db = self::_db();
         $check = $db->where(array('uid' => $_SESSION['token']['uid']))->limit(1)->select();
         if ($check && $check[0]['uid']) {
             //已经建立过用户了
             LuS::set('uid', $check[0]['user_id']);
             LuS::set('username', $check[0]['screen_name']);
             return true;
         }
         //建立用户
         $email = $info['screen_name'] . '@sina.com';
         $username = $info['screen_name'];
         $password = md5(rand(100, 9999) . time());
         $user_id = User::addUser($username, $password, $email);
         if (!$user_id) {
             echo '登录失败';
             throw new Exception('exit');
         }
         //存储用户信息
         $rs = self::addWeiboUserInfo($user_id);
         if ($rs) {
             LuS::set('uid', $user_id);
             LuS::set('username', $username);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:lughong,项目名称:test,代码行数:45,代码来源:WeiBoLogin.class.php

示例9: redirect

                 redirect($options['site_url'] . '/admin.php?area=' . $area);
             }
             if (isset($_POST['delete'])) {
                 Role::deleteRole($id);
                 redirect($options['site_url'] . '/admin.php?area=' . $area);
             }
         } else {
             $template->page_title = 'Manage Roles';
         }
     }
     break;
 case 'users':
     if ($action == 'add') {
         $template->page_title = 'Add New User';
         if (isset($_POST['submit'])) {
             User::addUser($_POST);
             redirect($options['site_url'] . '/admin.php?area=' . $area);
         }
     } else {
         if ($action == 'view') {
             $template->page_title = 'View User';
             if (isset($_POST['submit'])) {
                 User::saveUser($id, $_POST);
                 redirect($options['site_url'] . '/admin.php?area=' . $area);
             }
             if (isset($_POST['delete'])) {
                 User::deleteUser($id);
                 redirect($options['site_url'] . '/admin.php?area=' . $area);
             }
         } else {
             $template->page_title = 'Manage Users';
开发者ID:Hackmastr,项目名称:apps-base,代码行数:31,代码来源:admin.php

示例10: header

<?php

/**
 * Created by PhpStorm.
 * User: Hoan
 * Date: 11/4/2015
 * Time: 7:44 PM
 */
//Khởi động session
session_start();
//Kiểm tra nếu chưa đăng nhập thì quay về trang đăng nhập
if (!isset($_SESSION['user'])) {
    header('location:login.php');
}
//Require các file cần thiết
require '../../config/Config.php';
require '../../models/User.php';
//Nếu có POST dữ liệu lên thì xử lý
if ($_POST) {
    //Nhận dữ liệu từ form và gán vào một mãng (Có thể sử dụng UserObj để lưu dữ liệu)
    $data = array('username' => $_POST['username'], 'password' => md5($_POST['password']), 'fullname' => $_POST['fullname'], 'email' => $_POST['email'], 'status' => isset($_POST['status']) ? 1 : 0, 'created' => date('Y-m-d H:i:s'), 'modified' => date('Y-m-d H:i:s'));
    $userModel = new User();
    if ($userModel->addUser($data)) {
        $_SESSION['success'] = true;
        header('location:list.php');
    }
    //Ngừng thực thi
    exit;
}
require '../../views/user/v_add.php';
开发者ID:hoannc54,项目名称:WebBanHang,代码行数:30,代码来源:add.php

示例11: dirname

<?php

if (!isset($_SESSION)) {
    session_start();
}
define('__ROOT__', dirname(dirname(__FILE__)));
define('__BASENAME__', basename(__ROOT__));
require_once __ROOT__ . '/modules/User.class.php';
$email = !isset($_POST['email']) ? "" : $_POST['email'];
$password = !isset($_POST['password']) ? "" : $_POST['password'];
$firstName = !isset($_POST['firstName']) ? "" : $_POST['firstName'];
$lastName = !isset($_POST['lastName']) ? "" : $_POST['lastName'];
$companyId = !isset($_POST['companyId']) ? "" : $_POST['companyId'];
$userType = !isset($_POST['userType']) ? "" : $_POST['userType'];
$isUserActive = !isset($_POST['isActive']) ? 0 : $_POST['isActive'];
$phone = !isset($_POST['phone']) ? '' : $_POST['phone'];
$baseUrl = !isset($_POST['baseUrl']) ? '' : $_POST['baseUrl'];
$userObj = new User();
$userObj->addUser($email, $password, $firstName, $lastName, $companyId, $userType, $isUserActive, $phone, $baseUrl);
开发者ID:erickigotho,项目名称:Paxis,代码行数:19,代码来源:add_user.php

示例12: User

<?php

include_once "../class/User.php";
$regUser = new User();
$usname = $_GET["regUname"];
$paword = $_GET["regPass"];
$firstName = $_GET["regFname"];
$lastName = $_GET["regLname"];
$position = $_GET["regPosition"];
$stat = $_GET["regStatus"];
if ($stat == "ผู้ดูแลระบบ") {
    $stat = "Administrator";
    $regUser->setValues($usname, $paword, $firstName, $lastName, $position, $stat);
    $regUser->addUser();
} else {
    if ($stat == "เจ้าหน้าที่พัสดุ") {
        $stat = "Officer";
        $regUser->setValues($usname, $paword, $firstName, $lastName, $position, $stat);
        $regUser->addUser();
    } else {
    }
}
开发者ID:JhunCabas,项目名称:asset-project-system,代码行数:22,代码来源:reqAddUser.php

示例13: function

        }
    }
    return $response->withStatus(401);
};
$app->get('/', function ($request, $response, $args) {
    $response->write("Welcome to Slim!");
    return $response;
});
$app->get('/register', function ($request, $response, $args) {
    render('views/registration.php');
    return $response;
});
$app->post('/registration', function ($request, $response, $args) {
    $data = $request->getParsedBody();
    $user = new User(db::getInstance());
    $result = $user->addUser($data['username'], $data['password'], $data['email']);
    if ($result) {
        $response->write("Registration successful");
    } else {
        $response->write("Error: wrong data format");
    }
    return $response;
});
$app->post('/login', function ($request, $response, $args) {
    $data = $request->getParsedBody();
    $user = new User(db::getInstance());
    $result = $user->checkUser($data['username'], $data['password']);
    if ($result === false) {
        $response->write(json_encode(array('error' => array('message' => 'Wrong login information.'))));
    } else {
        $response->write(json_encode(array('token' => $result)));
开发者ID:a-melnichuk,项目名称:SlimAuthTest,代码行数:31,代码来源:index.php

示例14: array

     }
     $data = $userModel->getUserInfo($registry->session->user->id);
     $userView->details('update', $data);
     break;
 case 'register':
     // display signup form and allow user to register
     $data = array();
     $error = array();
     if ($_SERVER['REQUEST_METHOD'] === "POST") {
         // POST values that will be validated
         $values = array('details' => array('firstName' => isset($_POST['firstName']) ? $_POST['firstName'] : '', 'lastName' => isset($_POST['lastName']) ? $_POST['lastName'] : ''), 'username' => array('username' => isset($_POST['username']) ? $_POST['username'] : ''), 'email' => array('email' => isset($_POST['email']) ? $_POST['email'] : ''), 'password' => array('password' => isset($_POST['password']) ? $_POST['password'] : '', 'password2' => isset($_POST['password2']) ? $_POST['password2'] : ''), 'captcha' => array('recaptcha_challenge_field' => isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : '', 'recaptcha_response_field' => isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : ''));
         $dotValidateUser = new Dot_Validate_User(array('who' => 'user', 'action' => 'add', 'values' => $values));
         if ($dotValidateUser->isValid()) {
             // no error - then add user
             $data = $dotValidateUser->getData();
             $userModel->addUser($data);
             $session->message['txt'] = $option->infoMessage->add;
             $session->message['type'] = 'info';
             //login user
             $userModel->authorizeLogin($data);
         } else {
             if (array_key_exists('password', $data)) {
                 // do not display password in the add form
                 $data = $dotValidateUser->getData();
                 unset($data['password']);
             }
         }
         // add action and validation are made with ajax, so return json string
         header('Content-type: application/json');
         echo Zend_Json::encode(array('data' => $dotValidateUser->getData(), 'error' => $dotValidateUser->getError()));
         // return $data and $error as json
开发者ID:sandeepdwarkapuria,项目名称:dotkernel,代码行数:31,代码来源:UserController.php

示例15: User

session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include_once '../resources/User.php';
$error = NULL;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $tag = $_POST['user'];
    $email = $_POST['email'];
    $pass = $_POST['password'];
    $confirm = $_POST['confirm-password'];
    if ($pass != $confirm) {
        $error = "Passwords did not match.";
    } else {
        $user = new User($tag, $pass, $email);
        $error = $user->addUser();
        if ($error == NULL) {
            header("Location: index.php");
            exit;
        }
    }
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" media="all"
	href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="all"
	href="css/main.css">
开发者ID:CalebTVanDyke,项目名称:Renegades,代码行数:31,代码来源:register.php


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