dedecms 发文章 插入discuz x2 代码

dedecms

2011-10-22 15:04

找到后台

archives_add.php

此代码可以放在 $wintitle = '成功发布文档!';    300行上面。

 

PS:dedecms  和 dxmemo 在2个不同的库。切有权限访问.

 

//---------------------------------------------------------------------------------------------------------------------------------------

$title="$title";              //标题
$fid=41;                                       //版块
$uid=1;                                        //发帖人ID
$uname='admin';                                //发帖人
$time=time();                                  //发帖时间
$content=$content;    //内容
$ip='127.0.0.1';                               //IP
$views=rand(0,100);                            //浏览次数
$htmlon=1;                                     // 是否支持HTML 1是支持

 

$db->ExecuteNoneQuery("INSERT INTO dxdemo.`pre_forum_thread` ( `fid`, `posttableid`, `typeid`, `sortid`, `readperm`, `price`, `author`, `authorid`, `subject`, `dateline`, `lastpost`, `lastposter`, `views`, `replies`, `displayorder`, `highlight`, `digest`, `rate`, `special`, `attachment`, `moderated`, `closed`, `stickreply`, `recommends`, `recommend_add`, `recommend_sub`, `heats`, `status`, `isgroup`, `favtimes`, `sharetimes`, `stamp`, `icon`, `pushedaid`, `cover`, `replycredit`) VALUES  ( $fid, 0, 0, 0, 0, 0, '$uname', $uid, '$title', $time, $time, '$uname', $views, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, -1, -1, 0, 0, 0)");//插入主题

$tid=$db->GetLastID();


$db->ExecuteNoneQuery("INSERT INTO dxdemo.`pre_forum_post` ( `fid`, `tid`, `first`, `author`, `authorid`, `subject`, `dateline`, `message`, `useip`, `invisible`, `anonymous`, `usesig`, `htmlon`, `bbcodeoff`, `smileyoff`, `parseurloff`, `attachment`, `rate`, `ratetimes`, `status`, `tags`, `comment`, `replycredit`) VALUES  ($fid, $tid, 1, '$uname', $uid, '$title', $time, '$content', '$ip', 0, 0, 1, $htmlon, -1, -1, 0, 0, 0, 0, 0, '', 0, 0)"); //插入内容
$pid=$db->GetLastID();

 

$db->ExecuteNoneQuery("INSERT dxdemo.pre_forum_post_tableid (pid) values ('$pid')");//必要更新
$db->ExecuteNoneQuery("UPDATE dxdemo.pre_forum_forum SET threads=threads+1,posts=posts+1,todayposts=todayposts+1,lastpost='$pid $title $time $uname' WHERE fid='$fid'");//更新板块数量
$db->ExecuteNoneQuery("UPDATE dxdemo.pre_common_member_count SET posts=posts+1 WHERE uid='$uid'");  //更新发帖数量
$db->ExecuteNoneQuery("UPDATE dxdemo.pre_common_member_status SET lastip='$ip',lastvisit='$time',lastactivity='$time',lastpost='$pid $title $time $uname' WHERE uid='$uid'");   //更新个人状态

// $tid;  是论坛帖子值 可以dede插入数据 链接相关内容。 

//---------------------------------------------------------------------------------------------------------------------------------------