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


PHP common::hash方法代码示例

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


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

示例1: ChangePass

 /**
  * Save a user's new password
  *
  */
 function ChangePass()
 {
     global $langmessage, $config;
     $fields = 0;
     if (!empty($_POST['oldpassword'])) {
         $fields++;
     }
     if (!empty($_POST['password'])) {
         $fields++;
     }
     if (!empty($_POST['password1'])) {
         $fields++;
     }
     if ($fields < 2) {
         return;
         //assume user didn't try to reset password
     }
     //make sure password and password1 match
     if (!$this->CheckPasswords()) {
         return false;
     }
     //check the old password
     $pass_hash = gpsession::PassAlgo($this->user_info);
     $oldpass = common::hash($_POST['oldpassword'], $pass_hash);
     if ($this->user_info['password'] != $oldpass) {
         message($langmessage['couldnt_reset_pass']);
         return false;
     }
     self::SetUserPass($this->users[$this->username], $_POST['password']);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:34,代码来源:admin_preferences.php

示例2: ChangePass

 function ChangePass()
 {
     global $langmessage;
     $fields = 0;
     if (!empty($_POST['oldpassword'])) {
         $fields++;
     }
     if (!empty($_POST['password'])) {
         $fields++;
     }
     if (!empty($_POST['password1'])) {
         $fields++;
     }
     if ($fields < 2) {
         return;
         //assume user didn't try to reset password
     }
     //see also admin_users for password checking
     if (!$this->CheckPasswords()) {
         return false;
     }
     $oldpass = common::hash(trim($_POST['oldpassword']));
     if ($this->user_info['password'] != $oldpass) {
         message($langmessage['couldnt_reset_pass']);
         return false;
     }
     $this->users[$this->username]['password'] = common::hash(trim($_POST['password']));
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:28,代码来源:admin_preferences.php

示例3: ResetPass

 /**
  * Save a user's new password
  *
  */
 function ResetPass()
 {
     global $langmessage, $config;
     if (!$this->CheckPasswords()) {
         return false;
     }
     $username = $_POST['username'];
     if (!isset($this->users[$username])) {
         message($langmessage['OOPS']);
         return false;
     }
     $pass_hash = gpsession::PassAlgo($this->users[$username]);
     $this->users[$username]['password'] = common::hash($_POST['password'], $pass_hash);
     return $this->SaveUserFile();
 }
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:19,代码来源:admin_users.php

示例4: Install_DataFiles_New

    static function Install_DataFiles_New($destination = false, $config = array(), $base_install = true)
    {
        global $langmessage;
        if ($destination === false) {
            $destination = $GLOBALS['dataDir'];
        }
        //set config variables
        //$config = array(); //because of ftp values
        $gpLayouts = array();
        //use bootswatch theme if server has enough memory
        $gpLayouts['default']['theme'] = 'Bootswatch_Flatly/4_Sticky_Footer';
        $gpLayouts['default']['label'] = 'Bootswatch_Flatly/4_Sticky_Footer';
        if (@ini_set('memory_limit', '96M') === false) {
            $limit = ini_get('memory_limit');
            $limit = common::getByteValue($limit);
            if ($limit < 100663296) {
                $gpLayouts['default']['theme'] = 'Three_point_5/Shore';
                $gpLayouts['default']['label'] = 'Three_point_5/Shore';
            }
        }
        $gpLayouts['default']['color'] = '#93c47d';
        $_config['toemail'] = $_POST['email'];
        $_config['gpLayout'] = 'default';
        $_config['title'] = Install_Tools::Install_Title();
        $_config['keywords'] = CMS_NAME . ' , Easy CMS, Content Management, PHP, Free CMS, Website builder, Open Source';
        $_config['desc'] = 'A new ' . CMS_NAME . ' installation. You can change your site\'s description in the configuration.';
        $_config['timeoffset'] = '0';
        $_config['langeditor'] = 'inherit';
        $_config['dateformat'] = '%m/%d/%y - %I:%M %p';
        $_config['gpversion'] = gpversion;
        $_config['passhash'] = 'sha512';
        $_config['gpuniq'] = common::RandomString(20);
        $_config['combinecss'] = Install_Tools::BooleanValue('combinecss', true);
        $_config['combinejs'] = Install_Tools::BooleanValue('combinejs', true);
        $_config['etag_headers'] = Install_Tools::BooleanValue('etag_headers', true);
        $_config['language'] = 'en';
        $config += $_config;
        //directories
        gpFiles::CheckDir($destination . '/data/_uploaded/image');
        gpFiles::CheckDir($destination . '/data/_uploaded/media');
        gpFiles::CheckDir($destination . '/data/_uploaded/file');
        gpFiles::CheckDir($destination . '/data/_uploaded/flash');
        gpFiles::CheckDir($destination . '/data/_sessions');
        // gp_index
        $new_index = array();
        $new_index['Home'] = 'a';
        $new_index['Heading_Page'] = 'b';
        $new_index['Help_Videos'] = 'c';
        $new_index['Child_Page'] = 'd';
        $new_index['More'] = 'e';
        $new_index['About'] = 'f';
        $new_index['Contact'] = 'special_contact';
        $new_index['Site_Map'] = 'special_site_map';
        $new_index['Galleries'] = 'special_galleries';
        $new_index['Missing'] = 'special_missing';
        $new_index['Search'] = 'special_gpsearch';
        //	gpmenu
        $new_menu = array();
        $new_menu['a'] = array('level' => 0);
        $new_menu['b'] = array('level' => 0);
        $new_menu['c'] = array('level' => 1);
        $new_menu['d'] = array('level' => 1);
        $new_menu['e'] = array('level' => 0);
        $new_menu['f'] = array('level' => 1);
        $new_menu['special_contact'] = array('level' => 1);
        //	links
        $new_titles = array();
        $new_titles['a']['label'] = 'Home';
        $new_titles['a']['type'] = 'text';
        $new_titles['b']['label'] = 'Heading Page';
        $new_titles['b']['type'] = 'text';
        $new_titles['c']['label'] = 'Help Videos';
        $new_titles['c']['type'] = 'text';
        $new_titles['d']['label'] = 'Child Page';
        $new_titles['d']['type'] = 'text';
        $new_titles['e']['label'] = 'More';
        $new_titles['e']['type'] = 'text';
        $new_titles['f']['label'] = 'About';
        $new_titles['f']['type'] = 'text';
        $new_titles['special_contact']['lang_index'] = 'contact';
        $new_titles['special_contact']['type'] = 'special';
        $new_titles['special_site_map']['lang_index'] = 'site_map';
        $new_titles['special_site_map']['type'] = 'special';
        $new_titles['special_galleries']['lang_index'] = 'galleries';
        $new_titles['special_galleries']['type'] = 'special';
        $new_titles['special_missing']['label'] = 'Missing';
        $new_titles['special_missing']['type'] = 'special';
        $new_titles['special_gpsearch']['label'] = 'Search';
        $new_titles['special_gpsearch']['type'] = 'special';
        $pages = array();
        $pages['gp_index'] = $new_index;
        $pages['gp_menu'] = $new_menu;
        $pages['gp_titles'] = $new_titles;
        $pages['gpLayouts'] = $gpLayouts;
        echo '<li>';
        if (!gpFiles::SaveData($destination . '/data/_site/pages.php', 'pages', $pages)) {
            echo '<span class="failed">';
            //echo 'Could not save pages.php';
            echo sprintf($langmessage['COULD_NOT_SAVE'], 'pages.php');
            echo '</span>';
//.........这里部分代码省略.........
开发者ID:stegrams,项目名称:Typesetter,代码行数:101,代码来源:install.php

示例5: SetUserPass

 /**
  * Set the user password and password hash algorithm
  *
  */
 static function SetUserPass(&$user_info, $password)
 {
     if (function_exists('password_hash') && $_REQUEST['algo'] == 'password_hash') {
         $temp = common::hash($_POST['password'], 'sha512', 50);
         $user_info['password'] = password_hash($temp, PASSWORD_DEFAULT);
         $user_info['passhash'] = 'password_hash';
     } else {
         $user_info['password'] = common::hash($_POST['password'], 'sha512');
         $user_info['passhash'] = 'sha512';
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:15,代码来源:admin_users.php

示例6: SendPassword

 function SendPassword()
 {
     global $langmessage, $dataDir, $gp_mailer;
     includeFile('tool/email_mailer.php');
     include $dataDir . '/data/_site/users.php';
     $username = $_POST['username'];
     if (!isset($users[$username])) {
         message($langmessage['OOPS']);
         return false;
     }
     $userinfo = $users[$username];
     if (empty($userinfo['email'])) {
         message($langmessage['no_email_provided']);
         return false;
     }
     $passwordChars = str_repeat('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 3);
     $newpass = str_shuffle($passwordChars);
     $newpass = substr($newpass, 0, 8);
     $users[$username]['newpass'] = common::hash(trim($newpass));
     if (!gpFiles::SaveArray($dataDir . '/data/_site/users.php', 'users', $users)) {
         message($langmessage['OOPS']);
         return false;
     }
     if (isset($_SERVER['HTTP_HOST'])) {
         $server = $_SERVER['HTTP_HOST'];
     } else {
         $server = $_SERVER['SERVER_NAME'];
     }
     $link = common::AbsoluteLink('Admin_Main', $langmessage['login']);
     $message = sprintf($langmessage['passwordremindertext'], $server, $link, $username, $newpass);
     if ($gp_mailer->SendEmail($userinfo['email'], $langmessage['new_password'], $message)) {
         list($namepart, $sitepart) = explode('@', $userinfo['email']);
         $showemail = substr($namepart, 0, 3) . '...@' . $sitepart;
         message(sprintf($langmessage['password_sent'], $username, $showemail));
         return true;
     }
     message($langmessage['OOPS'] . ' (Email not sent)');
     return false;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:39,代码来源:admin_display.php

示例7: CheckPassword

 /**
  * check password, choose between plaintext, md5 encrypted or sha-1 encrypted
  * @param string $user_pass
  */
 function CheckPassword($user_pass)
 {
     // $user_pass is the already encrypted password (md5 or sha)
     // the second level hash is always done with sha
     $nonced_pass = sha1($_POST['login_nonce'] . $user_pass);
     //without encryption
     if (!gp_require_encrypt && !empty($_POST['password'])) {
         $pass = common::hash(trim($_POST['password']));
         if ($user_pass === $pass) {
             return true;
         }
         return false;
     }
     //with md5 encryption
     if (isset($config['shahash']) && !$config['shahash']) {
         if ($nonced_pass === $_POST['pass_md5']) {
             return true;
         }
         return false;
     }
     //with sha encryption
     if ($nonced_pass === $_POST['pass_sha']) {
         return true;
     }
     return false;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:30,代码来源:sessions.php

示例8: ResetPass

 /**
  * Save a user's new password
  */
 function ResetPass()
 {
     global $langmessage;
     if (!$this->CheckPasswords()) {
         return false;
     }
     $username = $_POST['username'];
     if (!isset($this->users[$username])) {
         message($langmessage['OOPS']);
         return false;
     }
     $this->users[$username]['password'] = common::hash(trim($_POST['password']));
     return $this->SaveUserFile();
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:17,代码来源:admin_users.php

示例9: CheckPassword

 /**
  * Check password, choose between plaintext, md5 encrypted or sha-1 encrypted
  * @param string $user_pass
  * @param string $nonce
  * @param string $pass_algo Password hashing algorithm
  *
  */
 static function CheckPassword($user_pass, $nonce, $pass_algo)
 {
     global $config;
     $posted_pass = false;
     switch ($pass_algo) {
         case 'md5':
             $posted_pass = $_POST['pass_md5'];
             $user_pass = sha1($nonce . $user_pass);
             break;
         case 'sha1':
             $posted_pass = $_POST['pass_sha'];
             $user_pass = sha1($nonce . $user_pass);
             break;
         case 'sha512':
             //javascript only loops through sha512 50 times
             $posted_pass = common::hash($_POST['pass_sha512'], 'sha512', 950);
             break;
         case 'password_hash':
             return password_verify($_POST['pass_sha512'], $user_pass);
     }
     if ($posted_pass && $posted_pass === $user_pass) {
         return true;
     }
     return false;
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:32,代码来源:sessions.php


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