Marxuw Admin
Posts : 13 Join date : 02/09/24
| Konu: PHP ILE HAZIR SİTE KODU Ptsi Eyl. 02, 2024 11:30 pm | |
| Buyrun arkadaşlar Yardım isterseniz yardımcı olurum - Kod:
-
<?php $board = isset($_GET['board']) ? $_GET['board'] : 'general'; $messages = [];
if ($_SERVER["REQUEST_METHOD"] == "POST") { $username = !empty($_POST["username"]) ? $_POST["username"] : 'Anonymous'; $message = $_POST["message"]; $image = isset($_FILES["image"]["name"]) ? $_FILES["image"]["name"] : ''; $timestamp = date("Y-m-d H:i:s"); $id = uniqid();
if ($image) { move_uploaded_file($_FILES["image"]["tmp_name"], "uploads/" . $image); }
$messages[] = [ "id" => $id, "timestamp" => $timestamp, "username" => $username, "message" => $message, "image" => $image ];
file_put_contents("messages_{$board}.json", json_encode($messages)); } else { if (file_exists("messages_{$board}.json")) { $messages = json_decode(file_get_contents("messages_{$board}.json"), true); } } ?>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>GhostChan</title> <style> body { font-family: 'Open Sans', sans-serif; background-image: url('https://media.discordapp.net/attachments/1274081366824321140/1275390478648475691/Screenshot_20240819_134839_Linux_Shell.jpg?ex=66c5b771&is=66c465f1&hm=3451289b71a59e26a37f1a31c32b8a6485ab312e71bb3e7e9a7c365714360d69&'); background-size: cover; background-repeat: no-repeat; background-attachment: fixed; color: #d3d3d3; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; }
.container { width: 90%; max-width: 1000px; background-color: rgba(0, 0, 0, 0.8); padding: 30px; margin-top: 30px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
.board-section { margin-bottom: 30px; }
.board-list { list-style: none; padding: 0; }
.board-list li { margin-bottom: 5px; }
textarea, input[type="text"] { width: 100%; padding: 10px; margin-bottom: 10px; border-radius: 4px; border: 1px solid #444; background-color: #333; color: #d3d3d3; }
button { background-color: #00cc00; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; }
button:hover { background-color: #009900; }
.message-box { margin-bottom: 20px; padding: 15px; border: 1px solid #444; border-radius: 6px; background-color: #222; }
.message-box p { margin: 5px 0; }
.message { margin-bottom: 10px; }
.image { max-width: 100%; height: auto; border-radius: 4px; }
a { color: #00cc00; text-decoration: none; }
a:hover { text-decoration: underline; } </style> </head> <body> <div class="container"> <h1>GhostChan</h1>
<div class="board-section"> <h2>Boards</h2> <ul class="board-list"> <li><strong>Interests</strong></li> <li><a href="index.php?board=cartoons">/c/ - Cartoons</a></li> <li><a href="index.php?board=anime">/a/ - Anime</a></li> <li><a href="index.php?board=video-games">/vg/ - Video Games</a></li> <li><a href="index.php?board=weapons">/w/ - Weapons</a></li> </ul> <ul class="board-list"> <li><strong>Hacking</strong></li> <li><a href="index.php?board=technology">/g/ - Technology</a></li> <li><a href="index.php?board=programming">/pr/ - Programming</a></li> <li><a href="index.php?board=exploits">/ex/ - Exploits</a></li> <li><a href="index.php?board=secure">/s/ - Secure</a></li> </ul> <ul class="board-list"> <li><strong>Other</strong></li> <li><a href="index.php?board=general">/en/ - General</a></li> <li><a href="index.php?board=turkish">/tr/ - Türkçe</a></li> <li><a href="index.php?board=russian">/ru/ - Русский</a></li> <li><a href="index.php?board=doomsday">/ds/ - Doomsday Scenarios</a></li> <li><a href="index.php?board=overboard">/all/ - Overboard</a></li> </ul> <ul class="board-list"> <li><strong>NSFW</strong></li> <li><a href="index.php?board=random">/b/ - Random</a></li> <li><a href="index.php?board=pornography">/p/ - Pornography</a></li> <li><a href="index.php?board=politics">/pol/ - Politics & News</a></li> </ul> </div>
<form action="index.php?board=<?php echo $board; ?>" method="POST" enctype="multipart/form-data"> <input type="text" name="username" placeholder="Enter your username..."><br> <textarea name="message" placeholder="Enter your message..." required></textarea><br> <input type="file" name="image"><br> <button type="submit">Post</button> </form>
<hr>
<div class="messages"> <?php if (!empty($messages)): ?> <?php foreach ($messages as $msg): ?> <div class="message-box"> <p><strong>ID:</strong> <?php echo $msg["id"]; ?></p> <p><strong>Timestamp:</strong> <?php echo $msg["timestamp"]; ?></p> <p><strong>Username:</strong> <?php echo htmlspecialchars($msg["username"]); ?></p> <p class="message"><?php echo htmlspecialchars($msg["message"]); ?></p> <?php if ($msg["image"]): ?> <img src="uploads/<?php echo htmlspecialchars($msg["image"]); ?>" alt="Image" class="image"> <?php endif; ?> </div> <?php endforeach; ?> <?php else: ?> <p>No messages yet.</p> <?php endif; ?> </div> </div> </body> </html>
| Marxuw likes this post |
|