-while(<DATA>) {
- if ( m/^select/i ) {
- print qq{<table>\n};
- my $sth = $dbh->prepare($_);
- $sth->execute;
- while ( my $row = $sth->fetchrow_arrayref ) {
- print qq{<tr><td>}, join(qq{</td><td>}, @$row), qq{</td></tr>\n};
- }
- print qq{</table>\n};
- } else {
- print "$_<br>\n";
- }
+# Authentication
+my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($q, { tools => 'inventory' });
+if ($status ne "ok") {
+ print "This requres tools - inventory permission";
+ exit;