• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP md5函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中md5函数的典型用法代码示例。如果您正苦于以下问题:PHP md5函数的具体用法?PHP md5怎么用?PHP md5使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: login

 function login()
 {
     $this->admin_security->check_no_admin_login();
     // Process the inputs if form is posted
     if ($_POST) {
         // To avoid mysql injection
         $this->admin_security->avoid_mysql_injection();
         // Setting validation rules
         $this->form_validation->set_rules($this->admin_rules->login());
         $this->form_validation->set_error_delimiters('<div class="er">', '</div>');
         //provide div to show message
         // Continue authentication if form is valid
         if ($this->form_validation->run() == FALSE) {
             $this->data['error'] = 1;
         } else {
             // make sessions and redirect to home page if admin is authenticated
             if ($admin_id = $this->admin_security->authenticate_admin($_POST['username'], md5($_POST['password']))) {
                 // Set session data
                 $this->session->set_userdata('admin_id', $admin_id);
                 redirect(base_url() . 'admin/dashboard');
             } else {
                 // Assign error message
                 $this->data['err_msg_invalid'] = 'Invalid username or password.';
             }
         }
     }
     // Load login page
     $this->load->view('admin/login', $this->data);
 }
开发者ID:centaurustech,项目名称:funding,代码行数:29,代码来源:admin.php


示例2: generateSecurekey

 /**
  *
  * @ORM\PrePersist
  */
 public function generateSecurekey()
 {
     $generator = new SecureRandom();
     $random = $generator->nextBytes(150);
     $securekey = md5($random . time());
     $this->setSecurekey($securekey);
 }
开发者ID:ssone,项目名称:cms-bundle,代码行数:11,代码来源:FieldType.php


示例3: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $m = $this->getConfig('methods');
     if (@count($m) == 1) {
         $a = new Am_Paysystem_Action_Form(self::URL . $m[0] . '/event/');
     } else {
         $a = new Am_Paysystem_Action_HtmlTemplate_Micropayment($this->getDir(), 'micropayment-confirm.phtml');
         $methods = array();
         if (@count($m)) {
             $a->url = self::URL . $m[0] . '/event/';
             foreach ($m as $title) {
                 $methods[self::URL . $title . '/event/'] = $this->getConfig($title . '.title');
             }
         } else {
             foreach ($this->getConfig() as $k => $v) {
                 if (is_array($v) && !empty($v['title'])) {
                     $methods[self::URL . $k . '/event/'] = $v['title'];
                 }
             }
             $a->url = array_shift(array_keys($methods));
         }
         $a->methods = $methods;
     }
     $a->project = $this->getConfig('project');
     $a->amount = $invoice->first_total * 100;
     $a->freepaymentid = $invoice->public_id;
     $a->seal = md5("project={$a->project}&amount={$a->amount}&freepaymentid={$a->freepaymentid}" . $this->getConfig('key'));
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:29,代码来源:micropayment.php


示例4: actionModify

 function actionModify()
 {
     $id = (int) $this->_context->get('id');
     $rs = Account::find('user_id = ?', $id)->getOne();
     if (!$rs->id()) {
         return $this->msg($tip = '参数错误', url('manage::account'));
     }
     $form = Form_Common::createForm('', 'manage/profile');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         $post = $form->values();
         $user_mail = $post['user_mail'];
         $user_pass = $post['user_pass'];
         $is_locked = $post['is_locked'] ? '1' : '0';
         #dump($post);
         if ($user_pass) {
             $user_pass = sha1(md5('sike' . $post['user_pass'] . Q::ini('appini/secret_key')));
             $rs->user_pass;
         }
         $rs->user_mail = $user_mail;
         $rs->is_locked = $is_locked;
         $rs->save();
         return $this->msg($tip = '修改成功', url('manage::account/modify', array('id' => $id)));
     }
     $form->import($rs->toArray());
     $form->element('user_pass')->value = '';
     $form->element('is_locked')->checked = $rs->is_locked;
     #dump($form->element('is_locked'));
     $this->_view['form'] = $form;
     $this->_view['rs'] = $rs;
     $order = Order::find('user_id = ?', $id)->order('created DESC')->getAll();
     $this->_view['order'] = $order;
     $this->_view['_UDI'] = 'manage::account/index';
 }
开发者ID:xyz12810,项目名称:xiao3vpn,代码行数:33,代码来源:account_controller.php


示例5: wpcom_static_url

 function wpcom_static_url($file)
 {
     $i = hexdec(substr(md5($file), -1)) % 2;
     $http = is_ssl() ? 'https' : 'http';
     $url = $http . '://s' . $i . '.wp.com' . $file;
     return $url;
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:7,代码来源:notes.php


示例6: getkey

 public function getkey($actionUrl = null, $mktime = null)
 {
     $actionUrl = $this->_getActionUrl($actionUrl);
     if ($mktime == null) {
         $lifetime = Centurion_Config_Manager::get('ticket.lifetime');
         list($lifetimeValue, $lifetimeUnit) = sscanf($lifetime, '%d%s');
         $mktime = new Zend_Date();
         switch ($lifetimeUnit) {
             case 'j':
             case 'd':
                 $mktime->setHour(0);
             case 'h':
                 $mktime->setMinute(0);
             case 'm':
             default:
                 $mktime->setSecond(0);
         }
     }
     if ($mktime instanceof Zend_Date) {
         $date = $mktime->toString('YYYYMMdd-HH:mm');
     } else {
         $date = date('Ymd-H:i', $mktime);
     }
     $salt = Centurion_Config_Manager::get('ticket.salt');
     $ticket = md5($salt . $actionUrl . $date);
     return $ticket;
 }
开发者ID:netconstructor,项目名称:Centurion,代码行数:27,代码来源:Ticket.php


示例7: get_token_from_guids

function get_token_from_guids($guids)
{
    $guids = array_unique($guids);
    sort($guids);
    $string = implode(',', $guids);
    return md5($string);
}
开发者ID:beck24,项目名称:granular_access,代码行数:7,代码来源:functions.php


示例8: session_init

/**
 * Initialize session.
 * @param boolean $keepopen keep session open? The default is
 * 			to close the session after $_SESSION has been populated.
 * @uses $_SESSION
 */
function session_init($keepopen = false)
{
    $settings = new phpVBoxConfigClass();
    // Sessions provided by auth module?
    if (@$settings->auth->capabilities['sessionStart']) {
        call_user_func(array($settings->auth, $settings->auth->capabilities['sessionStart']), $keepopen);
        return;
    }
    // No session support? No login...
    if (@$settings->noAuth || !function_exists('session_start')) {
        global $_SESSION;
        $_SESSION['valid'] = true;
        $_SESSION['authCheckHeartbeat'] = time();
        $_SESSION['admin'] = true;
        return;
    }
    // start session
    session_start();
    // Session is auto-started by PHP?
    if (!ini_get('session.auto_start')) {
        ini_set('session.use_trans_sid', 0);
        ini_set('session.use_only_cookies', 1);
        // Session path
        if (isset($settings->sessionSavePath)) {
            session_save_path($settings->sessionSavePath);
        }
        session_name(isset($settings->session_name) ? $settings->session_name : md5('phpvbx' . $_SERVER['DOCUMENT_ROOT'] . $_SERVER['HTTP_USER_AGENT']));
        session_start();
    }
    if (!$keepopen) {
        session_write_close();
    }
}
开发者ID:rgooler,项目名称:personal-puppet,代码行数:39,代码来源:utils.php


示例9: encrypt

/**
 * Encrypts password with salt and entered password
 * Stucture => saltedHash:salt
 * @param $pass
 * @return string
 *
 */
function encrypt($pass)
{
    $password = $pass;
    $salt = 'LSAS213saddEASDRAs2135SDA';
    $password = md5($salt . $password) . ":" . $salt;
    return $password;
}
开发者ID:Substractive,项目名称:Webshop,代码行数:14,代码来源:register_model.php


示例10: getSQLValue

 function getSQLValue()
 {
     if (is_array($this->property_info['value'])) {
         return md5($this->property_info['value']['original']);
     }
     return md5($this->property_info['value']);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:7,代码来源:PasswordType.php


示例11: generatePassword

 public static function generatePassword($request, $seed)
 {
     $context = $request['context'];
     $username = $request['username'];
     $pass = convBase(md5($context . $username . $seed), '0123456789abcdef', "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNIOPQRSTUVWXYZ()-_!\$%&=@#");
     return $pass;
 }
开发者ID:Adrian0350,项目名称:zero-knowledge-keychain,代码行数:7,代码来源:ZKKGenerator.php


示例12: iCMS_link

/**
 * @package iCMS
 * @copyright 2007-2010, iDreamSoft
 * @license http://www.idreamsoft.com iDreamSoft
 * @author coolmoo <[email protected]>
 */
function iCMS_link($vars)
{
    $limit = isset($vars['row']) ? (int) $vars['row'] : "100";
    $cache_time = isset($vars['time']) ? (int) $vars['time'] : -1;
    switch ($vars['type']) {
        case "text":
            $sql[] = " `logo`='' ";
            break;
        case "logo":
            $sql[] = " `logo`!='' ";
            break;
    }
    isset($vars['cid']) && ($sql[] = " cid='" . $vars['cid'] . "'");
    $sql && ($where = 'WHERE ' . implode(' AND ', $sql));
    $iscache = true;
    if ($vars['cache'] == false || isset($vars['page'])) {
        $iscache = false;
        $rs = '';
    } else {
        $cacheName = 'links/' . md5($sql);
        $rs = iCache::get($cacheName);
    }
    if (empty($rs)) {
        $rs = iDB::all("SELECT * FROM `#iCMS@__links`{$where} ORDER BY ordernum ASC,id ASC LIMIT 0 , {$limit}");
        $iscache && iCache::set($cacheName, $rs, $cache_time);
    }
    return $rs;
}
开发者ID:sunhk25,项目名称:iCMS,代码行数:34,代码来源:iCMS.link.php


示例13: is_auth

 public static function is_auth($cookie)
 {
     $request = APF::get_instance()->get_request();
     if ($cookie) {
         $is_flash = @$request->get_parameter("is_flash");
         if ($is_flash) {
             $browser = $request->get_parameter("user_agent");
         } else {
             $browser = $_SERVER['HTTP_USER_AGENT'];
         }
         $iBugsecques = APF::get_instance()->get_config('iBugSecques');
         $cookieStr = Util_AuthorCrypt::decrypt($cookie, md5($browser . $iBugsecques));
         if (empty($cookieStr)) {
             return false;
         }
         $cookieArr = explode("\t", $cookieStr);
         @(list($user_id, $username, $cookietime) = $cookieArr);
         if (empty($user_id) || empty($username)) {
             return false;
         }
         $request->set_user_id($user_id);
         $request->set_username($username);
         return true;
     } else {
         return false;
     }
 }
开发者ID:emilymwang8,项目名称:ibug,代码行数:27,代码来源:NoAuth.php


示例14: addUser

 public function addUser($add = array())
 {
     if (empty($add['staff_name']) and empty($add['username']) and empty($add['password'])) {
         return TRUE;
     }
     $this->db->where('staff_email', strtolower($add['site_email']));
     $this->db->delete('staffs');
     $this->db->set('staff_email', strtolower($add['site_email']));
     $this->db->set('staff_name', $add['staff_name']);
     $this->db->set('staff_group_id', '11');
     $this->db->set('staff_location_id', '0');
     $this->db->set('language_id', '11');
     $this->db->set('timezone', '0');
     $this->db->set('staff_status', '1');
     $this->db->set('date_added', mdate('%Y-%m-%d', time()));
     $query = $this->db->insert('staffs');
     if ($this->db->affected_rows() > 0 and $query === TRUE) {
         $staff_id = $this->db->insert_id();
         $this->db->where('username', $add['username']);
         $this->db->delete('users');
         $this->db->set('username', $add['username']);
         $this->db->set('staff_id', $staff_id);
         $this->db->set('salt', $salt = substr(md5(uniqid(rand(), TRUE)), 0, 9));
         $this->db->set('password', sha1($salt . sha1($salt . sha1($add['password']))));
         $query = $this->db->insert('users');
     }
     return $query;
 }
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:28,代码来源:Setup_model.php


示例15: testRegularUser

 public function testRegularUser()
 {
     $originalUser = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserInterface');
     $user = new UserWrapped($originalUser, $this->apiUser);
     $this->assertTrue($user->isEnabled());
     $this->assertTrue($user->isAccountNonExpired());
     $this->assertTrue($user->isAccountNonLocked());
     $this->assertTrue($user->isCredentialsNonExpired());
     $this->assertTrue($user->isEqualTo($this->getMock('Symfony\\Component\\Security\\Core\\User\\UserInterface')));
     $originalUser->expects($this->once())->method('eraseCredentials');
     $user->eraseCredentials();
     $username = 'lolautruche';
     $password = 'NoThisIsNotMyRealPassword';
     $roles = array('ROLE_USER', 'ROLE_TEST');
     $salt = md5(microtime(true));
     $originalUser->expects($this->exactly(2))->method('getUsername')->will($this->returnValue($username));
     $originalUser->expects($this->once())->method('getPassword')->will($this->returnValue($password));
     $originalUser->expects($this->once())->method('getRoles')->will($this->returnValue($roles));
     $originalUser->expects($this->once())->method('getSalt')->will($this->returnValue($salt));
     $this->assertSame($username, $user->getUsername());
     $this->assertSame($username, (string) $user);
     $this->assertSame($password, $user->getPassword());
     $this->assertSame($roles, $user->getRoles());
     $this->assertSame($salt, $user->getSalt());
     $this->assertSame($originalUser, $user->getWrappedUser());
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:26,代码来源:UserWrappedTest.php


示例16: actionToken

 public function actionToken($state)
 {
     // only poeple on the list should be generating new tokens
     if (!$this->context->token->checkAccess($_SERVER['REMOTE_ADDR'])) {
         echo "Oh sorry man, this is a private party!";
         mail($this->context->token->getEmail(), 'Notice', 'The token is maybe invalid!');
         $this->terminate();
     }
     // facebook example code...
     $stoken = $this->session->getSection('token');
     if (!isset($_GET['code'])) {
         $stoken->state = md5(uniqid(rand(), TRUE));
         //CSRF protection
         $dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" . $this->context->token->getAppId() . "&redirect_uri=" . urlencode($this->link('//Crawler:token')) . "&scope=" . $this->context->token->getAppPermissions() . "&state=" . $stoken->state;
         echo "<script> top.location.href='" . $dialog_url . "'</script>";
         $this->terminate();
     }
     if (isset($stoken->state) && $stoken->state === $_GET['state']) {
         $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $this->context->token->getAppId() . "&redirect_uri=" . urlencode($this->link('//Crawler:token')) . "&client_secret=" . $this->context->token->getAppSecret() . "&code=" . $_GET['code'];
         $response = file_get_contents($token_url);
         $params = null;
         parse_str($response, $params);
         $date = new DateTime();
         $date->add(new DateInterval('PT' . $params["expires"] . 'S'));
         $this->context->token->saveToken($params['access_token'], $date);
         echo "Thanks for your token :)";
     } else {
         echo "The state does not match. You may be a victim of CSRF.";
     }
     $this->terminate();
 }
开发者ID:ISCCTU,项目名称:fitak,代码行数:31,代码来源:CrawlerPresenter.php


示例17: onadd

 function onadd()
 {
     $this->load('misc');
     $appid = intval($this->input('appid'));
     $icon = $this->input('icon');
     $uid = intval($this->input('uid'));
     $username = $this->input('username');
     $body_data = $_ENV['misc']->array2string($this->input('body_data'));
     $title_data = $_ENV['misc']->array2string($this->input('title_data'));
     $title_template = $this->_parsetemplate($this->input('title_template'));
     $body_template = $this->_parsetemplate($this->input('body_template'));
     $body_general = $this->input('body_general');
     $target_ids = $this->input('target_ids');
     $image_1 = $this->input('image_1');
     $image_1_link = $this->input('image_1_link');
     $image_2 = $this->input('image_2');
     $image_2_link = $this->input('image_2_link');
     $image_3 = $this->input('image_3');
     $image_3_link = $this->input('image_3_link');
     $image_4 = $this->input('image_4');
     $image_4_link = $this->input('image_4_link');
     $hash_template = md5($title_template . $body_template);
     $hash_data = md5($title_template . $title_data . $body_template . $body_data);
     $dateline = $this->time;
     $this->db->query("INSERT INTO " . UC_DBTABLEPRE . "feeds SET appid='{$appid}', icon='{$icon}', uid='{$uid}', username='{$username}',\r\n\t\t\ttitle_template='{$title_template}', title_data='{$title_data}', body_template='{$body_template}', body_data='{$body_data}', body_general='{$body_general}',\r\n\t\t\timage_1='{$image_1}', image_1_link='{$image_1_link}', image_2='{$image_2}', image_2_link='{$image_2_link}',\r\n\t\t\timage_3='{$image_3}', image_3_link='{$image_3_link}', image_4='{$image_4}', image_4_link='{$image_4_link}',\r\n\t\t\thash_template='{$hash_template}', hash_data='{$hash_data}', target_ids='{$target_ids}', dateline='{$dateline}'");
     return $this->db->insert_id();
 }
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:27,代码来源:feed.php


示例18: callback

 function callback($in, &$paymentId, &$money, &$message)
 {
     $digest = trim(md5($in['OrderMessage']));
     $info = explode('|', $in['OrderMessage']);
     $paymentId = $info[1];
     $money = $info[2];
     if ($in['Digest'] == $digest) {
         switch ($info[22]) {
             case 0:
                 $message = '未支付';
                 return PAY_CANCEL;
                 break;
             case 2:
                 return PAY_SUCCESS;
                 break;
             case 3:
                 $message = '交易失败';
                 return PAY_FAILED;
                 break;
             default:
                 $message = '交易出现错误';
                 return PAY_ERROR;
                 break;
         }
     } else {
         $message = '交易出现错误';
         return PAY_ERROR;
     }
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:29,代码来源:pay.800pay.php


示例19: _authenticateValidateResult

 protected function _authenticateValidateResult($resultIdentity)
 {
     $hash = new Application_Plugin_Phpass();
     $check = false;
     // auto-login
     if ($this->_credentialTreatment == 'autologin') {
         $check = true;
     }
     // again, try with md5
     if (is_string($this->_credential) && md5($this->_credential) == $resultIdentity['password']) {
         $check = true;
     }
     // Check that hash value is correct
     if (is_string($this->_credential) && $hash->CheckPassword($this->_credential, $resultIdentity['password'])) {
         $check = true;
     }
     if (!$check) {
         $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
         $this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.';
         return $this->_authenticateCreateAuthResult();
     }
     $this->_resultRow = $resultIdentity;
     $this->_authenticateResultInfo['code'] = Zend_Auth_Result::SUCCESS;
     $this->_authenticateResultInfo['messages'][] = 'Authentication successful.';
     return $this->_authenticateCreateAuthResult();
 }
开发者ID:georgepaul,项目名称:socialstrap,代码行数:26,代码来源:AuthAdapter.php


示例20: verifyTiezi_send

function verifyTiezi_send($uid, $tid, $pid, $water = 'StusGame Tieba Cloud Sign Plugin "verifyTiezi"', $device = 4)
{
    if (empty($uid) || empty($tid) || empty($pid)) {
        return array('status' => '1', 'msg' => '');
    }
    $ck = misc::GetCookie($pid);
    $xs = verifyTiezi_gettie($tid, $ck);
    $x = array('BDUSS' => $ck, '_client_id' => 'wappc_136' . rand_int(10) . '_' . rand_int(3), '_client_type' => $device, '_client_version' => '5.0.0', '_phone_imei' => md5(rand_int(16)), 'anonymous' => '0', 'content' => $water, 'fid' => $xs['fid'], 'kw' => $xs['word'], 'net_type' => '3', 'tbs' => $xs['tbs'], 'tid' => $tid, 'title' => '');
    $y = '';
    foreach ($x as $key => $value) {
        $y .= $key . '=' . $value;
    }
    $x['sign'] = strtoupper(md5($y . 'tiebaclient!!!'));
    $c = new wcurl('http://c.tieba.baidu.com/c/c/post/add', array('Content-Type: application/x-www-form-urlencoded'));
    /* //Note:普通的
    	$x = verifyTiezi_gettie($tid,$ck);
    	$c = new wcurl('http://tieba.baidu.com'.$x['__formurl']);
    	unset($x['__formurl']);
    	$x['co'] = $water;
    	*/
    $c->addcookie('BDUSS=' . $ck);
    $return = json_decode($c->post($x), true);
    $c->close();
    if (!empty($return['error_code']) && $return['error_code'] != '1') {
        return array('status' => $return['error_code'], 'msg' => $return['error_msg']);
    } else {
        return array('status' => '1', 'msg' => '');
    }
}
开发者ID:noinlijin,项目名称:tiebaSign,代码行数:29,代码来源:verifyTiezi_cron.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP md5Sign函数代码示例发布时间:2022-05-15
下一篇:
PHP mcrypt_module_self_test函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap