3 require("class/board-level-database-connection.php");
4 $connection = new BoardLevelDatabaseConnection();
6 if ($_POST["ticket"] == "-1"){
8 $connection->deleteFromTable("SubmissionTicket", "IPAddress", $_SERVER["HTTP_X_REAL_IP"]);
12 $session_ip = $_SERVER["HTTP_X_REAL_IP"];
13 $ticket_stored_parts = $connection->getPostDetails("SubmissionTicket", "IPAddress", $session_ip)[0];
14 $recieved_ticket = base64_decode($_POST["ticket"]);
16 $uncompressed_ticket = gzuncompress ($recieved_ticket);
17 $ticket_parts = explode(",", $uncompressed_ticket);
19 if($ticket_stored_parts["TicketValue"] != $ticket_parts[0]){//ticket id check against DB and token == Was this token registered
21 $connection->deleteFromTable("SubmissionTicket", "IPAddress", $_SERVER["HTTP_X_REAL_IP"]);
24 if($ticket_stored_parts["PostText"] != $ticket_parts[1]){//comment check against DB and token == Was this comment checked?
26 $connection->deleteFromTable("SubmissionTicket", "IPAddress", $_SERVER["HTTP_X_REAL_IP"]);
29 if($_SERVER["HTTP_X_REAL_IP"] != $ticket_parts[2]){ // IP check against poster and token == Are you the person who made the token?
31 $connection->deleteFromTable("SubmissionTicket", "IPAddress", $_SERVER["HTTP_X_REAL_IP"]);
35 require_once("class/board-functions.php");
36 require_once("class/additional-functions.php");
38 $comment = $ticket_parts[1];
39 $file_string = BoardFunctions
::uploadAndVerify(array($_POST["file1"], $_POST["file2"], $_POST["file3"], $_POST["file4"]));
40 if($file_string != "" && $ticket_parts[3] == "0"){//Unpermitted image
41 $connection->deleteFromTable("SubmissionTicket", "IPAddress", $_SERVER["HTTP_X_REAL_IP"]);
42 $file_string_arr = explode(",", urldecode($file_string));
43 foreach($file_string_arr as $upload_location){
44 if($upload_location !== "")
45 unlink($upload_location);
52 $do_not_submit = false;
54 for($file = 0 ; $file < 4 ; $file++
) if(BoardFunctions
::$die_state[$file] != 0 && BoardFunctions
::$die_state[$file] != 5){
55 $do_not_submit = true;
59 $file_string_arr = explode(",", urldecode($file_string));
60 $connection->deleteFromTable("SubmissionTicket", "IPAddress", $_SERVER["HTTP_X_REAL_IP"]);
61 foreach($file_string_arr as $upload_location){
62 if($upload_location !== "")
63 unlink($upload_location);
67 $id = ceil((microtime(true) *10)) . "" . (rand(0,9));
68 $unverified_state = 0; // 0=false. Is verifed
69 if(strpos($comment, "VERIFY: ") !== false){
70 $unverified_state = 1;// 1=true. Is not verifed
71 $comment = substr($comment, 8);
74 $post_properties = parse_ini_file("settings/postproperties.ini");
75 $post_properties["TotalPosts"] = intval($post_properties["TotalPosts"]) +
1;
76 StandardFunctions
::write_php_ini($post_properties, "settings/postproperties.ini");
78 $connection->addToTable("Tweet", ["PostID"=> $id, "ImageURL" => $file_string, "PostText"=>$comment]);
79 $connection->addToTable("Unsubmitted", ["PostID"=> $id, "IPAddress"=>$_SERVER["HTTP_X_REAL_IP"], "Unverified"=>$unverified_state]);
81 echo "f1=".BoardFunctions
::$die_state[0] ."&f2=". BoardFunctions
::$die_state[1]
82 ."&f3=". BoardFunctions
::$die_state[2] ."&f4=".BoardFunctions
::$die_state[3];