当前位置: 首页>>代码示例>>PHP>>正文


PHP hex2str函数代码示例

本文整理汇总了PHP中hex2str函数的典型用法代码示例。如果您正苦于以下问题:PHP hex2str函数的具体用法?PHP hex2str怎么用?PHP hex2str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hex2str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: HandleCallback

 /**
  * Function that processes the callback from the bank and returns CPayment objects with isSuccessful
  * (and other applicable) parameters filled according to the answers from the bank.
  *
  * @return CPayment
  */
 public function HandleCallback()
 {
     $rsField = array();
     foreach ((array) $_REQUEST as $ixField => $fieldValue) {
         $rsField[$ixField] = $fieldValue;
     }
     $sSignatureBase = sprintf("%03s", $rsField['ver']) . sprintf("%-10s", $rsField['id']) . sprintf("%012s", $rsField['ecuno']) . sprintf("%06s", $rsField['receipt_no']) . sprintf("%012s", $rsField['eamount']) . sprintf("%3s", $rsField['cur']) . $rsField['respcode'] . $rsField['datetime'] . sprintf("%-40s", $rsField['msgdata']) . sprintf("%-40s", $rsField['actiontext']);
     function hex2str($hex)
     {
         for ($i = 0; $i < strlen($hex); $i += 2) {
             $str .= chr(hexdec(substr($hex, $i, 2)));
         }
         return $str;
     }
     $mac = hex2str($rsField['mac']);
     $sSignature = sha1($sSignatureBase);
     $flKey = openssl_get_publickey(file_get_contents($this->flBankCertificate));
     if (!openssl_verify($sSignatureBase, $mac, $flKey)) {
         trigger_error("Invalid signature", E_USER_ERROR);
     }
     if ($rsField['receipt_no'] == 00) {
         return new CPayment($rsField['ecuno'], $rsField['msgdata'], null, null, False);
     } else {
         return new CPayment($rsField['ecuno'], $rsField['msgdata'], $rsField['eamount'] / 100, $rsField['cur'], True);
     }
 }
开发者ID:vcgato29,项目名称:poff,代码行数:32,代码来源:EstCardLink.class.php

示例2: isSuccesful

 public function isSuccesful()
 {
     foreach ((array) $_REQUEST as $ixField => $fieldValue) {
         $this->responseFields[$ixField] = $fieldValue;
     }
     $sSignatureBase = sprintf("%03s", $this->responseFields['ver']) . sprintf("%-10s", $this->responseFields['id']) . sprintf("%012s", $this->responseFields['ecuno']) . sprintf("%06s", $this->responseFields['receipt_no']) . sprintf("%012s", $this->responseFields['eamount']) . sprintf("%3s", $this->responseFields['cur']) . $this->responseFields['respcode'] . $this->responseFields['datetime'] . $this->mb_sprintf("%-40s", $this->responseFields['msgdata']) . $this->mb_sprintf("%-40s", $this->responseFields['actiontext']);
     function hex2str($hex)
     {
         $str = '';
         for ($i = 0; $i < strlen($hex); $i += 2) {
             $str .= chr(hexdec(substr($hex, $i, 2)));
         }
         return $str;
     }
     $mac = hex2str($this->responseFields['mac']);
     $flKey = openssl_get_publickey(\Configuration::where('code', '=', 'estcard/pubkey')->first()->value);
     if (!openssl_verify($sSignatureBase, $mac, $flKey)) {
         // invalidSignature
         return false;
     }
     if ($this->responseFields['receipt_no'] == 00) {
         # Payment was cancelled
         return false;
     }
     if ($this->responseFields['respcode'] == 00) {
         # Payment success
         return true;
     }
 }
开发者ID:Silxik,项目名称:banklink,代码行数:29,代码来源:Estcard.php

示例3: getMessage

 function getMessage()
 {
     $message = $this->message;
     $message = hex2str($message);
     $message = wordwrap($message, 70);
     $this->message = $message;
 }
开发者ID:CarlosOVillanueva,项目名称:BIFROST,代码行数:7,代码来源:ArcEmail.php

示例4: main

function main()
{
    global $VERSION, $key, $iv2;
    $a = $_GET['a'];
    switch ($a) {
        default:
            print '
				<html>
					<head>
						<title>rsdf2txt ' . $VERSION . ' from fox21.at</title>
					</head>
					<body>
						Copy and paste the content of the .rsdf file into this textarea.<br />
						<form action="?a=decrypt" method="post">
							<textarea name="content" rows="10" cols="60"></textarea><br /><br />
							<input type="submit" value="Get" />
						</form>
					</body>
				</head>
			';
            break;
        case 'decrypt':
            $content = $_POST['content'];
            #$content = implode('', file($url));
            $content = hex2str($content);
            $links = explode("\r\n", $content);
            $out = '';
            foreach ($links as $link) {
                if (strlen($link) != 0) {
                    $b64 = base64_decode($link);
                    $dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $b64, MCRYPT_MODE_CFB, $iv2);
                    $dec = substr($dec, strpos($dec, '/files/'));
                    if ($dec != '') {
                        $out .= "http://rapidshare.com{$dec}\n";
                    }
                }
            }
            print '
				<html>
					<head>
						<title>rsdf2txt ' . $VERSION . ' from fox21.at</title>
					</head>
					<body>
						<textarea rows="20" cols="70">' . $out . '</textarea>
					</body>
				</head>
			';
            break;
    }
}
开发者ID:TheFox,项目名称:rsdf2txt,代码行数:50,代码来源:rsdf2txt.php

示例5: color

 /**
  * @param number $factor
  * @return string
  */
 public function color($factor)
 {
     $factor = max(0.0, min(1.0, $factor));
     $color1 = $color2 = $this->gradient['0.0'];
     $f1 = 0;
     foreach ($this->gradient as $f => $color) {
         if ($factor <= $f) {
             $color2 = $color;
             if ($f1 != $f) {
                 $factor = ($factor - $f1) / ($f - $f1);
             } else {
                 $factor = $f;
             }
             break;
         }
         $color1 = $color;
         $f1 = $f;
     }
     return hex2str(interpolate($color1, $color2, $factor));
 }
开发者ID:codeagent,项目名称:treemap,代码行数:24,代码来源:Gradient.php

示例6: concat

    case 2:
        $gdbo->sql = "delete from _srv_resolution where id_srv_resolution={$rid}";
        $gdbo->dbTable = "_srv_resolution";
        $gdbo->execQuery();
        break;
}
$gdbo->sql = "update _srv set srv_du=current_timestamp where id_srv={$id}";
$gdbo->dbTable = "_srv";
$gdbo->execQuery();
$gdbo->sql = "SELECT\na.id_srv_resolution,\nscript2text(a.srv_resolution) as \"Notes\",\nFROM_UNIXTIME(UNIX_TIMESTAMP(a.srv_resolution_dc)+{$gmtOffset}) as \"srv_resolution_dc\",\nFROM_UNIXTIME(UNIX_TIMESTAMP(a.srv_resolution_du)+{$gmtOffset},'%M %D, %Y') as \"srv_resolution_du\",\nconcat(d.cust_contact_givenName,' ',d.cust_contact_familyName) as \"fullname\",\na.id_sys_user,\na.srv_resolution_privateBit,\n(SELECT concat('<img src=''/_avatar/thumb_',fso,''' height=''32'' width=''32''/>') as fso FROM _fso where fso_pkcol='id_cust_contact' AND fso_pk=b.id_cust_contact AND fso_originalname='avatar') as \"Avatar\"\nFROM\n_srv_resolution a\nLEFT JOIN _sys_user_emp b ON a.id_sys_user=b.id_sys_user\nLEFT JOIN _cust_contact d ON b.id_cust_contact=d.id_cust_contact\nWHERE a.id_srv=" . $id . "\nORDER BY\na.srv_resolution_dc DESC";
$gdbo->getRec();
$aResolution = $gdbo->dbData;
if (count($aResolution) > 0) {
    $debug = 1;
    foreach ($aResolution as $key => $row) {
        $isPrivate = $row[6] == 1 ? " [Private Note]" : "";
        $editRecord = $row[5] == $id_sys_user ? " onclick=\"editRow('resolution'," . $row[0] . ")\"" : "";
        echo "<div class=\"frmrowh\" {$editRecord}>";
        foreach ($row as $col => $value) {
            if ($col == 1) {
                $notes = $row[6] == 1 && $row[5] != $id_sys_user ? encrypt(hex2str($value)) : $value;
                $notes = wordwrap($notes, 128, "\n", true);
                echo "<div class=\"srvDate\" id=\"resolution_head_" . $row[0] . "\">\n<div class=\"flLeft\">" . $row[7] . " Last updated " . $row[3] . " by " . $row[4] . "</div><div class=\"flRight\">{$isPrivate}</div></div>";
                echo "<div class=\"srvData\" id=\"resolution_" . $row[0] . "\">" . $notes . "</div>";
            }
        }
        echo "</div>";
    }
} else {
    echo "";
}
开发者ID:CarlosOVillanueva,项目名称:BIFROST,代码行数:31,代码来源:sql_resolution.php

示例7: dosendsms

function dosendsms($msisdn, $sms_text)
{
    // 短信中心号码
    $smsc = "8613800755500";
    // 短信最大长度70个汉字,Unicode表示需要280个字节
    $max_len = 280;
    $invert_smsc = InvertNumbers($smsc);
    $len = 1;
    $s = chr(13);
    $msisdn = "86" . $msisdn;
    $sms_text = $sms_text;
    $pdu_text = hex2str(gb2unicode($sms_text));
    echo gb2unicode($sms_text) . "\n";
    $invert_msisdn = InvertNumbers($msisdn);
    // 拆分发送超过70汉字的短信(todo: 没有判断全英文的情况)
    $pdu_len = strlen($pdu_text);
    if ($pdu_len > $max_len) {
        $pdu_text1 = substr($pdu_text, 0, $max_len);
        $pdu_text = substr($pdu_text, $max_len, $pdu_len - $max_len);
    } else {
        $pdu_text1 = $pdu_text;
        $pdu_text = "";
    }
    $pdu_len1 = sprintf("%02X", strlen($pdu_text1) / 2);
    $pdu_text1 = $pdu_len1 . $pdu_text1;
    $pdu_text1 = "11000D91" . $invert_msisdn . "000800" . $pdu_text1;
    $atcmd = "AT+CMGS=" . sprintf("%d", strlen($pdu_text1) / 2) . chr(13);
    $l = strlen($atcmd);
    echo $atcmd . "\n";
    /*
    $ll = @dio_write($fd,$atcmd);
    while ($l != $ll) {
    		sleep(10);
    		$ll = @dio_write($fd,$atcmd);
    }
    if ($DEBUG) echo date("Y-m-d H:i:s")." DEBUG $atcmd\n";
    
    do {
    		$data = dio_read($fd, $len);
    		echo $data;
    } while ( $data != $s );
    
    sleep(1);
    */
    $pdu_text1 = "0891" . $invert_smsc . $pdu_text1 . chr(26) . chr(13);
    $l = strlen($pdu_text1);
    echo $pdu_text1 . "\n";
    /*
    $ll = @dio_write($fd,$pdu_text1);
    while ($l != $ll) {
    		sleep(10);
    		$ll = @dio_write($fd,$pdu_text1);
    }
    if ($DEBUG) echo date("Y-m-d H:i:s")." DEBUG $pdu_text1\n";
    
    do {
    		$data = dio_read($fd, $len);
    		echo $data;
    } while ( $data != $s );
       
    sleep(7);
    */
}
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:63,代码来源:sms_pdu.php

示例8: ArcTbl

GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once "_lib/php/auth.php";
if (!isset($_POST["id_cfg"])) {
    $_POST["id_cfg"] = "";
}
$device = new ArcTbl();
$device->dbConStr = $globalDBCON;
$device->dbLimit = 10;
$device->dbOffset = 0;
$device->dbType = $globalDBTP;
$device->dbSchema = $globalDB;
$device->recIndex = "id_cfg_device";
$device->recOrder = "asc";
$device->actionDestination = "popWindow";
$device->recOrderCol = "Label";
$device->recLink = $path . "edit_cfgdevice.php";
$device->actionFilterKey = "id_cfg_device";
$device->recQuery = "\nSELECT\na.cfg_device as \"Device Label\",\na.id_cfg_device,\nc.device_grp as \"Type\",\nb.device as \"Device\",\na.cfg_device_os as \"OS\",\nconcat(f.cust_contact_familyName,',',f.cust_contact_givenName) as \"Admin\",\na.cfg_device_serialnumber as \"Serial Number\",\nUNHEX(a.cfg_device_notes) as \"Notes\",\nFROM_UNIXTIME(UNIX_TIMESTAMP(a.cfg_device_dc)+" . $gmtOffset . ",'%Y-%m-%d') as \"Date Entered\",\nFROM_UNIXTIME(UNIX_TIMESTAMP(a.cfg_device_du)+" . $gmtOffset . ") as \"Last Update\",\nd.sys_status as \"Status\",\nCASE\nWHEN a.cfg_device_keyenabled = 1\nTHEN 'Yes'\nELSE 'No'\nEND as \"Manageable\",\na.id_cfg,\nconcat('\n<input type=\"button\" value=\"Interfaces\" onclick=\"arc(''popWindow'',''/_mod/smod_18/manage_interface.php'',''id_cfg=',cast(id_cfg as char),'&id_cfg_device=',cast(a.id_cfg_device as char),'&id_device=',cast(a.id_device as char),''',1,1)\"/>\n<input type=\"button\" value=\"Delete\" onclick=\"delCfgDevice(',cast(id_cfg as char),',',cast(a.id_cfg_device as char),')\"/>\n') as \"\" FROM _cfg_device a\nLEFT JOIN\n_device b ON a.id_device=b.id_device\nLEFT JOIN\n_device_grp c ON b.id_device_grp=c.id_device_grp\nLEFT JOIN\n_sys_status d ON a.id_sys_status=d.id_sys_status\nLEFT JOIN\n_hr_emp e ON a.id_hr_emp = e.id_hr_emp\nLEFT JOIN\n_cust_contact f ON e.id_cust_contact = f.id_cust_contact\nWHERE a.id_cfg=" . $_POST["id_cfg"] . " ORDER by a.cfg_device";
$device->ajDestination = "list18-0";
$device->ajPage = "/_mod/smod_18/list_cfgdevice.php";
$device->recOrder = "asc";
$device->recOrderCol = "Device";
$device->ignoreCols = array("id_cfg", "Notes", "Date Entered", "id_cfg_device");
$device->ignoreFilterCols = array("id_cfg", "id_cfg_device", "");
$device->build();
echo hex2str($device->tblNav);
echo $device->dataTable;
开发者ID:CarlosOVillanueva,项目名称:BIFROST,代码行数:31,代码来源:list_cfgdevice.php

示例9: snmp_hexstring

function snmp_hexstring($hex)
{
    return hex2str(str_replace(' ', '', str_replace(' 00', '', $hex)));
}
开发者ID:syzdek,项目名称:librenms,代码行数:4,代码来源:functions.php

示例10: snmp_hexstring

function snmp_hexstring($str)
{
    if (isHexString($str)) {
        return hex2str(str_replace(' ', '', str_replace(' 00', '', $str)));
    } else {
        return $str;
    }
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:8,代码来源:functions.inc.php

示例11: parsEmo

function parsEmo($matches)
{
    return hex2str($matches[1]);
}
开发者ID:rsiva6,项目名称:WhatsAPI,代码行数:4,代码来源:example.php

示例12: decrypt

function decrypt($str)
{
    $key = $GLOBALS['salt'];
    $str = hex2str($str);
    $str = mcrypt_decrypt(MCRYPT_DES, $key, $str, MCRYPT_MODE_ECB);
    $block = mcrypt_get_block_size('des', 'ecb');
    $pad = ord($str[($len = strlen($str)) - 1]);
    return substr($str, 0, strlen($str) - $pad);
}
开发者ID:CarlosOVillanueva,项目名称:BIFROST,代码行数:9,代码来源:ArcCore.php

示例13: array

# Contract Type
require "_model/dboContractTp.php";
$gdbo->getRec();
$listContractTp = $gdbo->dbData;
# Contract Category
require "_model/dboContractCat.php";
$gdbo->getRec();
$listContractCat = $gdbo->dbData;
# Contract Status
require "_model/dboContractStatus.php";
$gdbo->getRec();
$listContractStatus = $gdbo->dbData;
# Fieldset Variables
$buttonDate = '<div class="elementIconBox" onclick="openCalendar(this,\'interface\',null,\'dateFld\')"><i class="fa fa-calendar"></i></div>';
# Fieldsets
$fsContract = array(array(array("*Organization", "id_cust_company", null, 1, $listCompany, $rec[0]["id_cust_company"]), array("*Status", "id_sys_status", null, 1, $listContractStatus, $rec[0]["id_sys_status"]), array(null, "id_contract", null, 3, null, $rec[0]["id_contract"])), array(array("*Type", "id_contract_tp", null, 1, $listContractTp, $rec[0]["id_contract_tp"]), array("*Category", "id_contract_cat", null, 1, $listContractCat, $rec[0]["id_contract_cat"])), array(array("*Contract", "contract", null, 0, null, $rec[0]["contract"]), array("*Label", "contract_label", null, 0, null, $rec[0]["contract_label"])), array(array("*Value", "contract_value", 'onblur="validateElement(\'money\',this)"', 0, null, $rec[0]["contract_value"]), array("Paid to Date", "paid", 'disabled="disabled"', 0, null, $rec[0]["contract_paid"])), array(array('Award Date', 'contract_da', 'class="dateFld elementIcon" onblur="validateElement(\'date\',this)"', 0, null, $rec[0]["contract_da"], null, $buttonDate, null, 'YYYY-MM-DD'), array("Date Updated", "contract_du", 'disabled="disabled"', 0, null, $rec[0]["contract_du"])), array(array('Execution Date', 'contract_ds', 'class="dateFld elementIcon" onblur="validateElement(\'date\',this)"', 0, null, $rec[0]["contract_ds"], null, $buttonDate, null, 'YYYY-MM-DD'), array("Date Terminated", "contract_dr", 'disabled="disabled"', 0, null, $rec[0]["contract_dr"])), array(array('Expiration Date', 'contract_de', 'class="dateFld elementIcon" onblur="validateElement(\'date\',this)"', 0, null, $rec[0]["contract_ds"], null, $buttonDate, null, 'YYYY-MM-DD')), array(array('General Notes', 'contract_notes', 'onkeydown="detectTab(this,event)"', 6, null, hex2str($rec[0]["contract_notes"]))), array(array('Billing Notes', 'contract_billingNotes', 'onkeydown="detectTab(this,event)"', 6, null, hex2str($rec[0]["contract_billingNotes"]))));
$requiredFields = "contract_value,id_cust_company,id_sys_status,contract_label,contract,id_contract_cat,id_contract_tp";
?>
<form method="post" id="frmContract" name="frmContract" action="javascript:submitFrmVals('content','/_mod/smod_08/sql.php','<?php 
echo $requiredFields;
?>
','&form=frmContract&action=update','frmContract')">
<fieldset id="contract_detail">
<legend>Contract Detail</legend>
<?php 
echo frmElements($fsContract);
?>
</fieldset>
</form>
<form action="#">
<fieldset id="Files">
开发者ID:CarlosOVillanueva,项目名称:BIFROST,代码行数:31,代码来源:edit.php

示例14: sendImage

 public function sendImage($msgid, $to, $path, $size, $link, $b64thumb)
 {
     $thumb_length = hex2str(_hex(strlen($b64thumb)));
     $to_length = chr(mb_strlen($to, "UTF-8"));
     $msgid_length = chr(mb_strlen($msgid));
     $path_length = chr(mb_strlen($path));
     $size_length = chr(mb_strlen($size));
     // in bytes
     $link_length = chr(strlen($link));
     $content = "ø] úü{$to_length}";
     $content .= $to;
     $content .= "Š¢Cü{$msgid_length}";
     $content .= $msgid;
     $content .= "øøº½OøøŒø\f\\½°¢Düfileü{$path_length}";
     $content .= $path;
     $content .= "üsizeü{$size_length}";
     $content .= $size;
     $content .= "¥ü{$link_length}";
     $content .= $link;
     $content .= "ý{$thumb_length}";
     $content .= $b64thumb;
     $total_length = hex2str(_hex(strlen($content)));
     $msg = "";
     $msg .= "{$total_length}";
     $msg .= $content;
     echo str2hex($msg);
     $stream = $this->send($msg);
     $this->read();
 }
开发者ID:rprados,项目名称:WhatsAPI,代码行数:29,代码来源:whatsapp.v2.php

示例15: foreach

$inc = 1;
foreach ($dboData as $Column => $Data) {
    $comma = $inc != 1 ? "," : "";
    $dbo->{$Column} = $Data;
    $inc = $inc + 1;
}
if (isset($dbo->dependents)) {
    $dependents = json_decode($dbo->dependents);
    foreach ($dependents as $element => $name) {
        echo '<script>$("' . $name . '").prop("disabled",true);</script>';
    }
}
$attributes = isset($dbo->attributes) ? $dbo->attributes : "";
$recID = isset($dbo->id) ? $dbo->id : "";
if (!empty($_POST["VAL"])) {
    $dbo->sql = $dbo->sql . " " . $dbo->dbFilter . hex2str($_POST["VAL"]);
    $dbo->getRec();
    $results = $dbo->dbData;
    $count = $dbo->dbRows;
    $disabled = "";
} else {
    $results = array();
    $disabled = 'disabled="disabled"';
}
if ($count == 0) {
    $disabled = 'disabled="disabled"';
    $first = null;
    $text = null;
} else {
    $first = $results[0][0];
    $text = $results[0][1];
开发者ID:CarlosOVillanueva,项目名称:BIFROST,代码行数:31,代码来源:ArcFilterRec.php


注:本文中的hex2str函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。