initial commit

This commit is contained in:
Luke Ogburn
2019-03-30 23:03:43 -04:00
commit 3d9e0c7717
29 changed files with 740 additions and 0 deletions

2
write/error_log Normal file
View File

@@ -0,0 +1,2 @@
[29-Mar-2019 13:05:44 America/New_York] PHP Notice: Undefined index: 500ID in /home/lukeuxao/public_html/500/global.php on line 12
[29-Mar-2019 13:05:44 America/New_York] PHP Notice: Undefined index: 500KEY in /home/lukeuxao/public_html/500/global.php on line 13

32
write/fork.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
require "/home/lukeuxao/public_html/500/global.php";
//Getting the proper file for submitting or saving (Placed here for the <title>)
$place = $_POST["submit"];
//The functions of this page are at the bottom so that the HTML will show (no idea if that actually works, but I think it has in the past so)
?>
<!DOCTYPE html>
<html>
<head>
<?php
$title = $place." post";
$css = "";
require $root."/res/head.php";
?>
</head>
<body>
<h2>Your secrets are safe here.</h2>
<pre>
<?php include $place.'.php'; ?>
</pre>
</body>
</html>
<?php
if($_POST["submit"] != "submit" && $_POST["submit"] != "save"){
//POST informatin missing
echo "Umm... POST information is missing - how/why are you here?";
exit();
exit(); //just in case lol
}
?>

40
write/index.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
require "/home/lukeuxao/public_html/500/global.php";
?>
<!DOCTYPE html>
<html>
<head>
<?php
$title = "Write";
$css = "write";
require $root."/res/head.php";
?>
</head>
<body>
<?php require $root."/res/top.php"; ?>
<script>
function wordCount(thing) {
regex = /(\S\s)|(([A-Z]|[a-z])(\.|\!|\?|\z))/;
numOfParenthesis = 5; //how many par. sets are in the regex
wordsLeft = 500-((thing.value.split(regex).length-1)/numOfParenthesis);
//if(wordsLeft<0){
// wordsLeft = 0;
//}
document.getElementById("counter").innerHTML = wordsLeft;
if(wordsLeft<=0){
document.getElementById("submitWriting").disabled = false;
}else{
document.getElementById("submitWriting").disabled = true;
}
}
</script>
<form action=fork.php method=POST>
<h2 id=counter>500</h2>
<textarea onkeyup=wordCount(this) placeholder='Write your words here...' name=words></textarea>
<div id=writeButtons>
<button type=submit name=submit value=save id=saveWriting>SAVE</button>
<button type=submit name=submit value=submit id=submitWriting disabled>SUBMIT</button>
</div>
</form>
</body>
</html>

1
write/save.php Normal file
View File

@@ -0,0 +1 @@
You are in save.php

15
write/submit.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
require $root."enc.php";
$enc = encrypt($_POST["words"], $current_key);
$postID = bin2hex(openssl_random_pseudo_bytes(7));
$stmt = $conn->prepare("INSERT INTO posts (id, user_id, text, iv, tag) VALUES (:id, :uid, :txt, :iv, :tag)");
$stmt->bindParam(":id", $postID);
$stmt->bindParam(":uid", $current_userID);
$stmt->bindParam(":txt", $enc[0]);
$stmt->bindParam(":iv", $enc[1]);
$stmt->bindParam(":tag", $enc[2]);
$stmt->execute();
header("Location: /500/read/?post=".$postID);
?>

29
write/write.css Normal file
View File

@@ -0,0 +1,29 @@
textarea{
display: block;
width: 60%;
height: calc(100vh - (1em + 1.4em + 4.5em + 2.5em) - 5em);
margin-left: auto;
margin-right: auto;
background-color: var(--main-back-color);
color: var(--main-light-color);
border: none;
resize: none;
font-family: inherit;
font-size: 1em;
padding: 1em 0.5em;
border-radius: var(--border-radius);
}
#writeButtons{
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 1em;
width: 20%;
margin-top: 0.7em;
margin-left: auto;
margin-right: auto;
}
#counter{
text-align: center;
color: var(--main-light-color);
font-weight: 500;
}