Andy's Blog » » OSC与vbulletin 3的整合代码

OSC与vbulletin 3的整合代码

这里贴出的是vbulletin的连接代码,步骤及相关修改参考“OSC与discuz2.5f的整合代码及其步骤

vbulletin.php代码

<?php
 
if($forum_nick!='') {
 
require(DIR_WS_VBULLETIN . 'includes/config.php');
 
function fetch_user_salt($length = 3)
{
$salt = '';
for ($i = 0; $i < $length; $i++)
{
$salt .= chr(rand(32, 126));
}
return $salt;
}
 
$timestamp = time();
 
mysql_connect($servername, $dbusername, $dbpassword);
 
mysql_select_db($dbname);
 
$query = mysql_query("SELECT COUNT(*) FROM " . $tableprefix . "user WHERE username='$forum_nick'");
 
if(mysql_result($query, 0)) {
 
mysql_close();
 
} else {
 
$salt = fetch_user_salt(3);
 
mysql_query("INSERT INTO " . $tableprefix . "user (username, salt, password, email, joindate, lastvisit, lastactivity, usergroupid, displaygroupid, passworddate, options, showvbcode, usertitle, timezoneoffset)
VALUES ('
" . addslashes($forum_nick) . "', '" . addslashes($salt) . "', '" . addslashes(md5(md5($password) . $salt)) . "', '" . addslashes($email_address) . "', '$timestamp', '$timestamp', '$timestamp', '2', '2', 'NOW()', '1711', '1', '', '8')
");
 
$userid = mysql_insert_id();
 
mysql_query("INSERT INTO " . $tableprefix . "userfield (userid) VALUES ('$userid')");
 
mysql_query("INSERT INTO " . $tableprefix . "usertextfield (userid) VALUES ('$userid')");
 
mysql_close();
 
}
 
}
 
?>

感谢radnows分享.

Tags:

本文地址: http://www.21andy.com/new/20050831/37.html