Add files via upload

This commit is contained in:
Getindor 2021-02-05 16:20:57 -05:00 committed by GitHub
parent 3b10813d4e
commit d6c9283ae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 193 additions and 0 deletions

47
chat.php Normal file
View File

@ -0,0 +1,47 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<?php
include("settings.php");
$date = getdate(date("U"));
$time = date("Y/m/d g:i:s");
$nick = $_GET["nick"];
$nick = htmlspecialchars($nick);
$admin = $_GET["admin"];
if($admin == $pass){
$badge = "<span id='admin'>@</span>";
}
if(isset($_POST["chatbox"])){
$message = $_POST["chatbox"];
if (substr($message, 0,3) == "/raw"){
$raw = substr($message, 3);
$message = "";
}
$message = htmlspecialchars($message);
$db = file_get_contents("db.txt");
$db = $db . $badge . "<span id='time'>$time </span><span id='nick'>$nick: </span>" . $message . "\n";
file_put_contents("db.txt", $db);
file_put_contents("chats.html", $db);
}
$db_array = explode("\n", $db);
if(sizeof($db_array) > 40){
unset($db_array[0]);
file_put_contents("db.txt", implode("\n", $db_array));
}
?>
</head>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=1.0)">
<iframe id = "chat" src="display.php" scrolling="yes"></iframe>
<iframe id = "users" src="userlist.php?nick=<?php echo $nick?>" scrolling="yes"></iframe>
<form method = "post" action="" >
<input type="text" name="chatbox" autocomplete="off" maxlength="150" autofocus>
</form>
</html>

1
chats.html Normal file
View File

@ -0,0 +1 @@

36
display.php Normal file
View File

@ -0,0 +1,36 @@
<meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=1.0)">
<style>
body{
background-color:#111;
color:#999;
}
#nick{
color:#f00;
margin:0px;
}
#big{
font-size:50px;
}
#admin{
color:#0f0;
}
#messages{
}
</style>
<?php
$db = file_get_contents("db.txt");
//$db = str_replace("<", "gt;", $db);
$db = str_replace("\n", "<br/></span>", $db);
echo "<span id='messages'>" . $db . "</span>";
?>
<?php
//sleep(0.3);
header("Refresh:2.6");
?>

47
index.php Normal file
View File

@ -0,0 +1,47 @@
<html>
<style>
body{
margin:0px; /* rip dooms */
padding:0px;
background-color:#111;
color:#999;
text-align:center;
}
iframe{
height:92%;
width:100%;
border:0px;
}
#nickbox{
padding-top:30px;
padding:10px;
width:20%;
background-color:#222;
border:0px;
color:#999;
}
textarea:focus, input:focus{
border:0px;
outline: none;
}
#nick{
float:right;
color:#f00;
}
</style>
<head>
<?php
include("settings.php");
//if(isset($_POST["nickbox"])){
//header("Location: $_POST['nickbox']");
//}
?>
</head>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=1.0)">
<form method = "get" action="chat.php">
<input placeholder="put ur nick here pls" type="text" name="nick" autocomplete="off" autofocus id="nickbox">
</form>
</html>

3
settings.php Normal file
View File

@ -0,0 +1,3 @@
<?php
$pass = "cock#420";
?>

36
style.css Normal file
View File

@ -0,0 +1,36 @@
body{
margin:0px; /* rip dooms */
padding:0px;
background-color:#111;
color:#444;
text-align:center;
}
#chat{
height:92%;
width:90%;
border:0px;
}
#users{
height:92%;
width:10%;
border:0px;
float:right;
}
input{
padding:10px;
width:97%;
background-color:#222;
border:0px;
color:#999;
}
textarea:focus, input:focus{
border:0px;
outline: none;
}
#nick{
float:right;
color:#f00;
}
#time{
}

22
userlist.php Normal file
View File

@ -0,0 +1,22 @@
<link rel="stylesheet" type="text/css" href="style.css">
<h2>Users:</h2>
<?php
error_reporting(0);
ini_set('display_errors', 0);
$db = file_get_contents("users.txt");
$date = getdate(date("U"));
$time = $date[seconds];
$nick = htmlspecialchars($_GET["nick"]);
//echo $time;
// if enough seconds has passed, clear the userlist.
if($time % 5 == 0){
file_put_contents("users.txt", "");
} elseif (!in_array($nick, explode("<br>", $db))) {
$db = $db . $nick . "<br>";
file_put_contents("users.txt", $db);
}
echo($db);
header("Refresh:1");
?>

1
users.txt Normal file
View File

@ -0,0 +1 @@
nobody<br>