2021-01-19 23:12:01 +00:00
|
|
|
<?php
|
2021-09-16 23:23:42 +00:00
|
|
|
session_start();
|
2021-01-19 22:55:35 +00:00
|
|
|
|
2021-01-19 23:50:19 +00:00
|
|
|
$new_post = filter_input(INPUT_POST, 'new_post');
|
2021-01-20 21:03:55 +00:00
|
|
|
// $new_post = filter_input(INPUT_POST, 'new_post', FILTER_SANITIZE_SPECIAL_CHARS);
|
|
|
|
|
2021-09-16 23:23:42 +00:00
|
|
|
// Generate ID
|
|
|
|
function id(){
|
|
|
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
|
|
$randstring = '';
|
|
|
|
$i=0;
|
|
|
|
while ($i <= 6) {
|
|
|
|
$randstring .= $characters[rand(0, strlen($characters))];
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
return $randstring;
|
|
|
|
}
|
|
|
|
$id=id();
|
2021-01-19 22:55:35 +00:00
|
|
|
|
|
|
|
if($new_post) {
|
2021-09-16 23:23:42 +00:00
|
|
|
$contents = $_SESSION["twtxt"];
|
|
|
|
$contents .= "\n" . date("Y-m-d\TH:i:s\Z") . "\t(#" . $id . ")\t" ;
|
2021-01-19 22:55:35 +00:00
|
|
|
$contents .= "$new_post";
|
2021-09-16 23:23:42 +00:00
|
|
|
$_SESSION["twtxt"] = $contents;
|
2021-01-19 22:55:35 +00:00
|
|
|
|
|
|
|
header("Refresh:0; url=index.html");
|
|
|
|
//header("Location: index.html");
|
|
|
|
exit;
|
|
|
|
} else {
|
2021-09-16 23:23:42 +00:00
|
|
|
//header("Location: index.html");
|
2021-01-19 22:55:35 +00:00
|
|
|
echo "Opps something went wrong...\n\nCheck the error_log on the server";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
?>
|