add maxlength

This commit is contained in:
trinkey 2025-03-18 09:13:09 -04:00
parent 75f6589b33
commit d640b8dc50
3 changed files with 8 additions and 4 deletions

View file

@ -9,6 +9,10 @@ $adminPassword = "setAPasswordHere!123";
// page title // page title
$pageTitle = "the cool qna"; $pageTitle = "the cool qna";
// only applies to sent messages, responses and cws edited by admins can exceed this limit
$maxQuestionLength = 10000;
$maxCWLength = 250;
$pageDomainEnabled = true; $pageDomainEnabled = true;
$pageProto = "https"; $pageProto = "https";
$pagePath = "/qna"; $pagePath = "/qna";

View file

@ -33,9 +33,9 @@ if ($_GET["sent"] == 1) {
<summary class="sendsum">send a message!</summary> <summary class="sendsum">send a message!</summary>
<form class="frm" action="send.php"> <form class="frm" action="send.php">
<label for="questioninput">enter your message: </label> <label for="questioninput">enter your message: </label>
<input id="questioninput" name="text" required><br> <input id="questioninput" name="text" required maxlength="<?php echo($maxQuestionLength); ?>"><br>
<label for="cwinput">cw if applicable: </label> <label for="cwinput">cw if applicable: </label>
<input id="cwinput" name="cw"><br> <input id="cwinput" name="cw" maxlength="<?php echo($maxCWLength); ?>"><br>
<input type="checkbox" id="pubbox" name="public" value="1" checked> <input type="checkbox" id="pubbox" name="public" value="1" checked>
<label for="pubbox">if this is checked, your message will be available publicly</label><br> <label for="pubbox">if this is checked, your message will be available publicly</label><br>
<input type="submit" value="send"> <input type="submit" value="send">

View file

@ -7,8 +7,8 @@ if ($_GET["text"] === null) {
} }
$dataArray = array( $dataArray = array(
"text" => $_GET["text"], "text" => substr($_GET["text"], 0, $maxQuestionLength),
"cw" => $_GET["cw"], "cw" => substr($_GET["cw"], 0, $maxCWLength),
"iscwed" => !($_GET["cw"] === null || $_GET["cw"] === ""), "iscwed" => !($_GET["cw"] === null || $_GET["cw"] === ""),
"time" => date("Y-m-d H:i:sP"), "time" => date("Y-m-d H:i:sP"),
"ispublic" => $_GET["public"] == 1, "ispublic" => $_GET["public"] == 1,