$files = array(); $attach = $_FILES['attach']; if (is_array($attach) && !empty($attach['name'])) { foreach ($attach['name'] as $key => $v) { if (!$attach['name'][$key] || $key > articles_comments::MAX_FILE_COUNT) { continue; } $files[] = new CFile(array('name' => $attach['name'][$key], 'type' => $attach['type'][$key], 'tmp_name' => $attach['tmp_name'][$key], 'error' => $attach['error'][$key], 'size' => $attach['size'][$key])); } } list($att, $uperr, $error_flag) = $comments->UploadFiles($files, array('width' => 390, 'height' => 1000, 'less' => 0)); if ($uperr) { $alert[2] = $uperr; } if (!isset($alert)) { $new = $comments->Add($uid, $reply, $thread, $msg, $yt_link, $att, getRemoteIP(), $err, $tn); } if ($new) { $q = array(); parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $q); $q['goto'] = $new; header('Location: ./' . url($GET, $q, true, '?')); // echo "<script>document.location.href = '{$_SERVER['HTTP_REFERER']}#c_$new';</script>"; exit; } break; case 'edit-comment': if (!$uid) { header('Location: /fbd.php'); die; }