forked from lholliger/ATC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spost.php
38 lines (31 loc) · 1.09 KB
/
spost.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
$p_data = $_POST["content"];
$title = $_POST['pname'];
session_start();
$username = $_SESSION['USERNAME'];
$password = $_SESSION['PASSWORD'];
if (file_exists("../data/users/$username")) {
if (password_verify($password, trim(preg_replace('/\s\s+/', '', file_get_contents("../data/users/$username/password"))))) {
$title = str_replace(">", ">", $title);
$title = str_replace("<", "<", $title);
$p_data = str_replace(">", ">", $p_data);
$p_data = str_replace("<", "<", $p_data);
$p_data = nl2br($p_data);
$pid = uniqid();
$path = "../data/posts/$pid/";
mkdir($path);
mkdir("$path/0");
file_put_contents("$path/0/title", $title);
file_put_contents("$path/0/contents", $p_data);
file_put_contents("$path/0/poster", $username);
file_put_contents("$path/0/type", $_POST["type"]);
file_put_contents("$path/0/time", date('d-m-Y H:i:s'));
file_put_contents("$path/0/status", "open");
header("Location: post.php?id=$pid");
} else {
header("Location: login.php?err=3");
}
} else {
header("Location: login.php?err=3");
}
?>