* */ chdir('..'); require_once './core/session.php'; require_once './core/functions.php'; require_once './core/genres.php'; require_once './core/custom.php'; require_once './core/security.php'; // check for localnet localnet_or_die(); // multiuser permission check permission_or_die(PERM_WRITE, $_COOKIE['VDBuserid']); $SELECT = 'SELECT opt FROM '.TBL_CONFIG." WHERE LOWER(opt) LIKE 'custom_type' AND value = 'barcode'"; $result = runSQL($SELECT); if (count($result)>0) $customFieldName = preg_replace('/type/','',$result[0]['opt']); if (count($result) == 0) { ?> Borrow / return movie via barcode Please select &qt;barcode&qt; as a custom field in the &qt;configuration&qt; tab. 0) { // If there is a rotten apple - just skip if (preg_match('/[^0]+/',substr($row['barcode'],0,$lenDiff))) { continue; } } $DELETE = 'DELETE FROM '.TBL_LENT.' WHERE diskid = '.escapeSQL($row['diskid']); $INSERT = 'INSERT '.TBL_LENT." SET who = '".escapeSQL($who)."', diskid = '".escapeSQL($row['diskid'])."'"; runSQL($DELETE,false); runSQL($INSERT); $specialJsCode = "parent.mainFrame.location.href='../borrow.php';"; $notFound=0; } } } else if ($_GET['process'] == "RETURN") { $barcode = trim($_GET['barcode']); if ($barcode == '' || preg_match('/[^0-9]+/',$barcode)) { $notFound=1; } else { $result = runSQL('SELECT diskid, '.$customFieldName.' AS barcode FROM '.TBL_DATA.' LEFT JOIN '.TBL_USERS.' ON '.TBL_DATA.'.owner_id = '.TBL_USERS.'.id WHERE '.TBL_USERS.".name = '".escapeSQL($_COOKIE['VDBusername'])."'".' AND '.TBL_DATA.'.'.$customFieldName." LIKE '%".$barcode."'"); foreach($result as $row) { // missing zeros at the beginning? if (($lenDiff = strlen($row['barcode'])-strlen($barcode))>0) { // If there is a rotten apple - just skip if (preg_match('/[^0]+/',substr($row['barcode'],0,$lenDiff))) { continue; } } $DELETE = 'DELETE FROM '.TBL_LENT.' WHERE diskid = '.escapeSQL($row['diskid']); runSQL($DELETE); $specialJsCode = "parent.mainFrame.location.href='../borrow.php';"; $notFound=0; } } } ?> Borrow / return movie via barcode
Borrow / return movie via barcode <body>Please use a browser which supports frames!</body>