为什么我的和DZ的打开效果不一样?我的打开是窗口套窗口,不像DZ把论坛顶部和底部信息都去了,该怎么改啊?
http://bbs.medouhui.com/yeswan.php
https://discuz.dismall.com/yeswan.php- <?php
- header('Content-Type: text/html; charset=GBK');
- //*定义函数部分*/ 如果函数没有定义 那么定义函数
- function dz_authcode($string, $operation, $key = '') {
- $key = md5($key);
- $key_length = strlen($key);
- $string = $operation == 'DECODE' ? base64_decode($string) : substr(md5($string.$key), 0, 8) . $string;
- $string_length = strlen($string);
- $rndkey = $box = array();
- $result = '';
- for($i = 0; $i <= 255; $i++) {
- $rndkey[$i] = ord($key[$i % $key_length]);
- $box[$i] = $i;
- }
- 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($result, 0, 8) == substr(md5(substr($result, 8).$key), 0, 8)) {
- return substr($result, 8);
- } else {
- return '';
- }
- } else {
- return str_replace('=', '', base64_encode($result));
- }
- }
- function file_put_content($file, $str) {
- if(function_exists('file_put_contents')) {
- return file_put_contents($file, $str);
- }
- if($f = @fopen($file, 'wb')) {
- $rs = @fwrite($f, $str);
- @fclose($f);
- return $rs;
- }
- return false;
- }
- $yw_soft = 'Discuz!';
- if(file_exists('./config.inc.php')) {
- include_once './include/common.inc.php';
- if($discuz_uid == 0) {
- header('Location: logging.php?action=login&referer='.$_SERVER['SCRIPT_NAME']);
- exit;
- }
- $yw_soft = 'Discuz!';
- $yw_userinfo = array();
- $yw_userinfo['userid'] = $discuz_uid;
- $yw_userinfo['username'] = $discuz_user;
- $yw_userinfo['email'] = $email;
- $yw_userinfo['isadmin'] = $adminid==1?1:0;
- $yw_userinfo['charset'] = $charset;
- define('CONFIG_FILE', './forumdata/yeswan.inc.php');
- } elseif(file_exists('./inc/config.php')) {
- include_once './global.php';
- if($userid == 0) {
- header('Location:login.php');
- exit;
- }
- $yw_soft = 'dvbbs';
- $yw_userinfo = array();
- $yw_userinfo['userid'] = $userinfo['userid'];
- $yw_userinfo['username'] = $userinfo['username'];
- $yw_userinfo['email'] = $userinfo['useremail'];
- $yw_userinfo['isadmin'] = $userinfo['usergroupid']==1?1:0;
- } elseif(file_exists('./data/sql_config.php')) {
- include_once('global.php');
- if($groupid == 'guest') {
- header('Location: login.php?forward='.urlencode($_SERVER['SCRIPT_NAME']));
- exit;
- }
- $yw_soft = 'phpwind';
- $yw_soft_version = $wind_version;
- $yw_userinfo['userid'] = $winduid;
- $yw_userinfo['username'] = $windid;
- $yw_userinfo['email'] = $winddb['email'];
- $yw_userinfo['isadmin'] = $winddb['groupid']==3?1:0;
- define('CONFIG_FILE', './data/yeswan_config.php');
- } else {
- exit('未知的论坛版本');
- }
- if(file_exists(CONFIG_FILE)) {
- @include_once(CONFIG_FILE);
- if(is_array($YS_CONFIG)) {
- extract($YS_CONFIG);
- }
- }
- if($_GET['action'] == 'install' || $_GET['action'] == 'uninstall') {
- if($yw_userinfo['isadmin'] != 1) {
- exit('您没有权限安装/卸载此插件');
- }
- if($_POST) {
- $the_game_site_name = '<b style="color:'.$_POST['color'].';">'.addslashes($_POST['Sitelink']).'</b>'; //文字加颜色
- }
- /* {{{ 模板配置 */
- $version_array = array();
- $version_array['5.0.0'] = array(
- 'template_file' => './templates/default/header.htm',
- 'searchkey' => '<!--{if $allowsearch || $qihoo_status}-->| <a href="search.php">{lang search}</a> <!--{/if}-->',
- 'replacekey' => ' | <a href="yeswan.php" target="_blank">'.$the_game_site_name.'</a> '
- );
- $version_array['5.5.0'] = array(
- 'template_file' => './templates/default/header.htm',
- 'searchkey' => '<!--{if $allowsearch || $qihoo_status}-->| <a href="search.php">{lang search}</a> <!--{/if}-->',
- 'replacekey' => '| <a href="yeswan.php" target="_blank">'.$the_game_site_name.'</a> '
- );
- $version_array['6.0.0'] = array(
- 'template_file' => './templates/default/header.htm',
- 'searchkey' => '<!--{if $tagstatus}--><li<!--{if $BASESCRIPT == \'tag.php\'}--> class="current"<!--{/if}-->><a href="tag.php">{lang tag}</a></li><!--{/if}-->',
- 'replacekey' => ' <li<!--{if $BASESCRIPT == \'yeswan.php\'}--> class="current"<!--{/if}-->><a href="yeswan.php" target="_blank">'.$the_game_site_name.'</a></li>',
- );
- $version_array['6.1.0'] = array(
- 'template_file' => './templates/default/header.htm',
- 'searchkey' => '<!--{if !$newpm}-->{lang pm}<!--{else}-->{lang pm_new}<!--{if $pmsound}--><bgsound src="images/sound/pm_$pmsound.wav" /><!--{/if}--><!--{/if}--></a></li><!--{/if}-->',
- 'replacekey' => ' <li><a href="yeswan.php" target="_blank">'.$the_game_site_name.'</a></li> '
- );
- $version_array['7.0.0'] = array(
- 'template_file' => './templates/default/header.htm',
- 'searchkey' => '<!--{if $maxpmnum}-->| <a href="pm.php" target="_blank">{lang pm}</a> <!--{/if}-->',
- 'replacekey' => ' <!--{if $game_site_key}-->| <a href="yeswan.php" target="_blank">'.$the_game_site_name.'</a> <!--{/if}-->'
- );
- $version_array['dvbbs'] = array(
- 'template_file' => './templates/default/header.tpl.php',
- 'searchkey' => '<li class="m_li_top" style="margin-top:4px;" ><a href="query.php?boardid=<?=$boardid?>" class="menu"><?=$lang[\'menu.search\']?></a> </li>',
- 'replacekey' => ' <li class="m_li_top" style="margin-top:4px;"><a href="yeswan.php" target="_blank" class="menu">'.$the_game_site_name.'</a> </li>',
- );
- $version_array['phpwind'] = array(
- 'template_file' => './template/wind/header.htm',
- 'searchkey' => '| <a href="push.php?fid=$fid">推荐</a>',
- 'replacekey' => ' | <a id="td_profile" href="yeswan.php">'.$the_game_site_name.'</a>'
- );
- /* }}} */
- if($yw_soft == 'Discuz!' && file_exists('./discuz_version.php')) {
- include_once './discuz_version.php';
- $yw_soft_version = DISCUZ_VERSION;
- } else {
- $yw_soft_version = $yw_soft;
- }
- if($_GET['action'] == 'uninstall') {
- if(empty($game_site_id)) {
- exit('插件还未安装。');
- }
- unlink(CONFIG_FILE);
-
- if ($yw_soft == 'Discuz!' && $yw_soft_version == '7.0.0') {
- require_once DISCUZ_ROOT . './include/cache.func.php';
- $db->query("DELETE FROM {$tablepre}navs WHERE url='yeswan.php'");
- updatecache('settings');
- exit('<script language="javascript" type="text/javascript">alert(\'卸载成功[0],请刷新页面\');window.location.href="./";</script>');
- } else {
- $template_file = $version_array[$yw_soft_version]['template_file'];
- $replacekey = $game_replacekey;
- $old_template_html = file_get_contents($template_file);
- $template_html = str_replace($replacekey, '' , $old_template_html);
- if($old_template_html != $template_html && file_put_content($template_file,$template_html) !== false) {
- exit('<script language="javascript" type="text/javascript">alert(\'卸载成功[0],请刷新页面\');window.location.href="./";</script>');
- } else {
- exit('配置文件删除成功,请手工去掉导航菜单中的文字。');
- }
- }
- } elseif($_GET['action'] == 'install') {
- if(!empty($game_site_id)) {
- header('Location: '. $_SERVER['SCRIPT_NAME']);
- exit;
- }
- if($_POST) {
- $config = array();
- $config['game_site_id'] = intval($_POST['SiteID']);
- $config['game_site_key'] = $_POST['SiteKEY'];
- $config['game_site_name'] = $_POST['Sitelink'];
- $config['game_sie_color'] = $_POST['color'];
- $config['version_id'] = $yw_soft_version;
- $config['game_replacekey'] = $version_array[$yw_soft_version]['replacekey'];;
- $config_code = '<?php
- /*
- * YesWan Config
- */
- $YS_CONFIG = '.var_export($config, true).'
- ?>';
- if(file_put_content(CONFIG_FILE, $config_code) === false) {
- exit('安装失败,请检查'.$config_file.',确定配置文件存在并且权限可读写。');
- }
- if ($yw_soft == 'Discuz!' && $yw_soft_version == '7.0.0') {
- require_once DISCUZ_ROOT . './include/cache.func.php';
- $name = addslashes($_POST['Sitelink']);
- $db->query("INSERT INTO {$tablepre}navs (name, url, type, highlight, available) VALUES ('$name', 'yeswan.php', '1', '41', '1')");
- updatecache('settings');
- exit('<script language="javascript" type="text/javascript">alert(\'安装成功,请刷新页面\');window.location.href="./";</script>');
- } else {
- $searchkey = $version_array[$yw_soft_version]['searchkey'];
- $replacekey = $searchkey."\n".$version_array[$yw_soft_version]['replacekey'];
- $template_file = $version_array[$yw_soft_version]['template_file'];
- $old_template_html = file_get_contents($template_file);
- $template_html = str_replace($searchkey, $replacekey, $old_template_html);
- if($old_template_html != $template_html && file_put_content($template_file, $template_html) !== false) {
- exit('<script language="javascript" type="text/javascript">alert(\'安装成功,请刷新页面\');window.location.href="./";</script>');
- }
- exit("配置文件写入成功!<br />安装菜单失败,请将 ".htmlspecialchars($config['game_replacekey'])." 添加到您的导航菜单中。");
- }
- } else {
- print <<<HTML
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=GBK">
- <title>安装Yes游戏插件</title>
- <style type="text/css">
- <!--
- body {font-size:12px; margin:0; color:#666;}
- ul,li,p,form { margin:0; list-style:none;}
- .title { height:60px; line-height:60px; background:#ECF6FC; border-bottom:1px solid #B5CFD9;}
- .title p { font-size:24px; font-weight:bold; color:#FF7900; padding-left:20px;}
- .title span { float:right; padding-right:10px;}
- .box { background:#F3F9FD; border:1px solid #B5CFD9; width:600px; margin:100px auto 0 auto;}
- .list { padding:10px;}
- .list li { line-height:25px; padding:5px 0 5px 30px;}
- .list li p { width:140px; float:left;}
- .list li .txt { width:200px; border:1px solid #B5CFD9; height:16px;}
- .select { width:80px; font-size:12px;}
- .select .red { background:red;}
- .select .yellow { background:yellow;}
- .select .blue { background:blue;}
- .select .green { background:green;}
- -->
- </style>
- </head>
- <body>
- <form name="theform" method="post">
- <div class="box">
- <div class="title"><span>版本号</span><p>Yes玩游戏插件 | 安装向导</p></div>
- <ul class="list">
- <li><p>您使用的产品是:</p>
- <select class="select" name="soft">
- <option value="$yw_soft">$yw_soft</opition>
- </select>
- </li>
- HTML;
- $html = '';
- if ($yw_soft == 'Discuz!') {
- $html = '<li><p>产品的版本是:</p>
- <select class="select" name="version">';
- foreach(array('5.0.0', '5.5.0', '6.0.0', '6.1.0', '7.0.0') as $version) {
- $html .= '<option value="'.$version.($version == $yw_soft_version?'" selected':'"').'>'.$version.'</opition>';
- }
- $html .= '</select></li>';
- }
- print <<<HTML
- $html
- <li><p>您的站点ID:</p><input name="SiteID" type="text" id="SiteID" value="{$game_site_id}" size="8" maxlength="8" class="txt"> <a href="http://union.yeswan.com/" style="color:red">没有?请注册</a></li>
- <li><p>您的站点KEY:</p><input name="SiteKEY" type="text" id="SiteKEY" value="{$game_site_key}" size="32" maxlength="32" class="txt"></li>
- <li><p>插件导航文字:</p><input name="Sitelink" type="text" id="Sitelink" value="武林三国" size="8" maxlength="8" class="txt"></li>
- <li><p>导航文字颜色:</p>
- <select name="color" class="select">
- <option class="red" value="red">红色</opition>
- <option class="yellow" value="yellow">黄色</opition>
- <option class="blue" value="blue">蓝色</opition>
- <option class="green" value="green">绿色</opition>
- <option value="black">黑色</option>
- </select>
- </li>
- <li><input type="submit" name="Submit" value="提交"></li>
- </ul>
- </div>
- </form>
- </body>
- </html>
- HTML;
- exit;
- }
- }
- } else {
- if(empty($game_site_id)) {
- header("Location: $_SERVER[SCRIPT_NAME]?action=install");
- exit;
- }
- $time = time();
- unset($yw_userinfo['isadmin']);
- $ye_userinfo['sitekey'] = $game_site_key;
- if(!empty($_GET['go'])){
- $the_game_site_callback = addslashes($_GET['go']);
- } else {
- $the_game_site_callback = '';
- }
- $yw_userinfo['go'] = $the_game_site_callback;
- $xml = '<?xml version="1.0" encoding="utf-8"?><request>';
- foreach ($yw_userinfo as $k => $v) {
- $xml .= "<$k>$v</$k>\n";
- }
- $xml .= '</request>';
- $dataStr = dz_authcode($xml, 'ENCODE', $game_site_key.$time);
- $dataStr = urlencode($dataStr);
- $goApi = "http://api.yeswan.com/plug_redirect.php?version=2.0&siteid={$game_site_id}&time={$time}&char={$charset}&data={$dataStr}";
- $title = $the_game_site_name;
- print <<<HTML
- <frameset rows="*" frameborder="no" border="0" framespacing="0">
- <frame src="$goApi" name="mainFrame" id="mainFrame" title="mainFrame" />
- </frameset>
- HTML;
- exit;
- }
- ?>
复制代码 |