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


PHP UserManager::create方法代码示例

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


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

示例1: UserManager

<?php

if (isset($_POST['action'])) {
    if ($_POST['action'] == "register") {
        if (isset($_POST['f-name'], $_POST['l-name'], $_POST['email'], $_POST['emailRepeat'], $_POST['password'], $_POST['passwordRepeat'])) {
            $lastname = $_POST['l-name'];
            $firstname = $_POST['f-name'];
            $email = $_POST['email'];
            $emailRepeat = $_POST['emailRepeat'];
            $userManager = new UserManager($database);
            try {
                $data = $userManager->create($_POST['l-name'], $_POST['f-name'], $_POST['password'], $_POST['passwordRepeat'], $_POST['email'], $_POST['emailRepeat']);
            } catch (Exception $e) {
                $errors[] = $e->getMessage();
            }
            if (count($errors) == 0) {
                $_SESSION['success'] = "Votre inscription est réussite!";
                $_SESSION['id'] = $data->getId();
                header("Location: index.php");
                exit;
            } else {
                return $errors;
            }
        }
    } else {
        if ($_POST['action'] == "connect") {
            if (isset($_POST['email'], $_POST['password'])) {
                $email = $_POST['email'];
                $userManager = new UserManager($database);
                try {
                    $user = $userManager->findByEmail($_POST['email']);
开发者ID:CreepingPanda,项目名称:FennecPlusUltra,代码行数:31,代码来源:handler_user.php

示例2: header

         } else {
             $user = $retour;
             if ($user->verifPassword($_POST['password'])) {
                 $_SESSION['id'] = $user->getId();
                 header('Location: index.php');
                 exit;
             } else {
                 $errors[] = 'Incorrect Password';
             }
         }
     }
 } else {
     if ($action == 'register') {
         if (isset($_POST['login'], $_POST['password1'], $_POST['password2'], $_POST['email'], $_POST['avatar'])) {
             $manager = new UserManager($db);
             $retour = $manager->create($_POST['login'], $_POST['password1'], $_POST['password2'], $_POST['email'], $_POST['avatar']);
             if (is_array($retour)) {
                 $errors = array_merge($errors, $retour);
             } else {
                 header('Location: index.php?page=login');
                 exit;
             }
         }
     } else {
         if ($action == 'logout') {
             session_destroy();
             $_SESSION = array();
             header('Location: index.php');
             exit;
         } else {
             if ($action == 'edit_profil') {
开发者ID:Hollux,项目名称:Fennec,代码行数:31,代码来源:traitement_user.php

示例3: header

         } else {
             $user = $retour;
             if ($user->verifPassword($_POST['password'])) {
                 $_SESSION['id'] = $user->getId();
                 header('Location: index.php');
                 exit;
             } else {
                 $errors[] = 'Incorrect Password';
             }
         }
     }
 } else {
     if ($action == 'register') {
         if (isset($_POST['login'], $_POST['password1'], $_POST['password2'], $_POST['email'], $_POST['name'], $_POST['surname'], $_POST['date_birth'])) {
             $manager = new UserManager($db);
             $retour = $manager->create($_POST['login'], $_POST['password1'], $_POST['password2'], $_POST['email'], $_POST['name'], $_POST['surname'], $_POST['date_birth']);
             if (is_array($retour)) {
                 $errors = array_merge($errors, $retour);
             } else {
                 if (is_string($retour)) {
                     $errors[] = $retour;
                 } else {
                     header('Location: index.php?page=login');
                     exit;
                 }
             }
         }
     } else {
         if ($action == 'logout') {
             session_destroy();
             $_SESSION = array();
开发者ID:berserkr1,项目名称:e-commerce,代码行数:31,代码来源:traitement_user.php

示例4: UserManager

<?php

if (isset($_GET['page'])) {
    // Register function
    if ($_GET['page'] == 'register') {
        if (isset($_POST['register_email'], $_POST['register_name'], $_POST['register_surname'], $_POST['register_password'], $_POST['register_password2'])) {
            $manager = new UserManager($db);
            try {
                $res = $manager->create($_POST['register_email'], $_POST['register_name'], $_POST['register_surname'], $_POST['register_password'], $_POST['register_password2']);
            } catch (Exception $e) {
                $errors[] = $e->getMessage();
            }
            if (count($errors) == 0) {
                $_SESSION['success'] = "Registration successful";
                header('Location: ?page=login');
                exit;
            }
        }
    }
    // Login function
    if ($_GET['page'] == 'login') {
        if (isset($_POST['login_email'], $_POST['login_password'])) {
            $userManager = new UserManager($db);
            try {
                $user = $userManager->readByEmail($_POST['login_email']);
            } catch (Exception $e) {
                $errors[] = $e->getMessage();
            }
            if (count($errors) == 0) {
                if ($user->checkPassword($_POST['login_password'])) {
                    $_SESSION['id'] = $user->getId();
开发者ID:dispxxx,项目名称:leshop,代码行数:31,代码来源:handler_user.php

示例5: elseif

                 $login = $_POST['login'];
                 $email = $_POST['email'];
             } elseif ($taille > $taille_maxi) {
                 $error = 'Le fichier est trop gros.';
                 $login = $_POST['login'];
                 $email = $_POST['email'];
             } elseif ($error == "") {
                 //On formate le nom du fichier ici...
                 $fichier = strtr($fichier, 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
                 $fichier = preg_replace('/([^.a-z0-9]+)/i', '-', $fichier);
                 if (move_uploaded_file($_FILES['image']['tmp_name'], $dossier . $fichier) == FALSE) {
                     $error = 'Echec de l\'upload !';
                     $login = $_POST['login'];
                     $email = $_POST['email'];
                 } else {
                     $user = $manager->create($_POST['login'], $_POST['email'], $_POST['password'], $dossier . $fichier);
                     header('Location:' . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . 'login');
                     exit;
                 }
             }
         } else {
             $error = "Les deux mots de passe ne correspondent pas";
             $login = $_POST['login'];
             $email = $_POST['email'];
         }
     } else {
         $error = "Le mot de passe doit contenir 6 caractères minimum";
         $login = $_POST['login'];
         $email = $_POST['email'];
     }
 }
开发者ID:jmgerber,项目名称:forum,代码行数:31,代码来源:traitement-register.php


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