@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 16 | - if(isset($_SESSION['user'])) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | + if (isset($_SESSION['user'])) { |
|
| 17 | 17 | $target_dir = __DIR__ . "/images/"; |
| 18 | 18 | $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); |
| 19 | 19 | $uploadOk = 1; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | echo 'file with the same name already exists<hr>'; |
| 24 | 24 | $uploadOk = 0; |
| 25 | 25 | } |
| 26 | - if($imageFileType != "gif" && $imageFileType != "png" && $imageFileType != "jpg" && $imageFileType != "jpeg") { |
|
| 26 | + if ($imageFileType != "gif" && $imageFileType != "png" && $imageFileType != "jpg" && $imageFileType != "jpeg") { |
|
| 27 | 27 | echo 'unsupported file type. must be .gif, .png, .jpg, or .jpeg<hr>'; |
| 28 | 28 | $uploadOk = 0; |
| 29 | 29 | } |
@@ -21,16 +21,16 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | <div class="container"> |
| 23 | 23 | <?php |
| 24 | - if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 25 | - if(!isset($_SESSION['user'])) { |
|
| 24 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 25 | + if (!isset($_SESSION['user'])) { |
|
| 26 | 26 | $error = "you are not logged in"; |
| 27 | 27 | goto skipcomment; |
| 28 | 28 | } |
| 29 | - if(!$_POST['comment']) { |
|
| 29 | + if (!$_POST['comment']) { |
|
| 30 | 30 | $error = "your comment cannot be blank"; |
| 31 | 31 | goto skipcomment; |
| 32 | 32 | } |
| 33 | - if(strlen($_POST['comment']) > 500) { |
|
| 33 | + if (strlen($_POST['comment']) > 500) { |
|
| 34 | 34 | $error = "your comment must be shorter than 500 characters"; |
| 35 | 35 | goto skipcomment; |
| 36 | 36 | } |
@@ -45,26 +45,26 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | skipcomment: |
| 47 | 47 | |
| 48 | - if(isset($_GET['id'])) { |
|
| 48 | + if (isset($_GET['id'])) { |
|
| 49 | 49 | $stmt = $conn->prepare("SELECT * FROM `groups` WHERE id = ?"); |
| 50 | 50 | $stmt->bind_param("i", $_GET['id']); |
| 51 | 51 | $stmt->execute(); |
| 52 | 52 | $result = $stmt->get_result(); |
| 53 | - if($result->num_rows === 0) echo('Group doesnt exist.'); |
|
| 54 | - while($row = $result->fetch_assoc()) { |
|
| 53 | + if ($result->num_rows === 0) echo('Group doesnt exist.'); |
|
| 54 | + while ($row = $result->fetch_assoc()) { |
|
| 55 | 55 | $id = $row['id']; |
| 56 | 56 | ?> |
| 57 | 57 | <img style='border: 1px solid white; width: 5em;' |
| 58 | - src='/pfp/<?php echo getPFP($row["author"], $conn);?>'> |
|
| 58 | + src='/pfp/<?php echo getPFP($row["author"], $conn); ?>'> |
|
| 59 | 59 | <span style='float: right;text-align: right;'> |
| 60 | - <a href='/viewgroup?id=<?php echo $row["id"];?>' style='color: gold;font-size:1.5em'> |
|
| 61 | - <?php echo $row['title'];?> |
|
| 60 | + <a href='/viewgroup?id=<?php echo $row["id"]; ?>' style='color: gold;font-size:1.5em'> |
|
| 61 | + <?php echo $row['title']; ?> |
|
| 62 | 62 | </a><br> |
| 63 | 63 | <small> |
| 64 | 64 | <i> |
| 65 | 65 | Created by |
| 66 | - <a href='/?id=<?php echo getID($row["author"], $conn);?>'> |
|
| 67 | - <?php echo $row['author'];?> |
|
| 66 | + <a href='/?id=<?php echo getID($row["author"], $conn); ?>'> |
|
| 67 | + <?php echo $row['author']; ?> |
|
| 68 | 68 | </a> |
| 69 | 69 | </i><br> |
| 70 | 70 | <?php echo $row['date']?> |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | $stmt->bind_param("i", $id); |
| 81 | 81 | $stmt->execute(); |
| 82 | 82 | $result = $stmt->get_result(); |
| 83 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 83 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 84 | 84 | $members = 0; |
| 85 | - while($row = $result->fetch_assoc()) { |
|
| 85 | + while ($row = $result->fetch_assoc()) { |
|
| 86 | 86 | $members++; |
| 87 | 87 | } |
| 88 | - echo "<span style='float:right;'><a href='/joingroup?id=" . $id. "'><button>Join</button></a></span>"; |
|
| 88 | + echo "<span style='float:right;'><a href='/joingroup?id=" . $id . "'><button>Join</button></a></span>"; |
|
| 89 | 89 | } else { |
| 90 | 90 | header("Location: viewgroups.php"); |
| 91 | 91 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | <hr> |
| 95 | 95 | <div> |
| 96 | 96 | <div class="left"> |
| 97 | - <?php if(isset($error)) {echo "<small style='color:red'>" . $error . "</small>";}?> |
|
| 97 | + <?php if (isset($error)) {echo "<small style='color:red'>" . $error . "</small>"; }?> |
|
| 98 | 98 | <h2>Comments</h2> |
| 99 | 99 | <?php if (isset($_SESSION['user'])) { ?> |
| 100 | 100 | <form method="post" enctype="multipart/form-data"> |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | $stmt->execute(); |
| 112 | 112 | $result = $stmt->get_result(); |
| 113 | 113 | |
| 114 | - while($row = $result->fetch_assoc()) { ?> |
|
| 114 | + while ($row = $result->fetch_assoc()) { ?> |
|
| 115 | 115 | <div class='commentRight' style='display: grid; grid-template-columns: 75% auto; padding:5px;'> |
| 116 | 116 | <div style="word-wrap: break-word;"> |
| 117 | 117 | <small><?php echo $row['date']; ?></small> |
| 118 | - <?php echo validateMarkdown($row['text']);?> |
|
| 118 | + <?php echo validateMarkdown($row['text']); ?> |
|
| 119 | 119 | </div> |
| 120 | 120 | <div> |
| 121 | 121 | <a style='float: right;' href='/?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a> |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | </div> |
| 128 | 128 | </div> |
| 129 | 129 | <div class="right"> |
| 130 | - <h2>Members (<?php echo $members;?>)</h2> |
|
| 130 | + <h2>Members (<?php echo $members; ?>)</h2> |
|
| 131 | 131 | <?php |
| 132 | 132 | $stmt = $conn->prepare("SELECT `username`, `id` FROM `users` WHERE `currentgroup` = ?"); |
| 133 | 133 | $stmt->bind_param("i", $id); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | echo "<ul>"; |
| 138 | 138 | while ($row = $result->fetch_assoc()) { |
| 139 | - echo "<li><a href='/?id=" . $row['id'] . "'>". $row['username'] . "</a></li>"; |
|
| 139 | + echo "<li><a href='/?id=" . $row['id'] . "'>" . $row['username'] . "</a></li>"; |
|
| 140 | 140 | } |
| 141 | 141 | echo "</ul>"; |
| 142 | 142 | ?> |
@@ -50,7 +50,9 @@ discard block |
||
| 50 | 50 | $stmt->bind_param("i", $_GET['id']); |
| 51 | 51 | $stmt->execute(); |
| 52 | 52 | $result = $stmt->get_result(); |
| 53 | - if($result->num_rows === 0) echo('Group doesnt exist.'); |
|
| 53 | + if($result->num_rows === 0) { |
|
| 54 | + echo('Group doesnt exist.'); |
|
| 55 | + } |
|
| 54 | 56 | while($row = $result->fetch_assoc()) { |
| 55 | 57 | $id = $row['id']; |
| 56 | 58 | ?> |
@@ -80,7 +82,9 @@ discard block |
||
| 80 | 82 | $stmt->bind_param("i", $id); |
| 81 | 83 | $stmt->execute(); |
| 82 | 84 | $result = $stmt->get_result(); |
| 83 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 85 | + if($result->num_rows === 0) { |
|
| 86 | + echo('There are no users.'); |
|
| 87 | + } |
|
| 84 | 88 | $members = 0; |
| 85 | 89 | while($row = $result->fetch_assoc()) { |
| 86 | 90 | $members++; |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | $stmt = $conn->prepare("SELECT * FROM `groups` ORDER BY id DESC"); |
| 19 | 19 | $stmt->execute(); |
| 20 | 20 | $result = $stmt->get_result(); |
| 21 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 22 | - while($row = $result->fetch_assoc()) { |
|
| 21 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 22 | + while ($row = $result->fetch_assoc()) { |
|
| 23 | 23 | echo "<img style='position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 24 | 24 | <small> |
| 25 | 25 | <a href='/viewgroup?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>" . $row['title'] . "</a></i></span><br> |
@@ -18,7 +18,9 @@ |
||
| 18 | 18 | $stmt = $conn->prepare("SELECT * FROM `groups` ORDER BY id DESC"); |
| 19 | 19 | $stmt->execute(); |
| 20 | 20 | $result = $stmt->get_result(); |
| 21 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 21 | + if($result->num_rows === 0) { |
|
| 22 | + echo('There are no users.'); |
|
| 23 | + } |
|
| 22 | 24 | while($row = $result->fetch_assoc()) { |
| 23 | 25 | echo "<img style='position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 24 | 26 | <small> |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 16 | - if(isset($_SESSION['user'])) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | + if (isset($_SESSION['user'])) { |
|
| 17 | 17 | $stmt = $conn->prepare("INSERT INTO files (type, title, extrainfo, author, filename) VALUES ('review', ?, ?, ?, '')"); |
| 18 | 18 | $stmt->bind_param("sss", $title, $description, $_SESSION['user']); |
| 19 | 19 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $stmt->execute(); |
| 35 | 35 | $result = $stmt->get_result(); |
| 36 | 36 | |
| 37 | - while($row = $result->fetch_assoc()) { |
|
| 37 | + while ($row = $result->fetch_assoc()) { |
|
| 38 | 38 | echo "<br><img style='position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 39 | 39 | <small> |
| 40 | 40 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>[" . $row['agerating'] . "] " . $row['title'] . "</a></i></span><br> |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require("dependencies.php"); |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['user'])) { |
|
| 5 | - if(isset($_GET['id'])) { |
|
| 6 | - if(isAdmin($_SESSION['user'], $conn) == "admin") { |
|
| 4 | +if (isset($_SESSION['user'])) { |
|
| 5 | + if (isset($_GET['id'])) { |
|
| 6 | + if (isAdmin($_SESSION['user'], $conn) == "admin") { |
|
| 7 | 7 | $stmt = $conn->prepare("DELETE FROM users WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require("dependencies.php"); |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['user'])) { |
|
| 5 | - if(isset($_GET['id'])) { |
|
| 6 | - if(isAdmin($_SESSION['user'], $conn) == "admin") { |
|
| 4 | +if (isset($_SESSION['user'])) { |
|
| 5 | + if (isset($_GET['id'])) { |
|
| 6 | + if (isAdmin($_SESSION['user'], $conn) == "admin") { |
|
| 7 | 7 | $stmt = $conn->prepare("UPDATE files SET status = 'd' WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | require("dependencies.php"); |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['user'])) { |
|
| 5 | - if(isAdmin($_SESSION['user'], $conn) == "admin") { |
|
| 4 | +if (isset($_SESSION['user'])) { |
|
| 5 | + if (isAdmin($_SESSION['user'], $conn) == "admin") { |
|
| 6 | 6 | echo "<h1>Welcome</h1>"; |
| 7 | 7 | } else { |
| 8 | 8 | die("not a admin"); |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | $stmt = $conn->prepare("SELECT * FROM files WHERE status = 'n'"); |
| 34 | 34 | $stmt->execute(); |
| 35 | 35 | $result = $stmt->get_result(); |
| 36 | - if($result->num_rows === 0) echo('There are no items waiting for approval.'); |
|
| 37 | - while($row = $result->fetch_assoc()) { |
|
| 36 | + if ($result->num_rows === 0) echo('There are no items waiting for approval.'); |
|
| 37 | + while ($row = $result->fetch_assoc()) { |
|
| 38 | 38 | echo "" . $row['title'] . " by " . $row['author'] . " @ " . $row['date'] . " | <a href='approve.php?id=" . $row['id'] . "'>Approve</a> | <a href='deny.php?id=" . $row['id'] . "'>Deny</a><br>"; |
| 39 | 39 | } |
| 40 | 40 | ?> |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC"); |
| 46 | 46 | $stmt->execute(); |
| 47 | 47 | $result = $stmt->get_result(); |
| 48 | - if($result->num_rows === 0) echo('There are no items waiting for approval.'); |
|
| 49 | - while($row = $result->fetch_assoc()) { |
|
| 48 | + if ($result->num_rows === 0) echo('There are no items waiting for approval.'); |
|
| 49 | + while ($row = $result->fetch_assoc()) { |
|
| 50 | 50 | echo "<a href='/index.php?id=" . $row['id'] . "'>" . $row['username'] . "</a> | <a href='ban.php?id=" . $row['id'] . "'>Ban</a><br>"; |
| 51 | 51 | } |
| 52 | 52 | ?> |
| 53 | 53 | \ No newline at end of file |
@@ -33,7 +33,9 @@ discard block |
||
| 33 | 33 | $stmt = $conn->prepare("SELECT * FROM files WHERE status = 'n'"); |
| 34 | 34 | $stmt->execute(); |
| 35 | 35 | $result = $stmt->get_result(); |
| 36 | - if($result->num_rows === 0) echo('There are no items waiting for approval.'); |
|
| 36 | + if($result->num_rows === 0) { |
|
| 37 | + echo('There are no items waiting for approval.'); |
|
| 38 | + } |
|
| 37 | 39 | while($row = $result->fetch_assoc()) { |
| 38 | 40 | echo "" . $row['title'] . " by " . $row['author'] . " @ " . $row['date'] . " | <a href='approve.php?id=" . $row['id'] . "'>Approve</a> | <a href='deny.php?id=" . $row['id'] . "'>Deny</a><br>"; |
| 39 | 41 | } |
@@ -45,7 +47,9 @@ discard block |
||
| 45 | 47 | $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC"); |
| 46 | 48 | $stmt->execute(); |
| 47 | 49 | $result = $stmt->get_result(); |
| 48 | - if($result->num_rows === 0) echo('There are no items waiting for approval.'); |
|
| 50 | + if($result->num_rows === 0) { |
|
| 51 | + echo('There are no items waiting for approval.'); |
|
| 52 | + } |
|
| 49 | 53 | while($row = $result->fetch_assoc()) { |
| 50 | 54 | echo "<a href='/index.php?id=" . $row['id'] . "'>" . $row['username'] . "</a> | <a href='ban.php?id=" . $row['id'] . "'>Ban</a><br>"; |
| 51 | 55 | } |
@@ -7,9 +7,9 @@ |
||
| 7 | 7 | $stmt->bind_param("s", $user); |
| 8 | 8 | $stmt->execute(); |
| 9 | 9 | $result = $stmt->get_result(); |
| 10 | - if($result->num_rows === 0) return "user doesn't exist"; |
|
| 11 | - while($row = $result->fetch_assoc()) { |
|
| 12 | - if($row['rank'] == "Admin" || $row['rank'] == "Owner") { |
|
| 10 | + if ($result->num_rows === 0) return "user doesn't exist"; |
|
| 11 | + while ($row = $result->fetch_assoc()) { |
|
| 12 | + if ($row['rank'] == "Admin" || $row['rank'] == "Owner") { |
|
| 13 | 13 | return "admin"; |
| 14 | 14 | } else { |
| 15 | 15 | return "not admin"; |
@@ -7,7 +7,9 @@ |
||
| 7 | 7 | $stmt->bind_param("s", $user); |
| 8 | 8 | $stmt->execute(); |
| 9 | 9 | $result = $stmt->get_result(); |
| 10 | - if($result->num_rows === 0) return "user doesn't exist"; |
|
| 10 | + if($result->num_rows === 0) { |
|
| 11 | + return "user doesn't exist"; |
|
| 12 | + } |
|
| 11 | 13 | while($row = $result->fetch_assoc()) { |
| 12 | 14 | if($row['rank'] == "Admin" || $row['rank'] == "Owner") { |
| 13 | 15 | return "admin"; |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require("dependencies.php"); |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['user'])) { |
|
| 5 | - if(isset($_GET['id'])) { |
|
| 6 | - if(isAdmin($_SESSION['user'], $conn) == "admin") { |
|
| 4 | +if (isset($_SESSION['user'])) { |
|
| 5 | + if (isset($_GET['id'])) { |
|
| 6 | + if (isAdmin($_SESSION['user'], $conn) == "admin") { |
|
| 7 | 7 | $stmt = $conn->prepare("UPDATE files SET status = 'y' WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |