-
Notifications
You must be signed in to change notification settings - Fork 10
/
list.php
26 lines (23 loc) · 1.23 KB
/
list.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
<?php
require_once('config.php');
require_once('function.php');
$typedesc=$_POST['type'];
$value = iconv(mb_detect_encoding($_POST['value'], mb_detect_order('ISO-8859-15, ISO-8859-1')), "UTF-8", $_POST['value']);
$type = $tables["$typedesc"]['field'];
$table = ($tables["$typedesc"]['milter']) ? milterTable($type) : $tables["$typedesc"]['name'];
openlog($tag, LOG_PID, $fac);
if (empty($_POST['reason'])) die ("<p>Please, specify a reason!</p>");
if (preg_match( '/[^\x20-\x7f]/', $_POST['reason']))
exit('<p>ERROR: <'.htmlentities($_POST['reason'],ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'> contains NON ASCII chars.</p>');
$user = username();
$err = NULL;
if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE )
exit ($user.': Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
if (addtolist ($mysqli,$user,$value,$tables["$typedesc"],$_POST['unit'],$_POST['quantity'],$_POST['reason'],$err))
print 'OK '.$_POST["type"].' <'.htmlentities($value).'> first time listed for '.$_POST['quantity'].$_POST['unit'].'.';
else
print 'List operation ERROR; check log.';
if (!is_null($err) ) print htmlentities(' Error: ' . $err);
$mysqli->close();
closelog();
?>