More changes for byethost

This commit is contained in:
HotPizzaYT 2022-04-27 07:55:12 -05:00
commit 3d04a88dfe
4 changed files with 4 additions and 3 deletions

View file

@ -55,7 +55,7 @@ if(isset($_GET["room"])){
document.getElementById("chatscreen").innerHTML = (xhr.responseText);
}
};
xhr.open('GET', 'innerchat.php?room=<?php echo $room ?>', true);
xhr.open('GET', 'innerch.php?room=<?php echo $room ?>', true);
xhr.send(null);
}
function chatload(){

View file

@ -62,7 +62,8 @@ session_start();
$jsonD = json_decode($jsonF, true);
$name = "<a href='topic.php?t=".str_replace(".json","",$file)."'>".$jsonD["name"]."</a>";
$desc = $jsonD["description"];
$latestPost = "Latest post by: ".$jsonD["posts"][0]["from"].", \"".htmlspecialchars($jsonD["posts"][0]["title"])."\"";
$latest = count($jsonD["posts"]) - 1;
$latestPost = "Latest post by: ".$jsonD["posts"][$latest]["from"].", \"".htmlspecialchars($jsonD["posts"][$latest]["title"])."\"";
echo "<div class='crow' alt='".$desc."'>" . $name . "<br/><font color='grey'>".$latestPost."</font></div>";
}
}

View file

@ -13,7 +13,7 @@ body, html {
$jsonD = json_decode($jsonF, true);
$posts = $jsonD["posts"];
$newPost = array("title"=>$_POST["title"],"from"=>$_SESSION["ts_user"],"cont"=>$_POST["cont"],"time"=>time(),"com"=>array());
array_unshift($jsonD["posts"], $newPost);
array_push($jsonD["posts"], $newPost);
$newj = json_encode($jsonD);
file_put_contents("data/topic/".$_POST["topic"].".json", $newj);
$id = count($jsonD["posts"]) - 1;