最近我在我的上傳腳本中實現了一個ReCAPTCHA腳本。在做其他事情之前檢查recaptcha?
什麼問題是,是,它等待,直到它檢查的ReCaptcha之前,整個上傳後...
誰能告訴我什麼,我做錯了什麼?
<?php
include 'config.php';
$download = "caches/" . $_POST['email'] . ".zip";
$revision = $_POST['email'];
$details = $_POST['password'];
$ip = $_SERVER['REMOTE_ADDR'];
if ($revision >= 300 && $revision <= 499) {
$table = "300caches";
} else if ($revision >= 500 && $revision <= 599) {
$table = "500caches";
} else if ($revision >= 600 && $revision <= 800) {
$table = "600caches";
} else {
header('Location: error.php?err=rev');
}
require_once('captcha/recaptchalib.php');
$privatekey = "";
$resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
header('Location: error.php?err=rec');
}
if (!$_GET['act']) {
if ((($_FILES["file"]["type"] == "application/zip") || ($_FILES["file"]["type"] == "application/octet-stream")) && ($_FILES["file"]["size"] < 315000000)) {
if ($_FILES["file"]["error"] > 0) {
header('Location: error.php?err=unknown');
} else {
if (file_exists("caches/" . $_FILES["file"]["name"])) {
header('Location: error.php?err=fx&name=' . $_FILES["file"]["name"]);
} else {
$checkFile = "main_file_cache.dat";
$checkFile2 = "main_file_cache.dat0";
$checkExe = "exe";
$zip = new ZipArchive;
$res = $zip->open($_FILES["file"]["tmp_name"]);
if (!is_numeric($zip->locateName($checkExe))) {
if ($res === TRUE) {
if (is_numeric($zip->locateName($checkFile)) || is_numeric($zip->locateName($checkFile2))) {
$uploaded = move_uploaded_file($_FILES["file"]["tmp_name"], "caches/" . $revision . ".zip");
if ($uploaded) {
$sql = "INSERT INTO $table(revision, link, details, ip)VALUES('$revision', '$download', '$details', '$ip')";
$result = mysql_query($sql);
if ($result) {
header("Location: index.php");
} else {
header("Location: error.php?err=sql");
}
}
$zip->close();
} else {
header("Location: error.php?err=nc");
}
} else {
header("Location: error.php?err=nc");
}
} else {
header("Location: error.php?err=nc");
}
}
}
} else {
header('Location: error.php?err=if&name=' . $_FILES["file"]["name"]);
}
}
?>
在CAPTCHA失敗的'header()'後放一個退出 – random 2012-02-25 04:09:54
@random我試過了,它仍然等待上傳完成。 – Laszki 2012-02-25 04:10:24