Jump to content

Recommended Posts

Could someone tell me why the statement is completely being ignored when the conditional is TRUE? It just continues to load the page as usual. Using OB, nothing sent to browser prior. If I change header() to redirect to another page it works, but I can't get the HTTP 401 error to display.  Thanks for the help.

[code=PHP]
if (!isset($_COOKIE['username'])) { header ('HTTP/1.0 401 Unauthorized'); }
[/code]
Link to comment
https://forums.phpfreaks.com/topic/14241-header-issue/
Share on other sites

Yes, tried that too. Attempted to use 401, 403, 405, etc. None of them work. Also tried all using HTTP 1.0 and HTTP 1.1, to no avail.

Is there something I should look to server-side that might prevent this function from executing?

If not, I'll just spare the rest of the hair on my head and just rewrite the script.

Link to comment
https://forums.phpfreaks.com/topic/14241-header-issue/#findComment-55935
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.