<b>Start</b><br/> <?php // per ogni files $ok = 0; $error = 0; if (IsBlocked(BIT_BLOCK_ACCREDITATION)) { print 'Accreditation is blocked'; } else { foreach ($files as $f) { // se l'id è nella lista di quelli da tirar dentro $parts = pathinfo($dir . $f); $kk = array_search($parts['filename'], $bibs); if ($kk !== false) { $errMsg = ''; print $dir . $f . ' --> '; if ($image = photoresize($dir . $f, true)) { $query = "INSERT INTO Photos (PhEnId,PhPhoto,PhPhotoEntered) " . "VALUES(" . Strsafe_DB($kk) . "," . "'" . $image . "', " . "NOW()" . ") " . "ON DUPLICATE KEY UPDATE " . "PhPhoto='" . $image . "', PhPhotoEntered=NOW()"; //print $query . '<br>'; $rs = safe_w_sql($query); if ($rs) { print 'ok'; ++$ok; } else { print 'error'; ++$error; } } else { print $errMsg; } print '<br/>'; }
require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; if (!CheckTourSession() || empty($_REQUEST['id']) || !($id = $_REQUEST['id'])) { printCrackError(); } $errMsg = ''; $command = isset($_REQUEST['command']) ? $_REQUEST['command'] : null; if (!IsBlocked(BIT_BLOCK_PARTICIPANT) and $_POST) { include 'Common/PhotoResize.php'; if (!empty($_REQUEST['remove'])) { // ask for the removal of the picture $query = "DELETE FROM Photos WHERE PhEnId=" . StrSafe_DB($id) . " "; $rs = safe_w_sql($query); unlink($CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-En-' . $id . '.jpg'); } elseif (!empty($_FILES['file']['name'])) { $file = $_FILES['file']; if ($image = photoresize($file)) { $query = "REPLACE INTO Photos (PhEnId,PhPhoto) VALUES(" . StrSafe_DB($id) . ",'" . $image . "') "; //print $query;exit; if (!safe_w_sql($query)) { $errMsg = get_text('PhotoUpError', 'Tournament'); } else { $errMsg = get_text('PhotoUploaded', 'Tournament'); $ImName = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-En-' . $id . '.jpg'; if ($im = @imagecreatefromstring(base64_decode($image))) { Imagejpeg($im, $ImName, 95); } } } } else { // why did you press OK for? :D $errMsg = get_text('PhotoUpError', 'Tournament');