falon /
RBL
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | require_once('config.php'); |
||
| 3 | require_once('function.php'); |
||
| 4 | $typedesc=$_POST['type']; |
||
| 5 | $type = $tables["$typedesc"]['field']; |
||
| 6 | $table = ($tables["$typedesc"]['milter']) ? milterTable($type) : $tables["$typedesc"]['name']; |
||
| 7 | |||
| 8 | openlog($tag, LOG_PID, $fac); |
||
| 9 | if (empty($_POST['reason'])) die ("<p>Please, specify a reason!</p>"); |
||
| 10 | View Code Duplication | if (preg_match( '/[^\x20-\x7f]/', $_POST['reason'])) |
|
| 11 | exit('<p>ERROR: <'.htmlentities($_POST['reason'],ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'> contains NON ASCII chars.</p>'); |
||
| 12 | $user = username(); |
||
| 13 | $err = NULL; |
||
| 14 | |||
| 15 | View Code Duplication | if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE ) |
|
|
0 ignored issues
–
show
|
|||
| 16 | exit ($user.': Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error); |
||
| 17 | |||
| 18 | if (addtolist ($mysqli,$user,$_POST['value'],$tables["$typedesc"],$_POST['unit'],$_POST['quantity'],$_POST['reason'],$err)) |
||
| 19 | print 'OK '.$_POST["type"].' <'.$_POST['value'].'> first time listed for '.$_POST['quantity'].$_POST['unit'].'.'; |
||
| 20 | else |
||
| 21 | print 'List operation ERROR; check log.'; |
||
| 22 | if (!is_null($err) ) print htmlentities(' Error: ' . $err); |
||
| 23 | $mysqli->close(); |
||
| 24 | closelog(); |
||
| 25 | ?> |
||
| 26 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.