本文整理汇总了PHP中str_rot13函数的典型用法代码示例。如果您正苦于以下问题:PHP str_rot13函数的具体用法?PHP str_rot13怎么用?PHP str_rot13使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了str_rot13函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(array $inputs)
{
/** @var SecretMessage $message */
$message = $inputs[0];
$this->decoded = str_rot13($message->message);
return $this->decoded;
}
开发者ID:stiggg,项目名称:command-dispatcher,代码行数:7,代码来源:chain_dispatcher.php
示例2: hash
/**
* Generate the message digest for the given message.
*
* An example usage is:
*
* <code>
* $message = "this is the message to be hashed";
*
* $test_gishiki_md5 = Algorithms::hash($message, Algorithms::MD5);
* $test_php_md5 = md5($message);
*
* if ($test_gishiki_md5 == $test_php_md5) {
* echo "Gishiki's MD5 produces the same exact hash of the PHP's MD5";
* }
* </code>
*
* @param string $message the string to be hashed
* @param string $algorithm the name of the hashing algorithm
* @param bool $binaryUnsafe if false the result is binhex
*
* @return string the result of the hash algorithm
*
* @throws \InvalidArgumentException the message or the algorithm is given as a non-string or an empty string
* @throws HashingException the error occurred while generating the hash for the given message
*/
public static function hash($message, $algorithm = self::MD5, $binaryUnsafe = false)
{
//check for the parameter
if (!is_bool($binaryUnsafe)) {
throw new \InvalidArgumentException('The binary safeness must be given as a boolean value');
}
//check for the message
if (!is_string($message) || strlen($message) <= 0) {
throw new \InvalidArgumentException('The message to be hashed must be given as a valid non-empty string');
}
//check for the algorithm name
if (!is_string($algorithm) || strlen($algorithm) <= 0) {
throw new \InvalidArgumentException('The name of the hashing algorithm must be given as a valid non-empty string');
}
if ($algorithm == self::ROT13) {
return str_rot13($message);
}
//check if the hashing algorithm is supported
if (!in_array($algorithm, openssl_get_md_methods()) && !in_array($algorithm, hash_algos())) {
throw new HashingException('An error occurred while generating the hash, because an unsupported hashing algorithm has been selected', 0);
}
//calculate the hash for the given message
$hash = in_array($algorithm, openssl_get_md_methods()) ? openssl_digest($message, $algorithm, $binaryUnsafe) : hash($algorithm, $algorithm, $binaryUnsafe);
//check for errors
if ($hash === false) {
throw new HashingException('An unknown error occurred while generating the hash', 1);
}
//return the calculated message digest
return $hash;
}
开发者ID:neroreflex,项目名称:gishiki,代码行数:55,代码来源:Algorithms.php
示例3: mudaSenha
public function mudaSenha($novaSenha)
{
// lemos as credenciais do banco de dados
$dados = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../config.json");
$dados = json_decode($dados, true);
foreach ($dados as $chave => $valor) {
$dados[$chave] = str_rot13($valor);
}
$host = $dados["host"];
$usuario = $dados["nome_usuario"];
$senhaBD = $dados["senha"];
// Cria conexão com o banco
$conexao = null;
try {
$conexao = new PDO("mysql:host={$host};dbname=homeopatias;charset=utf8", $usuario, $senhaBD);
} catch (PDOException $e) {
echo $e->getMessage();
}
$comando = "UPDATE Usuario SET senha = :senha WHERE id = :id";
$query = $conexao->prepare($comando);
// Fazemos o hash da senha usando a biblioteca phppass
$hasher = new PasswordHash(8, false);
$hashSenha = $hasher->HashPassword($novaSenha);
$query->bindParam(":senha", $hashSenha, PDO::PARAM_STR);
$query->bindParam(":id", $this->id, PDO::PARAM_INT);
$sucesso = $query->execute();
// Encerramos a conexão com o BD
$conexao = null;
return $sucesso;
}
开发者ID:homeopatias,项目名称:sysadmin,代码行数:30,代码来源:Usuario.php
示例4: user
public function user()
{
$db =& DB::connect('mysql://em:islam,nan,[email protected]/em');
if (PEAR::isError($db)) {
die($db->getDebugInfo());
}
$db->setFetchMode(DB_FETCHMODE_ASSOC);
$res = $db->query('SELECT id, name, joint, level, pwd, clear_pwd, last FROM user LEFT JOIN user_pwd ON id=user_id WHERE id!="admin" ORDER BY id');
if (PEAR::isError($res)) {
die($res->getDebugInfo());
}
while ($row = $res->fetchRow()) {
$row['id'] = trim($row['id']);
if (!$row['id'] || preg_match('/[^0-9a-zA-Z-_@.]/', $row['id'])) {
echo "<p>Exclude '{$row['id']}'</p>";
continue;
}
$res2 = self::$dbh->query('INSERT INTO user (uid, name, mail, level, since) VALUES (?, ?, ?, ?, ?)', array($row['id'], $row['name'], $row['mail'], $row['level'], $row['joint']));
if (PEAR::isError($res2)) {
printf('%s<br/>', $res2->getDebugInfo());
}
$user_id = self::$dbh->getOne('SELECT id FROM user WHERE uid=?', array($row['id']));
$res3 = self::$dbh->query('INSERT INTO user_pwd (user_id, pwd, clear) VALUES (?, ?, ?)', array($user_id, $row['pwd'], str_rot13($row['clear_pwd'])));
if (PEAR::isError($res3)) {
printf('%s<br/>', $res3->getDebugInfo());
}
++$count;
}
printf("<p>{$count} Processed</p>");
}
开发者ID:rezaprima,项目名称:icms,代码行数:30,代码来源:migrate.php
示例5: filter
public function filter($in, $out, &$consumed, $closing) : int
{
while ($bucket = stream_bucket_make_writeable($in)) {
stream_bucket_append($out, stream_bucket_new($this->stream, str_rot13($bucket->data)));
}
return \PSFS_PASS_ON;
}
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:7,代码来源:default-filters.php
示例6: obfuscate
/**
* テンプレート関数
*/
function obfuscate($address)
{
$address = str_replace('@', '*', $address);
$address = str_replace('.', ':', $address);
$address = str_rot13($address);
return $address;
}
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:10,代码来源:postman.php
示例7: execute
function execute($par)
{
global $wgRequest, $wgEmailImage;
$size = 4;
$text = $wgRequest->getText('img');
/* decode this rubbish */
$text = rawurldecode($text);
$text = str_rot13($text);
$text = base64_decode($text);
$text = str_replace($wgEmailImage['ugly'], "", $text);
$fontwidth = imagefontwidth($size);
$fontheight = imagefontheight($size);
$width = strlen($text) * $fontwidth + 4;
$height = $fontheight + 2;
$im = @imagecreatetruecolor($width, $height) or exit;
$trans = imagecolorallocate($im, 0, 0, 0);
/* must be black! */
$color = imagecolorallocate($im, 1, 1, 1);
/* nearly black ;) */
imagecolortransparent($im, $trans);
/* seems to work only with black! */
imagestring($im, $size, 2, 0, $text, $color);
//header ("Content-Type: image/png"); imagepng($im); => IE is just so bad!
header("Content-Type: image/gif");
imagegif($im);
exit;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:emailtag.php
示例8: createFromDatabase
public function createFromDatabase()
{
require "config.php";
if (!isset($svnserve_user_file)) {
return;
}
$filename = $svnserve_user_file;
$accessfile = "## This SVNServe user file generated by SVNManager\n[users]\n";
$accessfile .= "\n";
$userresults = $this->database->Execute("SELECT * FROM users ORDER BY name");
while (!$userresults->EOF) {
$id = $userresults->fields['id'];
$password = $this->database->Execute("SELECT * FROM svnserve_pwd WHERE ownerid=" . makeSqlString($id));
if ($password->RecordCount() > 0) {
$accessfile .= $userresults->fields['name'] . " = " . str_rot13($password->fields['password']) . "\n";
}
$userresults->MoveNext();
}
$userresults->Close();
if (!($handle = fopen($filename, 'w'))) {
echo "Cannot open file ({$filename})";
exit;
}
if (fwrite($handle, $accessfile) === FALSE) {
echo "Cannot write to file ({$filename})";
exit;
}
fclose($handle);
}
开发者ID:joybinchen,项目名称:svnmanager-1.09,代码行数:29,代码来源:class.svnservefile.php
示例9: it_encrypts_and_decrypts_cookies
/**
* @test
*/
public function it_encrypts_and_decrypts_cookies()
{
// Simulate a request coming in with several cookies.
$request = (new FigCookieTestingRequest())->withHeader(Cookies::COOKIE_HEADER, 'theme=light; sessionToken=RAPELCGRQ; hello=world');
// "Before" Middleware Example
//
// Get our token from an encrypted cookie value, "decrypt" it, and replace the cookie on the request.
// From here on out, any part of the system that gets our token will be able to see the contents
// in plaintext.
$request = FigRequestCookies::modify($request, 'sessionToken', function (Cookie $cookie) {
return $cookie->withValue(str_rot13($cookie->getValue()));
});
// Even though the sessionToken initially comes in "encrypted", at this point (and any point in
// the future) the sessionToken cookie will be available in plaintext.
$this->assertEquals('theme=light; sessionToken=ENCRYPTED; hello=world', $request->getHeaderLine(Cookies::COOKIE_HEADER));
// Simulate a response going out.
$response = new FigCookieTestingResponse();
// Various parts of the system will add set cookies to the response. In this case, we are
// going to show that the rest of the system interacts with the session token using
// plaintext.
$response = $response->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('sessionToken', 'ENCRYPTED'))->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('hello', 'world'));
// "After" Middleware Example
//
// Get our token from an unencrypted set cookie value, "encrypt" it, and replace the cook on the response.
// From here on out, any part of the system that gets our token will only be able to see the encrypted
// value.
$response = FigResponseCookies::modify($response, 'sessionToken', function (SetCookie $setCookie) {
return $setCookie->withValue(str_rot13($setCookie->getValue()));
});
// Even though the sessionToken intiially went out "decrypted", at this point (and at any point
// in the future) the sessionToken cookie will remain "encrypted."
$this->assertEquals(['theme=light', 'sessionToken=RAPELCGRQ', 'hello=world'], $response->getHeader(SetCookies::SET_COOKIE_HEADER));
}
开发者ID:philsam,项目名称:dflydev-fig-cookies,代码行数:36,代码来源:FigCookiesTest.php
示例10: testFilterShouldPassReturnValueOfEachSubscriberToNextSubscriber
public function testFilterShouldPassReturnValueOfEachSubscriberToNextSubscriber()
{
$this->filterchain->connect('trim');
$this->filterchain->connect('str_rot13');
$value = $this->filterchain->filter(' foo ');
$this->assertEquals(\str_rot13('foo'), $value);
}
开发者ID:alab1001101,项目名称:zf2,代码行数:7,代码来源:FilterChainTest.php
示例11: request
public function request()
{
if (!$this->session->exists()) {
$this->redirectNoSession();
return false;
}
if ($this->getRequestVar('save')) {
$filePath = base64_decode(str_rot13($this->getRequestVar('save')));
$file = new \fpcm\model\files\dbbackup(basename($filePath));
if (!$file->exists()) {
$this->view = new \fpcm\model\view\error();
$this->view->setMessage($this->lang->translate('GLOBAL_NOTFOUND_FILE'));
$this->view->render();
die;
}
header('Content-Description: File Transfer');
header('Content-Type: ' . $file->getMimetype());
header('Content-Disposition: attachment; filename="' . $file->getFilename() . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . $file->getFilesize());
readfile($file->getFullpath());
exit;
}
return true;
}
开发者ID:sea75300,项目名称:fanpresscm3,代码行数:27,代码来源:backups.php
示例12: checa_situacao_pagamentos_por_id
function checa_situacao_pagamentos_por_id($idAssociado)
{
// lemos as credenciais do banco de dados
$dados = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../config.json");
$dados = json_decode($dados, true);
foreach ($dados as $chave => $valor) {
$dados[$chave] = str_rot13($valor);
}
$host = $dados["host"];
$usuario = $dados["nome_usuario"];
$senhaBD = $dados["senha"];
// cria conexão com o banco
$conexao = null;
$db = "homeopatias";
try {
$conexao = new PDO("mysql:host={$host};dbname={$db};charset=utf8", $usuario, $senhaBD);
} catch (PDOException $e) {
echo $e->getMessage();
}
// selecionamos todos os pagamentos em aberto dos outros anos, e também selecionamos
// a inscrição desse ano caso ela esteja em aberto
$textoQuery = "SELECT NOT EXISTS\n (SELECT idPagAnuidade \n FROM PgtoAnuidade\n WHERE chaveAssoc = ? AND fechado = 0 AND (ano <> YEAR(CURDATE())\n OR inscricao = 1))\n AND EXISTS \n (SELECT idPagAnuidade FROM PgtoAnuidade WHERE ano = YEAR(CURDATE())\n AND chaveAssoc = ?) as emDia";
// se o associado estiver em dia com os pagamentos, essa query não deve retornar nada
$query = $conexao->prepare($textoQuery);
$query->bindParam(1, $idAssociado);
$query->bindParam(2, $idAssociado);
$query->setFetchMode(PDO::FETCH_ASSOC);
$query->execute();
$emDia = $query->fetch()['emDia'];
$conexao = null;
return $emDia;
}
开发者ID:homeopatias,项目名称:sysadmin,代码行数:32,代码来源:checa_situacao_pagamentos.php
示例13: cookie_encrypt
public function cookie_encrypt($username, $password, $rand)
{
$hold = hash('crc32b', str_rot13($password . $username . $rand));
$rand = hash('md5', 'old_skkooll');
$hold = hash('ripemd128', $hold . $rand);
return $hold;
}
开发者ID:shahril96,项目名称:Old-Skool,代码行数:7,代码来源:cookie_class.php
示例14: fakeTranslation
function fakeTranslation($object)
{
// Find relational and meta fields we are not interested in writing right now.
$noninterestingFields = array('ID', 'Created', 'LastEdited', 'ClassName', 'RecordClassName', 'YMLTag', 'Version', 'URLSegment');
foreach (array_keys($object->has_one()) as $relation) {
array_push($noninterestingFields, $relation . 'ID');
}
// Write fields.
$modifications = 0;
foreach ($object->toMap() as $field => $value) {
if (in_array($field, $noninterestingFields)) {
continue;
}
// Skip non-textual fields
$dbObject = $object->dbObject($field);
if (!is_object($dbObject) || !$dbObject instanceof DBField) {
continue;
}
$class = get_class($dbObject);
if (!in_array($class, array('Varchar', 'HTMLText', 'Text'))) {
continue;
}
if ($class == 'HTMLText') {
$object->{$field} = "<p>" . nl2br(str_rot13(strip_tags($object->{$field}))) . "</p>";
} else {
$object->{$field} = str_rot13($object->{$field});
}
}
return $object;
}
开发者ID:helpfulrobot,项目名称:silverstripe-testdata,代码行数:30,代码来源:EntireSiteTranslator.php
示例15: convertToPHPValue
/**
* {@inheritdoc}
*
* @param string|null $value
* @param AbstractPlatform $platform
*
* @return string|null
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return null;
}
return str_rot13($value);
}
开发者ID:selimcr,项目名称:servigases,代码行数:15,代码来源:Rot13Type.php
示例16: __construct
public function __construct($type = 1, $string = null)
{
if (is_null(Oraculum_Request::sess("captcha"))) {
if ($type == 2 || $type == 3) {
$aux = $string . time();
$aux = md5(base64_encode(str_rot13($aux)));
$aux = str_rot13(base64_encode(str_rot13($aux)));
if ($type == 2) {
$aux = strtolower($aux);
}
$string = substr($aux, 0, 6);
} else {
$string = rand(1, 999999);
}
Oraculum_Request::setsess("captcha", $string);
} else {
$string = Oraculum_Request::sess("captcha");
}
$img = imagecreate(60, 25);
$backcolor = imagecolorallocate($img, 255, 255, 255);
$textcolor = imagecolorallocate($img, 00, 00, 00);
imagefill($img, 0, 0, $backcolor);
imagestring($img, 10, 5, 5, $string, $textcolor);
header("Content-type: image/jpeg");
imagejpeg($img);
}
开发者ID:patrix,项目名称:oraculum,代码行数:26,代码来源:captcha.php
示例17: encodePassword
public static function encodePassword($password)
{
$password = convert_uuencode($password);
$password = base64_encode($password);
$password = str_rot13($password);
return $password;
}
开发者ID:laiello,项目名称:yale-advanced-oci,代码行数:7,代码来源:StringUtil.php
示例18: constants
private function constants()
{
# Dirs
define('THESIS_LIB', TEMPLATEPATH . '/lib');
define('THESIS_ADMIN', THESIS_LIB . '/admin');
define('THESIS_CORE', THESIS_LIB . '/core');
define('THESIS_JS', THESIS_LIB . '/js');
define('THESIS_SKINS', THESIS_LIB . '/skins');
# URLs
define('THESIS_URL', get_bloginfo('template_url'));
#wp
define('THESIS_CSS_URL', THESIS_URL . '/lib/css');
define('THESIS_JS_URL', THESIS_URL . '/lib/js');
define('THESIS_IMAGES_URL', THESIS_URL . '/lib/images');
# User dirs
define('THESIS_USER', WP_CONTENT_DIR . '/thesis');
define('THESIS_USER_SKINS', THESIS_USER . '/skins');
define('THESIS_USER_BOXES', THESIS_USER . '/boxes');
define('THESIS_USER_PACKAGES', THESIS_USER . '/packages');
# User URLs
define('THESIS_USER_URL', content_url('thesis'));
define('THESIS_USER_SKINS_URL', THESIS_USER_URL . '/skins');
define('THESIS_USER_BOXES_URL', THESIS_USER_URL . '/boxes');
define('THESIS_USER_PACKAGES_URL', THESIS_USER_URL . '/packages');
if (is_multisite()) {
define('THESIS_MS_CSS_VAL', substr(str_rot13(md5("ms-css_{$GLOBALS['blog_id']}")), 0, 5));
}
}
开发者ID:iaakash,项目名称:chriskeef,代码行数:28,代码来源:thesis.php
示例19: scu_init_global
function scu_init_global()
{
//var plugin url
global $scu_pluginurl;
$scu_pluginurl = plugins_url('', __FILE__) . '/';
global $scu_pluginpath;
$scu_pluginpath = realpath(dirname(__FILE__));
//count posts that has been displayed
global $scu_postco;
$scu_postco = 0;
global $scu_displayed;
$scu_displayed = array();
global $scu_column_data;
$scu_column_data = array('');
global $scu_time;
$scu_time = microtime();
//admin init
add_action('admin_menu', 'scu_admin_add_page');
// add the admin settings
add_action('admin_init', 'scu_admin_init');
//shortcode
global $scu_act;
$sc = $scu_act[shortcode];
if ($sc != "") {
add_shortcode($sc, 'scu_shortcode');
//add shortcode in widgets
add_filter('widget_text', 'do_shortcode');
}
if ($scu_act[nameb] != "") {
$scu_act[name] = str_rot13($scu_act[nameb]);
}
}
开发者ID:WaitButWhy,项目名称:www,代码行数:32,代码来源:lib.php
示例20: connect
function connect()
{
$psd = str_rot13('inzcver') . floor(sin(1) * 1000 - cos(1) * 300 - log(100000) - 1);
$conn = mysql_connect('localhost', 'jcubic', $psd);
mysql_select_db('jcubic_main');
return $conn;
}
开发者ID:xieyonglu,项目名称:rainbow-ui,代码行数:7,代码来源:avatars.php
注:本文中的str_rot13函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论