| @@ -12,18 +12,18 @@ | ||
| 12 | 12 | <body> | 
| 13 | 13 | <?php require(__DIR__ . "/important/header.php"); | 
| 14 | 14 | |
| 15 | -        if(isset($_GET['id'])) { | |
| 15 | +        if (isset($_GET['id'])) { | |
| 16 | 16 |              $stmt = $conn->prepare("SELECT * FROM files WHERE author = ? AND id = ?"); | 
| 17 | 17 |              $stmt->bind_param("si", $_SESSION['user'], $_GET['id']); | 
| 18 | 18 | $stmt->execute(); | 
| 19 | 19 | $result = $stmt->get_result(); | 
| 20 | -            if($result->num_rows === 0) die('Item doesnt exist or item isnt made by you.'); | |
| 20 | +            if ($result->num_rows === 0) die('Item doesnt exist or item isnt made by you.'); | |
| 21 | 21 |          } else { | 
| 22 | 22 |              header("Location: index.php"); | 
| 23 | 23 | } | 
| 24 | 24 | |
| 25 | -        if(@$_POST['submit']) { | |
| 26 | -            if(isset($_SESSION['user'])) { | |
| 25 | +        if (@$_POST['submit']) { | |
| 26 | +            if (isset($_SESSION['user'])) { | |
| 27 | 27 |                  $stmt = $conn->prepare("UPDATE files SET title = ?, extrainfo = ? WHERE id = ?"); | 
| 28 | 28 |                  $stmt->bind_param("ssi", $title, $description, $_GET['id']); | 
| 29 | 29 | $title = htmlspecialchars($_POST['title']); | 
| @@ -17,7 +17,9 @@ | ||
| 17 | 17 |              $stmt->bind_param("si", $_SESSION['user'], $_GET['id']); | 
| 18 | 18 | $stmt->execute(); | 
| 19 | 19 | $result = $stmt->get_result(); | 
| 20 | -            if($result->num_rows === 0) die('Item doesnt exist or item isnt made by you.'); | |
| 20 | +            if($result->num_rows === 0) { | |
| 21 | +                die('Item doesnt exist or item isnt made by you.'); | |
| 22 | + } | |
| 21 | 23 |          } else { | 
| 22 | 24 |              header("Location: index.php"); | 
| 23 | 25 | } | 
| @@ -12,8 +12,8 @@ | ||
| 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 ('news', ?, ?, ?, '')"); | 
| 18 | 18 |                  $stmt->bind_param("sss", $title, $description, $_SESSION['user']); | 
| 19 | 19 | |
| @@ -2,13 +2,13 @@ | ||
| 2 | 2 | require(__DIR__ . "/func/func.php"); | 
| 3 | 3 | require(__DIR__ . "/func/conn.php"); | 
| 4 | 4 | |
| 5 | -if(isset($_SESSION['user'])) { | |
| 6 | -    if(isset($_GET['id'])) { | |
| 5 | +if (isset($_SESSION['user'])) { | |
| 6 | +    if (isset($_GET['id'])) { | |
| 7 | 7 |          $stmt = $conn->prepare("SELECT * FROM `groups` WHERE id = ?"); | 
| 8 | 8 |          $stmt->bind_param("i", $_GET['id']); | 
| 9 | 9 | $stmt->execute(); | 
| 10 | 10 | $result = $stmt->get_result(); | 
| 11 | -        if($result->num_rows === 0) { | |
| 11 | +        if ($result->num_rows === 0) { | |
| 12 | 12 |              die("Group doesn't exist"); | 
| 13 | 13 | } | 
| 14 | 14 | $stmt->close(); | 
| @@ -12,8 +12,8 @@ | ||
| 12 | 12 | <body> | 
| 13 | 13 |          <?php require("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 `groups` (title, description, author) VALUES (?, ?, ?)"); | 
| 18 | 18 |                  $stmt->bind_param("sss", $name, $text, $_SESSION['user']); | 
| 19 | 19 | $text = htmlspecialchars($_POST['description']); | 
| @@ -9,7 +9,9 @@ | ||
| 9 | 9 |              $stmt->bind_param("s", $_SESSION['user']); | 
| 10 | 10 | $stmt->execute(); | 
| 11 | 11 | $result = $stmt->get_result(); | 
| 12 | -            if($result->num_rows === 0) header('Location: index.php'); | |
| 12 | +            if($result->num_rows === 0) { | |
| 13 | +                header('Location: index.php'); | |
| 14 | + } | |
| 13 | 15 |              while($row = $result->fetch_assoc()) { | 
| 14 | 16 | $username = $row['username']; | 
| 15 | 17 | $id = $row['id']; | 
| @@ -9,8 +9,8 @@ discard block | ||
| 9 | 9 |              $stmt->bind_param("s", $_SESSION['user']); | 
| 10 | 10 | $stmt->execute(); | 
| 11 | 11 | $result = $stmt->get_result(); | 
| 12 | -            if($result->num_rows === 0) header('Location: index.php'); | |
| 13 | -            while($row = $result->fetch_assoc()) { | |
| 12 | +            if ($result->num_rows === 0) header('Location: index.php'); | |
| 13 | +            while ($row = $result->fetch_assoc()) { | |
| 14 | 14 | $username = $row['username']; | 
| 15 | 15 | $id = $row['id']; | 
| 16 | 16 | $date = $row['date']; | 
| @@ -28,21 +28,21 @@ discard block | ||
| 28 | 28 | <body> | 
| 29 | 29 | <?php require(__DIR__ . "/important/header.php"); | 
| 30 | 30 | |
| 31 | -        if(@$_POST['bioset']) { | |
| 31 | +        if (@$_POST['bioset']) { | |
| 32 | 32 |              $stmt = $conn->prepare("UPDATE users SET bio = ? WHERE `users`.`username` = ?;"); | 
| 33 | 33 |              $stmt->bind_param("ss", $text, $_SESSION['user']); | 
| 34 | 34 | $text = $_POST['bio']; | 
| 35 | 35 | $stmt->execute(); | 
| 36 | 36 | $stmt->close(); | 
| 37 | 37 |              header("Location: home.php"); | 
| 38 | -        } else if(@$_POST['css']) { | |
| 38 | +        } else if (@$_POST['css']) { | |
| 39 | 39 |              $stmt = $conn->prepare("UPDATE users SET css = ? WHERE `users`.`username` = ?;"); | 
| 40 | 40 |              $stmt->bind_param("ss", $validatedcss, $_SESSION['user']); | 
| 41 | 41 | $validatedcss = validateCSS($_POST['css']); | 
| 42 | 42 | $stmt->execute(); | 
| 43 | 43 | $stmt->close(); | 
| 44 | 44 |              header("Location: home.php"); | 
| 45 | -        } else if(@$_POST['submit']) { | |
| 45 | +        } else if (@$_POST['submit']) { | |
| 46 | 46 | $target_dir = "dynamic/pfp/"; | 
| 47 | 47 | $imageFileType = strtolower(pathinfo($_FILES["fileToUpload"]["name"], PATHINFO_EXTENSION)); | 
| 48 | 48 | $target_name = md5_file($_FILES["fileToUpload"]["tmp_name"]) . "." . $imageFileType; | 
| @@ -52,8 +52,8 @@ discard block | ||
| 52 | 52 | $uploadOk = true; | 
| 53 | 53 | $movedFile = false; | 
| 54 | 54 | |
| 55 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" | |
| 56 | -            && $imageFileType != "gif" ) { | |
| 55 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" | |
| 56 | +            && $imageFileType != "gif") { | |
| 57 | 57 | echo 'unsupported file type. must be jpg, png, jpeg, or gif<hr>'; | 
| 58 | 58 | $uploadOk = false; | 
| 59 | 59 | } | 
| @@ -74,7 +74,7 @@ discard block | ||
| 74 | 74 | echo 'fatal error<hr>'; | 
| 75 | 75 | } | 
| 76 | 76 | } | 
| 77 | -        } else if(@$_POST['photoset']) { | |
| 77 | +        } else if (@$_POST['photoset']) { | |
| 78 | 78 | $uploadOk = true; | 
| 79 | 79 | $movedFile = false; | 
| 80 | 80 | |
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | |
| 86 | 86 | $target_file = $target_dir . $target_name; | 
| 87 | 87 | |
| 88 | -            if($songFileType != "ogg" && $songFileType != "mp3") { | |
| 88 | +            if ($songFileType != "ogg" && $songFileType != "mp3") { | |
| 89 | 89 | echo 'unsupported file type. must be mp3 or ogg<hr>'; | 
| 90 | 90 | $uploadOk = false; | 
| 91 | 91 | } | 
| @@ -123,14 +123,14 @@ discard block | ||
| 123 | 123 | <button><a href="/2fa">Manage 2-Factor Authentication</a></button><br><br> | 
| 124 | 124 | <b>Bio</b> | 
| 125 | 125 | <form method="post" enctype="multipart/form-data"> | 
| 126 | - <textarea required cols="58" placeholder="Bio" name="bio"><?php echo $bio;?></textarea><br> | |
| 126 | + <textarea required cols="58" placeholder="Bio" name="bio"><?php echo $bio; ?></textarea><br> | |
| 127 | 127 | <input name="bioset" type="submit" value="Set"> | 
| 128 | 128 | <small>max limit: 500 characters | supports <a href="https://www.markdownguide.org/basic-syntax">Markdown</a></small> | 
| 129 | 129 | </form><br> | 
| 130 | 130 | <b>CSS</b> | 
| 131 | 131 | <button onclick="loadpfwin()" id="prevbtn">Show Live CSS Preview</button> | 
| 132 | 132 | <form method="post" enctype="multipart/form-data"> | 
| 133 | - <textarea required rows="15" cols="58" placeholder="Your CSS" name="css" id="css_code"><?php echo $css;?></textarea><br> | |
| 133 | + <textarea required rows="15" cols="58" placeholder="Your CSS" name="css" id="css_code"><?php echo $css; ?></textarea><br> | |
| 134 | 134 | <input name="cssset" type="submit" value="Set"> <small>max limit: 5000 characters</small> | 
| 135 | 135 | </form><br> | 
| 136 | 136 | </div> | 
| @@ -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"; |