I'M PULLING MY HAIR OUT WITH THIS GODDAMN CODE PLEASE HELP

This commit is contained in:
HotPizzaYT 2022-04-25 20:23:50 -05:00
commit 6faebed08f
13 changed files with 169 additions and 71 deletions

View file

@ -4,6 +4,8 @@ pussy
dick
penis
cock
nigga
nigger
fortnite is good
minecraft is bad
fortnite is awesome

28
3ds/chat/functions.php Normal file
View file

@ -0,0 +1,28 @@
<?php
/**
* Split a string using a delimiter and return two strings split on the the nth occurrence of the delimiter.
* @param string $source
* @param integer $index - one-based index
* @param char $delimiter
*
* @return array - two strings
*/
function strSplit($source, $index, $delim)
{
$outStr[0] = $source;
$outStr[1] = '';
$partials = explode($delim, $source);
if (isset($partials[$index]) && strlen($partials[$index]) > 0) {
$splitPos = strpos($source, $partials[$index]);
$outStr[0] = substr($source, 0, $splitPos - 1);
$outStr[1] = substr($source, $splitPos);
}
return $outStr;
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before After
Before After

BIN
3ds/chat/i/mad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

37
3ds/chat/icons.php Normal file
View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<!-- saved from url=(0089)https://web.archive.org/web/20211116050941if_/https://3dsplaza.com/chat3/nav.php?loc=icon -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- End Wayback Rewrite JS Include -->
<title>Nav Browser</title>
<style type="text/css">
a {
border-bottom: 1px solid black;
display: block;
}
</style></head><body><span style="font-size: 80%;">
<a href="nav.php" style="font-size: 85%;">nav index </a><br>Emoticon Reference:<br><br>
:)&nbsp;&nbsp;<img src="i/happy.gif" alt="happy"><br>:D&nbsp;&nbsp;<img src="i/icon_cheesygrin.gif" alt="grin"><br>;)&nbsp;&nbsp;<img src="i/icon_wink.gif" alt="wink"><br>;(&nbsp;&nbsp;<img src="i/icon_cry.gif" alt="cry"><br>:con:&nbsp;&nbsp;<img src="i/icon_confused.gif" alt="confused"><br>:@&nbsp;&nbsp;<img src="i/icon_mad.gif" alt="mad"><br>:grr:&nbsp;&nbsp;<img src="i/buy_sweat.png" alt="annoyed"><br>XD&nbsp;&nbsp;<img src="i/ecksdee.png" alt="ecksdee"><br>:omg:&nbsp;&nbsp;<img src="i/icon_amazed.gif" alt="omg"><br>:fp:&nbsp;&nbsp;<img src="i/icon_facepalm.gif" alt="facepalm"><br>:thinking:&nbsp;&nbsp;<img src="i/thinking.png" width="16px" height="16px" alt="thinking"><br>:eyes:&nbsp;&nbsp;<img src="i/eyes.png" style="height:20px" alt="eyes"><br>R(&nbsp;&nbsp;<img src="i/icon_unknown1.png" alt="negitiveepicface"><br>RB:&nbsp;&nbsp;<img src="i/rbow.png" alt="rainbowepicface"><br>R:&nbsp;&nbsp;<img src="i/epic.png" alt="epicface"><br>:ponything:&nbsp;&nbsp;<img src="i/icon_ponything.jpg" alt="ponything"><br>:waah:&nbsp;&nbsp;<img src="i/waah.gif" alt="waah"><br>:nuu:&nbsp;&nbsp;<img src="i/nuu.gif" alt="nuu"><br>:caps:&nbsp;&nbsp;<img src="i/caps.gif" alt="caps"><br>:lenny:&nbsp;&nbsp;( ͡° ͜ʖ ͡°)<br>:shrug:&nbsp;&nbsp;¯\_()_/¯<br>:megusta:&nbsp;&nbsp;<img src="i/icon_megusta.jpg" alt="megusta"><br>:lol:&nbsp;&nbsp;<img src="i/lol.png" alt="lol"><br>:troll:&nbsp;&nbsp;<img src="i/icon_trollface.png" alt="troll"><br>:no:&nbsp;&nbsp;<img src="i/no.png" alt="no"><br>:pface:&nbsp;&nbsp;<img src="i/pokerface.png" alt="pokerface"><br>:raeg:&nbsp;&nbsp;<img src="i/raeg.png" alt="raeg"><br>:ohplz:&nbsp;&nbsp;<img src="i/please.png" alt="ohplz"><br>:ydsay:&nbsp;&nbsp;<img src="i/buy_youdontsay.png" alt="ydsay"><br>:falone:&nbsp;&nbsp;<img src="i/icon_foreveralone.jpg" alt="falone"><br>:doge:&nbsp;&nbsp;<img src="i/doge.png" alt="&lt;DOGE (not the currency)&gt;"><br>:trig:&nbsp;&nbsp;<img src="i/triggered.jpg" alt="triggered"><br>:wolfthing:&nbsp;&nbsp;<img src="i/wolfthing.gif" alt="&lt;•o•&gt;"><br>:mccreeper:&nbsp;&nbsp;<img src="i/icon_mccreeper.png" width="16px" height="16px" alt="mccreeper"><br>:mchappy:&nbsp;&nbsp;<img src="i/icon_mchappy.png" width="16px" height="16px" alt="mchappy"><br>:sonic:&nbsp;&nbsp;<img src="i/buy_sonic.png" alt="sonic"><br>:yoshi:&nbsp;&nbsp;<img src="i/buy_yoshi.png" alt="yoshi"><br>:mario:&nbsp;&nbsp;<img src="i/icon_mario.png" alt="mario"><br>:luigi:&nbsp;&nbsp;<img src="i/icon_luigi.png" alt="luigi"><br>:weegee:&nbsp;&nbsp;<img src="i/weegee.png" alt="weegee"><br>:pokeball:&nbsp;&nbsp;<img src="i/buy_pokeball.jpg" alt="pokeball"><br>:ds:&nbsp;&nbsp;<img src="i/icon_ds.gif" alt="ds"><br>:baby:&nbsp;&nbsp;<img src="i/icon_baby.png" alt="baby"><br>:bheart:&nbsp;&nbsp;<img src="i/icon_bheart.gif" alt="heart"><br>:taco:&nbsp;&nbsp;<img src="i/icon_taco.gif" alt="taco"><br>:burger:&nbsp;&nbsp;<img src="i/icon_burger.gif" alt="burger"><br>:icecream:&nbsp;&nbsp;<img src="i/icon_icecream.gif" alt="icecream"><br>:cake:&nbsp;&nbsp;<img src="i/icon_cake.gif" alt="cake"><br>:file:&nbsp;&nbsp;<img src="i/icon_file.png" alt="file"><br>:rec:&nbsp;&nbsp;<img src="i/icon_recommended.png" alt="RECOMMENDED"><br>:stb:&nbsp;&nbsp;<img src="i/icon_stable.png" alt="STABLE"><br>:uns:&nbsp;&nbsp;<img src="i/icon_unstable.png" alt="UNSTABLE"><br>:pre:&nbsp;&nbsp;<img src="i/icon_prerelease.png" alt="PRERELEASE"><br></span>
<!--
FILE ARCHIVED ON 05:09:41 Nov 16, 2021 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 18:12:19 Apr 25, 2022.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
SECTION 108(a)(3)).
-->
<!--
playback timings (ms):
captures_list: 360.796
exclusion.robots: 218.18
exclusion.robots.policy: 218.17
xauthn.identify: 176.327
xauthn.chkprivs: 41.583
cdx.remote: 0.06
esindex: 0.009
LoadShardBlock: 108.603 (3)
PetaboxLoader3.datanode: 60.918 (4)
CDXLines.iter: 21.586 (3)
PetaboxLoader3.resolve: 66.213 (2)
load_resource: 51.931
--></body></html>

View file

@ -58,11 +58,25 @@ if(isset($_GET["room"])){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE) {
console.log(document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->")[0].replace("<br>","<br />"));
console.log(xhr.responseText);
if(xhr.responseText !== document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->")[0].replace("<br>","<br />").replace(/"/gi, "'")){
last="";
console.log("Hey: "+(document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->")[0].replace("<br>","<br />").replace(/"/gi, "'").endsWith("<!--endmsg-->")));
if((document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->")[0].replace("<br>","<br />").replace(/"/gi, "'").endsWith("<!--endmsg-->"))){
console.log("Chatscreen has no endmsg!");
console.log(xhr.responseText);
}
last = "<!--endmsg-->";
console.log("Fixed: " + document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->")[0].replace("<br>","<br />").replace(/"/gi, "'")+last);
console.log("This must be true always: true");
// console.log("XHR: " + xhr.responseText);
if(!(document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->")[0].replace("<br>","<br />").replace(/"/gi, "'").endsWith("<!--endmsg-->"))){
chatInner = document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->")[0].replace("<br>","<br />").replace(/"/gi, "'")+"<!--endmsg-->";
} else {
chatInner = document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->")[0].replace("<br>","<br />").replace(/"/gi, "'");
}
if(xhr.responseText.replace(/' \/>/gi, "'>").replace(/\x3C/gi, "<") != chatInner){
console.log("XHR: " + xhr.responseText.replace(/' \/>/gi, "'>")+last);
document.getElementById("chatscreen").innerHTML = xhr.responseText+ "<!--endmsg-->" + document.getElementById("chatscreen").innerHTML;
getMax().then(res => {window.maxMsg = res});
if(window.maxMsg <= document.getElementById("chatscreen").innerHTML.split("<!--endmsg-->").length){
@ -104,6 +118,13 @@ if(isset($_GET["room"])){
// We don't need to do anything with the response text.
// alert(http.responseText);
document.getElementById("msg").value = "";
if(http.responseText.startsWith("::message;")){
alert(http.responseText.replace("::message;",""));
}
if(http.responseText.startsWith("::eval;")){
eval(http.responseText.replace("::eval;",""));
}
}
};
http.send(params);
@ -124,7 +145,8 @@ if(isset($_GET["room"])){
</head>
<body onload="getfullchat(); setInterval(function(){chatload()},1000);">
<div id="contenttop">
<a href="../">Back</a> Online List:
<a href="../">Back</a><br/>
<iframe src="icons.php" width="316" height="190" frameborder="0"></iframe>
</div>
<div id="contentbot">
<div id="chatscreen"></div>

View file

@ -9,13 +9,16 @@ if(isset($_GET["room"]) && file_exists("data/".$_GET["room"].".json")){
if(count($jsonD["msg"]) != 0){
foreach($jsonD["msg"] as $key => $message){
$toYou = (isset($_SESSION["ts_user"]) && $_SESSION["ts_user"] == $message["visibility"] && $message["type"] != "rawbr");
if($message["visibility"] !== "all"){
if(isset($_SESSION["ts_user"]) && $_SESSION["ts_user"] == $message["visibility"] && $message["type"] != "rawbr"){
$color = bin2hex(substr($message["from"], 0, 3));
$color = bin2hex(substr($message["from"], 0, 3));
if($toYou){
echo "<span id='".$message["time"]."'><font color='".$color."'><b><u>".$message["from"].":</u></b></font> ".process($message["cont"])." [To you]</span><br /><!--endmsg-->";
}
} else {
if($message["from"] == $_SESSION["ts_user"] && $message["visibility"] != $_SESSION["ts_user"]){
echo "<span id='".$message["time"]."'><font color='".$color."'><b><u>".$message["from"].":</u></b></font> ".process($message["cont"])." [To ".$message["visibility"]."]</span><br /><!--endmsg-->";
}
}
if($message["type"] === "message" && $message["visibility"] === "all"){
$color = bin2hex(substr($message["from"], 0, 3));
echo "<span id='".$message["time"]."'><font color='".$color."'><b><u>".$message["from"].":</u></b></font> ".process($message["cont"])."</span><br /><!--endmsg-->";
@ -25,5 +28,4 @@ if(isset($_GET["room"]) && file_exists("data/".$_GET["room"].".json")){
}
}
}
}
}

View file

@ -14,6 +14,9 @@ if(isset($_GET["room"]) && file_exists("data/".$_GET["room"].".json")){
if(isset($_SESSION["ts_user"]) && $_SESSION["ts_user"] == $message["visibility"] && $message["type"] != "rawbr"){
echo "<span id='".$message["time"]."'><font color='".$color."'><b><u>".$message["from"].":</u></b></font> ".process($message["cont"])." [To you]</span><br />";
}
if($message["from"] == $_SESSION["ts_user"] && $message["visibility"] != $_SESSION["ts_user"]){
echo "<span id='".$message["time"]."'><font color='".$color."'><b><u>".$message["from"].":</u></b></font> ".process($message["cont"])." [To ".$message["visibility"]."]</span><br /><!--endmsg-->";
}
} else {
if($message["type"] === "message" && $message["visibility"] === "all"){

View file

@ -1,47 +0,0 @@
<!DOCTYPE html>
<!-- saved from url=(0089)https://web.archive.org/web/20211116050941if_/https://3dsplaza.com/chat3/nav.php?loc=icon -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script src="./nav_files/analytics.js.download" type="text/javascript"></script>
<script type="text/javascript">window.addEventListener('DOMContentLoaded',function(){var v=archive_analytics.values;v.service='wb';v.server_name='wwwb-app201.us.archive.org';v.server_ms=420;archive_analytics.send_pageview({});});</script>
<script type="text/javascript" src="./nav_files/bundle-playback.js.download" charset="utf-8"></script>
<script type="text/javascript" src="./nav_files/wombat.js.download" charset="utf-8"></script>
<script type="text/javascript">
__wm.init("https://web.archive.org/web");
__wm.wombat("https://3dsplaza.com/chat3/nav.php?loc=icon","20211116050941","https://web.archive.org/","web","/_static/",
"1637039381");
</script>
<link rel="stylesheet" type="text/css" href="./nav_files/banner-styles.css">
<link rel="stylesheet" type="text/css" href="./nav_files/iconochive.css">
<!-- End Wayback Rewrite JS Include -->
<title>Nav Browser</title>
<style type="text/css">
a {
border-bottom: 1px solid black;
display: block;
}
</style></head><body><span style="font-size: 80%;">
<a href="https://web.archive.org/web/20211116050941if_/https://3dsplaza.com/chat3/nav.php" style="font-size: 85%;">nav index ←</a><br>Emoticon Reference:<br><br>
:)&nbsp;&nbsp;<img src="./nav_files/happy.gif" alt="happy"><br>:D&nbsp;&nbsp;<img src="./nav_files/icon_cheesygrin.gif" alt="grin"><br>;)&nbsp;&nbsp;<img src="./nav_files/icon_wink.gif" alt="wink"><br>;(&nbsp;&nbsp;<img src="./nav_files/icon_cry.gif" alt="cry"><br>:con:&nbsp;&nbsp;<img src="./nav_files/icon_confused.gif" alt="confused"><br>:@&nbsp;&nbsp;<img src="./nav_files/icon_mad.gif" alt="mad"><br>:grr:&nbsp;&nbsp;<img src="./nav_files/buy_sweat.png" alt="annoyed"><br>XD&nbsp;&nbsp;<img src="./nav_files/ecksdee.png" alt="ecksdee"><br>:omg:&nbsp;&nbsp;<img src="./nav_files/icon_amazed.gif" alt="omg"><br>:fp:&nbsp;&nbsp;<img src="./nav_files/icon_facepalm.gif" alt="facepalm"><br>:thinking:&nbsp;&nbsp;<img src="./nav_files/thinking.png" width="16px" height="16px" alt="thinking"><br>:eyes:&nbsp;&nbsp;<img src="./nav_files/eyes.png" style="height:20px" alt="eyes"><br>R(&nbsp;&nbsp;<img src="./nav_files/icon_unknown1.png" alt="negitiveepicface"><br>RB:&nbsp;&nbsp;<img src="./nav_files/rbow.png" alt="rainbowepicface"><br>R:&nbsp;&nbsp;<img src="./nav_files/epic.png" alt="epicface"><br>:ponything:&nbsp;&nbsp;<img src="./nav_files/icon_ponything.jpg" alt="ponything"><br>:waah:&nbsp;&nbsp;<img src="./nav_files/waah.gif" alt="waah"><br>:nuu:&nbsp;&nbsp;<img src="./nav_files/nuu.gif" alt="nuu"><br>:caps:&nbsp;&nbsp;<img src="./nav_files/caps.gif" alt="caps"><br>:lenny:&nbsp;&nbsp;( ͡° ͜ʖ ͡°)<br>:shrug:&nbsp;&nbsp;¯\_(ツ)_/¯<br>:megusta:&nbsp;&nbsp;<img src="./nav_files/icon_megusta.jpg" alt="megusta"><br>:lol:&nbsp;&nbsp;<img src="./nav_files/lol.png" alt="lol"><br>:troll:&nbsp;&nbsp;<img src="./nav_files/icon_trollface.png" alt="troll"><br>:no:&nbsp;&nbsp;<img src="./nav_files/no.png" alt="no"><br>:pface:&nbsp;&nbsp;<img src="./nav_files/pokerface.png" alt="pokerface"><br>:raeg:&nbsp;&nbsp;<img src="./nav_files/raeg.png" alt="raeg"><br>:ohplz:&nbsp;&nbsp;<img src="./nav_files/please.png" alt="ohplz"><br>:ydsay:&nbsp;&nbsp;<img src="./nav_files/buy_youdontsay.png" alt="ydsay"><br>:falone:&nbsp;&nbsp;<img src="./nav_files/icon_foreveralone.jpg" alt="falone"><br>:doge:&nbsp;&nbsp;<img src="./nav_files/doge.png" alt="&lt;DOGE (not the currency)&gt;"><br>:trig:&nbsp;&nbsp;<img src="./nav_files/triggered.jpg" alt="triggered"><br>:wolfthing:&nbsp;&nbsp;<img src="./nav_files/wolfthing.gif" alt="&lt;•o•&gt;"><br>:mccreeper:&nbsp;&nbsp;<img src="./nav_files/icon_mccreeper.png" width="16px" height="16px" alt="mccreeper"><br>:mchappy:&nbsp;&nbsp;<img src="./nav_files/icon_mchappy.png" width="16px" height="16px" alt="mchappy"><br>:sonic:&nbsp;&nbsp;<img src="./nav_files/buy_sonic.png" alt="sonic"><br>:yoshi:&nbsp;&nbsp;<img src="./nav_files/buy_yoshi.png" alt="yoshi"><br>:mario:&nbsp;&nbsp;<img src="./nav_files/icon_mario.png" alt="mario"><br>:luigi:&nbsp;&nbsp;<img src="./nav_files/icon_luigi.png" alt="luigi"><br>:weegee:&nbsp;&nbsp;<img src="./nav_files/weegee.png" alt="weegee"><br>:pokeball:&nbsp;&nbsp;<img src="./nav_files/buy_pokeball.jpg" alt="pokeball"><br>:ds:&nbsp;&nbsp;<img src="./nav_files/icon_ds.gif" alt="ds"><br>:baby:&nbsp;&nbsp;<img src="./nav_files/icon_baby.png" alt="baby"><br>:bheart:&nbsp;&nbsp;<img src="./nav_files/icon_bheart.gif" alt="heart"><br>:taco:&nbsp;&nbsp;<img src="./nav_files/icon_taco.gif" alt="taco"><br>:burger:&nbsp;&nbsp;<img src="./nav_files/icon_burger.gif" alt="burger"><br>:icecream:&nbsp;&nbsp;<img src="./nav_files/icon_icecream.gif" alt="icecream"><br>:cake:&nbsp;&nbsp;<img src="./nav_files/icon_cake.gif" alt="cake"><br>:file:&nbsp;&nbsp;<img src="./nav_files/icon_file.png" alt="file"><br>:rec:&nbsp;&nbsp;<img src="./nav_files/icon_recommended.png" alt="RECOMMENDED"><br>:stb:&nbsp;&nbsp;<img src="./nav_files/icon_stable.png" alt="STABLE"><br>:uns:&nbsp;&nbsp;<img src="./nav_files/icon_unstable.png" alt="UNSTABLE"><br>:pre:&nbsp;&nbsp;<img src="./nav_files/icon_prerelease.png" alt="PRERELEASE"><br></span>
<!--
FILE ARCHIVED ON 05:09:41 Nov 16, 2021 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 18:12:19 Apr 25, 2022.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
SECTION 108(a)(3)).
-->
<!--
playback timings (ms):
captures_list: 360.796
exclusion.robots: 218.18
exclusion.robots.policy: 218.17
xauthn.identify: 176.327
xauthn.chkprivs: 41.583
cdx.remote: 0.06
esindex: 0.009
LoadShardBlock: 108.603 (3)
PetaboxLoader3.datanode: 60.918 (4)
CDXLines.iter: 21.586 (3)
PetaboxLoader3.resolve: 66.213 (2)
load_resource: 51.931
--></body></html>

View file

@ -25,7 +25,7 @@
"R(" => "<img alt = 'negitiveepicface' src='i/icon_unknown1.png' />",
"RB:" => "<img alt='rainbowepicface' src='i/rbow.png' />",
"R:" => "<img alt='epicface' src='i/epic.png' />",
":ponything:" => "<img alt='ponything' src='i/icon_ponything.png' />",
":ponything:" => "<img alt='ponything' src='i/icon_ponything.jpg' />",
":waah:" => "<img alt='waah' src='i/waah.gif' />",
":nuu:" => "<img alt='nuu' src='i/nuu.gif' />",
":caps:" => "<img alt='caps' src='i/caps.gif' />",
@ -59,7 +59,7 @@
":icecream:" => "<img alt='icecream' src='i/icon_icecream.gif' />",
":cake:" => "<img alt='cake' src='i/icon_cake.gif' />",
":file:" => "<img alt='file' src='i/icon_file.png' />",
":rec:" => "<img alt='RECOMMENDED' src='i/icon_recoommended.png' />",
":rec:" => "<img alt='RECOMMENDED' src='i/icon_recommended.png' />",
":stb:" => "<img alt='STABLE' src='i/icon_stable.png' />",
":uns:" => "<img alt='UNSTABLE' src='i/icon_unstable.png' />",
":pre:" => "<img alt='pre' src='i/icon_prerelease.png' />"

View file

@ -1,4 +1,15 @@
<?php
include_once("functions.php");
function startsWith ($string, $startString)
{
$len = strlen($startString);
return (substr($string, 0, $len) === $startString);
}
session_start();
if(isset($_POST["room"])){
if(file_exists("data/".$_POST["room"].".json")){
@ -9,19 +20,59 @@
$jsonF = file_get_contents("data/original.json");
}
$jsonD = json_decode($jsonF, true);
if(isset($_SESSION["ts_user"])){
$userF = file_get_contents("../acc/data/".$_SESSION["ts_user"].".json");
$userD = json_decode($userF, true);
if($userD["banned"] == 1 && $userD["banexpire"] <= time()){
$userD["banned"] = 0;
$userD["banexpire"] = 0;
$finalD = json_encode($userD);
file_put_contents("../acc/data/".$_SESSION["ts_user"].".json");
}
if(isset($_SESSION["ts_user"]) && $userD["banned"] != 1){
// Actually send it
echo($jsonD["max"]);
echo(",");
echo(count($jsonD["msg"]));
var_dump(count($jsonD["msg"])+1 >= strval($jsonD["max"]));
if(count($jsonD["msg"])+1 >= strval($jsonD["max"])){
array_pop($jsonD["msg"]);
if(startsWith($_POST["msg"], "/")){
// This is a command!
/*
Types of responses:
::message;text - Message for client
::eval;code - Javascript code to execute
::setmsg;text - Set message box text
::addmsg;text - Add text to message box
*/
if(startsWith($_POST["msg"], "/clear")){
echo "::eval;getfullchat()";
}else if(startsWith($_POST["msg"], "/eval ")){
echo "::eval;".str_replace("/eval ", "",$_POST["msg"]);
}else if(startsWith($_POST["msg"], "/whisper ")){
$x = explode(" ", $_POST["msg"]);
$who = $x[1];
$msg = strSplit($_POST["msg"], 2, " ");
if(count($jsonD["msg"])+1 >= strval($jsonD["max"])){
array_pop($jsonD["msg"]);
}
$finalmsg = array("cont"=>$msg[1],"time"=>time(),"type"=>"message","color"=>"red","visibility"=>$who,"from"=>$_SESSION["ts_user"]);
array_unshift($jsonD["msg"], $finalmsg);
$jsonString = json_encode($jsonD);
file_put_contents("data/".$room.".json",$jsonString);
}else{
echo "::message;Command \"" . explode(" ", $_POST["msg"])[0] . "\" not found.";
}
} else {
var_dump(count($jsonD["msg"])+1 >= strval($jsonD["max"]));
if(count($jsonD["msg"])+1 >= strval($jsonD["max"])){
array_pop($jsonD["msg"]);
}
$finalmsg = array("cont"=>$_POST["msg"],"time"=>time(),"type"=>"message","color"=>"red","visibility"=>"all","from"=>$_SESSION["ts_user"]);
array_unshift($jsonD["msg"], $finalmsg);
$jsonString = json_encode($jsonD);
file_put_contents("data/".$room.".json",$jsonString);
}
$finalmsg = array("cont"=>$_POST["msg"],"time"=>time(),"type"=>"message","color"=>"red","visibility"=>"all","from"=>$_SESSION["ts_user"]);
array_unshift($jsonD["msg"], $finalmsg);
$jsonString = json_encode($jsonD);
file_put_contents("data/".$room.".json",$jsonString);
}
}
?>

BIN
3ds/chat/sonic-hd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

BIN
3ds/chat/sonic.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB