Update config.php
This commit is contained in:
parent
56ba3d4a3a
commit
14737e359c
27
config.php
27
config.php
|
@ -1,26 +1,33 @@
|
||||||
<?php
|
<?php
|
||||||
|
session_start();
|
||||||
// Name (and path) of you twtxt.txt file
|
|
||||||
$txt_file = '../twtxt.txt';
|
|
||||||
|
|
||||||
$new_post = filter_input(INPUT_POST, 'new_post');
|
$new_post = filter_input(INPUT_POST, 'new_post');
|
||||||
// $new_post = filter_input(INPUT_POST, 'new_post', FILTER_SANITIZE_SPECIAL_CHARS);
|
// $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) {
|
if($new_post) {
|
||||||
$contents = file_get_contents($txt_file);
|
$contents = $_SESSION["twtxt"];
|
||||||
// $contents .= "\n" . date(DATE_RFC3339) . "\t" ;
|
$contents .= "\n" . date("Y-m-d\TH:i:s\Z") . "\t(#" . $id . ")\t" ;
|
||||||
$contents .= "\n" . date("Y-m-d\TH:i:s\Z") . "\t" ;
|
|
||||||
$contents .= "$new_post";
|
$contents .= "$new_post";
|
||||||
|
$_SESSION["twtxt"] = $contents;
|
||||||
file_put_contents($txt_file, $contents);
|
|
||||||
|
|
||||||
header("Refresh:0; url=index.html");
|
header("Refresh:0; url=index.html");
|
||||||
//header("Location: index.html");
|
//header("Location: index.html");
|
||||||
//header("Location: $txt_file");
|
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
//header("Location: index.html");
|
//header("Location: index.html");
|
||||||
echo "Opps something went wrong...\n\nCheck the error_log on the server";
|
echo "Opps something went wrong...\n\nCheck the error_log on the server";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue