@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | if (!$_SESSION['logged_in'] && $password != "") { |
| 28 | 28 | require_once("functions/login.php"); |
| 29 | - }else if ($_SESSION['logged_in'] || $password == "") { |
|
| 29 | + } else if ($_SESSION['logged_in'] || $password == "") { |
|
| 30 | 30 | // display messages |
| 31 | 31 | require_once("functions/display_messages.php"); |
| 32 | 32 | $messages = get_messages($file); |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | -if($password != "" && isset($_POST['auth_submit'])){ |
|
| 3 | - if($password != $_POST['password']){ |
|
| 2 | +if ($password != "" && isset($_POST['auth_submit'])) { |
|
| 3 | + if ($password != $_POST['password']) { |
|
| 4 | 4 | ?> |
| 5 | 5 | <b>wrong password</b>, try again. |
| 6 | 6 | <?php |
| 7 | - } else{ |
|
| 7 | + }else { |
|
| 8 | 8 | $_SESSION['logged_in'] = true; |
| 9 | 9 | echo 'logged in!'; |
| 10 | 10 | header("refresh:0;"); |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | $uploadOk = 1; |
| 14 | 14 | $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); |
| 15 | 15 | $check = getimagesize($_FILES["file"]["tmp_name"]); |
| 16 | - if($imageFileType != "webm" && $imageFileType != "mp4"){ |
|
| 16 | + if ($imageFileType != "webm" && $imageFileType != "mp4") { |
|
| 17 | 17 | if ($check !== false) { |
| 18 | 18 | $uploadOk = 1; |
| 19 | - } else { |
|
| 19 | + }else { |
|
| 20 | 20 | echo "what are you doing anon? that file was not an image or a webm..."; |
| 21 | 21 | $uploadOk = 0; |
| 22 | 22 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // Upload the file |
| 38 | 38 | if ($uploadOk == 0) { |
| 39 | 39 | echo "Sorry, your file was not uploaded."; |
| 40 | - } else { |
|
| 40 | + }else { |
|
| 41 | 41 | move_uploaded_file($_FILES["file"]["tmp_name"], $target_file); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | array_push($messages["messages"], $new_message); |
| 61 | 61 | $jsondata = json_encode($messages, JSON_PRETTY_PRINT); |
| 62 | 62 | file_put_contents($file, $jsondata); |
| 63 | - } else { |
|
| 63 | + }else { |
|
| 64 | 64 | echo "The message field is <b>required</b>."; |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - function greenText($msg){ |
|
| 68 | + function greenText($msg) { |
|
| 69 | 69 | preg_match_all('/(?<!>)>(?!>).*/', $msg, $matches, PREG_SET_ORDER, 0); |
| 70 | 70 | |
| 71 | 71 | foreach ($matches as $m) { |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | return $result; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - function build_message($message){ |
|
| 19 | + function build_message($message) { |
|
| 20 | 20 | $result = ""; |
| 21 | 21 | $result = $result . "<div class='message'>"; |
| 22 | 22 | $result = $result . "<div class='title' id='" . $message['id'] . "'><span class='name'>Anonymous</span> " . $message['date'] . " id. <a href='#" . $message['id'] . "'>" . $message['id'] . "</a></div><div class = 'message-inside'>"; |
| 23 | 23 | if ($message['file'] != "") { |
| 24 | - if(substr($message['file'], -4) == "webm" || substr($message['file'], -3) == "mp4"){ |
|
| 24 | + if (substr($message['file'], -4) == "webm" || substr($message['file'], -3) == "mp4") { |
|
| 25 | 25 | $result = $result . '<div><video width="600" controls loop><source src="images/' . $message['file'] . '" type="video/mp4"></video></div><br />'; |
| 26 | - }else{ |
|
| 26 | + }else { |
|
| 27 | 27 | $result = $result . "<div><a href='images/" . $message['file'] . "'><img src = 'images/" . $message['file'] . "' class='message-image'/></a></div>"; |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -31,21 +31,21 @@ discard block |
||
| 31 | 31 | return $result; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - function check_empty($msgs){ |
|
| 34 | + function check_empty($msgs) { |
|
| 35 | 35 | if (isset($msgs) && $msgs != "") { |
| 36 | 36 | $msg = $msgs; |
| 37 | - } else { |
|
| 37 | + }else { |
|
| 38 | 38 | $msg = "something's wrong, this nerve is either empty or our brain doesn't have access to this nerve's messages..."; |
| 39 | 39 | } |
| 40 | 40 | return $msg; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - function build_result($msg, $last_msg, $action){ |
|
| 43 | + function build_result($msg, $last_msg, $action) { |
|
| 44 | 44 | if ($action == "messages") { |
| 45 | 45 | $result = $msg; |
| 46 | - } else if ($action == "last_msg") { |
|
| 46 | + }else if ($action == "last_msg") { |
|
| 47 | 47 | $result = $last_msg; |
| 48 | - } else { |
|
| 48 | + }else { |
|
| 49 | 49 | $result = "show_messages: parameters <b>must</b> be \$messages and either 'messages' or 'last_msg'"; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | if ($message['file'] != "") { |
| 24 | 24 | if(substr($message['file'], -4) == "webm" || substr($message['file'], -3) == "mp4"){ |
| 25 | 25 | $result = $result . '<div><video width="600" controls loop><source src="images/' . $message['file'] . '" type="video/mp4"></video></div><br />'; |
| 26 | - }else{ |
|
| 26 | + } else{ |
|
| 27 | 27 | $result = $result . "<div><a href='images/" . $message['file'] . "'><img src = 'images/" . $message['file'] . "' class='message-image'/></a></div>"; |
| 28 | 28 | } |
| 29 | 29 | } |