易截截图软件、单文件、免安装、纯绿色、仅160KB

迅速学会PHP加密解密技巧

闲话少说,先将它们打包成一个文件就叫fun.php吧
< ?php  
function passport_encrypt($txt, $key) {  
srand((double)microtime() * 1000000);  
$encrypt_key = md5(rand(0, 32000));  
$ctr = 0;  
$tmp = '';  
for($i = 0;$i < strlen($txt); $i++) {  
$ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr;  
$tmp .= $encrypt_key[$ctr].($txt[$i]
 ^ $encrypt_key[$ctr++]);  
}  
return base64_encode(passport_key($tmp, $key));  
}  
function passport_decrypt($txt, $key) {  
$txt = passport_key(base64_decode($txt), $key);  
$tmp = '';  
for($i = 0;$i < strlen($txt); $i++) {  
$md5 = $txt[$i];  
$tmp .= $txt[++$i] ^ $md5;  
}  
return $tmp;  
}  
function passport_key($txt, $encrypt_key) {  
$encrypt_key = md5($encrypt_key);  
$ctr = 0;  
$tmp = '';  
for($i = 0; $i < strlen($txt); $i++) {  
$ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr;  
$tmp .= $txt[$i] ^ $encrypt_key[$ctr++];  
}  
return $tmp;  
}  
?> 
以下是一些示例…加深对这三个PHP加密解密函数的理解…
 
//string.php  < ?php  include “fun.php”;  $txt = “This is a test”;  $key = “testkey”;  $encrypt = passport_encrypt($txt,$key);  $decrypt = passport_decrypt($encrypt,$key);  echo $txt.”< br>< hr>”;


相关文档:

学习php Reflection(二)

(4)映射类(ReflectionClass)
ReflectionClass类允许你反向映射类。
<?
php
interface MySerializable  
{    
// ...}
class My
Object
 
{    
// ...}
/** A counter class */
class 
Counter 
exten ......

windows下开发PHP扩展dll(无需Cygwin)

windows下开发php扩展网上很多资料都说需要Cygwin,其实完全可以不必安装该东东。没错,是可以在linux下生成骨架后拷到windos下来用,但是,如果没有linux环境呢?什么,装虚拟机?我晕,你咋又绕回去了- -! 除了编译外,shell环境主要就是为了生成扩展的骨架,其实骨架已经在php源码包中了了,我们只需要把相关名字替换一 ......

CentOS通过yum升级php到5.2.9版本的方法

CentOS的php版本默认为5.1.6,然后在5.2.9版本之前的的php都存在一个漏洞,但是目前网上很多地方都无法使用yum update php*升级到5.2.9,比较常见的是升级到5.2.6版本的,经过搜索国外资料,现在终于找到一种升级CentOS的php到5.2.9的方法。
运行下面命令:
# wget http://download.fedora.redhat.com/pub/epel/5/i386/ep ......

php正则取嵌套html标签

<?php
$s = <<<html
<html>
<head>
<title>nested tag test</title>
<mce:script type="text/javascript"><!--
alert('fdsafdasfasd');
// --></mce:script>
</head>
<body>
<div id=0>
<div id=1><img name="im ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号