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


PHP UserManager::save方法代码示例

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


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

示例1: registerUser

function registerUser()
{
    $stat = '';
    try {
        $userManager = new UserManager();
        $userId = $userManager->getUserId($_GET["email"]);
        if (!$userId) {
            $user = new User();
            $user->hydrate(populateUserArrayFromGet());
            $userManager->save($user);
            if (session_status() == PHP_SESSION_NONE) {
                session_start();
            }
            $_SESSION['FFuser'] = serialize($user);
            $stat = 'Registration successful; ' . $user->getName() . " logged in";
        } else {
            $stat = 'Registration failed; duplicate user email';
        }
    } catch (Exception $e) {
        error_log('registerUser Exception: ' . $e->getMessage(), 0);
        $stat = $e->getMessage();
    }
    return $stat;
}
开发者ID:cownby,项目名称:weblab2015-project,代码行数:24,代码来源:index.php

示例2: User

    // after you save User data to sesson
    // otherwise, return to UserInfo page.
    if (!$User) {
        include 'views/userInfo.php';
    } else {
        $_SESSION['current_user'] = $User;
        include 'views/report.php';
    }
} else {
    // is user entered email address, go ahead and update user in case it is a new email.
    if (isset($_GET['email'])) {
        $username = $_GET['name'];
        $email = $_GET['email'];
        $UserID = $_GET['UID'];
        $User = new User();
        $User->setMail($email);
        $User->setName($username);
        $User->setUID($UserID);
        $UserManager = new UserManager();
        $returnVal = $UserManager->save($User);
        // URW TODO Remove commented line
        // No need to set user ID. this should always be an update User was added before this page
        // came up.
        // $User->setUID($returnVal);
        $_SESSION['current_user'] = $User;
        //   print("<br><br>Saving to session before PlantAdd. <br>");
        /*var_dump ($User);*/
    }
    // now go to the plant data collection form
    include_once "views/flower_add.php";
}
开发者ID:uwillmore,项目名称:phpsite,代码行数:31,代码来源:RunUserInfo.php

示例3: elseif

} elseif (isset($_GET['confirm'])) {
    //visitor goes on what seems to be a good link
    $message = new Alert("danger", true);
    $confirmCode = htmlspecialchars($_GET['confirm']);
    $userManager = new UserManager($db);
    $user = $userManager->getUniqueFromConfirmCode($confirmCode);
    if ($user instanceof User) {
        //if code corresponds to user
        //echo $user->getUserStatus();
        if ($user->getUserStatus() < 2) {
            //if user is not confirmed yet
            //echo ' in';
            //echo $user->getUserStatus();
            $user->setUserStatus(2);
            //echo 'in';
            $userManager->save($user);
            //echo $user->getUserStatus().'in';
            $message = new Alert("info", true);
            $message->addText('Thanks ' . $user->getFirstName() . '!</br>Your email is now confirmed. You can already login.');
            $message->messageToSession();
            //echo $user->getUserStatus().'should be there';
            header('Location: index.php');
            exit;
            //echo '</br> shouldnt be there';
        } else {
            //user already confirmed
            $message->addText("Your account is already confirmed.");
        }
    } else {
        //confirmCode doesnt exist
        $message->addText("Your comfirm link is broken.");
开发者ID:JhumanJ,项目名称:Unisales,代码行数:31,代码来源:confirm.php

示例4: UserManager

<?php

// Inicio la sesión
@session_start();
// Load user
require_once __DIR__ . '/../oop/manager/UserManager.php';
require_once __DIR__ . '/../oop/Security.php';
$userManager = new UserManager();
$USER = $userManager->loadSession();
// Check the login
if ($USER != null) {
    $oldPIN = Security::obtainHash($_POST['oldPIN'], $USER->getID());
    $newPIN1 = $_POST['newPIN1'];
    $newPIN2 = $_POST['newPIN2'];
    if ($newPIN1 != $newPIN2) {
        echo 'different';
    } else {
        if ($oldPIN != $USER->getPIN()) {
            echo 'wrong';
        } else {
            $USER->setPIN($newPIN1);
            $userManager->save($USER);
            echo 'correct';
        }
    }
} else {
    echo 'wrong';
}
开发者ID:shaunwickett13,项目名称:GriffTutor,代码行数:28,代码来源:ajax_updatePIN.php

示例5: UserManager

     $user = $userManager->getUser($target);
     $roles = $userManager->getAllRoles();
     include '../views/user_add_edit_view.php';
     break;
 case 'save_user':
     $userManager = new UserManager();
     $arr = array();
     $arr["email"] = isset($_GET["email"]) ? $_GET["email"] : '';
     $arr["name"] = isset($_GET["name"]) ? $_GET["name"] : '';
     $arr["password"] = isset($_GET["password"]) ? $_GET["password"] : '';
     $arr["created"] = isset($_GET["created"]) ? $_GET["created"] : '';
     $arr["lastLogin"] = isset($_GET["lastLogin"]) ? $_GET["lastLogin"] : '';
     $arr["roleid"] = isset($_GET["roleid"]) ? $_GET["roleid"] : '';
     $user = new User();
     $user->hydrate($arr);
     $success = $userManager->save($user);
     if (!$success) {
         if ($_SESSION['current_user']->getrole() == USER) {
             $roles = $userManager->getUserRole();
         } else {
             $roles = $userManager->getAllRoles();
         }
         $user->setemail = '';
         include '../views/user_add_edit_view.php';
         break;
     }
     header('Location: user.php');
     break;
 default:
     $userManager = new UserManager();
     $users = $userManager->getAllUsers();
开发者ID:stevekrog,项目名称:floraful,代码行数:31,代码来源:user.php

示例6: UserManager

 //-------If all fields are correct--------
 if ($postIsCorrect) {
     // Check that email doesn't exist yet
     $userManager = new UserManager($db);
     if (!$userManager->getUniqueFromEmail($email) instanceof User) {
         //User doesn't exist yet, and data are checked
         //So we register user (userType 1,userStatus 1,..)
         $data = User::returnDataArrayFromData(1, 1, $email, $university->getId(), $firstName, $lastName, $passWord);
         $newUser = new User($data);
         $newUser->setEmailChecker();
         $mailer->sendEmailVerify($newUser);
         if ($mailer->sendEmailVerify($newUser)) {
             $message = new Alert('info', true);
             $message->addText('Welcome <strong>' . $firstName . '</strong>! Before you log in, please confirm your email by clicking the link you received.');
             $message->messageToSession();
             $userManager->save($newUser);
             header('Location: index.php');
             exit;
         } else {
             $message = new Alert('warning', true);
             $message->addText('Sorry <strong>' . $firstName . '</strong> we had a little problem! Please try again.');
             $message->messageToSession();
         }
     } else {
         //User exist already ( email already used)
         $message->addText('Email address already registered.');
     }
 }
 //-------All fields are NOT correct OR user already registered --------
 // From here, there was a problem with one of the field or user already registered
 // We show the form again, prefill in with error message
开发者ID:JhumanJ,项目名称:Unisales,代码行数:31,代码来源:register.php

示例7: header

    header('Location: index.php?action=login');
}
$target = isset($_GET["target"]) ? $_GET["target"] : '';
//$target = $current_user->id;
//var_dump($user->getId());
switch ($action) {
    case 'user_save':
        $userManager = new UserManager();
        $arr = array();
        $arr["name"] = isset($_POST["name"]) ? $_POST["name"] : '';
        $arr["email"] = isset($_POST["email"]) ? $_POST["email"] : '';
        $arr["pass"] = isset($_POST["pass"]) ? $_POST["pass"] : '';
        // $arr["role"] = isset($_POST["role"])?$_POST["role"]:'';
        $user = new User();
        $user->hydrate($arr);
        $userManager->save($user);
        $error = $userManager->save($user);
        //var_dump($user);
        // header('Location: index.php');
        include '../views/register_success.php';
        break;
    case 'account':
        $userManager = new UserManager();
        $user = $userManager->getUser($target);
        include '../views/user_view.php';
        break;
        // case 'user_edit':
        //   $userManager = new UserManager();
        //   $user = $userManager->getUser($target);
        //   $roles = $userManager->getAllRoles();
        //   include('../views/user_add_edit.php');
开发者ID:darrenhankins,项目名称:weblab-flora-app,代码行数:31,代码来源:user.php


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