php - 如果用户登录 php,导航栏按钮排序
问题描述
嗨谢谢你帮助我我有一个导航栏和登录和注册按钮如果用户登录我想隐藏这些按钮我正在用 PHP 编写请帮助我
这些是我的导航栏和登录信息代码
<header class="navbar navbar-expand-lg bg-gradient-default p-2 navbar-expand navbar-dark flex-row align-items-md-center ct-navbar bg-primary py-2">
<a class="navbar-brand text-white" href="/"><img style="width:150px; height: 60px;" src="arodanalandscape.png" class="radius-10 shadow-sm"
width="100"></a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
</div>
<!-- <a style="font-family:'Droid-Arabic-Kufi';" href="team.php" class="btn btn-secondary my-2 my-sm-0"><i
class="fal fa-terminal ml-2"></i>تیمەکەمان</a>-->
<a style="font-family:'Droid-Arabic-Kufi';" href="login-user.php" class="btn btn-gradient-warning btn-round my-2 my-sm-0 text-white"><i
class="fal fa-sign-in-alt ml-2"></i> چونەژورەوە </a>
<a style="font-family:'Droid-Arabic-Kufi';" href="signup-user.php" class="btn btn-info mr-3 my-2 my-sm-0"><i
class="fal fa-user-plus ml-2"></i> خۆتۆمارکردن</a>
<div class="dropdown ">
<button style="font-family: 'Montserrat', sans-serif;" class="btn btn-gradient-secondary my-2 my-sm-0" type="button" id="multiDropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" /> <i class="fas fa-cogs"></i> <strong class="center"> <?php echo $fetch_info['name'] ?> <img style="width:40px; height:40px;" class="img-fluid rounded shadow card-img-top" src= <?php echo $fetch_info['picture'] ?>>
<div class="ripple-container mr-3"></div></button>
<div class="dropdown-menu" aria-labelledby="multiDropdownMenu">
<a style="background-color: #e63946; " class="btn-danger text-white dropdown-item mr-3" href="logout-user.php">Logout</a>
<a style="background-color: #457b9d; " class="text-white dropdown-item mr-3" href="profile-user.php">Profile</a>
</div>
</div>
</div>
<!-- <a href="" class=" btn btn-success my-2 my-sm-0 "><i class="fas fa-user"></i> <strong class="center"> <?php echo $fetch_info['name'] ?> <img style="width:40px; height:40px;" class="rounded-circle card-img-top" src= <?php echo $fetch_info['picture'] ?> > </a>
-->
</nav>
</header>
这是我的登录代码
require_once "controllerUserData.php"; $email = $_SESSION['email']; $password = $_SESSION['password']; if($email != false && $password != false){
$sql = "SELECT * FROM usertable WHERE email = '$email'";
$run_Sql = mysqli_query($con, $sql);
if($run_Sql){
$fetch_info = mysqli_fetch_assoc($run_Sql);
$status = $fetch_info['status'];
$code = $fetch_info['code'];
if($status == "verified"){
if($code != 0){
header('Location: reset-code.php');
}
}else{
header('Location: user-otp.php');
}
} }else{
header('Location: login-user.php'); } ?>
解决方案
代替...
<a style="font-family:'Droid-Arabic-Kufi';" href="login-user.php" class="btn btn-gradient-warning btn-round my-2 my-sm-0 text-white"><i
class="fal fa-sign-in-alt ml-2"></i> چونەژورەوە </a>
<a style="font-family:'Droid-Arabic-Kufi';" href="signup-user.php" class="btn btn-info mr-3 my-2 my-sm-0"><i
class="fal fa-user-plus ml-2"></i> خۆتۆمارکردن</a>
和...
假设您在用户已经登录的情况下$loggedon
设置了一个变量TRUE
<?php
if(!$loggedon){
echo <<<EOT
<a style="font-family:'Droid-Arabic-Kufi';" href="login-user.php" class="btn btn-gradient-warning btn-round my-2 my-sm-0 text-white"><i
class="fal fa-sign-in-alt ml-2"></i> چونەژورەوە </a>
<a style="font-family:'Droid-Arabic-Kufi';" href="signup-user.php" class="btn btn-info mr-3 my-2 my-sm-0"><i
class="fal fa-user-plus ml-2"></i> خۆتۆمارکردن</a>';
EOT;
}
?>
推荐阅读
- ios - 带有标题和图像的 UIButton,系统选择的背景不包括图像
- android - 关于移动应用方案深度链接的问题
- android - 向 Android 设备发送数据 向 IOS 设备发送通知
- angular - 如何在 Angular 6 中使用全局组件
- macos - 从 mac 使用 EWS 托管 API 2.2 连接到 Exchange Web Server (EWS)
- esper - Esper EPL - 在定时窗口中区分已删除事件和已发布事件
- django - Django 在分区表上保存和更新速度变慢,但查询速度要快得多
- html - 有没有办法在不生成 type=submit 的情况下使用 a4j:commandButton?
- sql - 在sql中对varchar进行排序和排序
- autodesk-forge - 为网站上的产品创建 3d 查看器和配置器