Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Location: " . $_SERVER['HTTP_REFERER']);
- $post = $_POST['content'];
- $post = htmlspecialchars($post);
- $post = filter_var($post, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
- $post = str_replace("\n", " ", $post);
- $post = str_replace("\r", " ", $post);
- // Test if post matches last post
- $first_line = fgets(fopen("content.txt", 'r'));
- $format_post = "- " . $post . "\n";
- if ($first_line == $format_post) {
- exit();
- }
- if ($post != "" && strlen($post) <= 400 && ! ctype_space($post)) {
- file_put_contents("content.txt", "- " . $post . "\n" . file_get_contents("content.txt"));
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement