www.gusucode.com > 搜一次CMS电影程序 PHP 1.5源码程序 > admin/tools/admin_cnzz.php

    <?php
include_once('../../include/conn.php');
include_once('../../include/function.php');
include_once('../../include/cnzz.php');
$action=SafeRequest("action","get");
switch($action){
	case 'set':
		set();
		break;
	default:
		main();
		break;
	}
	

function main(){
	if(cnzz_open=='0'){
		header("Location:admin_cnzz.php?action=set");
	}else{
		$url='http://intf.cnzz.com/user/companion/b2b-builder_login.php';
		$site_id=cnzz_id;
		$pass=cnzz_pwd;
		$cms=$url.'?site_id='.$site_id.'&password='.$pass;
		header("Location:".$url.'?site_id='.$site_id.'&password='.$pass.'&cms='.$cms);
	}
}

function set(){
if(cnzz_open=='0'){
		$domain=ReplaceStr(strtolower(S_SiteDomain),'http://','');		
		$key=md5($domain.'KclGiq7H');		
		$url='http://intf.cnzz.com/user/companion/b2b-builder.php';
		$cms=$url.'?domain='.$domain.'&key='.$key;
		$urlgo=	$url.'?domain='.$domain.'&key='.$key.'&cms='.$cms;		
		$returnstr=@file_get_contents($urlgo);
		$arr=explode('@',$returnstr);
		if(count($arr)==2){
			$text="<?php"."\n";
			$text.="define(\"cnzz_open\",\"1\");"."\n";
			$text.="define(\"cnzz_id\",\"".$arr[0]."\");"."\n";		
			$text.="define(\"cnzz_pwd\",\"".$arr[1]."\");"."\n";
			$text.="?>";
			@chmod("../../include/cnzz.php",0777);
			fwrite(fopen("../../include/cnzz.php","wb"),$text);
			header("Location:admin_cnzz.php");
		}else{
			echo "错误编号:".$returnstr;	
				}
	}	
}
?>