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


PHP Password::getPassword方法代码示例

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


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

示例1: edit

 public function edit($args)
 {
     if ($_POST) {
         $filter = new Validations();
         $pass = new Password();
         $_POST["password"] = $filter->sanitizeText($_POST["password"]);
         $_POST["password"] = $pass->getPassword($_POST["password"]);
         if ($this->db->update("usuarios", $_POST)) {
             $this->redirect(array("controller" => "usuarios"));
         } else {
             $this->redirect(array("controller" => "usuarios", "action" => "edit"));
         }
     }
     $usuario = $this->db->find("usuarios", "first", array("conditions" => "usuarios.id=" . $args[0]));
     $this->set("usuario", $usuario);
 }
开发者ID:karhega,项目名称:Gestion,代码行数:16,代码来源:usuariosController.php

示例2: edit

 /**
  * Metodo de actualizar el usuario, parte del controlador 
  */
 public function edit($id = NULL)
 {
     if ($_POST) {
         if (!empty($_POST["pass"])) {
             $pass = new Password();
             $_POST["password"] = $pass->getPassword($_POST["pass"]);
         }
         if ($this->update("usuarios", $_POST)) {
             $this->redirect(array("controller" => "usuarios", "action" => "index"));
         } else {
             $this->redirect(array("controller" => "usuarios", "action" => "edit/" . $_POST["id"]));
         }
     } else {
         $this->_view->titulo = "Editar usuario";
         $this->_view->usuario = $this->find("usuarios", "first", array("conditions" => "id=" . $id));
         $this->_view->renderizar("edit");
     }
 }
开发者ID:RodibelMorales,项目名称:remedialRMA,代码行数:21,代码来源:usuariosController.php

示例3: edit

 public function edit($id = null)
 {
     if ($_POST) {
         $filter = new Validations();
         $pass = new Password();
         $_POST["password"] = $filter->sanitizeText($_POST["password"]);
         $_POST["password"] = $pass->getPassword($_POST["password"]);
         if ($this->User->update("users", $_POST)) {
             $this->redirect(array("controller" => "users", "action" => "index"));
         } else {
             $this->redirect(array("controller" => "users", "action" => "edit"));
         }
     }
     $user = $this->User->find("users", "first", array("conditions" => "users.id={$id}"));
     $this->set("user", $user);
     //$groups = $this->User->find("groups", "all");
     //$this->set("groups", $groups);
 }
开发者ID:jeromdz,项目名称:Simple-MVC,代码行数:18,代码来源:UsersController.php

示例4: edit

 public function edit($id = null)
 {
     if ($_POST) {
         if (!empty($_POST['pass'])) {
             $pass = new Password();
             $_POST['password'] = $pass->getPassword($_POST['pass']);
         }
         if ($this->db->update("usuarios", $_POST)) {
             $this->redirect(array('controller' => 'usuarios', 'action' => 'index'));
         } else {
             $this->redirect(array('controller' => 'usuarios', 'action' => 'edit'));
         }
     } else {
         $this->_view->titulo = "Editar usuario";
         $this->_view->usuario = $this->db->find('usuarios', 'first', array('conditions' => 'id=' . $id));
         $this->_view->renderizar('edit');
     }
 }
开发者ID:abnercgomez,项目名称:framework,代码行数:18,代码来源:usuariosController.php

示例5: edit

 public function edit($id = null)
 {
     /**
      * edit function to edit users
      * @param  string $id contains the id of the row
      * @return void
      */
     if ($_POST) {
         if (!empty($_POST['pass'])) {
             $pass = new Password();
             $_POST['password'] = $pass->getPassword($_POST['pass']);
         }
         if ($this->db->update("usuarios", $_POST)) {
             $this->redirect(array('controller' => 'usuarios', 'action' => 'index'));
         } else {
             $this->redirect(array('controller' => 'usuarios', 'action' => 'edit'));
         }
     } else {
         $this->_view->titulo = "Editar usuario";
         $this->_view->usuario = $this->db->find('usuarios', 'first', array('conditions' => 'id=' . $id));
         $this->_view->renderizar('edit');
     }
 }
开发者ID:karhega,项目名称:framework,代码行数:23,代码来源:usuariosController.php

示例6: add

 /**
  * add este metodo es para añadir un usuario
  */
 public function add()
 {
     $pass = new Password();
     if ($_POST) {
         //se invvoca al metodo para incriptar
         $cryp = $pass->getPassword($_POST['password']);
         //se elimina el password
         unset($_POST['password']);
         //se agrega el password ya encriptado
         $_POST = $_POST + array('password' => $cryp);
         # code...
     }
     if ($_POST) {
         if ($this->db->save('usuarios', $_POST)) {
             $this->redirect(array('controller' => 'usuarios', 'action' => 'index'));
         } else {
             $this->redirect(array('controller' => 'usuarios', 'action' => 'add'));
         }
     } else {
         $this->_view->titulo = "Agregar usuarios";
         $this->_view->renderizar = "add";
     }
     $this->_view->renderizar('add');
 }
开发者ID:salvaroad,项目名称:examen,代码行数:27,代码来源:usuariosController.php

示例7: save

 public function save(PropelPDO $con = null)
 {
     if (!$this->getId()) {
         $this->setUid(UserPeer::getMaxUid() + 1);
         $password = new Password();
         $this->generated_password = $password->getPassword();
         $this->setNtPassword($password->getNtHash());
         $this->setUnixPassword($password->getNtHash());
         $this->setCryptPassword($password->getCryptHash());
         $this->setLmPassword($password->getLmHash());
     }
     if (!$this->getDomainnameId()) {
         // get the default domainname
         $domainname = DomainnamePeer::getDefaultDomainname();
         $this->setDomainnameId($domainname->getId());
     }
     if (!$this->getLogin()) {
         $this->generateLogin();
     }
     if (!$this->getEmailLocalPart()) {
         $this->generateEmailLocalPart();
     }
     return parent::save();
 }
开发者ID:habtom,项目名称:uas,代码行数:24,代码来源:User.php

示例8: getPassword

        }
    }
    //PHP >= 5.5.0
    public static function getPassword($password)
    {
        $option = array("cost" => 7);
        $hash = password_hash($password, PASSWORD_BCRYPT, $option);
        return $hash;
    }
    public static function passwordVerify($pass1, $pass2)
    {
        if (password_verify($pass1, $pass2)) {
            return true;
        }
        return false;
    }
}
$verificador = new Password();
$password1 = "12345";
$password2 = 12345;
echo md5($password1);
echo "<br>";
$hash = Password::getPassword($password1);
echo $hash;
echo "<br>";
echo "<br>";
if (Password::passwordVerify($password2, $hash)) {
    echo "Contraseñas validas";
} else {
    echo "Contraseñas invalidas";
}
开发者ID:juancruzek,项目名称:Frameworkcristian,代码行数:31,代码来源:password.php

示例9: dirname

<?php

// test/unit/uasTest.php
require_once dirname(__FILE__) . '/../bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../lib/Password.class.php';
$t = new lime_test(5, new lime_output_color());
$pass = new Password();
$p = $pass->getPassword();
$t->is(strlen($p), 8);
preg_match_all('/[A-Z]/', $p, $cap_letter_match);
preg_match_all('/[a-z]/', $p, $small_letter_match);
preg_match_all('/[0-9]/', $p, $number_match);
preg_match_all('/[&\\$@#\\)\\(\\[\\]\\?><!]/', $p, $special_char_match);
$t->is(count($cap_letter_match[0]), 2);
$t->is(count($small_letter_match[0]), 2);
$t->is(count($number_match[0]), 2);
$t->is(count($special_char_match[0]), 2);
开发者ID:rgevaert,项目名称:uas,代码行数:17,代码来源:uasTest.php


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