當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authentication::createUser方法代碼示例

本文整理匯總了PHP中Authentication::createUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authentication::createUser方法的具體用法?PHP Authentication::createUser怎麽用?PHP Authentication::createUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Authentication的用法示例。


在下文中一共展示了Authentication::createUser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createAlumno

 public function createAlumno(array $post)
 {
     //var_dump($post);
     //Sanitisar los valores enviados por el usuario ( POST )
     $username = filter_var($post['username_input_data'], FILTER_SANITIZE_STRING);
     $mail = filter_var($post['email_input_data'], FILTER_SANITIZE_EMAIL);
     $password = filter_var($post['password_input_data'], FILTER_SANITIZE_STRING);
     $username = strip_tags($username);
     $mail = strip_tags($mail);
     $password = strip_tags($password);
     //Validar el email
     $mail = filter_var($mail, FILTER_VALIDATE_EMAIL);
     $longitudPass = strlen($password);
     $perfil = Perfil::where('email', '=', $mail)->get();
     //Verificar que el email sea valido
     if (!$mail) {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=1');
     }
     //Verificar la longitud del password
     if ($longitudPass < 8) {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=2');
     }
     //Verificar que el email no exista en la base de datos (Perfil)
     if (count($perfil) > 0) {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=3');
     }
     //Verificar que el username no exista en la base de datos
     $perfil = Perfil::where('username', '=', $username)->get();
     if (count($perfil) > 0) {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=4');
     }
     $user = Authentication::createUser($username, $mail, $password, 4);
     if ($user) {
         if (isset($_SESSION['proceso']) && ($_SESSION['proceso']['proceso'] = 1)) {
             $this->app->redirect('/suscribirme/' . $_SESSION['proceso']['curso']);
         } else {
             $this->app->redirect('/' . $username);
         }
     } else {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=5');
     }
 }
開發者ID:CodeSomethingMX,項目名稱:barney,代碼行數:42,代碼來源:AlumnoController.class.php

示例2: Authentication

    }
    if (!preg_match("#[a-z]+#", $password)) {
        $error .= "Password must include at least one letter!<br />";
    }
    if (!preg_match("#[A-Z]+#", $password)) {
        $error .= "Password must include at least one CAPS!<br />";
    }
    //if( !preg_match("#\W+#", $password) ) {
    //	$error .= "Password must include at least one symbol!<br />";
    //}
    if (!empty($error)) {
        $app->flash('error', $error);
        $app->redirect('/create/new/user');
    }
    $auth = new Authentication($email, $password);
    if (!$auth->createUser($first_name, $last_name, $company, $phone, $group)) {
        $app->flash('error', $error . "<br />" . $auth->getError());
        $app->redirect('/create/new/user');
    }
    $_SESSION['user'] = $email;
    $app->redirect('/');
});
$app->get("/forgotpassword", function () use($app) {
    $flash = $app->view()->getData('flash');
    $error = "";
    echo "error: " . $flash['error'];
    if (isset($flash['error'])) {
        $error = $flash['error'];
    }
    $app->render("Authentication/Forgotpassword.php", array('error' => $error));
});
開發者ID:kxopa,項目名稱:Slim-PHP-Authentication-App,代碼行數:31,代碼來源:Authentication.php


注:本文中的Authentication::createUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。