zoukankan      html  css  js  c++  java
  • discuz系统整合,外部调用登陆和会员信息

    本方法主要是在静态htm文件引入动态php,输出到页面:

    在论坛根部新建文件login.php

    //引入discuz核心初始化类
    require './source/class/class_core.php';
    $discuz = C::app();
    $discuz->init();
    
    //判断用户登陆
    <?php  if (empty($_G['uid'])) {?>
    
    document.writeln("<form action="<?php echo $_G['siteurl']; ?>member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes" method="post" name="form2" onSubmit="return check()" >");
    document.writeln("<div class="login_un">");
    document.writeln("<input class="u_t" name="username" type="text" value="" > ");
    document.writeln("<input class="s_t" type="submit" name="sub" value="登录" ><span>|</span><a class="index_reg" href="<?php echo $_G['siteurl']; ?>member.php?mod=register">注册</a> ");
    document.writeln("</div>");
    
    document.writeln("<div class="login_up" >");
    document.writeln("<input class="u_t" type="password" name="password" > <a href="<?php echo $_G['siteurl']; ?>member.php?mod=logging&action=login&viewlostpw" style="padding-left:16px;">找回密码</a> ");
    document.writeln("</div>");
    
       
    <?php } else { ?>
    
    document.writeln("<div class="status_user">欢迎您:<a href=<?php echo $_G['siteurl']; ?>home.php?mod=space&uid=<?php echo $_G['uid']; ?> class="yellow"><?php echo  $_G['username']; ?></a> ");
    document.writeln("<a href=<?php echo $_G['siteurl']; ?>home.php?mod=spacecp>设置</a> ");
    document.writeln("<a href=<?php echo $_G['siteurl']; ?>home.php?mod=space&do=pm>消息</a> ");
    document.writeln("<a href=<?php echo $_G['siteurl']; ?>home.php?mod=space&do=notice>提醒</a> ");
    
    document.writeln("<a href=<?php echo $_G['siteurl']; ?>forum.php?mod=guide&view=my>我的帖子</a> ");
    document.writeln(" <a href=<?php echo $_G['siteurl']; ?>home.php>个人中心</a> ");
    document.writeln(" <a href=<?php echo $_G['siteurl']; ?>member.php?mod=logging&action=logout&formhash=<?php echo FORMHASH;?>>退出登陆</a></div>");
    
    <?php }?>

      引入文件即可:  <script src="http://www.XXX.com/bbs/login.php" type="text/javascript"></script>

  • 相关阅读:
    巧用border效果
    移动端页面无刷新跳转方法有三种
    word-break和word-wrap的使用和区别
    动态获取移动端视宽,从而结合rem达到适配
    一步一步学习IdentityServer4 (3)自定登录界面并实现业务登录操作
    一步一步学习IdentityServer3 (15) 授权模式那些事
    一步一步学习IdentityServer4 (2) 开始一个简单的事例
    一步一步学习IdentityServer4 (1) 概要配置说明
    Owin 自定义中间件(2)中间件进阶
    一步一步学习IdentityServer3 (14) 启用Https
  • 原文地址:https://www.cnblogs.com/swinm/p/3389715.html
Copyright © 2011-2022 走看看