本文整理汇总了PHP中CHR函数的典型用法代码示例。如果您正苦于以下问题:PHP CHR函数的具体用法?PHP CHR怎么用?PHP CHR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ENCRYPT_DECRYPT
function ENCRYPT_DECRYPT($Str_Message)
{
//Function : encrypt/decrypt a string message v.1.0 without a known key
//Author : Aitor Solozabal Merino (spain)
//Email : aitor-3@euskalnet.net
//Date : 01-04-2005
$Len_Str_Message = STRLEN($Str_Message);
$Str_Encrypted_Message = "";
for ($Position = 0; $Position < $Len_Str_Message; $Position++) {
// long code of the function to explain the algoritm
//this function can be tailored by the programmer modifyng the formula
//to calculate the key to use for every character in the string.
$Key_To_Use = $Len_Str_Message + $Position + 1;
// (+5 or *3 or ^2)
//after that we need a module division because can´t be greater than 255
$Key_To_Use = (255 + $Key_To_Use) % 255;
$Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
$Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
$Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;
//xor operation
$Encrypted_Byte = CHR($Xored_Byte);
$Str_Encrypted_Message .= $Encrypted_Byte;
//short code of the function once explained
//$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));
}
return $Str_Encrypted_Message;
}
示例2: conversion
function conversion($s)
{
$n = str_replace(CHR(32), "", $s);
$array = array(1, 2, 3, 4, 5, 6);
$array1 = array("goodmorning", "goodafternoon", "goodevening", "goodnight", "goodbye", "thankyou");
echo $conversion = str_replace($array1, $array, $n);
}
示例3: stripLines
public static function stripLines($text)
{
$text = str_replace(CHR(10), "", $text);
// et celle là aussi :
$text = str_replace(CHR(13), "", $text);
return $text;
}
示例4: bin2text
function bin2text($bin_str)
{
$text_str = '';
$chars = EXPLODE("\n", CHUNK_SPLIT(STR_REPLACE("\n", '', $bin_str), 8));
$_I = COUNT($chars);
for ($i = 0; $i < $_I; $text_str .= CHR(BINDEC($chars[$i])), $i) {
}
return $text_str;
}
示例5: isExcluded
function isExcluded($url)
{
global $exclusions;
foreach (explode(CHR(13) . CHR(10), $exclusions) as $e) {
$e = trim(preg_replace('/\\s+/', ' ', $e));
if (strpos($url, $e) !== false) {
return true;
}
}
return false;
}
示例6: decrypt
public function decrypt($string)
{
$ivArray = array(0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef);
$iv = null;
foreach ($ivArray as $element) {
$iv .= CHR($element);
}
$string = base64_decode($string);
$result = mcrypt_decrypt(MCRYPT_DES, $this->key, $string, MCRYPT_MODE_CBC, $iv);
$result = $this->pkcs5Unpad($result);
return $result;
}
示例7: Formulaires_CSV
function Formulaires_CSV($data_in = array())
{
Lib_myLog("action: " . $data_in['action']);
foreach ($GLOBALS['tab_globals'] as $global) {
global ${$global};
}
Lib_myLog("IN: ", $data_in);
Lib_myLog("FILE: ", __FILE__);
/*=============*/
Lib_myLog("Impression de la liste en CSV");
$time = time();
$filename = $data_in['form'] . "_" . $time . ".xls";
$file = '../dilasys/tmp/' . $filename;
// le fichier doit déjà exister
if (!($myfile = fopen($file, "w"))) {
/*=============*/
Lib_myLog("Erreur lors de la creation du fichier {$file}");
exit;
} else {
/*=============*/
Lib_myLog("Creation du fichier {$file}");
}
$intitules = array("Nom", "Prénom", "Email", "Donneé1", "Donnée2");
foreach ($intitules as $intitule) {
$header .= $intitule . "\t ";
}
$header .= "\n";
fputs($myfile, $header);
$body = '';
$liste_tmp = Forms_chercher('*');
foreach ($liste_tmp as $tmp) {
$body .= utf8_decode($tmp['nom']) . "\t ";
$body .= utf8_decode($tmp['prenom']) . "\t ";
for ($id = 1; $id <= 8; $id++) {
$body .= str_replace(CHR(13) . CHR(10), " ", utf8_decode($tmp['form' . $id])) . "\t ";
}
$body .= "\n";
}
fputs($myfile, $body);
fclose($myfile);
//on ferme le fichier
$size = filesize($file);
header("Content-Type: application/octet-stream");
header("Content-Length: {$size}");
header("Content-Disposition: attachment; filename=" . $filename);
header("Content-Transfer-Encoding: binary");
$fh = fopen($file, "r");
fpassthru($fh);
}
示例8: UnFilterHtml
function UnFilterHtml($Str)
{
$Str = str_Replace("<br/>", CHR(10), $Str);
$Str = str_Replace("<br />", chr(10), $Str);
$Str = str_Replace("", CHR(13), $Str);
$Str = str_Replace("'", CHR(39), $Str);
$Str = str_Replace(""", CHR(34), $Str);
$Str = str_Replace(" ", CHR(9), $Str);
$Str = str_Replace(" ", CHR(32), $Str);
$Str = str_Replace("<", "<", $Str);
$Str = str_Replace(">", ">", $Str);
$Str = str_Replace("&", "&", $Str);
$Str = str_Replace("´", "'", $Str);
$Str = str_Replace(",", ",", $Str);
return $Str;
}
示例9: HTMLDecode
function HTMLDecode($str)
{
if (!empty($str)) {
$str = str_replace("&", "&", $str);
$str = str_replace(">", ">", $str);
$str = str_replace("<", "<", $str);
$str = str_replace(" ", CHR(32), $str);
$str = str_replace(" ", CHR(9), $str);
$str = str_replace("    ", CHR(9), $str);
$str = str_replace(""", CHR(34), $str);
$str = str_replace("'", CHR(39), $str);
$str = str_replace("", CHR(13), $str);
$str = str_replace("<br/>", CHR(10), $str);
$str = str_replace("<br>", CHR(10), $str);
}
return $str;
}
示例10: enregistrerComment
public static function enregistrerComment($id, $pseudo, $message)
{
$nomSite = Config::getVal('nom', 'core/data/');
$adresseSite = Config::getVal('adresse', 'core/data/');
$message = str_replace("<", "<", $message);
$message = str_replace(">", ">", $message);
$message = str_replace("\\'", "'", $message);
$message = str_replace('\\"', '"', $message);
$message = str_replace(CHR(10), "<br>", $message);
$pseudo = str_replace("<", "<", $pseudo);
$pseudo = str_replace(">", ">", $pseudo);
$pseudo = str_replace("\\'", "'", $pseudo);
$pseudo = str_replace('\\"', '"', $pseudo);
//date_default_timezone_set('Europe/Paris');
//$date = date('Y-m-d H\hi');
$date = time();
$comment = new Archivable('Commentaire');
$comment->set('ip', $_SERVER['REMOTE_ADDR']);
$comment->set('id_article', $id);
$comment->set('pseudo', $pseudo);
$comment->set('texte', $message);
//verification que le commentaire n'a as déja été enregistré
$arch = new Archiviste(Commentaire::$dbSite);
$commsTest = $arch->restituer($comment);
$retour = false;
if (count($commsTest) == 0) {
$comment->set('date', $date);
$arch->archiver($comment);
//on informe l'admin qu'un commentaire a été posté
$corps_message = 'Nouveau commentaire de ' . $pseudo . ' (<a href="http://' . $adresseSite . '/?mod=site&art=' . $id . '">lien vers l\'article</a>)' . PHP_EOL . '<br />' . PHP_EOL . $message;
$headers = 'Content-type: text/html; charset=UTF-8' . "\r\n" . 'From: "' . $nomSite . '"<robot@' . $adresseSite . '>' . "\r\n";
mail(Config::getVal('mail', 'core/data/'), 'Nouveau commentaire', $corps_message, $headers);
$retour = true;
}
return $retour;
}
示例11: ENCRYPT_DECRYPT
function ENCRYPT_DECRYPT($Str_Message)
{
$Len_Str_Message = STRLEN($Str_Message);
$Str_Encrypted_Message = "";
for ($Position = 0; $Position < $Len_Str_Message; $Position++) {
// long code of the function to explain the algoritm
//this function can be tailored by the programmer modifyng the formula
//to calculate the key to use for every character in the string.
$Key_To_Use = ($Len_Str_Message + $Position) * 230;
// (+5 or *3 or ^2)
//after that we need a module division because can´t be greater than 255
//$Key_To_Use = (255+$Key_To_Use) % 255;
$Key_To_Use = (168 + $Key_To_Use) % 168;
$Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
$Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
$Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;
//xor operation
$Encrypted_Byte = CHR($Xored_Byte);
$Str_Encrypted_Message .= $Encrypted_Byte;
//short code of the function once explained
//$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));
}
return $Str_Encrypted_Message;
}
示例12: array
<?php
include "verification.php";
$id = $_GET['id'];
$form = $_GET['form'];
$tab = array(CHR(13) => " ", CHR(10) => " ");
//si un menu et un seul doit être retourné
if ($id > 0) {
$sqliste = "SELECT * FROM utilisateurs.t_menus\n\t\tWHERE id_menu={$id}";
} else {
$sqliste = "SELECT * FROM utilisateurs.t_menus";
}
$result = pg_query($sqliste) or die('Échec requête : ' . pg_last_error());
$nb = pg_numrows($result);
$json = "[";
$i = 0;
while ($val = pg_fetch_assoc($result)) {
$id_menu = $val['id_menu'];
$nom_menu = str_replace("'", "\\'", $val['nom_menu']);
$desc_menu = str_replace("'", "\\'", $val['desc_menu']);
$desc_menu = strtr($desc_menu, $tab);
$id_application = $val['id_application'];
$text = "{id_menu:" . $id_menu . ",nom_menu:'" . $nom_menu . "',desc_menu:'" . $desc_menu . "',id_application:" . $id_application . "}";
$json = $json . $text;
$i++;
if ($i > 0 and $i != $nb) {
$json = $json . ",";
}
}
$json = $json . "]";
if ($form) {
示例13: foreach
<?php
$pathBatch = "../../";
include $pathBatch . "init_pages/" . "batch.php";
//echoa($_REQUEST);
foreach ($myAdmin->LIST_LANG_DATAS as $clg => $nlg) {
$mySelect = new mySelect(__FILE__);
$mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "itineraires_texte";
$mySelect->where = "id=" . $_GET["id"] . " AND lg='" . $clg . "'";
$result = $mySelect->query();
$row = current($result);
$row["texte"] = str_replace("\n", "", $row["texte"]);
$row["texte"] = str_replace("\r\n", "", $row["texte"]);
$row["texte"] = str_replace("\r", "", $row["texte"]);
$row["texte"] = str_replace(CHR(10), "", $row["texte"]);
$row["texte"] = str_replace(CHR(13), "", $row["texte"]);
if ($row["id"] > 0) {
echo "\$('#idCurrent').val('" . $row["id"] . "');\n";
echo "\$('#titre_" . $clg . "').val(\"" . addslashes($row["titre"]) . "\");\n";
echo "\$('#type_texte').val(\"" . addslashes($row["type_texte"]) . "\");\n";
echo "tinyMCE.get('texte_" . $clg . "').setContent(\"" . addslashes($row["texte"]) . "\");\n";
}
}
?>
示例14: textWithHole
/**
* Text with hole.
*/
private function textWithHole()
{
$textEntryInteraction = '';
$newId = 1;
$html = htmlspecialchars_decode($this->interactionhole->getHtmlWithoutValue());
//delete the line break in $html
$html = str_replace(CHR(10), '', $html);
$html = str_replace(CHR(13), '', $html);
$html = html_entity_decode($html);
$regex = '(<input.*?class="blank".*?>|<select.*?class="blank".*?>.*?</select>)';
preg_match_all($regex, $html, $matches);
foreach ($matches[0] as $matche) {
$tabMatche = explode('"', $matche);
$id = $tabMatche[1];
if (substr($matche, 1, 5) == 'input') {
//hole with input element
$name = $tabMatche[7];
$size = $tabMatche[9];
$textEntryInteraction = str_replace('input', 'textEntryInteraction', $matche);
$textEntryInteraction = str_replace('class="blank" ', '', $textEntryInteraction);
$textEntryInteraction = str_replace('type="text" ', '', $textEntryInteraction);
$textEntryInteraction = str_replace('value="" ', '', $textEntryInteraction);
$textEntryInteraction = str_replace('id="' . $id . '"', 'responseIdentifier="blank_' . $newId . '"', $textEntryInteraction);
$textEntryInteraction = str_replace('name="' . $name . '"', '', $textEntryInteraction);
$textEntryInteraction = str_replace('autocomplete="off"', '', $textEntryInteraction);
$textEntryInteraction = str_replace('size="' . $size . '"', 'expectedLength="' . $size . '"', $textEntryInteraction);
} else {
//hole with select element
$name = $tabMatche[5];
$textEntryInteraction = str_replace('</select>', '</inlineChoiceInteraction>', $matche);
$textEntryInteraction = str_replace('select', 'inlineChoiceInteraction', $textEntryInteraction);
$textEntryInteraction = str_replace('id="' . $id . '"', 'responseIdentifier="blank_' . $newId . '"', $textEntryInteraction);
$textEntryInteraction = str_replace('class="blank" ', '', $textEntryInteraction);
$textEntryInteraction = str_replace('name="' . $name . '"', '', $textEntryInteraction);
$textEntryInteraction = str_replace('option', 'inlineChoice', $textEntryInteraction);
//for the option elements
$regexOpt = '(<inlineChoice value=.*?>)';
preg_match_all($regexOpt, $textEntryInteraction, $matchesOpt);
foreach ($matchesOpt[0] as $matcheOpt) {
$tabMatcheOpt = explode('"', $matcheOpt);
$holeID = $tabMatcheOpt[1];
$opt = str_replace('value="' . $holeID . '"', 'identifier="choice_' . $holeID . '"', $matcheOpt);
$textEntryInteraction = str_replace($matcheOpt, $opt, $textEntryInteraction);
}
}
$textEntryInteraction = str_replace(' ', ' ', $textEntryInteraction);
$html = str_replace($matche, $textEntryInteraction, $html);
++$newId;
}
//For the question created before the 2014/10/09
$html = str_replace('</select>', '', $html);
$fragment = $this->document->createDocumentFragment();
$fragment->appendXML($html);
$this->itemBody->appendChild($fragment);
$this->imgToObject($this->document);
$this->aToObject($this->document);
}
示例15: format
if (isset($lQueryResult->num_rows)){
if ($lQueryResult->num_rows > 0) {
$lResultsFound = TRUE;
$lRecordsFound = $lQueryResult->num_rows;
}//end if
}//end if
if ($lResultsFound){
echo format("Executed query 'SELECT * FROM accounts'. Found ".$lRecordsFound." records.","S");
$lAccountsXML='<?xml version="1.0" encoding="utf-8"?>'.PHP_EOL;
$lAccountsXML.="<Employees>".PHP_EOL;
$lCounter=1;
$cTAB = CHR(9);
while($row = $lQueryResult->fetch_object()){
$lAccountType = $row->is_admin?"Admin":"User";
$lAccountsXML.=$cTAB.'<Employee ID="'.$lCounter.'">'.PHP_EOL;
$lAccountsXML.=$cTAB.$cTAB.'<UserName>'.$row->username.'</UserName>'.PHP_EOL;
$lAccountsXML.=$cTAB.$cTAB.'<Password>'.$row->password.'</Password>'.PHP_EOL;
$lAccountsXML.=$cTAB.$cTAB.'<Signature>'.$row->mysignature.'</Signature>'.PHP_EOL;
$lAccountsXML.=$cTAB.$cTAB.'<Type>'.$lAccountType.'</Type>'.PHP_EOL;
$lAccountsXML.=$cTAB.'</Employee>'.PHP_EOL;
$lAccountsText.=$lCounter.",".$row->username.",".$row->password.",".$row->mysignature.",".$lAccountType.PHP_EOL;
$lCounter+=1;
}// end while
$lAccountsXML.="</Employees>".PHP_EOL;