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


PHP Password::validate方法代码示例

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


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

示例1: login

 public function login()
 {
     if (!empty($_POST['username']) && !empty($_POST['password'])) {
         $username = filter_var($_POST['username'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
         $data["admin"] = $this->_model->check_admin("username", $username);
         if (!sizeof($data["admin"])) {
             Message::set("There is no username with this value '" . $_POST['username'] . "'", "error");
             URL::REDIRECT("portfolio");
         } else {
             foreach ($data["admin"] as $key => $value) {
                 $password = $_POST['password'];
                 $hash_password = $value['password'];
                 $username = $value['username'];
                 if ($value['state'] == 1) {
                     if (Password::validate($password, $hash_password)) {
                         Session::set("admin", $username);
                         Message::set("Herzlich Wilkommen " . Session::get('admin') . "!", "success");
                         URL::REDIRECT("portfolio");
                     } else {
                         Message::set("Password not matched", "error");
                         URL::REDIRECT("portfolio");
                     }
                 } else {
                     Message::set("Your account hasn't been activated yet. Please activate your account by confirming our email.", "info");
                     URL::REDIRECT("portfolio");
                 }
             }
         }
     } else {
         Message::set("Please fill the login form", "error");
         URL::REDIRECT("portfolio");
     }
 }
开发者ID:cescgie,项目名称:garth,代码行数:33,代码来源:admin.php

示例2: date

     $daten['lists'] = $_GET['daten'];
     $daten['name'] = $_GET['name'];
     $daten['updated_at'] = date("Y-m-d H:i:s");
     $db->update('playlist', $daten, 'name="' . $daten["name"] . '"');
 } elseif ($_GET['action'] == 'check_name') {
     $name = $_GET['name'];
     $result = $db->select("SELECT EXISTS(SELECT 1 FROM playlist WHERE name ='{$name}' LIMIT 1) as checked");
     /*
      * if exists result is 1 else is 0
      */
     print_r($result[0]['checked']);
 } elseif ($_GET['action'] == 'check_password') {
     $name = $_GET['name'];
     $pass = $_GET['password'];
     $result = $db->select("SELECT password FROM playlist WHERE name='{$name}' ");
     if ($password->validate($pass, $result[0]['password'])) {
         echo 1;
     } else {
         echo 0;
     }
 } elseif ($_GET['action'] == 'update_viewer') {
     # code...
     $id = $_GET['id'];
     $viewers = $db->select("SELECT * FROM yapi WHERE yid='{$id}' ");
     $viewer['viewers'] = $viewers[0]['viewers'] + 1;
     $db->update('yapi', $viewer, 'yid="' . $id . '"');
     echo $viewers[0]['viewers'];
 } elseif ($_GET['action'] == 'update_empf_videos') {
     $new_empf_id = $_GET['new_empf_id'];
     $old_empf_id = $_GET['old_empf_id'];
     $suggest_old['suggest'] = 0;
开发者ID:cescgie,项目名称:videotube,代码行数:31,代码来源:operatePlaylist.php


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