mirror of
https://github.com/ithrts/ImoutoIB.git
synced 2025-01-17 00:38:15 +01:00
report captcha + better report
added captcha for reports and cleaned it up slightly
This commit is contained in:
parent
46544b30e7
commit
20a66f2010
@ -6,9 +6,7 @@ require 'require.php';
|
||||
//if captcha required?
|
||||
|
||||
if (empty($_POST)) {
|
||||
$output_html .= 'No post request received.';
|
||||
echo $output_html;
|
||||
exit();
|
||||
error('No post request received.');
|
||||
}
|
||||
|
||||
//cleanse
|
||||
@ -50,23 +48,17 @@ if (ctype_alnum($delrep_board) != true || ctype_alnum($delrep_thread) != true ||
|
||||
|
||||
//DOES BOARD EXIST?
|
||||
if (!in_Array($delrep_board, $config['boardlist'])) {
|
||||
$output_html .= 'Board ' . $delrep_board . ' does not exist.';
|
||||
echo $output_html;
|
||||
exit();
|
||||
error('Board does not exist.');
|
||||
}
|
||||
//DOES REPLY EXIST
|
||||
if ($delrep_reply != $delrep_thread) {
|
||||
if (isset($delrep_reply) && (!file_exists($path . '/' . $database_folder . '/boards/' . $delrep_board . '/' . $delrep_thread . '/' . $delrep_reply . '.php'))) {
|
||||
$output_html .= 'Reply ' . $delrep_reply . ' does not exist.';
|
||||
echo $output_html;
|
||||
exit();
|
||||
error('Reply does not exist.');
|
||||
}
|
||||
}
|
||||
//DOES THREAD EXIST?
|
||||
if (isset($delrep_thread) && (!file_exists($path . '/' . $database_folder . '/boards/' . $delrep_board . '/' . $delrep_thread . '/OP.php'))) {
|
||||
$output_html .= 'Thread ' . $delrep_thread . ' does not exist.';
|
||||
echo $output_html;
|
||||
exit();
|
||||
error('Thread does not exist.');
|
||||
}
|
||||
|
||||
//OK THEN CONTINUE:
|
||||
@ -271,6 +263,19 @@ if (isset($_POST["delete"]) && $_POST["delete"] != "") {
|
||||
|
||||
if (isset($_POST["report"]) && $_POST["report"] != "") {
|
||||
|
||||
if ($captcha_required == true) {
|
||||
if(isset($_POST['captcha'])){
|
||||
session_start();
|
||||
if (($captcha_required == true) && ($_SESSION['captcha_text'] != strtolower($_POST['captcha']))) {
|
||||
error('Wrong captcha!! How annoying...');
|
||||
} else {
|
||||
session_destroy();
|
||||
}
|
||||
} else {
|
||||
error('No captcha entered.');
|
||||
}
|
||||
}
|
||||
|
||||
//CREATE GLOBAL REPORT
|
||||
if (isset($_POST["global"]) && $_POST["global"] == "on") {
|
||||
|
||||
@ -299,12 +304,10 @@ if (isset($_POST["report"]) && $_POST["report"] != "") {
|
||||
ReportCounter($database_folder, 'global'); //refresh report counter
|
||||
//done
|
||||
if (file_exists($path . '/' . $database_folder . '/reportsglobal/' . $newcount . '.php')) {
|
||||
$output_html .= 'Global Report Created!';
|
||||
error('Global Report Created!', true);
|
||||
} else {
|
||||
$output_html .= 'Failed generating Global Report...';
|
||||
error('Failed generating Global Report...');
|
||||
}
|
||||
echo $output_html;
|
||||
exit();
|
||||
}
|
||||
|
||||
//CREATE BOARD REPORT
|
||||
@ -339,22 +342,14 @@ if (isset($_POST["report"]) && $_POST["report"] != "") {
|
||||
ReportCounter($database_folder, 'normal'); //refresh report counter
|
||||
//done
|
||||
if (file_exists($path . '/' . $database_folder . '/reports/' . $delrep_board . '/' . $newcount . '.php')) {
|
||||
$output_html .= 'Board Report Created!';
|
||||
error('Board Report Created!', true);
|
||||
} else {
|
||||
$output_html .= 'Failed generating Board Report...';
|
||||
error('Failed generating Board Report...');
|
||||
}
|
||||
echo $output_html;
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*foreach($_POST as $key => $value) {
|
||||
$output_html .= "POST parameter '$key' has '$value'<hr>";
|
||||
}*/
|
||||
|
||||
$output_html .= 'uh... supposed to exit before this';
|
||||
echo $output_html;
|
||||
error('uh... supposed to exit before this');
|
||||
|
||||
?>
|
79
report.php
Normal file
79
report.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
require 'require.php';
|
||||
|
||||
|
||||
if (isset($_GET["board"])) {
|
||||
$rep_board = phpClean($_GET["board"]);
|
||||
if (!in_Array(htmlspecialchars($_GET["board"]), $config['boardlist'])) {
|
||||
error('invalid board, what are you even trying to do it checks for this in the other file too btw');
|
||||
}
|
||||
}
|
||||
if (isset($_GET["thread"])) {
|
||||
$rep_thread = phpClean($_GET["thread"]);
|
||||
}
|
||||
if (isset($_GET["reply"])) {
|
||||
$rep_reply = phpClean($_GET["reply"]);
|
||||
}
|
||||
|
||||
if (!isset($_GET["board"]) || !isset($_GET["thread"]) || !isset($_GET["reply"]) ) {
|
||||
error('missing parameter board/thread/reply');
|
||||
}
|
||||
|
||||
$title = 'Report Post No.' . $rep_reply;
|
||||
|
||||
$output_html .= '<html data-stylesheet="'. $current_theme .'">';
|
||||
$output_html .= '<head>';
|
||||
include $path . '/templates/header.php';
|
||||
$output_html .= '</head>';
|
||||
$output_html .= '<body class="report" style="max-width:400px">';
|
||||
|
||||
$output_html .= '<form action="' . $prefix_folder . '/delete-report.php' . '" method="POST">';
|
||||
|
||||
//reason?
|
||||
//global?
|
||||
|
||||
$output_html .= '<table>
|
||||
<tr>
|
||||
<th>Report</th>
|
||||
<td><input type="text" id="reason_' . $rep_reply . '" name="reason" maxlength="256" autocomplete="off" value="" placeholder="Reason">
|
||||
<label for="global_' . $rep_reply . '"><input type="checkbox" id="global_' . $rep_reply . '" name="global">Global</label>
|
||||
<hr>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
if ($captcha_required == true) {
|
||||
$output_html .= '
|
||||
<tr>
|
||||
<th>Verification</th>
|
||||
<td>
|
||||
<span class="js-captcha" id="load-captcha" style="max-width:200px">
|
||||
<span class="js-captcha">
|
||||
<img title="Click Here To Refresh" height="50" width="198" id="captcha" src="' . $prefix_folder . '/captcha.php' .'" js-src="' . $prefix_folder . '/captcha.php' .'"/><br>
|
||||
</span>
|
||||
</span>
|
||||
<noscript>
|
||||
<style>.js-captcha { display:none }</style>
|
||||
<img height="50" width="198" id="no-js-captcha" src="' . $prefix_folder . '/captcha.php' .'"/><br>
|
||||
</noscript>
|
||||
<input id="captcha-field" type="text" name="captcha" minlength="6" maxlength="6" autocomplete="off" required>
|
||||
</span>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$output_html .= '</table>';
|
||||
|
||||
$output_html .= '<div class="rules">Submitting false or misclassified reports <i>may</i> result in a ban.</div>';
|
||||
|
||||
$output_html .= ' <input type="hidden" name="board" value="' . $rep_board . '"/>
|
||||
<input type="hidden" name="thread" value="' . $rep_thread . '"/>
|
||||
<input type="hidden" name="reply" value="' . $rep_reply . '"/>';
|
||||
$output_html .= '<input type="submit" name="report" value="Report">';
|
||||
$output_html .= '</table></form>';
|
||||
|
||||
$output_html .= '</body>';
|
||||
$output_html .= '</html>';
|
||||
echo $output_html;
|
||||
exit();
|
||||
?>
|
@ -37,24 +37,41 @@ $output_html .= '<div class="post-arrows">>></div>
|
||||
</tbody></table></details>';
|
||||
}
|
||||
|
||||
$output_html .= '<hr></td></tr>';
|
||||
$output_html .= '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$output_html .= '
|
||||
<input type="hidden" name="board" value="' . $current_board . '"/>
|
||||
$output_html .= '<tr><td>
|
||||
|
||||
<details><summary>Delete</summary>
|
||||
<input type="hidden" name="board" value="' . $current_board . '"/>
|
||||
<input type="hidden" name="thread" value="' . $post_number_op . '"/>
|
||||
<input type="hidden" name="reply" value="' . $post_number_reply . '"/>
|
||||
<tr>
|
||||
<td><input type="password" id="password_' . $post_number_reply . '" name="password" maxlength="256" placeholder="Password" value="' . $_COOKIE['post_password'] . '"></td>
|
||||
<td><input type="submit" name="delete" value="Delete"></td>
|
||||
<td><label for="file_' . $post_number_reply . '"><input type="checkbox" id="file_' . $post_number_reply . '" name="file">File only</label></td>
|
||||
</tr>
|
||||
|
||||
<input type="password" id="password_' . $post_number_reply . '" name="password" maxlength="256" placeholder="Password" value="' . $_COOKIE['post_password'] . '">
|
||||
<input type="submit" name="delete" value="Delete">
|
||||
<label for="file_' . $post_number_reply . '"><input type="checkbox" id="file_' . $post_number_reply . '" name="file">File only</label>
|
||||
|
||||
</details>
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td><input type="text" id="reason_' . $post_number_reply . '" name="reason" maxlength="256" autocomplete="off" value="" placeholder="Reason"></td>
|
||||
<td><input type="submit" name="report" value="Report"></td>
|
||||
<td><label for="global_' . $post_number_reply . '"><input type="checkbox" id="global_' . $post_number_reply . '" name="global">Global</label></td>
|
||||
<td>
|
||||
|
||||
<details><summary>Report</summary><a href="'.$prefix_folder.'/report.php?board='.$current_board.'&thread='.$post_number_op.'&reply='.$post_number_reply.'" onclick="window.open(this.href,\'targetWindow\',
|
||||
`toolbar=no,
|
||||
location=no,
|
||||
status=no,
|
||||
menubar=no,
|
||||
scrollbars=yes,
|
||||
resizable=yes,
|
||||
width=400,
|
||||
height=190`);
|
||||
return false;">[Report]</a>
|
||||
</details>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -156,27 +156,42 @@ $output_html .= '<div class="post-info">';
|
||||
$output_html .= '<hr></td></tr>';
|
||||
}
|
||||
|
||||
$output_html .= '
|
||||
$output_html .= '<tr><td>
|
||||
|
||||
<input type="hidden" name="board" value="' . $current_board . '"/>
|
||||
<details><summary>Delete</summary>
|
||||
<input type="hidden" name="board" value="' . $current_board . '"/>
|
||||
<input type="hidden" name="thread" value="' . $post_number_op . '"/>
|
||||
<input type="hidden" name="reply" value="' . $post_number_op . '"/>
|
||||
<tr>
|
||||
<td><input type="password" id="password_' . $post_number_op . '" name="password" maxlength="256" placeholder="Password" value="' . $_COOKIE['post_password'] . '"></td>
|
||||
<td><input type="submit" name="delete" value="Delete"></td>
|
||||
<td><label for="file_' . $post_number_op . '"><input type="checkbox" id="file_' . $post_number_op . '" name="file">File only</label></td>
|
||||
</tr>
|
||||
|
||||
<input type="password" id="password_' . $post_number_op . '" name="password" maxlength="256" placeholder="Password" value="' . $_COOKIE['post_password'] . '">
|
||||
<input type="submit" name="delete" value="Delete">
|
||||
<label for="file_' . $post_number_op . '"><input type="checkbox" id="file_' . $post_number_op . '" name="file">File only</label>
|
||||
|
||||
</details>
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td><input type="text" id="reason_' . $post_number_op . '" name="reason" maxlength="256" autocomplete="off" value="" placeholder="Reason"></td>
|
||||
<td><input type="submit" name="report" value="Report"></td>
|
||||
<td><label for="global_' . $post_number_op . '"><input type="checkbox" id="global_' . $post_number_op . '" name="global">Global</label></td>
|
||||
<td>
|
||||
|
||||
<details><summary>Report</summary><a href="'.$prefix_folder.'/report.php?board='.$current_board.'&thread='.$post_number_op.'&reply='.$post_number_op.'" onclick="window.open(this.href,\'targetWindow\',
|
||||
`toolbar=no,
|
||||
location=no,
|
||||
status=no,
|
||||
menubar=no,
|
||||
scrollbars=yes,
|
||||
resizable=yes,
|
||||
width=400,
|
||||
height=190`);
|
||||
return false;">[Report]</a>
|
||||
</details>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</details>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($op_subject != '') { $output_html .= '<span class="subject">' . $op_subject . ' </span>'; }
|
||||
if (($op_email != '') && ($show_email != false)) { $output_html .= '<a href="mailto:' . $op_email . '">';} $output_html .= '<span class="'; if(($op_email != '') && ($show_email != false)) { $output_html .= 'link '; } $output_html .= 'name">' . $op_name . '</span>'; if ($op_email != '') { $output_html .= '</a>'; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user