Home > php教程 > php手册 > PHP程序授权验证开发思路

PHP程序授权验证开发思路

WBOY
Release: 2016-06-13 10:36:50
Original
1315 people have browsed it

做一套商业程序,如只充许客户只能用于一台服务器,授权验证就很重要了。以下是我的一个想法,把服务器的php环境配置也应用在程序里面,生成一个许可字串,然后将字串写入到许可的文件代码中。就算是将程序原本不动地移到其它服务器上,程序都不能运行了。希望大家多多讨论……

 

 

 



/**
* bkJia中文论坛@授权字串
*/
function authorization        ($seed = ) {
        $encode = $_SERVER[SERVER_SOFTWARE] . $_SERVER[SERVER_NAME] . $_SERVER[DOCUMENT_ROOT] .       
                        $_SERVER[SERVER_ADMIN] . $_SERVER[SERVER_ADDR] . PHP_VERSION . PHP_OS . __FILE__;
        return md5 ($encode);
}

$authorization_key = 2cto.com;
echo authorization($authorization_key);//这里是生成字符串验证
$authorization_check = array(dd670852938815f3892d3c511cc8fceb,ddc976cc02bce5c3c22c4d7d201c0cae );//授权字串,把生成的字符验证复制到这里来

if (!in_array(authorization ($authorization_key), $authorization_check)) {
        die(对不起,你的程序未经过bkJia授权!!);
}

 

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template