| 1 |
sysadm |
1.1 |
<?php
|
| 2 |
sysadm |
1.2 |
function check_str($str) : bool
|
| 3 |
sysadm |
1.1 |
{
|
| 4 |
|
|
$filename = "../conf/deny_reg.conf";
|
| 5 |
|
|
$contents = file_get_contents($filename);
|
| 6 |
|
|
|
| 7 |
|
|
if ($contents == false)
|
| 8 |
|
|
{
|
| 9 |
|
|
echo ("Reversed words list not exist!\n");
|
| 10 |
|
|
return false;
|
| 11 |
|
|
}
|
| 12 |
|
|
|
| 13 |
|
|
// Builds the reserved words array
|
| 14 |
|
|
$word_list = explode("\n", str_replace("\r\n", "\n", $contents));
|
| 15 |
|
|
|
| 16 |
|
|
// Do the checking
|
| 17 |
|
|
foreach ($word_list as $reg_exp)
|
| 18 |
|
|
{
|
| 19 |
|
|
if ($reg_exp != "" && preg_match("/" . $reg_exp . "/i", $str))
|
| 20 |
|
|
{
|
| 21 |
|
|
return false;
|
| 22 |
|
|
}
|
| 23 |
|
|
}
|
| 24 |
|
|
|
| 25 |
|
|
return true;
|
| 26 |
|
|
}
|