From e4a8108dc1e2359256c99eb8e2568d2111b40804 Mon Sep 17 00:00:00 2001 From: ECHibiki Date: Sat, 8 Feb 2020 06:59:30 -0500 Subject: [PATCH] Rename and update to server --- settings/add-to-queue.php | 34 ++++++++++++++++++++++ settings/confirmation.php | 73 +++++++++++++++++++++++++++++++++++++++++++++++ settings/queue-form.php | 40 ++++++++++++++++++++++++++ settings/timed-post.php | 24 ++++++++++++++++ 4 files changed, 171 insertions(+) create mode 100644 settings/add-to-queue.php create mode 100644 settings/confirmation.php create mode 100644 settings/queue-form.php create mode 100644 settings/timed-post.php diff --git a/settings/add-to-queue.php b/settings/add-to-queue.php new file mode 100644 index 0000000..6ebda39 --- /dev/null +++ b/settings/add-to-queue.php @@ -0,0 +1,34 @@ +getPostDetails("SubmissionHalt", "IPAddress", $_SERVER['HTTP_X_REAL_IP']); + if(sizeof($halt_check) == 0){ + $construction->addToTable("SubmissionHalt", array("IPAddress"=>$_SERVER['HTTP_X_REAL_IP'])); + $comment = $construction->checkCommentValid($_POST["comment"]); + + $file_string = $construction->uploadAndVerify($_FILES); + + $do_not_submit = false; + //Duplicate code = 5 + for($file = 0 ; $file < 4 ; $file++) if($construction->die_state[$file] != -1 && $construction->die_state[$file] != 4){ + $do_not_submit = true; + } + if( $construction->comment_error == 0) $do_not_submit = true; + + if($do_not_submit) { + header("location: /twitter/confirmation.php?" . "comment=" . $construction->comment_error + . "&f1=".$construction->die_state[0] + ."&f2=". $construction->die_state[1] + ."&f3=". $construction->die_state[2] + ."&f4=".$construction->die_state[3]); + } + else $construction->addToTable("TweetQueue.php", ["ImageLocation" => $file_string, "Comment"=>$comment]); + header("location: /twitter/confirmation?" . "comment=" . $construction->comment_error + . "&f1=".$construction->die_state[0] + ."&f2=". $construction->die_state[1] + ."&f3=". $construction->die_state[2] + ."&f4=".$construction->die_state[3]); + } + else + header("location: /twitter/confirmation?errmsg=1"); +?> \ No newline at end of file diff --git a/settings/confirmation.php b/settings/confirmation.php new file mode 100644 index 0000000..d3c7c7a --- /dev/null +++ b/settings/confirmation.php @@ -0,0 +1,73 @@ + + + +
+ Back to Form +

+ +
+ '; + + if($_GET["errmsg"] == '1'){ + echo "Multiple Submissions Detected
"; + } + else if($_GET["errmsg"] == '1'){ + echo "Multiple Submissions Detected
"; + } + else{ + $do_not_submit = false; + for($file = 1 ; $file <= 4 ; $file++){ + if($_GET["f" . (string)$file] == -1){ + echo "File: $file was valid.
"; + continue;//bypass do_not_submit flag + } + else if($_GET["f" . (string)$file] == 4){ + echo "file $file, Empty
"; + continue;//bypass do_not_submit flag + } + else if($_GET["f" . (string)$file] == 0){ + echo "file" . (string)$file ." Over filesize limit-Server
"; + } + else if($_GET["f" . (string)$file] == 1){ + echo "file $file, PHP err " . $files["file" . (string)$file]["error"] . "
"; + } + else if($_GET["f" . (string)$file] == 2){ + echo "file $file, Over size limit-Client
"; + } + else if($_GET["f" . (string)$file] == 3){ + echo "file $file, The uploaded file was only partially uploaded.
"; + } + else if($_GET["f" . (string)$file] == 5) { + echo "file " . (string)$file .", Duplicate
"; + } + else{ + echo "file $file, Unkown Upload Error " . $files["file" . (string)$file]["error"] . "
"; + } + $do_not_submit = true; + } + if($_GET["comment"] == 0){ + echo "Comment too long[Server]
"; + $do_not_submit = true; + } + + echo "
"; + + if($do_not_submit) echo "Error in Tweet. Aborting addition to queue.
"; + + } + + $construction->displayTabularDatabase("TweetQueue", true); +?> + +
+Back to Form + + + + diff --git a/settings/queue-form.php b/settings/queue-form.php new file mode 100644 index 0000000..cc251bc --- /dev/null +++ b/settings/queue-form.php @@ -0,0 +1,40 @@ +deletePost("SubmissionHalt", "IPAddress", $_SERVER['HTTP_X_REAL_IP']); + + session_start(); + if($_POST["name"] == "ecorvid" && $_POST["pass"] == "unsafepassword"){ + $_SESSION["twitterboard"] = "sessionid"; + header("Location: "); + } + +echo ' + + + + + TweetQueue + + +

Project submits tweets to a specified twitter account at a specified time

+'; + + +// echo "

Password verification disabled

"; + // $construction->buildQueueForm(); + // $construction->displayTabularDatabase("TweetQueue", true); +echo "
"; +// $construction->buildPassForm(); + + if($_SESSION["twitterboard"] != "sessionid"){ + $construction->buildPassForm(); + } + else{ + $construction->buildQueueForm(); + $construction->displayTabularDatabase("TweetQueue", true); + } +?> + + + \ No newline at end of file diff --git a/settings/timed-post.php b/settings/timed-post.php new file mode 100644 index 0000000..97e0342 --- /dev/null +++ b/settings/timed-post.php @@ -0,0 +1,24 @@ +retrieveOldestEntry(); + echo "
" . var_dump($oldest); + echo "
"; + + //ob_start(); + require_once("class/twitter-connection.php"); + //ob_end_clean(); + $connection = new TwitterConnection(); + $response = $connection->makeTweet($oldest[0]["Comment"], explode(",", $oldest[0]["ImageLocation"])); + echo ""; + echo $oldest[0]["Comment"] . "
"; + if($response["created_at"] === null){ + echo "post unsuccessful"; + return; + } + else { + $construction->deleteOldestEntry($oldest); + echo "Found, Added and Deleted
"; + } +?> \ No newline at end of file -- 2.11.4.GIT