本文整理汇总了PHP中MD5Crypt类的典型用法代码示例。如果您正苦于以下问题:PHP MD5Crypt类的具体用法?PHP MD5Crypt怎么用?PHP MD5Crypt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MD5Crypt类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readIdPw2ch
/**
* 2ch●ログインの保存済みIDとPASSと自動ログイン設定を読み込む
*/
public static function readIdPw2ch()
{
global $_conf;
$login2chID = null;
$login2chPW = null;
$autoLogin2ch = false;
if (file_exists($_conf['idpw2ch_php'])) {
$rec_login2chID = null;
$rec_login2chPW = null;
$rec_autoLogin2ch = false;
include $_conf['idpw2ch_php'];
if (is_string($rec_login2chID)) {
$login2chID = $rec_login2chID;
}
// パスワードを復号化
if (is_string($login2chID) && is_string($rec_login2chPW)) {
$md5_crypt_key = self::getAngoKey();
$login2chPW = MD5Crypt::decrypt($rec_login2chPW, $md5_crypt_key, 32);
} else {
$login2chPW = null;
}
$autoLogin2ch = (bool) $rec_autoLogin2ch;
}
return array($login2chID, $login2chPW, $autoLogin2ch);
}
示例2: adodb_sess_write
function adodb_sess_write($key, $val)
{
$Crypt = new MD5Crypt();
global $ADODB_SESS_INSERT, $ADODB_SESS_CONN, $ADODB_SESS_LIFE, $ADODB_SESSION_TBL, $ADODB_SESSION_EXPIRE_NOTIFY;
$expiry = time() + $ADODB_SESS_LIFE;
// encrypt session data..
$val = $Crypt->Encrypt(rawurlencode($val), ADODB_Session_Key());
$arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);
if ($ADODB_SESSION_EXPIRE_NOTIFY) {
$var = reset($ADODB_SESSION_EXPIRE_NOTIFY);
global ${$var};
$arr['expireref'] = ${$var};
}
$rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL, $arr, 'sesskey', $autoQuote = true);
if (!$rs) {
ADOConnection::outp('
-- Session Replace: ' . $ADODB_SESS_CONN->ErrorMsg() . '</p>', false);
} else {
// bug in access driver (could be odbc?) means that info is not commited
// properly unless select statement executed in Win2000
if ($ADODB_SESS_CONN->databaseType == 'access') {
$rs = $ADODB_SESS_CONN->Execute("select sesskey from {$ADODB_SESSION_TBL} WHERE sesskey='{$key}'");
}
}
return isset($rs);
}
示例3: read
/**
*/
function read($data, $key)
{
$md5crypt = new MD5Crypt();
return $md5crypt->decrypt($data, $key);
}
示例4: adodb_sess_write
function adodb_sess_write($key, $val)
{
$Crypt = new MD5Crypt();
global $ADODB_SESS_INSERT, $ADODB_SESS_CONN, $ADODB_SESS_LIFE, $ADODB_SESSION_TBL;
$expiry = time() + $ADODB_SESS_LIFE;
// encrypt session data..
$val = $Crypt->Encrypt(rawurlencode($val), ADODB_Session_Key());
$qry = "UPDATE {$ADODB_SESSION_TBL} SET expiry={$expiry},data='{$val}' WHERE sesskey='{$key}'";
$rs = $ADODB_SESS_CONN->Execute($qry);
if ($rs) {
$rs->Close();
} else {
print '<p>Session Update: ' . $ADODB_SESS_CONN->ErrorMsg() . '</p>';
}
if ($ADODB_SESS_INSERT || $rs === false) {
$qry = "INSERT INTO {$ADODB_SESSION_TBL}(sesskey,expiry,data) VALUES ('{$key}',{$expiry},'{$val}')";
$rs = $ADODB_SESS_CONN->Execute($qry);
if ($rs) {
$rs->Close();
} else {
print '<p>Session Insert: ' . $ADODB_SESS_CONN->ErrorMsg() . '</p>';
}
}
// bug in access driver (could be odbc?) means that info is not commited
// properly unless select statement executed in Win2000
if ($ADODB_SESS_CONN->databaseType == 'access') {
$rs = $ADODB_SESS_CONN->Execute("select sesskey from {$ADODB_SESSION_TBL} WHERE sesskey='{$key}'");
}
return isset($rs);
}
示例5: getCidInfo
/**
* Cookie(CID)からユーザ情報を得る
*
* @return array|false 成功すれば配列、失敗なら false を返す
*/
public function getCidInfo($cid)
{
global $_conf;
$dec = MD5Crypt::decrypt($cid, self::getMd5CryptPassForCid());
$cid_info = explode(':', $dec);
switch (count($cid_info)) {
case 3:
break;
case 4:
$device_pixel_ratio = floatval(array_pop($cid_info));
if (isset($GLOBALS['_p2session']) && ($device_pixel_ratio === 1.5 || $device_pixel_ratio === 2.0)) {
$_SESSION['device_pixel_ratio'] = $device_pixel_ratio;
}
break;
default:
return false;
}
list($user, $time, $md5_utpx) = $cid_info;
if (!strlen($user) || !$time || !$md5_utpx) {
return false;
}
// 有効期限 日数
if (time() > $time + 60 * 60 * 24 * $_conf['cid_expire_day']) {
return false;
// 期限切れ
}
return $cid_info;
}
示例6: array
</tr>
</table></td>
<?php
$heading = array();
$contents = array();
if (isset($info)) {
$heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b><br />');
if (STORE_SESSIONS == '1') {
$sessionstable = $oostable['sessions'];
$session_data = $dbconn->Execute("SELECT data FROM $sessionstable WHERE sesskey = '" . $info . "'");
if (STORE_SESSIONS_CRYPT == '1') {
include_once '../includes/lib/adodb/session/crypt.inc.php';
$Crypt = new MD5Crypt;
$session_data = rawurldecode($Crypt->Decrypt(reset($session_data->fields), crypt(ADODB_Session::encryptionKey(), $info)));
} else {
$session_data = rawurldecode($session_data->fields['data']);
}
} else {
if ( (file_exists(oos_session_save_path() . '/sess_' . $info)) && (filesize(oos_session_save_path() . '/sess_' . $info) > 0) ) {
$session_data = file(oos_session_save_path() . '/sess_' . $info);
$session_data = trim(implode('', $session_data));
}
}
$currency = unserialize(oos_get_serialized_variable($session_data, 'currency', 'string'));
$cart = unserialize(oos_get_serialized_variable($session_data, 'cart', 'object'));
示例7: readIdPw2ch
/**
* 2ch●ログインの保存済みIDとPASSと自動ログイン設定を読み込む
*/
public static function readIdPw2ch()
{
global $_conf;
if (!file_exists($_conf['idpw2ch_php'])) {
return false;
}
$rec_login2chID = NULL;
$login2chPW = NULL;
$rec_autoLogin2ch = NULL;
include $_conf['idpw2ch_php'];
// パスを複合化
if (!is_null($rec_login2chPW)) {
$md5_crypt_key = self::getAngoKey();
$login2chPW = MD5Crypt::decrypt($rec_login2chPW, $md5_crypt_key, 32);
}
return array($rec_login2chID, $login2chPW, $rec_autoLogin2ch);
}
示例8: getCidInfo
/**
* Cookie(CID)からユーザ情報を得る
*
* @return array|false 成功すれば配列、失敗なら false を返す
*/
public function getCidInfo($cid)
{
global $_conf;
$dec = MD5Crypt::decrypt($cid, self::getMd5CryptPassForCid());
$cid_info = explode(':', $dec);
if (count($cid_info) != 3) {
return false;
}
list($user, $time, $md5_utpx) = $cid_info;
if (!strlen($user) || !$time || !$md5_utpx) {
return false;
}
// 有効期限 日数
if (time() > $time + 60 * 60 * 24 * $_conf['cid_expire_day']) {
return false;
// 期限切れ
}
return $cid_info;
}
示例9: setKey
/**
+----------------------------------------------------------
* 设置密钥函数
+----------------------------------------------------------
* @param string $key
* @access public
+----------------------------------------------------------
* @return void
*/
public static function setKey($key)
{
self::$key = $key;
}