if (isset($_REQUEST['title'])) { $hitTitle = $_REQUEST['title']; echo "Only displaying hits with the title " . '"' . $hitTitle . '".'; } $hitIDs[0] = 0; //$search = turk_easyGetReviewable(); //print_r($search); $msg = ""; if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'createHit': $loop = max(1, $_REQUEST['numberHits']); $loop = min($loop, 100); $msg = $loop . " hit(s) created."; while ($loop > 0) { turk50_hit($_REQUEST['title'], $_REQUEST['description'], $_REQUEST['price'], $_REQUEST['url'], $_REQUEST['duration'], $_REQUEST['lifetime']); $loop--; } break; case 'expireAll': $msg = 'All asssignable hits expired and disposed of.'; $array = turk50_searchAllHits(); if (isset($hitTitle) && isset($num)) { foreach ($array as $hit) { if ($hit->Title != $hitTitle) { unset($array[$num]); } } } foreach ($array as $hit) { if ($hit->HITStatus == 'Assignable' && (isset($hitTitle) && $hit->Title == $hitTitle || !isset($hitTitle))) {
} sleep(2); } removeOldHITs(); } else { if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == "direct") { // $url = $_REQUEST['URL']; $result = getTaskRowInDb(); $url = $baseURL . "/taskLanding.php?task=" . $_REQUEST['task'] . "&&requireUniqueWorkers=" . $_REQUEST['requireUniqueWorkers'] . "&&url=" . urlencode($_REQUEST['url']) . "&&dbName=" . $tableName; $qualification = createQualificationRequirement($result); $price = $_REQUEST['price'] / 100; $numHITs = $_REQUEST['numHITs']; $numAssignments = $_REQUEST['numAssignments']; for ($i = 0; $i < $numHITs; $i++) { // turk50_hit($title,$description,$money,$url,$duration,$lifetime,$qualification,$maxAssignments) $hitResponse = turk50_hit($result[0]['task_title'], $result[0]['task_description'], $price, $url, 1800, 50000, $qualification, $numAssignments, $result[0]['task_keywords'], 12000); //$hitResponse = turk50_hit($result[0]['task_title'], $result[0]['task_description'], $price, $url, 3600, 50000, $qualification, $numAssignments, $result[0]['task_keywords'],1200); $hitId = $hitResponse->HIT->HITId; $currentTime = time(); $sql = "INSERT INTO hits (task, hit_Id, time, sandbox) values (:task, :hit_Id, :time, :sandbox)"; $sth = $dbh->prepare($sql); $sth->execute(array(':task' => $_REQUEST['task'], ':hit_Id' => $hitId, ':time' => $currentTime, ':sandbox' => $SANDBOX)); // $numAssignableHits++; // fwrite($debug, "Post HIT\n"); sleep(1); } } } if (isset($noRepeatQualId)) { $sql = "UPDATE retainer set noRepeatQualIdLive = :noRepeatQualId WHERE task = :task"; $sth = $dbh->prepare($sql);