Skip to content

Instantly share code, notes, and snippets.

@nasrulhazim
Created June 1, 2018 00:32
Show Gist options
  • Select an option

  • Save nasrulhazim/f0140f635bb4db7684c9ebd6b2d31101 to your computer and use it in GitHub Desktop.

Select an option

Save nasrulhazim/f0140f635bb4db7684c9ebd6b2d31101 to your computer and use it in GitHub Desktop.
Syaiton Detector
<?php error_reporting(E_ALL ^ E_NOTICE); ?>
<?php $keyboard_warriors = $_REQUEST['keyboard_warriors']; ?>
<?php
$keyboard_warriors = [
[
'name' => 'J-bon',
'post' => 'Hutang 600 juta',
],
[
'name' => 'Mira 01',
'post' => 'Kenapa mira suka pakai makeup?',
]
];
?>
<?php if(empty($keyboard_warriors)): ?>
<h1>No syaiton detected. You are safe.</h1>
<?php exit(); ?>
<?php endif; ?>
<h3>Unfriend / block the following members</h3>
<ol>
<?php foreach ($keyboard_warriors as $keyboard_warrior): ?>
<?php if(isSyaiton($keyboard_warrior['post'])): ?>
<li><?php echo $keyboard_warrior['name']; ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ol>
<?php
/**
* Detect if the keyboard warrior is syaiton
* @param string $post It can be fb post, twitter, chat, etc.
* @return boolean Return true if they are amongst the syaiton
*/
function isSyaiton($post)
{
$issues = [
'Hutang 600 juta',
'Hutang 1 trillion',
'Buka tabung derma',
'World Cup kat Astro je',
'World Cup kat RTM',
'PTPTN Kena bayar',
'PTPTN Tak Kena bayar',
'Tol Kena Mansuh',
'Tol ada lagi',
'HSR jalan',
'HSR tak jalan',
'Manifesto dijalankan',
'Manifesto tak dijalankan',
'KWSP bagi bini',
'KWSP tak bagi bini',
];
foreach ($issues as $issue) {
if(false !== strpos($post, $issue)) {
return true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment