-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwikilist.php
More file actions
65 lines (59 loc) · 1.66 KB
/
wikilist.php
File metadata and controls
65 lines (59 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
// This allows users to view all wikis within the platform.
// Please Note option in the future to allow editing is comming soon.
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: login.php");
exit;
}
// Include config file
require_once "config.php";
// Pull the information from the database
$sql = "SELECT * FROM wikis";
$stmt = mysqli_prepare($link, $sql);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
// Processing form data when form is submitted
if($_SERVER["REQUEST_METHOD"] == "POST"){
echo $_POST["id"];
}
?>
<!DOCTYPE html>
<?php include_once("menu.php");?>
<html lang="en">
<head>
<title>Wiki List - MWAdmin</title>
</head>
<body>
<div class="content">
<h2>View wikis below</h2>
<table border="3" width="100%">
<tr>
<td>Wiki ID</td>
<td>Wiki Name</td>
<td>Wiki folder</td>
<td>Wiki Admin User</td>
<td>Wiki Admin Email</td>
<td>Edit Wiki info</td>
</tr>
<?php while($row = mysqli_fetch_array($result)){ ?>
<tr>
<td><?=$row['id']?></td>
<td><?=$row['wikiname']?></td>
<td><?=$row['wikifolder']?></td>
<td><?=$row['admin']?></td>
<td><?=$row['adminemail']?></td>
<td><form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<input type="hidden" name="id" value="<?php echo $row['id'];?>">
<input type="submit" class="btn btn-primary" value="Edit Wiki"></form></td>
</tr>
<?php } ?>
</table>
<?php
mysqli_stmt_close($stmt);
mysqli_close($link); ?>
</div>
</body>
</html>