100分求救:懂php和.net帮忙翻译下个函数
PHP code:
function _authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ckey_length = 4;
$key = md5($key ? $key : UC_KEY);
$keya = md5(substr($key, 0, 16));
$keyb = md5(substr($key, 16, 16));
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
$cryptkey = $keya.md5($keya.$keyc);
$key_length = strlen($cryptkey);
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
$string_length = strlen($string);
$result = '';
$box = range(0, 255);
$rndkey = array();
for($i = 0; $i <= 255; $i++) {
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
}
for($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}
for($a = $j = $i = 0; $i < $string_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
}
if($operation == 'DECODE') {
if((substr($r
相关问答:
<?php
if($_SERVER['HTTP_REFERER']!=''){
@header("Content-type:image/jpeg");
echo file_get_contents("xlight.jpg");
}
else{
@header("location:ht ......
现有一个 avi 格式的视频,
想在一个页面中加一个上传视频的功能,把这个avi的文件上传上去,并可在网页中点击查视频,这怎么实现呀,
自己去找一个普通的上传代码就可以了。
至于查看视频,你指的是在线 ......
系统:win2003 + IIS 6.0
php 是最新的版本了 刚下载的
安装的时候选择 IIS FastCGI模式
安装成功了
运行phpinfo 成功显示
在IIS新建网站 导入原来运行于apach的帝国管理系统网站 ......
请问一下各位大虾,我用php做个网页游戏,当然是最垃圾的那种html的,
现在我想把所有玩家和怪物,npc的数据储存,
当然,数据库中当然有,但是我又不想过多的去查询数据库,
比如战斗系统,肯定要先初始化双方数 ......
PHP code:
function delDirAndFile( $dirName )
{
if ( $handle = opendir( "$dirName" ) ) {
while ( false !== ( $item = readdir( $handle ) ) ) {
if ( $item != &qu ......