本文整理汇总了PHP中rc4encrypt函数的典型用法代码示例。如果您正苦于以下问题:PHP rc4encrypt函数的具体用法?PHP rc4encrypt怎么用?PHP rc4encrypt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rc4encrypt函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmldb_enrol_authorize_upgrade
function xmldb_enrol_authorize_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2006111700) {
$table = new XMLDBTable('enrol_authorize');
if (!field_exists($table, new XMLDBField('refundinfo'))) {
$field = new XMLDBField('cclastfour');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'paymentmethod');
$result = $result && rename_field($table, $field, 'refundinfo');
}
}
if ($result && $oldversion < 2006112900) {
if (isset($CFG->an_login)) {
if (empty($CFG->an_login)) {
unset_config('an_login');
} else {
$result = $result && set_config('an_login', rc4encrypt($CFG->an_login), 'enrol/authorize') && unset_config('an_login');
}
}
if (isset($CFG->an_tran_key)) {
if (empty($CFG->an_tran_key)) {
unset_config('an_tran_key');
} else {
$result = $result && set_config('an_tran_key', rc4encrypt($CFG->an_tran_key), 'enrol/authorize') && unset_config('an_tran_key');
}
}
if (isset($CFG->an_password)) {
if (empty($CFG->an_password)) {
unset_config('an_password');
} else {
$result = $result && set_config('an_password', rc4encrypt($CFG->an_password), 'enrol/authorize') && unset_config('an_password');
}
}
}
return $result;
}
示例2: process_config
/**
* process_config
*
* @param object $config
* @return bool true if it will be saved.
* @access public
*/
function process_config($config)
{
global $CFG;
$mconfig = get_config('enrol/authorize');
// site settings
if (($cost = optional_param('enrol_cost', 5, PARAM_INT)) > 0) {
set_config('enrol_cost', $cost);
}
set_config('enrol_currency', optional_param('enrol_currency', 'USD', PARAM_ALPHA));
set_config('enrol_mailstudents', optional_param('enrol_mailstudents', 0, PARAM_BOOL));
set_config('enrol_mailteachers', optional_param('enrol_mailteachers', 0, PARAM_BOOL));
set_config('enrol_mailadmins', optional_param('enrol_mailadmins', 0, PARAM_BOOL));
// optional authorize.net settings
set_config('an_avs', optional_param('an_avs', 0, PARAM_BOOL));
set_config('an_authcode', optional_param('an_authcode', 0, PARAM_BOOL));
set_config('an_test', optional_param('an_test', 0, PARAM_BOOL));
set_config('an_referer', optional_param('an_referer', 'http://', PARAM_URL));
$acceptmethods = optional_param('acceptmethods', get_list_of_payment_methods(), PARAM_ALPHA);
set_config('an_acceptmethods', implode(',', $acceptmethods));
$acceptccs = optional_param('acceptccs', array_keys(get_list_of_creditcards()), PARAM_ALPHA);
set_config('an_acceptccs', implode(',', $acceptccs));
$acceptechecktypes = optional_param('acceptechecktypes', get_list_of_bank_account_types(), PARAM_ALPHA);
set_config('an_acceptechecktypes', implode(',', $acceptechecktypes));
$cutoff_hour = optional_param('an_cutoff_hour', 0, PARAM_INT);
$cutoff_min = optional_param('an_cutoff_min', 5, PARAM_INT);
set_config('an_cutoff', $cutoff_hour * 60 + $cutoff_min);
// cron depencies
$reviewval = optional_param('an_review', 0, PARAM_BOOL);
$captureday = optional_param('an_capture_day', 5, PARAM_INT);
$emailexpired = optional_param('an_emailexpired', 2, PARAM_INT);
$emailexpiredteacher = optional_param('an_emailexpiredteacher', 0, PARAM_BOOL);
$sorttype = optional_param('an_sorttype', 'ttl', PARAM_ALPHA);
$captureday = $captureday > 29 ? 29 : ($captureday < 0 ? 0 : $captureday);
$emailexpired = $emailexpired > 5 ? 5 : ($emailexpired < 0 ? 0 : $emailexpired);
if (!empty($reviewval) && ($captureday > 0 || $emailexpired > 0)) {
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
if (time() - intval($lastcron) > 3600 * 24) {
return false;
}
}
set_config('an_review', $reviewval);
set_config('an_capture_day', $captureday);
set_config('an_emailexpired', $emailexpired);
set_config('an_emailexpiredteacher', $emailexpiredteacher);
set_config('an_sorttype', $sorttype);
// https and openssl library is required
if (substr($CFG->wwwroot, 0, 5) !== 'https' and empty($CFG->loginhttps) or !check_openssl_loaded()) {
return false;
}
// REQUIRED fields;
// an_login
$loginval = optional_param('an_login', '');
if (empty($loginval) && empty($mconfig->an_login)) {
return false;
}
$loginval = !empty($loginval) ? rc4encrypt($loginval) : strval($mconfig->an_login);
set_config('an_login', $loginval, 'enrol/authorize');
// an_tran_key, an_password
$tranval = optional_param('an_tran_key', '');
$tranval = !empty($tranval) ? rc4encrypt($tranval) : (isset($mconfig->an_tran_key) ? $mconfig->an_tran_key : '');
$passwordval = optional_param('an_password', '');
$passwordval = !empty($passwordval) ? rc4encrypt($passwordval) : (isset($mconfig->an_password) ? $mconfig->an_password : '');
$deletecurrent = optional_param('delete_current', '0', PARAM_BOOL);
if (!empty($deletecurrent) and !empty($tranval)) {
unset_config('an_password', 'enrol/authorize');
$passwordval = '';
} elseif (!empty($passwordval)) {
set_config('an_password', $passwordval, 'enrol/authorize');
}
if (empty($tranval) and empty($passwordval)) {
return false;
}
if (!empty($tranval)) {
set_config('an_tran_key', $tranval, 'enrol/authorize');
}
return true;
}
示例3: set_moodle_cookie
/**
* Sets a moodle cookie with a weakly encrypted username
*
* @param string $username to encrypt and place in a cookie, '' means delete current cookie
* @return void
*/
function set_moodle_cookie($username)
{
global $CFG;
if (NO_MOODLE_COOKIES) {
return;
}
if (empty($CFG->rememberusername)) {
// erase current and do not store permanent cookies
$username = '';
}
if ($username === 'guest') {
// keep previous cookie in case of guest account login
return;
}
$cookiename = 'MOODLEID1_' . $CFG->sessioncookie;
// delete old cookie
setcookie($cookiename, '', time() - HOURSECS, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
if ($username !== '') {
// set username cookie for 60 days
setcookie($cookiename, rc4encrypt($username), time() + DAYSECS * 60, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
}
}
示例4: set_moodle_cookie
/**
* Sets a moodle cookie with an encrypted string
*
* @uses $CFG
* @uses DAYSECS
* @uses HOURSECS
* @param string $thing The string to encrypt and place in a cookie
*/
function set_moodle_cookie($thing)
{
global $CFG;
if ($thing == 'guest') {
// Ignore guest account
return;
}
$cookiename = 'MOODLEID_' . $CFG->sessioncookie;
$days = 60;
$seconds = DAYSECS * $days;
setCookie($cookiename, '', time() - HOURSECS, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure);
setCookie($cookiename, rc4encrypt($thing), time() + $seconds, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure);
}
示例5: sAjax
function sAjax($i)
{
global $config;
exit(base64_encode(rc4encrypt($i, $config['sPass'])));
}
示例6: xmldb_enrol_authorize_upgrade
function xmldb_enrol_authorize_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2006111700) {
$table = new XMLDBTable('enrol_authorize');
if (!field_exists($table, new XMLDBField('refundinfo'))) {
$field = new XMLDBField('cclastfour');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'paymentmethod');
$result = $result && rename_field($table, $field, 'refundinfo');
}
}
if ($result && $oldversion < 2006112900) {
if (isset($CFG->an_login)) {
if (empty($CFG->an_login)) {
unset_config('an_login');
} else {
$result = $result && set_config('an_login', rc4encrypt($CFG->an_login), 'enrol/authorize') && unset_config('an_login');
}
}
if (isset($CFG->an_tran_key)) {
if (empty($CFG->an_tran_key)) {
unset_config('an_tran_key');
} else {
$result = $result && set_config('an_tran_key', rc4encrypt($CFG->an_tran_key), 'enrol/authorize') && unset_config('an_tran_key');
}
}
if (isset($CFG->an_password)) {
if (empty($CFG->an_password)) {
unset_config('an_password');
} else {
$result = $result && set_config('an_password', rc4encrypt($CFG->an_password), 'enrol/authorize') && unset_config('an_password');
}
}
}
if ($result && $oldversion < 2006112903) {
/// enrol_authorize.transid
/// Define index transid (not unique) to be dropped form enrol_authorize
$table = new XMLDBTable('enrol_authorize');
$index = new XMLDBIndex('transid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
drop_index($table, $index);
/// Changing precision of field transid on table enrol_authorize to (20)
$table = new XMLDBTable('enrol_authorize');
$field = new XMLDBField('transid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'userid');
change_field_precision($table, $field);
/// Launch add index transid again
$table = new XMLDBTable('enrol_authorize');
$index = new XMLDBIndex('transid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
add_index($table, $index);
/// enrol_authorize_refunds.transid
/// Define index transid (not unique) to be dropped form enrol_authorize_refunds
$table = new XMLDBTable('enrol_authorize_refunds');
$index = new XMLDBIndex('transid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
drop_index($table, $index);
/// Changing precision of field transid on table enrol_authorize_refunds to (20)
$table = new XMLDBTable('enrol_authorize_refunds');
$field = new XMLDBField('transid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, null, null, null, null, '0', 'amount');
change_field_precision($table, $field);
/// Launch add index transid again
$table = new XMLDBTable('enrol_authorize_refunds');
$index = new XMLDBIndex('transid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
add_index($table, $index);
}
return $result;
}
示例7: set_moodle_cookie
/**
* Sets a moodle cookie with an encrypted string
*
* @uses $CFG
* @uses DAYSECS
* @uses HOURSECS
* @param string $thing The string to encrypt and place in a cookie
*/
function set_moodle_cookie($thing)
{
global $CFG;
if ($thing == 'guest') {
// Ignore guest account
return;
}
$cookiename = 'MOODLEID_' . $CFG->sessioncookie;
$days = 60;
$seconds = DAYSECS * $days;
// no need to set secure or http cookie only here - it is not secret
setCookie($cookiename, '', time() - HOURSECS, $CFG->sessioncookiepath);
setCookie($cookiename, rc4encrypt($thing), time() + $seconds, $CFG->sessioncookiepath);
}