Better explanations I101
This commit is contained in:
@@ -10,53 +10,53 @@ foreach($_GET as $k => $v) {
|
||||
|
||||
if ( $num_get_args > 0 ){
|
||||
# they didn't supply any arguments
|
||||
naughty("9e756ee22b7cdcdb150a5baf167caa25 $num_get_args");
|
||||
naughty("9e756ee22b7cdcdb150a5baf167caa25 No arguments provided $num_get_args");
|
||||
}
|
||||
|
||||
if ( empty($_POST["anti_spam_question"]) ) {
|
||||
naughty("0601a23e358374c293b086bb75606cca");
|
||||
naughty("0601a23e358374c293b086bb75606cca You failed the anti spam question");
|
||||
}
|
||||
|
||||
if ( strlen($_POST["anti_spam_question"]) !== 6 ) {
|
||||
naughty("6f51e6e7e6820b3fdda5d4ca0df14db1");
|
||||
naughty("6f51e6e7e6820b3fdda5d4ca0df14db1 You're making up spam questions");
|
||||
}
|
||||
|
||||
if (strcasecmp('public', $_POST["anti_spam_question"]) !== 0) {
|
||||
naughty("6aef421ce05e3ac34f4cd91ae3248a45");
|
||||
naughty("6aef421ce05e3ac34f4cd91ae3248a45 You don't know what P is in HPR");
|
||||
}
|
||||
|
||||
if ( ! file_exists( $comment_directory ) ) {
|
||||
# Looks like the comments directory has not been created
|
||||
naughty("d5342ea497f701656433e81fb5eed064");
|
||||
naughty("d5342ea497f701656433e81fb5eed064 Comment file could not be created");
|
||||
}
|
||||
|
||||
$unprocessed_comments = iterator_count(new FilesystemIterator("$comment_directory", FilesystemIterator::SKIP_DOTS));
|
||||
|
||||
if( $unprocessed_comments >= 10 ) {
|
||||
# There has to be at least one comment here as they are calling the script, and too many is suspicious
|
||||
naughty("093f42abee30e69e0e4d5125c70a0f7c");
|
||||
naughty("093f42abee30e69e0e4d5125c70a0f7c Too many unprocessed comments - shutting myself down");
|
||||
}
|
||||
|
||||
# This is to prevent anything except hits from the web form.
|
||||
# Anyone wanting to script uploads can do so via ftp
|
||||
if ( $_SERVER['REQUEST_METHOD'] !== 'POST' ) {
|
||||
naughty("87613fc139b251b673e1dd51e378e462");
|
||||
naughty("87613fc139b251b673e1dd51e378e462 Must be a POST");
|
||||
}
|
||||
|
||||
if ( empty($_SERVER["REMOTE_ADDR"]) ) {
|
||||
naughty("d7d0b6ab9689be244e1b6a8fbe6effba");
|
||||
naughty("d7d0b6ab9689be244e1b6a8fbe6effba Missing remote address");
|
||||
}
|
||||
else {
|
||||
$ip = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
if (count($_POST) !== 8) {
|
||||
naughty("086fe155b0588de68fc5d9e4580254a8");
|
||||
naughty("086fe155b0588de68fc5d9e4580254a8 Not correct number of fields");
|
||||
}
|
||||
|
||||
// Basic POST Checks
|
||||
if ( empty($_POST["comment_author_name"]) or strlen($_POST["comment_author_name"]) > 40 or strtolower($_POST["comment_author_name"]) == "testdog" ) {
|
||||
naughty("294356cd36d3f9b75da4d8c0a6108881");
|
||||
naughty("294356cd36d3f9b75da4d8c0a6108881 Your name wrong");
|
||||
}
|
||||
$comment_author_name = $_POST["comment_author_name"];
|
||||
$comment_author_name_json = json_encode( $_POST["comment_author_name"] );
|
||||
@@ -69,7 +69,7 @@ else {
|
||||
}
|
||||
|
||||
if ( empty($_POST["comment_title"]) or strlen($_POST["comment_title"]) > 100 ) {
|
||||
naughty("a89efb428cfe36996a65b371d5f4e303");
|
||||
naughty("a89efb428cfe36996a65b371d5f4e303 The title is too long");
|
||||
}
|
||||
$comment_title = $_POST["comment_title"];
|
||||
$comment_title_json = json_encode( $_POST["comment_title"] );
|
||||
@@ -82,7 +82,7 @@ else {
|
||||
}
|
||||
|
||||
if ( empty($_POST["comment_text"]) or strlen($_POST["comment_text"]) > 2000 or strpos(strtolower($_POST["comment_text"]), "outlook.con") !== false ) {
|
||||
naughty("cd57ab4d7b77a131ed3deb441bd93dcd");
|
||||
naughty("cd57ab4d7b77a131ed3deb441bd93dcd The comment text is too verbose. Record a show instead.");
|
||||
}
|
||||
$comment_text = $_POST["comment_text"];
|
||||
$comment_text_json = json_encode( $_POST["comment_text"] );
|
||||
@@ -95,7 +95,7 @@ else {
|
||||
}
|
||||
|
||||
if ( empty($_POST["spammer"]) or strcmp($_POST["spammer"], "No") !== 0 ) {
|
||||
naughty("b2ec68bd04cee0f64143ce4827a97e7c");
|
||||
naughty("b2ec68bd04cee0f64143ce4827a97e7c You selected that you were a spammer");
|
||||
}
|
||||
|
||||
# We check to see if the eps_id has been suplied, that it's a integer, and that it's in our range.
|
||||
@@ -108,13 +108,13 @@ if (isset($_POST['eps_id'])){
|
||||
$row = mysqli_fetch_array($result, MYSQLI_NUM);
|
||||
$total = $row[0];
|
||||
if ( !isset($result) or ( $total != 1 ) ) {
|
||||
naughty("5348e3c2aee3644730c70d3f000bcb01");
|
||||
naughty("5348e3c2aee3644730c70d3f000bcb01 No response from the db");
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
|
||||
$result = mysqli_query($connection, 'SELECT MAX(id) as max FROM eps;');
|
||||
if (!isset($result)) {
|
||||
naughty("f00fb1f47affc3286aadc15038cfd5d7");
|
||||
naughty("f00fb1f47affc3286aadc15038cfd5d7 Could not find the max id");
|
||||
}
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$max_eps = $row['max'];
|
||||
@@ -122,19 +122,19 @@ if (isset($_POST['eps_id'])){
|
||||
mysqli_free_result($result);
|
||||
}
|
||||
else {
|
||||
naughty("02c560adf1ff39b140fe8b7abe02fd31");
|
||||
naughty("02c560adf1ff39b140fe8b7abe02fd31 Commenting on a non existant show is odd");
|
||||
}
|
||||
|
||||
if ( intval($eps_id) <= 0 ){
|
||||
naughty("2903eeac51bb479edb428ae3c896671c");
|
||||
naughty("2903eeac51bb479edb428ae3c896671c Commenting on a non show with ID less than zero is odd");
|
||||
}
|
||||
|
||||
if ( intval($eps_id) > $max_eps ){
|
||||
naughty("54aa65c12ba71f3dfc451ff5bc82c798");
|
||||
naughty("54aa65c12ba71f3dfc451ff5bc82c798 Commenting on a show that is more than our posted episodes is odd");
|
||||
}
|
||||
|
||||
if ( intval($eps_id) === 0 ) {
|
||||
naughty("11fe1f9b76bf9f30e6a3a784832cb738");
|
||||
naughty("11fe1f9b76bf9f30e6a3a784832cb738 Commenting on a show zero is odd");
|
||||
}
|
||||
else {
|
||||
$eps_id = intval($eps_id);
|
||||
@@ -155,16 +155,16 @@ if ($result = mysqli_query($connection, $query)) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
naughty("c34561d684ad97241c95a1287688638b");
|
||||
naughty("c34561d684ad97241c95a1287688638b Could not get the hosts from the db");
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
|
||||
if ( empty($_POST["hostid"]) or intval($_POST["hostid"]) != $host_id ) {
|
||||
naughty("b4d71481b7055272728094292fd2a562");
|
||||
naughty("b4d71481b7055272728094292fd2a562 Cant find that host id");
|
||||
}
|
||||
|
||||
if ( empty($_POST["justification"]) or strlen($_POST["justification"]) > 200 or strlen($_POST["justification"]) < 20) {
|
||||
naughty("156d2d2d5780bd7f4a750f7c162b3394");
|
||||
naughty("156d2d2d5780bd7f4a750f7c162b3394 You need to have a sufficently long justification.");
|
||||
}
|
||||
|
||||
# Checks to see how old the show is
|
||||
@@ -173,7 +173,7 @@ list ($current_episode_date, $current_episode_number) = GetLatestPublishedShow($
|
||||
|
||||
if ( ( $eps_id <= $current_episode_number ) and ( $eps_id >= ( $current_episode_number - 20 ) ) ) {
|
||||
if ( strcmp($_POST["justification"], "No justification is asked for or required.") !== 0 ) {
|
||||
naughty("9357d78bf73b03ee2dd902a4c975f91d");
|
||||
naughty("9357d78bf73b03ee2dd902a4c975f91d You're saying No justification on a show that requires justification");
|
||||
}
|
||||
else {
|
||||
$justification = "Current Comment";
|
||||
@@ -183,7 +183,7 @@ if ( ( $eps_id <= $current_episode_number ) and ( $eps_id >= ( $current_episode_
|
||||
else {
|
||||
if ( strcmp($_POST["justification"], "No justification is asked for or required.") === 0 ) {
|
||||
print ">" . $_POST["justification"] ."< eps_id: $eps_id, current_episode_number: $current_episode_number, ";
|
||||
naughty("df4af9bdd0302f672d6311c76bdc461a");
|
||||
naughty("df4af9bdd0302f672d6311c76bdc461a A current comment should not require Justification");
|
||||
}
|
||||
else {
|
||||
$justification = $_POST["justification"];
|
||||
@@ -199,7 +199,7 @@ else {
|
||||
}
|
||||
|
||||
if ( empty($_SERVER["REMOTE_ADDR"]) ) {
|
||||
naughty("611144d4c0d575fffbf8f3ef11f8ad68");
|
||||
naughty("611144d4c0d575fffbf8f3ef11f8ad68 Missing REMOTE_ADDR");
|
||||
}
|
||||
else {
|
||||
$ip = $_SERVER["REMOTE_ADDR"];
|
||||
@@ -216,7 +216,7 @@ $timestamp = $timestamp;
|
||||
$timestamp_json = json_encode($timestamp);
|
||||
$comment_key_json = json_encode( $key );
|
||||
if ( file_exists( $comment_file ) ) {
|
||||
naughty("ef5d14b33b262bfbf5d40544fdeb9ec3");
|
||||
naughty("ef5d14b33b262bfbf5d40544fdeb9ec3 File already exists");
|
||||
}
|
||||
|
||||
$comment_data = "{
|
||||
@@ -233,7 +233,7 @@ $comment_data = "{
|
||||
file_put_contents($comment_file, $comment_data );
|
||||
|
||||
if ( filesize( $comment_file ) > 4000 ) {
|
||||
naughty("56e00e793a27168511d1cfda11d3bc55");
|
||||
naughty("56e00e793a27168511d1cfda11d3bc55 Filesize is too big");
|
||||
}
|
||||
|
||||
$user_agent = preg_replace('/ \(/', "\n", $_SERVER["HTTP_USER_AGENT"] );
|
||||
|
||||
Reference in New Issue
Block a user