-
- 7 Posts
I have a snippet that runs on a page to check user input from a form post and want to return a 403 if naughty input is detected.
I have tried $modx->sendUnauthorizedPage(); but that returns a 401 response code.
How can I return a 403 response code from a snippet?
revo 2.2.6
[ed. note: mikegrace last edited this post 11 years ago.]
Oops, sorry for the typo - obviously I meant "403 Forbidden."
I think the problem with using $modx->sendRedirect is that 403 isn't a redirect. It's a status code indicating that you don't have permission to access the resource.
I think you can stop it from sending the page content if you just die() after sending the 403, but I haven't tried it.