getSettings(); $redirect = trim($_REQUEST['redirect']); $pattern = "'[^A-Za-z0-9]'"; if (!preg_match($pattern, $redirect, $matches)) { $sql = "SELECT `long_url` FROM " . $modx->getFullTableName('redirect_twitter') . " WHERE `short_url` = '$redirect'"; if($rs = $modx->db->query($sql)) { if($modx->db->getRecordCount($rs) == '1') { $row = $modx->db->getRow($rs, 'assoc'); $location = "Location: " . trim($row['long_url']); header($location, TRUE, 301); exit; } } } } $location = "Location: " . REDIRECT_TO; header($location, TRUE, 301); exit; ?>