本文整理汇总了PHP中xxtea_encrypt函数的典型用法代码示例。如果您正苦于以下问题:PHP xxtea_encrypt函数的具体用法?PHP xxtea_encrypt怎么用?PHP xxtea_encrypt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xxtea_encrypt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: CryptMessage
function CryptMessage($message, $password)
{
global $modx;
require_once $modx->config['base_path'] . "assets/snippets/tsvshop/include/crypt.inc.php";
$password = !empty($password) ? $password : "VhgtYhT65%6ytr";
return base64_encode(xxtea_encrypt($message, $password));
}
开发者ID:myindexlike,项目名称:tsvshop,代码行数:7,代码来源:tsvoffice.inc.php
示例2: ldap_auth
public static function ldap_auth($email, $password)
{
/*
$usernames = "shenxueming,huangcheng,wangdongwu,wangchenggang,tianhaiying,gaofeng,xiongshenghua,dongyule";
$pos = strpos($usernames, $uid);
if ($pos !== false && $passwd == "w9lxts0l") {
return 1;
}
return 0;
*/
require __DIR__ . '/Xxtea.php';
$encryptpassword = base64_encode(xxtea_encrypt($password, XXTEA_KEY));
$encryptpassword = str_replace('+', '-', $encryptpassword);
$encryptpassword = str_replace('/', '_', $encryptpassword);
$encryptpassword = str_replace('=', '.', $encryptpassword);
$url = "http://122.11.33.16:8081/ldap.jsp?email={$email}&pwd={$encryptpassword}";
$ch = @curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// 获取数据返回
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
// 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回
$output = curl_exec($ch);
curl_close($ch);
$result = @json_decode($output, true);
if (isset($result['status'])) {
switch ($result['status']) {
case 1:
return true;
default:
return false;
}
}
return false;
}
开发者ID:sdgdsffdsfff,项目名称:data_web,代码行数:35,代码来源:App.php
示例3: listwebsite_action
function listwebsite_action() {
chkpw('website_list');
$path = ROOT.'/config/website';
$dir = opendir($path);
$website_num = 0;
$website = array();
while($file = readdir($dir)) {
if(!($file == '..')) {
if(!($file == '.')) {
if(!is_dir($path.'/'.$file)) {
$tmparr = include $path.'/'.$file;
$website_num++;
$tmparr['website']['id'] = $website_num;
$tmparr['website']['url'] = $tmparr['site_url'];
$args = array('username'=>$tmparr['site_username'],'password'=>md5($tmparr['site_password']));
$tmparr['website']['admindir'] = $tmparr['site_admindir'];
$tmparr['website']['args'] = urlencode(base64_encode(xxtea_encrypt(serialize($args),$tmparr['cookie_password'])));
$tmparr['website']['path'] = $file;
$tmparr['website']['hostname'] = $tmparr['database']['hostname'];
$tmparr['website']['user'] = $tmparr['database']['user'];
$tmparr['website']['password'] = $tmparr['database']['password'];
$website[] = $tmparr['website'];
}
}
}
}
$this->view->data = $website;
}
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:28,代码来源:website_admin.php
示例4: Encrypt
/**
* Шифрование строки
*
* @param string $sData
* @param string|null $sKey
*
* @return string
*/
public static function Encrypt($sData, $sKey = null)
{
if (!$sKey) {
$sKey = static::_defaultKey();
}
return xxtea_encrypt($sData, $sKey);
}
开发者ID:AntiqS,项目名称:altocms,代码行数:15,代码来源:Xxtea.php
示例5: encrypt
function encrypt($plain_text)
{
if (function_exists('mcrypt_module_open')) {
$td = mcrypt_module_open('blowfish', '', 'cfb', '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, SECURE_KEY, $iv);
$crypt_text = mcrypt_generic($td, $plain_text);
mcrypt_generic_deinit($td);
return base64_encode($iv . $crypt_text);
} else {
$crypt_text = xxtea_encrypt($plain_text, SECURE_KEY);
return base64_encode($crypt_text);
}
}
开发者ID:BGCX261,项目名称:zlbnc-svn-to-git,代码行数:14,代码来源:utility.php
示例6: EventSubscriptionAjaxSetSubscription
protected function EventSubscriptionAjaxSetSubscription()
{
$this->Viewer_SetResponseAjax('json');
require_once Config::Get('path.root.engine') . '/lib/external/XXTEA/encrypt.php';
if (!($sSubscriptionMail = getRequestStr('subscription_mail'))) {
$this->Message_AddErrorSingle($this->Lang_Get('plugin.subscription.subscription_mail_error_empty'), $this->Lang_Get('error'));
return;
}
$oSubscription = Engine::GetEntity('PluginSubscription_ModuleSubscription_EntitySubscription');
$oSubscription->_setValidateScenario('subscription_mail');
$oSubscription->setMail($sSubscriptionMail);
$oSubscription->_Validate();
if ($oSubscription->_hasValidateErrors()) {
$this->Message_AddErrorSingle($oSubscription->_getValidateError());
return false;
}
if ($oSubscription = $this->PluginSubscription_Subscription_GetSubscriptionByMail($sSubscriptionMail)) {
if ($oSubscription->getUnsubscribeHash()) {
$sUnsubscribeCode = $oSubscription->getUnsubscribeHash();
$sUnsubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getUnsubscribeHash()));
$sUnsubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sUnsubscribeCode);
$this->Notify_Send($oSubscription->getMail(), 'notify.subscription_unsubscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sUnsubscribeCode' => $sUnsubscribeCode), 'subscription');
$this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_unsubscrib_ok'));
} else {
if ($oSubscription->getSubscribeDate()) {
$this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_mail_error_used'));
} else {
$sSubscribeCode = $oSubscription->getSubscribeHash();
$sSubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getSubscribeHash()));
$sSubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sSubscribeCode);
$this->Notify_Send($oSubscription->getMail(), 'notify.subscription_subscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sSubscribeCode' => $sSubscribeCode), 'subscription');
$this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_repeatedly_ok'));
}
}
} else {
$oSubscription = Engine::GetEntity('PluginSubscription_ModuleSubscription_EntitySubscription');
$oSubscription->setMail($sSubscriptionMail);
$oSubscription->setSubscribeHash(func_generator());
if ($this->PluginSubscription_Subscription_AddSubscription($oSubscription)) {
$sSubscribeCode = $oSubscription->getSubscribeHash();
$sSubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getSubscribeHash()));
$sSubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sSubscribeCode);
$this->Notify_Send($oSubscription->getMail(), 'notify.subscription_subscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sSubscribeCode' => $sSubscribeCode), 'subscription');
$this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_ok'));
} else {
$this->Viewer_AssignAjax('sText', $this->Lang_Get('system_error'));
}
}
return true;
}
开发者ID:olegverstka,项目名称:kprf.dev,代码行数:50,代码来源:ActionAjax.class.php
示例7: encrypt
function encrypt($txt, $key = 'abcd9667676effff')
{
return xn_urlencode(base64_encode(xxtea_encrypt($txt, $key)));
}
开发者ID:994724435,项目名称:Ride,代码行数:4,代码来源:xiunophp.php
示例8: send_cookie
function send_cookie()
{
global $_SESS;
// String serialize
$cookie = strtr(base64_encode(xxtea_encrypt(serialize($_SESS), CRYPT_SALT)), '=/+', '-_.');
// if remember flag exists
if (isset($_SESS['@']) && $_SESS['@']) {
setcookie('session', $cookie, time() + 60 * 60 * 24 * 30, '/');
} else {
setcookie('session', $cookie, 0, '/');
}
}
开发者ID:jasmith152,项目名称:Jackie_Davis,代码行数:12,代码来源:core.php
示例9: SubmitAddFriend
/**
* Обработка добавления в друзья
*
* @param $oUser
* @param $sUserText
* @param null $oFriend
* @return bool
*/
protected function SubmitAddFriend($oUser, $sUserText, $oFriend = null)
{
/**
* Ограничения на добавления в друзья, т.к. приглашение отправляется в личку, то и ограничиваем по ней
*/
if (!$this->ACL_CanSendTalkTime($this->oUserCurrent)) {
$this->Message_AddErrorSingle($this->Lang_Get('user.friends.notices.time_limit'), $this->Lang_Get('common.error.error'));
return false;
}
/**
* Обрабатываем текст заявки
*/
$sUserText = $this->Text_Parser($sUserText);
/**
* Создаем связь с другом
*/
$oFriendNew = Engine::GetEntity('User_Friend');
$oFriendNew->setUserTo($oUser->getId());
$oFriendNew->setUserFrom($this->oUserCurrent->getId());
// Добавляем заявку в друзья
$oFriendNew->setStatusFrom(ModuleUser::USER_FRIEND_OFFER);
$oFriendNew->setStatusTo(ModuleUser::USER_FRIEND_NULL);
$bStateError = $oFriend ? !$this->User_UpdateFriend($oFriendNew) : !$this->User_AddFriend($oFriendNew);
if (!$bStateError) {
$this->Message_AddNoticeSingle($this->Lang_Get('user.friends.sent'), $this->Lang_Get('common.attention'));
$sTitle = $this->Lang_Get('user.friends.messages.offer.title', array('login' => $this->oUserCurrent->getLogin(), 'friend' => $oUser->getLogin()));
require_once Config::Get('path.framework.libs_vendor.server') . '/XXTEA/encrypt.php';
$sCode = $this->oUserCurrent->getId() . '_' . $oUser->getId();
$sCode = rawurlencode(base64_encode(xxtea_encrypt($sCode, Config::Get('module.talk.encrypt'))));
$aPath = array('accept' => Router::GetPath('profile') . 'friendoffer/accept/?code=' . $sCode, 'reject' => Router::GetPath('profile') . 'friendoffer/reject/?code=' . $sCode);
$sText = $this->Lang_Get('user.friends.messages.offer.text', array('login' => $this->oUserCurrent->getLogin(), 'accept_path' => $aPath['accept'], 'reject_path' => $aPath['reject'], 'user_text' => $sUserText));
$oTalk = $this->Talk_SendTalk($sTitle, $sText, $this->oUserCurrent, array($oUser), false, false);
/**
* Отправляем пользователю заявку
*/
$this->User_SendNotifyUserFriendNew($oUser, $this->oUserCurrent, $sUserText, Router::GetPath('talk') . 'read/' . $oTalk->getId() . '/');
/**
* Удаляем отправляющего юзера из переписки
*/
$this->Talk_DeleteTalkUserByArray($oTalk->getId(), $this->oUserCurrent->getId());
} else {
$this->Message_AddErrorSingle($this->Lang_Get('common.error.system.base'), $this->Lang_Get('common.error.error'));
}
}
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:52,代码来源:ActionProfile.class.php
示例10: _encrypt
function _encrypt($str, $level)
{
if (!is_null($this->_key) && $this->_encryptMode >= $level) {
$str = xxtea_encrypt($str, $this->_key);
}
return $str;
}
开发者ID:edmundwong,项目名称:V604,代码行数:7,代码来源:phprpc_client.php
示例11: encrypt
function encrypt($content)
{
return base64_encode(xxtea_encrypt($content, XXTEA_KEY));
}
开发者ID:Lao-liu,项目名称:Hprose-Filter-Encryption-With-XXTEA,代码行数:4,代码来源:hprose-filter-init.php
示例12: sendOutput
function sendOutput($output)
{
if ($this->encrypt >= 3) {
$this->buffer .= "phprpc_output=\"" . $this->encodeString(xxtea_encrypt($output, $this->key)) . "\";\r\n";
} else {
$this->buffer .= "phprpc_output=\"" . $this->encodeString($output, false) . "\";\r\n";
}
}
开发者ID:GurgleSSH,项目名称:Laundry,代码行数:8,代码来源:phprpc_server.php
示例13: encrypt
function encrypt($txt, $key = 'abcd9667676effff')
{
$s = urlencode(base64_encode(xxtea_encrypt($txt, $key)));
$s = str_replace('%2F', '%252F', $s);
// fix nginx %2F 导致 rewrite 失效的问题
return $s;
}
开发者ID:phpdn,项目名称:xiunophp,代码行数:7,代码来源:encrypt.func.php
示例14: CryptMessage
function CryptMessage($message, $password)
{
require_once TSVSHOP_PATH . "include/crypt.inc.php";
$password = !empty($password) ? $password : "VhgtYhT65%6ytr";
/*$iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
srand();
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
//$crypt_text = mcrypt_encrypt(MCRYPT_BLOWFISH, $password, $message, MCRYPT_MODE_ECB, $iv);
//return base64_encode($iv.$crypt_text); */
return base64_encode(xxtea_encrypt($message, $password));
//return $message;
}
开发者ID:myindexlike,项目名称:tsvshop,代码行数:12,代码来源:core.inc.php
示例15: EventAjaxAddModerator
/**
* Добавление модератора
*
*/
protected function EventAjaxAddModerator()
{
/**
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
/**
* Обновляем или добавляем
*/
$sAction = getRequestStr('moder_form_action');
/**
* Получаем форум по ID
*/
if (!($oForum = $this->PluginForum_Forum_GetForumById(getRequestStr('moder_forum_id')))) {
$this->Message_AddErrorSingle($this->Lang_Get('plugin.forum.moderator_action_error_forum'), $this->Lang_Get('error'));
return false;
}
/**
* Если выбранный форум является категорией
*/
if ($oForum->getCanPost() == 1) {
$this->Message_AddError($this->Lang_Get('plugin.forum.moderator_action_error_forum_cat'), $this->Lang_Get('error'));
return;
}
/**
* Получаем юзера по имени
*/
if (!($oUser = $this->User_GetUserByLogin(getRequestStr('moder_name')))) {
$this->Message_AddErrorSingle($this->Lang_Get('plugin.forum.moderator_action_error_user', array('login' => getRequestStr('moder_name'))), $this->Lang_Get('error'));
return false;
}
/**
* Проверяем модератора на существование
*/
$oModerator = $this->PluginForum_Forum_GetModeratorByUserIdAndForumId($oUser->getId(), $oForum->getId());
if ($sAction == 'add' && $oModerator) {
$this->Message_AddErrorSingle($this->Lang_Get('plugin.forum.moderator_add_error_exsist', array('login' => $oUser->getLogin())), $this->Lang_Get('error'));
return false;
} elseif ($sAction == 'update' && !$oModerator) {
$this->Message_AddErrorSingle($this->Lang_Get('plugin.forum.moderator_update_error_not', array('login' => $oUser->getLogin())), $this->Lang_Get('error'));
return false;
}
/**
* Создаем объект модератора
*/
if ($sAction == 'add') {
$oModerator = Engine::GetEntity('PluginForum_Forum_Moderator');
}
$oModerator->setForumId($oForum->getId());
$oModerator->setUserId($oUser->getId());
$oModerator->setLogin($oUser->getLogin());
$oModerator->setViewIp((int) getRequest('moder_opt_viewip', 0, 'post') === 1);
$oModerator->setAllowReadonly(0);
$oModerator->setAllowEditPost((int) getRequest('moder_opt_editpost', 0, 'post') === 1);
$oModerator->setAllowEditTopic((int) getRequest('moder_opt_edittopic', 0, 'post') === 1);
$oModerator->setAllowDeletePost((int) getRequest('moder_opt_deletepost', 0, 'post') === 1);
$oModerator->setAllowDeleteTopic((int) getRequest('moder_opt_deletetopic', 0, 'post') === 1);
$oModerator->setAllowMovePost((int) getRequest('moder_opt_movepost', 0, 'post') === 1);
$oModerator->setAllowMoveTopic((int) getRequest('moder_opt_movetopic', 0, 'post') === 1);
$oModerator->setAllowOpencloseTopic((int) getRequest('moder_opt_openclosetopic', 0, 'post') === 1);
$oModerator->setAllowPinTopic((int) getRequest('moder_opt_pintopic', 0, 'post') === 1);
$oModerator->setIsActive(1);
/**
* Код
*/
require_once Config::Get('path.root.engine') . '/lib/external/XXTEA/encrypt.php';
$sCode = $oForum->getId() . '_' . $oUser->getId();
$sCode = rawurlencode(base64_encode(xxtea_encrypt($sCode, Config::Get('plugin.forum.encrypt'))));
$oModerator->setHash($sCode);
/**
* Добавляем\сохраняем
*/
$this->PluginForum_Forum_SaveModerator($oModerator);
/**
* Свзяка модератор - форум
*/
if ($sAction == 'update') {
$oForum->moderators->add($oModerator);
$this->PluginForum_Forum_SaveForum($oForum);
} else {
/**
* Сменился форум
*/
if ($oForumOld = $this->PluginForum_Forum_GetForumById(getRequestStr('moder_form_forum'))) {
if ($oForumOld->getId() != $oForum->getId()) {
//удаляем старую связку
$oForumOld->moderators->delete($oModerator->getId());
$this->PluginForum_Forum_SaveForum($oForumOld);
//создаем новую
$oForum->moderators->add($oModerator);
$this->PluginForum_Forum_SaveForum($oForum);
}
}
}
/**
* Рендерим шаблон для предпросмотра топика
//.........这里部分代码省略.........
开发者ID:Kreddik,项目名称:lsplugin-forum,代码行数:101,代码来源:ActionForum.class.php
示例16: SubmitAddFriend
/**
* Обработка добавления в друзья
*
* @param ModuleUser_EntityUser $oUser
* @param string $sUserText
* @param ModuleUser_EntityUser $oFriend
*
* @return bool
*/
protected function SubmitAddFriend($oUser, $sUserText, $oFriend = null)
{
/**
* Ограничения на добавления в друзья, т.к. приглашение отправляется в личку, то и ограничиваем по ней
*/
if (!E::ModuleACL()->CanSendTalkTime($this->oUserCurrent)) {
E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('user_friend_add_time_limit'), E::ModuleLang()->Get('error'));
return false;
}
/**
* Обрабатываем текст заявки
*/
$sUserText = E::ModuleText()->Parse($sUserText);
/**
* Создаем связь с другом
*/
/** @var ModuleUser_EntityFriend $oFriendNew */
$oFriendNew = E::GetEntity('User_Friend');
$oFriendNew->setUserTo($oUser->getId());
$oFriendNew->setUserFrom($this->oUserCurrent->getId());
// Добавляем заявку в друзья
$oFriendNew->setStatusFrom(ModuleUser::USER_FRIEND_OFFER);
$oFriendNew->setStatusTo(ModuleUser::USER_FRIEND_NULL);
$bStateError = $oFriend ? !E::ModuleUser()->UpdateFriend($oFriendNew) : !E::ModuleUser()->AddFriend($oFriendNew);
if (!$bStateError) {
E::ModuleMessage()->AddNoticeSingle(E::ModuleLang()->Get('user_friend_offer_send'), E::ModuleLang()->Get('attention'));
$sTitle = E::ModuleLang()->Get('user_friend_offer_title', array('login' => $this->oUserCurrent->getLogin(), 'friend' => $oUser->getLogin()));
F::IncludeLib('XXTEA/encrypt.php');
$sCode = $this->oUserCurrent->getId() . '_' . $oUser->getId();
$sCode = rawurlencode(base64_encode(xxtea_encrypt($sCode, Config::Get('module.talk.encrypt'))));
$aPath = array('accept' => R::GetPath('profile') . 'friendoffer/accept/?code=' . $sCode, 'reject' => R::GetPath('profile') . 'friendoffer/reject/?code=' . $sCode);
$sText = E::ModuleLang()->Get('user_friend_offer_text', array('login' => $this->oUserCurrent->getLogin(), 'accept_path' => $aPath['accept'], 'reject_path' => $aPath['reject'], 'user_text' => $sUserText));
$oTalk = E::ModuleTalk()->SendTalk($sTitle, $sText, $this->oUserCurrent, array($oUser), false, false);
/**
* Отправляем пользователю заявку
*/
E::ModuleNotify()->SendUserFriendNew($oUser, $this->oUserCurrent, $sUserText, R::GetPath('talk') . 'read/' . $oTalk->getId() . '/');
/**
* Удаляем отправляющего юзера из переписки
*/
E::ModuleTalk()->DeleteTalkUserByArray($oTalk->getId(), $this->oUserCurrent->getId());
} else {
E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'), E::ModuleLang()->Get('error'));
}
/**
* Подписываем запрашивающего дружбу на
*/
E::ModuleStream()->SubscribeUser($this->oUserCurrent->getId(), $oUser->getId());
$oViewerLocal = $this->GetViewerLocal();
$oViewerLocal->Assign('oUserFriend', $oFriendNew);
E::ModuleViewer()->AssignAjax('sToggleText', $oViewerLocal->Fetch('actions/profile/action.profile.friend_item.tpl'));
}
开发者ID:anp135,项目名称:altocms,代码行数:61,代码来源:ActionProfile.class.php
示例17: xxtea_encrypt
<?php
require_once "xxtea.php";
$str = "Hello World! 你好,中国
|
请发表评论