search
Homephp教程php手册这个字符串转换类用处大吗?

转换|字符串

PHP代码:--------------------------------------------------------------------------------

/**
* 字符串转换类
* 著作人:Michael Young
* 日 期:2002-4-21
* E-Mail:windring@yeah.net
* 版权所有
*/
class ExtendString{

var $keyWord="ilovechenyingmm.";

//获取密码
function getPassword(){
if (file_exists("admin.ini")==1){
$file=fopen("admin.ini","r");
fseek($file,31);
$buffer=fgets($file,4096);
fclose($file);
//return $buffer;
return $this->decrypt($buffer); //解密
}else
return "filenoexist";
}

//设置密码
function setPassword($password){
if (file_exists("admin.ini")==1){
$file=fopen("admin.ini","w");
$wStr="[admin password]\nadminPassWord=".$this->encrypt($password);
$wStr.="\n\n#不要随意更改该文件,否则会导致系统无法正常运行";
$result=fwrite($file,$wStr);
fclose($file);
return $result;
}else
return 0;
}

//加密
function encrypt($password){
$keyWord="ilovechenyingmm."; $i=strlen($password);
if ($i for($j=0;$j $password=$password." ";
}
$nostr=$password;
for($j=0;$j $c1=substr($password,$j,1);
$c=substr($keyWord,$j,1);
$c2=(ord($c))^(ord($c1));
if (strlen($c2) $c2="00".$c2;
if (strlen($c2)==2)
$c2="0".$c2;
$s1.=$c2;
}
return $s1;
}

//解密
function decrypt($password){
$keyWord="ilovechenyingmm.";
$i=strlen($password);
$s1="";
$stemp="";
for ($j=0;$j $stemp=substr($password,$j*3,3);
$c=substr($keyWord,$j,1);
$c1=chr((ord($c))^$stemp);
$s1.=$c1;
}
return trim($s1);
}
}
?>



Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment