向discuz里填充数据
好像是 discuz 6.0
迫于老板的需求 要给公司论坛发帖 好吧 程序灌水
需要 开启 pdo
1 <?php 2 set_time_limit(0); 3 /*************************** 4 向discuz里灌水帖子 by:Lucky (utf8) 5 addToDiscuz.class.php 6 2011-7-2 7 ***************************/ 8 function addToDiscuz($subject = "哈dd哈哈",$message = "[table=0][tr][td]游戏介绍:又一个国人制作的精彩CS,只要你喜欢CS,一定会喜欢它的。[/td][/tr][/table]"){ 9 //分类id 10 $fid = 30; 11 //发帖人 12 $author = "竹子"; 13 //发帖人id 14 $authorid = 25; 15 //标题 16 // $subject = "哈哈哈"; 17 //发帖时间 18 $dateline = "1309317569"; 19 //更新时间 20 $lastpost = "1309317569"; 21 //最新更新者 22 $lastposter = "竹子"; 23 //是否第一篇 24 $first = 1; 25 //帖子内容 26 // $message = "[table=0][tr][td]游戏介绍:又一个国人制作的精彩CS,只要你喜欢CS,一定会喜欢它的。[/td][/tr][/table]"; 27 //发帖者ip 28 $useip = "127.0.0.1"; 29 $smileyoff = -1; 30 31 $pdo = new PDO("mysql:host=127.0.0.1;dbname=forum_XXXXX_com;port=3306","root","mima",array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); 32 $pdo->exec("insert into forum_threads (fid, author, authorid, subject, dateline, lastpost, lastposter, recommends, recommend_add, recommend_sub) values ($fid, '$author', $authorid, '$subject', $dateline, $lastpost, '$lastposter','0','0','0')"); 33 //帖子id 34 $tid = $pdo->lastInsertId(); 35 $pdo->exec("insert into forum_posts (fid, tid, first, author, authorid, subject, dateline, message, useip, smileyoff) values ($fid, $tid, $first, '$author', $authorid, '$subject', '$dateline', '$message', '$useip', '$smileyoff')"); 36 //发帖人id 37 $uid = $authorid; 38 $pdo->exec("insert into forum_favoritethreads (tid, uid, dateline) values ($tid, $uid, $dateline)"); 39 40 echo $tid; 41 } 42 addToDiscuz(); 43 ?>
就是这三个倒霉的孩子
【话说 这个网站有bug 我上传图片后 居然死翘翘了 还得重新上传下图】