Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/response.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,18 @@ public function hdr($c = '200', $h = null) {
return true;
}

/* Redirect client */
public function redirect($t = '500.html', $o = null) {
/* Redirect client - target, status code, and options */
public function redirect($t = '500.html', $c = '302', $o = null) {
$message = array_key_exists($c, $this->codes) ? $this->codes[$c]
: 'Internal error';
$v = defined('SERVICE_VERSION') ? SERVICE_VERSION : PRESTO_VERSION;

header("HTTP/1.0 {$c} {$message}", true, $c);
header(VERSION_HEADER . ': ' . $v);
header('Cache-Control: no-cache');

$opt = isset($o) ? '?' . http_build_query($o) : '';

return header("Location: /$t$opt");
exit;
}
Expand Down