Added Matrix, cheatsheet, Update visitor counter

Co-authored-by: The Arrayser; <TheArrayser@users.noreply.github.com>
Co-authored-by: Julian; <JDobeshow@users.noreply.github.com>
This commit is contained in:
MrLetsplay 2022-04-21 20:25:56 +02:00
parent 77908d46ac
commit ab3f0b2df4
8 changed files with 216 additions and 40 deletions

View File

@ -1,6 +1,7 @@
RewriteEngine On
RewriteRule ^sus$ sus.html [NC]
RewriteRule ^matrix$ matrix.html [NC]
RewriteRule ^$ sus.html [NC]
RewriteRule ^sus$ sus.html [NC]
RewriteRule ^🆘$ sus.html [NC]

5
img/console.svg Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<rect x="3.1199" y="5.3971" width="17.868" height="14.384" opacity=".999" stroke-dasharray="30.0802, 30.0802" stroke-dashoffset="6.016" stroke-linecap="round" stroke-linejoin="round" stroke-width="7.52"/>
<path d="m20 19v-12h-16v12h16m0-16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-16a2 2 0 0 1-2-2v-14c0-1.11 0.9-2 2-2h16m-7 14v-2h5v2h-5m-3.42-4-4.01-4h2.83l3.3 3.3c0.39 0.39 0.39 1.03 0 1.42l-3.28 3.28h-2.83l3.99-4z" fill="#0f0"/>
</svg>

After

Width:  |  Height:  |  Size: 570 B

View File

@ -38,6 +38,11 @@
font-size: 50%;
}
button {
background-color: pink;
border-radius: 5px;
}
.gurke {
border: 2px solid black;
padding: 10px;
@ -68,15 +73,19 @@
/*animation: rickRoll 1s infinite ease;*/
animation: amogus 10s infinite linear;
max-width: 100%;
margin-top: 175px;
margin-bottom: 175px;
}
iframe {
background: url("https://nsfw.cringe-studios.com/wtf.png"), linear-gradient(rgb(255,0,0), rgb(0,255,0));
}
.blinking {
animation: blink 1s infinite linear;
}
iframe {
background: url("https://nsfw.cringe-studios.com/wtf.png"), linear-gradient(rgb(255,0,0), rgb(0,255,0));
}
@keyframes blink {
50% {
@ -166,7 +175,9 @@
100% {
transform: rotateZ(360deg);
}
}
</style>
</head>
@ -286,29 +297,26 @@
<!--<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>-->
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col">
<form action="index.php" method="post">
<label for="fName">First Name</label><br />
<input type="text" name="fName" /><br />
<label for="lName">Last Name</label><br />
<input type="text" name="lName" /><br />
<input type="submit" style="margin:5px"/>
<div class="row justify-content-center" style="margin:20px">
<form action="matrix" method="post" style="border:1px solid black">
<input type="text" name="username" placeholder="Username" style="margin:10px" /><br>
<input type="text" name="password" placeholder="Password" style="margin:10px" /><br>
<input type="submit" value="login" style="margin:10px" />
</form>
</div>
<div class="row justify-content-center">
<b class="blinking" style="background-color:red; color:yellow;text-align:center">This site has been visited <?php include("visitor_counter.php"); echo getCounter(); ?> times (<span id="visited-self"></span> times by you)</b>
</div>
</div>
<!--
<iframe id="cringe-frame" title="Recursion" src="https://cringe-studios.com/?poop" style="width:100%; height:800px; border:0px"></iframe>
-->
<h6><b class="blinking" style="background-color:red; color:yellow">This site has been visited <?php include("visitor_counter.php"); echo IncrementCounter(); ?> times</b></h6>
<!-- <footer>
<footer>
&copy; Cringe Studios
</footer>
<script>
<!-- <script>
let search = window.location.search;
let q = search != "" ? parseInt(search.substring(1)) : 0;
if(q <= 20) {
@ -317,5 +325,32 @@
}
</script>
-->
<script>
window.sus = () => console.log("You are sus");
function visited() {
// Count visit
let xhr = new XMLHttpRequest();
xhr.open("GET", "/visited.php");
xhr.send();
}
let lastVisited = window.localStorage.lastVisited;
if(lastVisited == null) {
window.localStorage.lastVisited = new Date().getTime();
window.localStorage.visitCounter = 1;
visited();
}else {
let diff = new Date().getTime() - lastVisited;
if(diff > 2000) {
window.localStorage.lastVisited = new Date().getTime();
window.localStorage.visitCounter++;
visited();
}
}
document.getElementById("visited-self").innerText = window.localStorage.visitCounter;
</script>
</body>
</html>

1
lzk-cheatsheet.html Normal file

File diff suppressed because one or more lines are too long

53
matrix.html Normal file
View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<title>Matrix</title>
<link rel="icon" href="https://nsfw.cringe-studios.com/console.svg">
<style>
body {
font-family: 'Courier';
text-align: center;
}
.blinking {
text-align: center;
width: max-content;
color: red;
animation: blink 1s infinite linear;
display: inline;
}
@keyframes blink {
50% {
background-color:red;
color:white;
}
}
</style>
</head>
<?php
$username = $_POST["username"];
$password = $_POST["password"];
$allowedUsers = array(
"sus" => "sus",
"RedPill" => "giveMe",
"admin" => "admin",
"cringe" => "123"
);
if(empty($username) || empty($password) || empty($allowedUsers[$username]) || $password != $allowedUsers[$username]) {
header("HTTP/1.1 418 I'm a teapot");
echo "<h1 class=\"blinking\">Your access to the Matrix has been denied</h1>";
die();
}
?>
<body style="margin: 0; overflow:hidden; background-color:black;">
<canvas width="auto" height="auto" id="canvas"></canvas>
<script src="matrix.js"></script>
</body>
</html>

67
matrix.js Normal file
View File

@ -0,0 +1,67 @@
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
let cw = window.innerWidth;
let ch = window.innerHeight;
window.onresize = () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
cw = window.innerWidth;
ch = window.innerHeight;
maxColumns = cw/fontSize;
};
let charArr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '€', '$', '£', 'µ', '§'];
let maxCharCount = 100;
let fallingCharArr = [];
let fontSize = 15;
let maxColumns = cw/fontSize;
canvas.width = cw;
canvas.height = ch;
let frames = 0;
class FallingChar {
constructor(x, y) {
this.x = x;
this.y = y;
}
draw(ctx) {
this.value = charArr[Math.floor(Math.random() * (charArr.length - 1))].toUpperCase();
this.speed = Math.random() * fontSize * 3 /4 + fontSize * 3 /4;
ctx.fillStyle = "rgba(0, 255, 0)";
ctx.font = fontSize + "px Courier";
ctx.fillText(this.value, this.x, this.y);
this.y += this.speed;
if (this.y > ch) {
this.y = Math.random() * ch/2 - 50;
this.x = Math.floor(Math.random() * maxColumns) * fontSize;
this.speed = - Math.random() * fontSize * 3 /4 + fontSize * 3 /4;
}
}
}
let update = () => {
if (fallingCharArr.length < maxCharCount) {
let fallingChar = new FallingChar(Math.floor(Math.random() * maxColumns) * fontSize, Math.random() * ch/2 - 50);
fallingCharArr.push(fallingChar);
}
ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
ctx.fillRect(0, 0, cw, ch);
for (let i = 0; i < fallingCharArr.length && frames % 2 == 0; i++){
fallingCharArr[i].draw(ctx);
}
requestAnimationFrame(update);
frames++;
}
update();

6
visited.php Normal file
View File

@ -0,0 +1,6 @@
<?php
include("visitor_counter.php");
echo incrementCounter();
?>

View File

@ -3,31 +3,39 @@
define("COUNTER_START_VALUE", 0);
define("COUNTER_LOG", "visit_counter.log"); //name of file you want to use to save the counter value
/*************************************************************************************************/
function IncrementCounter()
{
$create_file = !file_exists(COUNTER_LOG);
function getCounter() {
if(!file_exists(COUNTER_LOG)) return str_pad(COUNTER_START_VALUE, 9, '0', STR_PAD_LEFT);
if( !($fh = fopen(COUNTER_LOG, $create_file ? "x+b" : "r+b")) )
return "Error";
if(!($fh = fopen(COUNTER_LOG, $create_file ? "x+b" : "r+b"))) return "Error";
//do an flock here, maybe, I don't know :-)
//Reading current value of counter:
if($create_file)
$count = (int)fread($fh, 9); //reads 9 digits (supposing max 1 billion count)
if(!fclose($fh)) return "Error";
return str_pad($count, 9, '0', STR_PAD_LEFT);
}
function incrementCounter() {
$create_file = !file_exists(COUNTER_LOG);
if(!($fh = fopen(COUNTER_LOG, $create_file ? "x+b" : "r+b"))) return "Error";
//do an flock here, maybe, I don't know :-)
//Reading current value of counter:
if($create_file){
$count = COUNTER_START_VALUE;
else
{
}else{
$count = (int)fread($fh, 9); //reads 9 digits (supposing max 1 billion count)
rewind($fh);
}
//Writing new counter value:
if(!fwrite($fh, ++$count))
return "Error";
if(!fclose($fh))
return "Error";
if(!fwrite($fh, ++$count)) return "Error";
if(!fclose($fh)) return "Error";
return str_pad($count, 9, '0', STR_PAD_LEFT);
return "Success";
}
?>