1

我基本上是在我制作的 Bootstrap 网站上工作。我连接了我的论坛 (MyBB),这样我就可以通过我的网站登录。
现在的问题是,由于我仍然习惯于 PHP,我一直在尝试用用户名替换登录文本,以及使用注销或断开连接进行注册。

这是到目前为止的样子:

这是到目前为止的样子

这就是我想要实现的目标:

这就是我想要实现的

还获取论坛头像并将其显示在栏上

这是我的表格:

<?php

    if($mybb->user['uid'])
    {
        // If the user if logged in, display a welcoming message.
        echo "<div class='welcome-msg'>Welcome back ".$mybb->user['username']."!<br /></div>";
        echo "<div class='warning'>Log out.";
    }
    else
    {
        // If the user is not logged in, display the login form.
        echo "<form action='forums/member.php' method='post'>";
        echo "<input type='hidden' name='action' value='do_login' />";
        echo "<input type='hidden' name='url' value='../index.php' />";
        echo "<input id='user_username' placeholder='Username' type='text' name='username' maxlength='30' /><br />";
        echo "<input id='user_password' placeholder='Password' type='password' name='password' /><br />";
        echo "<input class='btn btn-warning' style='clear: left; width: 100%; height: 32px; font-size: 13px;' type='submit' name='submit' value='Login' />";
        echo "</form>";
    }

?>

很明显,我并不是要求有人真正做到这一点。我只需要一些关于如何实现它的参考。(例如:使用什么类型)

4

1 回答 1

0

您正在使用引导程序,因此您需要修改导航栏/导航部分中的代码,if($mybb->user['uid'])如果用户已登录,只需使用 if/else 模式换出链接。您将能够为显示论坛图像等所需的数据库提取任何数据。如果您在标题中使用这些链接同样适用,只需修改您处理注册/登录的区域。

于 2014-04-28T04:18:12.253 回答