forked from lholliger/ATC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reply.php
34 lines (28 loc) · 984 Bytes
/
reply.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
<?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();
$id = $_GET['post'];
$path = "../data/posts/$id/";
mkdir("$path/_$pid");
file_put_contents("$path/_$pid/contents", $p_data);
file_put_contents("$path/_$pid/poster", $username);
file_put_contents("$path/_$pid/time", date('d-m-Y H:i:s'));
header("Location: post.php?id=$id");
} else {
header("Location: login.php?err=3");
}
} else {
header("Location: login.php?err=3");
}
?>