Update config.php
This commit is contained in:
parent
56ba3d4a3a
commit
14737e359c
25
config.php
25
config.php
|
@ -1,23 +1,30 @@
|
|||
<?php
|
||||
|
||||
// Name (and path) of you twtxt.txt file
|
||||
$txt_file = '../twtxt.txt';
|
||||
session_start();
|
||||
|
||||
$new_post = filter_input(INPUT_POST, 'new_post');
|
||||
// $new_post = filter_input(INPUT_POST, 'new_post', FILTER_SANITIZE_SPECIAL_CHARS);
|
||||
|
||||
// Generate ID
|
||||
function id(){
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$randstring = '';
|
||||
$i=0;
|
||||
while ($i <= 6) {
|
||||
$randstring .= $characters[rand(0, strlen($characters))];
|
||||
$i++;
|
||||
}
|
||||
return $randstring;
|
||||
}
|
||||
$id=id();
|
||||
|
||||
if($new_post) {
|
||||
$contents = file_get_contents($txt_file);
|
||||
// $contents .= "\n" . date(DATE_RFC3339) . "\t" ;
|
||||
$contents .= "\n" . date("Y-m-d\TH:i:s\Z") . "\t" ;
|
||||
$contents = $_SESSION["twtxt"];
|
||||
$contents .= "\n" . date("Y-m-d\TH:i:s\Z") . "\t(#" . $id . ")\t" ;
|
||||
$contents .= "$new_post";
|
||||
|
||||
file_put_contents($txt_file, $contents);
|
||||
$_SESSION["twtxt"] = $contents;
|
||||
|
||||
header("Refresh:0; url=index.html");
|
||||
//header("Location: index.html");
|
||||
//header("Location: $txt_file");
|
||||
exit;
|
||||
} else {
|
||||
//header("Location: index.html");
|
||||
|
|
Loading…
Reference in New Issue