-
Notifications
You must be signed in to change notification settings - Fork 10
/
relist.php
29 lines (27 loc) · 1.43 KB
/
relist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
require_once('config.php');
require_once('function.php');
$typedesc=$_POST['type'];
$type = $tables["$typedesc"]['field'];
$value = iconv(mb_detect_encoding($_POST['value'], mb_detect_order('ISO-8859-1, ISO-8859-15')), "UTF-8", $_POST['value']);
$table = ($tables["$typedesc"]['milter']) ? milterTable($type) : $tables["$typedesc"]['name'];
$cl = ($tables["$typedesc"]['milter']) ? 10 : 9;
?>
<td colspan="<?php echo $cl; ?>" style="text-align: center">
<?php
openlog($tag, LOG_PID, $fac);
if (empty($_POST['reason'])) die ("Specify a reason, please!</td>");
if (preg_match( '/[^\x20-\x7f]/', $_POST['reason']))
exit('ERROR: <'.htmlentities($_POST['reason'],ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'> contains NON ASCII chars.</td>');
$user = username();
if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE )
exit ($user.': Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
if (isFull($mysqli,$typedesc,$tables)) die("ERROR in relist: ".htmlspecialchars("$typedesc has reached maximum value of ".$tables["$typedesc"]['limit'].' listed items.') );
if (relist ($mysqli,username(),$value,$type,$table,$_POST['unit'],$_POST['quantity'],$_POST['reason']))
print 'OK '.$_POST["type"].' <'.htmlentities($value).'> relisted for '.$_POST['quantity'].$_POST['unit'];
else
print 'ERROR in relist; check log';
$mysqli->close();
closelog();
print '</td>';
?>