OSC与Discuz2.5F的整合代码
论坛程序的数据库结构如没有重大改变的话,以下代码同样适用于更高版本的论坛程序。
修改configure.php
添加以下代码
define('DIR_WS_DISCUZ', '/home/thewall/www/discuz25f/'); //你的论坛代码存放位置
创建discuz.php
<?php
if($forum_nick!='') {
require(DIR_WS_DISCUZ . 'config.php');
mysql_connect($dbhost, $dbuser, $dbpw);
mysql_select_db($dbname);
$query = mysql_query("SELECT COUNT(*) FROM " .$tablepre. "members WHERE username='$forum_nick'");
if(mysql_result($query, 0)) {
mysql_close();
} else {
$timestamp = time();
mysql_query("INSERT INTO " .$tablepre. "members (username, password, gender, adminid, groupid, regip, regdate, lastvisit, lastactivity, postnum, credit, email, tpp, ppp, styleid, dateformat, timeformat, showemail, newsletter, timeoffset)
VALUES ('$forum_nick', '".md5($password)."', '0', '0', '10', 'Manual Acting', '$timestamp', '$timestamp', '$timestamp', '0', '0', '$email_address', '0', '0', '0', '{$_DCACHE[settings][dateformat]}', '{$_DCACHE[settings][timeformat]}', '1', '1', '{$_DCACHE[settings][timeoffset]}')");
mysql_close();
}
}
?>
if($forum_nick!='') {
require(DIR_WS_DISCUZ . 'config.php');
mysql_connect($dbhost, $dbuser, $dbpw);
mysql_select_db($dbname);
$query = mysql_query("SELECT COUNT(*) FROM " .$tablepre. "members WHERE username='$forum_nick'");
if(mysql_result($query, 0)) {
mysql_close();
} else {
$timestamp = time();
mysql_query("INSERT INTO " .$tablepre. "members (username, password, gender, adminid, groupid, regip, regdate, lastvisit, lastactivity, postnum, credit, email, tpp, ppp, styleid, dateformat, timeformat, showemail, newsletter, timeoffset)
VALUES ('$forum_nick', '".md5($password)."', '0', '0', '10', 'Manual Acting', '$timestamp', '$timestamp', '$timestamp', '0', '0', '$email_address', '0', '0', '0', '{$_DCACHE[settings][dateformat]}', '{$_DCACHE[settings][timeformat]}', '1', '1', '{$_DCACHE[settings][timeoffset]}')");
mysql_close();
}
}
?>
修改create_account.php
查找
require('includes/application_top.php');
在后面添加以下代码
require('discuz.php');
查找
$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
在这段代码上面加入以下代码
tep_db_connect();
查找
<tr>
<td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
<td class="main"><?php echo tep_draw_input_field('email_address') . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
</tr>
<td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
<td class="main"><?php echo tep_draw_input_field('email_address') . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
</tr>
在后面添加以下代码
<tr>
<td class="main"><?php echo ENTRY_FORUM_NICK; ?></td>
<td class="main"><input type="text" name="forum_nick"></td>
</tr>
<td class="main"><?php echo ENTRY_FORUM_NICK; ?></td>
<td class="main"><input type="text" name="forum_nick"></td>
</tr>
查找
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
在后面添加以下代码
$forum_nick = $HTTP_POST_VARS['forum_nick'];
修改chinese.php
添加以下代码
define('ENTRY_FORUM_NICK', '论坛昵称:');
define('HEADER_TITLE_FORUM', '用户论坛');
define('HEADER_TITLE_FORUM', '用户论坛');
新建forum.php
<?php require('includes/application_top.php'); ?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<!-- body_text //-->
<td width="100%" valign="top">
<iframe src="/discuz25f/" name="forum" frameborder="0" id="forum"style="possition:absolute; border: 0px; left:2px; top:0px; width:100%; height:1000px"></iframe>
</td>
<!-- body_text_eof //-->
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<!-- body_text //-->
<td width="100%" valign="top">
<iframe src="/discuz25f/" name="forum" frameborder="0" id="forum"style="possition:absolute; border: 0px; left:2px; top:0px; width:100%; height:1000px"></iframe>
</td>
<!-- body_text_eof //-->
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
修改filenames.php
添加以下代码
define('FILENAME_FORUM', 'forum.php');
如果想把连接放在header.php
查找
<td align="right" class="headerNavigation">
在后面添加以下代码
<?php echo '<a href="' . tep_href_link(FILENAME_FORUM) . '">' . HEADER_TITLE_FORUM . '</a>'; ?> |
如果想把连接放在information.php
查找
'<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
在后面添加以下代码
'<a href="' . tep_href_link(FILENAME_FORUM) . '">' . HEADER_TITLE_FORUM . '</a>') .
感谢radnows分享.
Tags:
[...] 这里贴出的是IPB 2.0.4的连接代码,步骤及相关修改参考“OSC与Discuz2.5F的整合代码 ” [...]
[...] 这里贴出的是phpwind2.0的连接代码,步骤及相关修改参考“OSC与Discuz2.5F的整合代码” [...]
[...] 这里贴出的是SMF的连接代码,步骤及相关修改参考“OSC与discuz2.5f的整合代码及其步骤” [...]
[...] 这里贴出的是vbulletin的连接代码,步骤及相关修改参考“OSC与discuz2.5f的整合代码及其步骤” [...]
大大,
能不能修改程序,以便能適用於discuz 4.1
先謝謝大大