diff options
author | Lizzy Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-10 01:25:22 -0700 |
---|---|---|
committer | Lizzy Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-10 01:25:22 -0700 |
commit | 11155128178ff3d8ea803a70dd7749e594b247a9 (patch) | |
tree | 23bbc8abfa3c9a51b48b3d670e59332a10a9d8f3 /html/public | |
parent | f2bf6e326bb0a5c3363b1fe3891a841dec644948 (diff) | |
download | tilde.club-11155128178ff3d8ea803a70dd7749e594b247a9.tar.gz tilde.club-11155128178ff3d8ea803a70dd7749e594b247a9.zip |
remove bad database flag, bad curl options, and add sigint listener
Diffstat (limited to 'html/public')
-rw-r--r-- | html/public/fruitvote/GoPage.php | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/html/public/fruitvote/GoPage.php b/html/public/fruitvote/GoPage.php index b6e205a..27fc361 100644 --- a/html/public/fruitvote/GoPage.php +++ b/html/public/fruitvote/GoPage.php @@ -29,53 +29,13 @@ class GoPage { public function go() { $ch = curl_init(); $url = "http://localhost".$this->page; - curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, $this->socket); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - // forward headers - $headers = array(); - foreach ($_SERVER as $key => $value) { - if (substr($key, 0, 5) == "HTTP_") { - $key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5))))); - $headers[] = "$key: $value"; - } - } - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - - // forward params depending on http method - if ($_SERVER['REQUEST_METHOD'] == "POST" || $_SERVER['REQUEST_METHOD'] == "PUT" || $_SERVER['REQUEST_METHOD'] == "DELETE") { - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents('php://input')); - } else { - $url .= "?".$_SERVER['QUERY_STRING']; - } - - // forward cookies - $cookie = array(); - foreach ($_COOKIE as $key => $value) { - $cookie[] = "$key=$value"; - } - $output = curl_exec($ch); curl_close($ch); - - // forward headers back to client - $headers = explode("\n", $output); - foreach ($headers as $header) { - if (strpos($header, "HTTP/") === false) { - header($header); - } - } - - // forward cookies back to client - $cookie = explode("\n", $output); - foreach ($cookie as $cookie) { - if (strpos($cookie, "Set-Cookie:") !== false) { - header($cookie); - } - } + // todo: get headers / cookies, forward back response return $output; } |