connect(); $project = new Project($db); $project->pid = $pid; $project->cid = $cid; $projectResult = $project->projectVendorCombinedData(); $num = $projectResult->rowCount(); if ($num > 0) { $capture = new Capture($db); $capture->pid = $pid; $capture->cid = $cid; $urlTrackingKey; $urlParamValue; $projectDetail = $projectResult->fetch(PDO::FETCH_ASSOC); if ($projectDetail["status"] == "close") { $redirectUrl = CLOSED_PAGE; } else { if ($projectDetail["isopen"] == 1) { $urlTrackingKey = !empty($projectDetail["attributes"]) ? $projectDetail["attributes"] : "uid"; $capture->openAttributes = true; } else { $urlTrackingKey = !empty($projectDetail["attributes"]) ? $projectDetail["attributes"] : "suid"; } if (!empty($_GET[$urlTrackingKey])) { if ($urlTrackingKey == "suid") { $capture->attributeName = "our_id"; $capture->attributeValue = $_GET[$urlTrackingKey]; } else { $capture->attributeName = "param1"; $capture->attributeValue = $urlTrackingKey . "=" . $_GET[$urlTrackingKey]; } $row = $capture->start(); if (empty($row)) { $redirectUrl = ERROR_PAGE; } else if ($row["linkStatus"] == "noOpenLink") { $redirectUrl = NO_OPEN_PAGE; } else if ($row["linkStatus"] != "started" && $row["linkStatus"] != "open") { $redirectUrl = TAKEN_PAGE; } else if (!empty($row["survey_url"])) { $redirectUrl = $row["survey_url"]; setcookie(TRACKING_COOKIE_NAME, $row["our_id"], time() + 21600, "/"); } } } } header("Location: " . $redirectUrl); exit; }