页面加载时,如何默认加载任何活动



下面是我的代码,用户成功登录后可以进入网站,但它显示为空,带有左右侧边栏我希望仪表板活动默认情况下在用户登录时加载。我该怎么做。

这是一个图书馆管理系统,用户可以借阅、编辑归还书籍,并记录所有历史。

<?php
session_start();
error_reporting(0);  
include("databaseConnection.php");
$username = $_SESSION['username'];
if($_REQUEST['activity'] == 'logout'){
$username = null;
$username ="";
unset($username);

$_SESSION['username'] = null;
$_SESSION['username'] ="";
unset($_SESSION['username']);

session_destroy();
}
if(empty($username)){
header("location: ../Index.php");
}
?>
<html>
<head>
</head>
<body>
<!--CONTAINER AREA  SECTION-->
<div class="containerHome">
<!--HEAD  SECTION-->
<div class="headSection">
<?php include("headSection.php"); ?>
</div>
<!--HEAD  SECTION-->
<div class="navSection">
<div class="welcomeTitle">Welcome</div>
<div class="tooltip">Contact Us
<span class="tooltiptext">
<b>Address:</b> Central Department Of Physics, Kirtipur<br>
<b>Phone:</b> 01-4331054
</span>
</div>
<div class="logoutLink"><a href="home.php?activity=logout">Logout</a></div>
</div>
<!--LEFT BAR  SECTION-->
<div class="leftSection">

<?php include("leftSection.php");?>
</div>
<!--LEFT BAR  SECTION-->
<!--CONTENT AREA  SECTION-->
<div class="contentSection">

<?php     
// CODE FOR PERFORMMING ACTIVITY..
$activity = $_REQUEST['activity'];
if($activity) {
if(isset($_POST['activity'])) {
include("dashboard.php");
}
if($activity) {
if($activity == 'addMember'){
include("addMember.php");
}
if($activity == 'dashboard'){
include("dashboard.php");
}

if($activity == 'issueBooks'){
include("issueBooks.php");
}

if($activity == 'returnBooks'){
include("returnBooks.php");
}   
if($activity == 'updateBook'){
$uBookId = $_REQUEST['uBookId'];
$return = mysql_num_rows(mysql_query("SELECT bookId From borrow Where bookId = '$uBookId'"));
if(empty($return)){

$query = mysql_query("SELECT bookId,title,author,price,publisher From books Where bookId = '$uBookId'");
$result = mysql_fetch_assoc($query);
?>

</div>
<!--CONTENT AREA  SECTION-->
<!--RIGHT AREA  SECTION-->
<div class="rightSection">

<?php include("rightSection.php");?>
</div>
<!--RIGHT AREA  SECTION-->
</div>
<!--CONTAINER AREA  SECTION-->
</body>
</html>

更改下方的代码

<?php     
// CODE FOR PERFORMMING ACTIVITY..
$activity = $_REQUEST['activity'];
if(isset($activity) || empty($activity)) {
include("dashboard.php");
}
else {
if($activity == 'addMember'){
include("addMember.php");
.............your code............

我的建议是不要使用$_REQUEST使用$_GET,$_POST。

最新更新