Fix register

This commit is contained in:
HotPizzaYT 2022-05-13 16:32:14 -05:00
commit a78d00c46b
2 changed files with 28 additions and 1 deletions

View file

@ -4,7 +4,7 @@
if(isset($_POST["msg"]) && isset($_POST["usr"]) && isset($_POST["room"])){
if(!(file_exists("dkey.global")) && !(file_exists("dhook.global"))){
echo "tunnel.setupfailure";
} else if(isset($_POST["key"]) && $_POST["key"] == file_get_contents("dkey.global") && file_exists("dhook.global")){
} else if(isset($_POST["key"]) && $_POST["key"] == file_get_contents("dkey.global")){
if(file_exists("data/".$_POST["room"].".json")){
// Room exists
// Set needed variables

27
3ds/chat/discordn.php Normal file
View file

@ -0,0 +1,27 @@
<?php
// If I didn't ignore dkey.global and dhook.global, things would be a disaster. That is why Discord keys and Discord webhooks will not be provided.
if(isset($_POST["msg"]) && isset($_POST["usr"]) && isset($_POST["room"])){
if(!(file_exists("dkey.global")) && !(file_exists("dhook.global"))){
echo "tunnel.setupfailure";
} else if(isset($_POST["key"]) && $_POST["key"] == file_get_contents("dkey.global") && false){
if(file_exists("data/".$_POST["room"].".json")){
// Room exists
// Set needed variables
$jsonF = file_get_contents("data/".$_POST["room"].".json");
$jsonD = json_decode($jsonF, true);
if(count($jsonD["msg"])+1 >= strval($jsonD["max"])){
array_pop($jsonD["msg"]);
}
$finalmsg = array("cont"=>$_POST["msg"],"time"=>time(),"type"=>"message","color"=>"red","visibility"=>"dall","from"=>$_POST["usr"]);
array_unshift($jsonD["msg"], $finalmsg);
$jsonString = json_encode($jsonD);
file_put_contents("data/".$_POST["room"].".json",$jsonString);
} else {
echo "tunnel.roomnotexistorhooknotexist";
}
} else {
echo "tunnel.security.invalidkey";
}
}