Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
//This page displays the list of the forum's categories
include('config.php');
if(!isset($_SESSION['username']))
{
?>
<div class="box_login">
<?php header("location:login.php?msg=Login First to use service"); //zubair ?>
</div>
<?php
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>WCMS</title>
<style>
.dropbtn {
background-color: #000000;
color: white;
padding: 16px;
font-size: 16px;
border-radius:10px;
border: none;
cursor: pointer;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
right: 0;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #f1f1f1;}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
</style>
</head>
<body>
<div align="center">
<div class="header" style="width: 100%;margin: auto;margin-top:10px">
<a href="<?php echo $url_home; ?>"><img width="80%" src="<?php echo $design; ?>/images/logo.png" alt="Water Conservation Management System " /></a>
<!--/images/logo.png -->
</div>
<div align="center" class="header" style="width: 100%;margin: auto;margin-top:10px">
<marquee>Announcement:
<?php
$ann = mysqli_query($var,'select notice from announcement');
while($notice = mysqli_fetch_array($ann))
{
$notice = $notice['notice'];
echo $notice;
}
?>
</marquee>
</div>
</div>
<div class="contentusers">
<?php
if(isset($_SESSION['username']))
{ // Salman
$nb_new_pm = mysqli_fetch_array(mysqli_query($var,'select count(*) as nb_new_pm from pm where ((user1="'.$_SESSION['userid'].'" and user1read="no") or (user2="'.$_SESSION['userid'].'" and user2read="no")) and id2="1"'));
$nb_new_pm = $nb_new_pm['nb_new_pm'];
?>
<div class="box">
<div class="box_left">
<b><a href="<?php echo $url_home; ?>">WCSF Index</a></b>
</div>
<div class="box_right">
<a href="list_pm.php">Your messages(<?php echo $nb_new_pm; ?>)</a> - <a href="profile.php?id=<?php echo $_SESSION['userid']; ?>"><?php echo htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8'); ?></a> (<a href="login.php">Logout</a>)
</div>
<div class="clean"></div>
</div>
<?php
}
else
{
?>
<div class="box">
<div class="box_left">
<a href="<?php echo $url_home; ?>"> <b>WCSF Index</b></a>
</div>
<div class="box_right">
<a href="signup.php"> <b>Sign Up</b></a> - <a href="login.php"> <b>Login </b></a>
</div>
<div class="clean"></div>
</div>
<?php
}
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<a href="new_category.php" class="button">New Category</a>
<?php
}
?>
<table class="categories_table">
<tr>
<th class="forum_cat">Category</th>
<th class="forum_ntop">Topics</th>
<th class="forum_nrep">Replies</th>
<?php
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<th class="forum_act">Action</th>
<?php
}
?>
</tr>
<?php
$dn1 = mysqli_query($var,'select c.id, c.name, c.description, c.position, (select count(t.id) from topics as t where t.parent=c.id and t.id2=1) as topics, (select count(t2.id) from topics as t2 where t2.parent=c.id and t2.id2!=1) as replies from categories as c group by c.id order by c.position asc');
$nb_cats = mysqli_num_rows($dn1);
while($dnn1 = mysqli_fetch_array($dn1))
{
?>
<tr>
<td class="forum_cat"><a href="list_topics.php?parent=<?php echo $dnn1['id']; ?>" class="title"><?php echo htmlentities($dnn1['name'], ENT_QUOTES, 'UTF-8'); ?></a>
<div class="description"><?php echo $dnn1['description']; ?></div></td>
<td><?php echo $dnn1['topics']; ?></td>
<td><?php echo $dnn1['replies']; ?></td>
<?php
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<td><a href="delete_category.php?id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/images/delete.png" alt="Delete" /></a>
<?php if($dnn1['position']>1){ ?><a href="move_category.php?action=up&id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/images/up.png" alt="Move Up" /></a><?php } ?>
<?php if($dnn1['position']<$nb_cats){ ?><a href="move_category.php?action=down&id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/images/down.png" alt="Move Down" /></a><?php } ?>
<a href="edit_category.php?id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/images/edit.png" alt="Edit" /></a>
</td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
if(isset($_SESSION['username']) and $_SESSION['username']!=$admin)
{
?>
</div>
<div class="contentusers">
<div class="box">
<div class="box_left">
<b>Water Usage & Billing Information</b>
</div>
<div class="box_right">
<div class="dropdown" style="float:right;">
<button class="dropbtn">Turn Valve</button>
<div class="dropdown-content">
<a href="valve_value.php?value=1" name="valve_value" id="valve_value" value=True>On</a>
<a href="valve_value.php?value=0" name="valve_value" id="valve_value" value=False>Off</a>
</div>
</div>
</div>
<div class="clean"></div>
</div>
<table>
<tr>
<td><br><a href="consumption.php"><b>Daily Usage</b></a><br/><br> </td>
<td><br><b><a href="chart.php">Weekly Usage</a></b></b><br><br> </td>
<td> <br><b><a href="monthly.php">Monthly Usage</a></b><br/><br> </td>
<td> <br><b><a href="prediction.php">Usage Prediction</a></b><br/><br> </td>
<td><b><a href="users_bill.php"> Billing Info</a></b> </td>
<!-- <td> <br/><p><b><a href="#" onclick="valueHide()"><span id="hide"> Hide Bill</span></a></b></p></td> -->
</tr>
</table>
<?php }
else
{
?>
</div>
<div class="contentusers">
<div class="box">
<div class="box_left">
<b>Water Usage & Billing Information</b>
</div>
<div class="clean"></div>
</div>
<table>
<tr>
<td> <br/><p> <b><a href="users_consumption.php">Users Monthly Usage</a></b></p> </td>
<td> <br/><p><b><a href="users_bill.php">Users Bills</a></b></p></td>
<td> <br/><p><b><a href="users.php">Users Detail</a></b></p></td>
<td> <br/><p><b><a href="new_user_list.php">SignUp Request</a></b></p></td>
<!-- <td> <br/><p><b><a href="#" onclick="valueHide()"><span id="hide"> Hide Bill</span></a></b></p></td> -->
<?php } ?>
</tr>
</table>
</div>
</div>
<!-- <div class="foot">
<p><b>Water Control System and Discussion Portal for Farmers</b></p>
</div> -->
</body>
</html>