首页 > 编程 > Discuz

Discuz数据库调用:DZ雷竞技官网dota调用常用代码手册

admin Discuz 2021-05-29 21:42:32 0 0


1.登录
  1. <a href="&rvpu;nfncfs.qiq?npe=mphhjoh&bnq;bdujpo=mphjo&rvpu;" onClick="showWindow('login', this.href);return false;" title="登录">登录</a>

2.注册
  1. <a href="&rvpu;nfncfs.qiq?npe=sfhjtufs&rvpu;" title="立即注册">立即注册</a>

3.忘记密码]
  1. <a href="javascript:;" onClick="showWindow('login', 'member.php?mod=logging&action=login&viewlostpw=1')" title="找回密码">找回密码</a>

4.购买邀请码
  1. misc.php?mod=buyinvitecode

5.JS跳转
  1. onclick="window.location.href="ipnf.qiq?npe=npcjmf&bnq;ep=gsjfoe";"

6.JS更换class的名称
  1. document.getElementById('idname').className='a';
  2. document.getElementById('idname').style.display='block';
  3. document.getElementById("idname").style.marginTop="30px";

7.批量替换超链接
  1. href="&rvpu;[^&rvpu;]*&rvpu;

8.过滤DZ代码:
  1. preg_replace ("/\[[a-z][^\]]*\]|\[\/[a-z]+\]/i",'',preg_replace("/\[attach\]\d+\[\/attach\]/i",'',$message));


9.调用单个数据
  1. $qishi = DB::result(DB::query("SELECT qi FROM ".DB::table('jiangchi')." WHERE id = '1'"));


10.调用统计数据
  1. $qishi = DB::result(DB::query("SELECT count(*) FROM ".DB::table('jiangchi')." WHERE id = '1'"));

11.单数据表调用
  1. $perpage = 20;
  2. $curpage = empty ( $_GET['page'] ) ? 1 : intval ( $_GET['page'] );
  3. $start = ($curpage-1)*$perpage;
  4. $askcount = DB::result(DB::query("SELECT COUNT(*) FROM ".DB::table('forum_thread')." WHERE fid = '2' AND authorid > 1 AND FROM_UNIXTIME(dateline, '%Y%m%d') = '$jintian'"));
  5. //$asklist
  6. $asklist = array();
  7. if ($askcount) {
  8. $query = DB::query("SELECT * FROM ".DB::table('forum_thread')." WHERE fid = '2' AND displayorder > -1 ORDER BY tid ASC LIMIT $start,$perpage");
  9. while ($value = DB::fetch($query)) {
  10. $asklist[] = $value;
  11. }
  12. }
  13. $multi = multi($askcount, $perpage, $curpage, "portal.php?mod=topic&topic=ask");

12.多数据表调用
  1. $perpage = 40;
  2. $curpage = empty ( $_GET['page'] ) ? 1 : intval ( $_GET['page'] );
  3. $start = ($curpage-1)*$perpage;
  4. $acount = DB::result(DB::query("SELECT count(*) FROM ".DB::table('forum_forum')." b LEFT JOIN ".DB::table('forum_forumfield')." bf ON bf.fid=b.fid WHERE b.type='sub' AND b.status = 3 AND bf.icon != ''"));
  5. //$alist
  6. $alist = array();
  7. if ($acount) {
  8. $query = DB::query("SELECT bf.*, b.* FROM ".DB::table('forum_forum')." b LEFT JOIN ".DB::table('forum_forumfield')." bf ON bf.fid=b.fid WHERE b.type='sub' AND b.status = 3 AND bf.icon != '' ORDER BY bf.shoplevel DESC, b.commoncredits DESC, bf.fid DESC LIMIT $start,$perpage");
  9. while ($value = DB::fetch($query)) {
  10. $alist[] = $value;
  11. }
  12. }
  13. $multi = multi($acount, $perpage, $curpage, "这里填写跳转地址");

13.前台数据显示
  1. <!--{loop $alist $key $value}-->
  2. <!--{eval $tupianfm = DB::result(DB::query("SELECT attachment FROM ".DB::table('forum_threadimage')." WHERE tid = '$value[tid]'"));}-->
  3. $value[authorid]
  4. <!--{/loop}-->

14.取数据表中符合条件的第一条数据
  1. $app=array();
  2. $app=DB::fetch_first("select * from ".DB::table('home_diy_center')." where id='{$id}'");


15.人性化时间戳
  1. <!--{echo dgmdate(这里填写时间参数, 'u', '9999', getglobal('setting/dateformat'))}-->
  2. <!--{echo date("Y-m/d H:i:s",这里填写时间参数)}-->


16.截取字符字数
  1. <!--{echo cutstr(这里填写参数,40)}-->

17.过滤DISCUZ代码
  1. preg_replace ("/\[[a-z][^\]]*\]|\[\/[a-z]+\]/i",'',preg_replace("/\[attach\]\d+\[\/attach\]/i",'',$message));

18.写入数据库
  1. if(submitcheck('tijiao')) {
  2. $setarr = array(
  3. 'tid' => $_GET['topicid'],
  4. 'name' => $_POST['name'],
  5. 'position' => $_GET['position'],
  6. 'dateline' => $_G['timestamp'],
  7. );
  8. DB::insert('forum_poststick', $setarr, 1);
  9. $query = DB::query("UPDATE ".DB::table('forum_thread')." SET stickreply='1'
  10. WHERE tid='$tid'");
  11. $query = DB::query("DELETE FROM ".DB::table('forum_post')." WHERE pid='$pid'");
  12. showmessage('成功的提示信息', "forum.php?mod=viewthread&tid=$tid");
  13. }

19.表单提交:
  1. <form action="do.php?op=jiangchi&con=yes" method="post" autocomplete="off">
  2. <input type="hidden" value="{FORMHASH}" name="formhash" />
  3. 最低奖金:<input name="qi" type="text" value="$qishi" /> 
  4. 最高奖金:<input name="end" type="text" value="$zhzh" />  
  5. <button value="true" name="tijiao" type="submit">提交设置</button>
  6. <input type="hidden" name="tijiao" value="true" />
  7. </form>

20.以下两个时间格式是对等关系
  1. date("Ymd",time()); 20150212
  2. FROM_UNIXTIME(dateline, '%Y%m%d')
前者用于PHP,后者用于数据库调用的字段的格式化
21.调用图片附件
  1. <!--{eval $biaoid = substr($value[tid], -1); $cover = DB::result(DB::query("SELECT attachment FROM ".DB::table('forum_attachment_'.$biaoid.'')." WHERE tid = '$value[tid]'"));}-->

22.数据库循环嵌套调用
  1. <!--{eval $slides = DB::fetch_all("SELECT * FROM ".DB::table('a')." WHERE `uid`= $_G[uid] ORDER BY `id` DESC");}-->
  2. <!--{loop $slides $slide}-->
  3. $slide[name]
  4. <!--{/loop}-->

23.ucenter无法登录:
  1. 打开uc_server/model/admin.php
  2. 找到第22行的
  3. $this->cookie_status = 0;
  4. 改成
  5. $this->cookie_status = isset($_COOKIE['sid']) ? 1 : 0;

24.无刷新切换li雷竞技官方app下载安卓版并且同时加载框架页面:
  1. <script type="text/javascript">
  2. var jq = jQuery.noConflict();
  3. jq(function(){
  4. jq("#changemenu>li").mouseover(function(){
  5. jq("#changemenu>li").each(function(i){
  6. jq(this).removeClass("current");
  7. });
  8. jq(this).addClass("current");
  9. document.getElementById("changenr").innerHTML='<iframe src="chart.php?op=index&id='+jq(this).attr('dataid')+'" height="350" width="1070" frameborder="0" scrolling="no"></iframe>';
  10. }).mouseout(function(){
  11. jq(this).addClass("current");
  12. });
  13. });
  14. </script>
  15. <ul id=“changemenu”>
  16. <li class=“current” dataid=“1”></li>
  17. <li dataid=“2”></li>
  18. </ul>
  19. <div id=“changenr”></div>

25.快速发帖
  1. <a href="&rvpu;gpsvn.qiq?npe=njtd&bnq;bdujpo=obw&rvpu;" onclick="showWindow('nav', this.href, 'get', 0);">发布新话题</a>

26.常用词汇
  1. select 选择
  2. count 总数
  3. table 表
  4. where 条件
  5. result 结果
  6. perpage 每页
  7. curpage 当前页
  8. update 更新
  9. delete 删除
  10. insert 写入
  11. dateline 日期
  12. time 时间
  13. echo 输出 <?php echo '123'; ?>
  14. multi 分页函数
  15. if 如果
  16. else 否则
  17. elseif
  18. start 起始
  19. limit 限制 limit 10
  20. DESC 倒序
  21. ASC 正序












版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。

本文(共有 0 条评论)

评论