Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:50:46+00:00 2026-05-24T02:50:46+00:00

The two paragraphs after this are background information in case I’m thinking of this

  • 0

The two paragraphs after this are background information in case I’m thinking of this problem wrong. The actual question is after.

I’m creating an application for an organization that uses Pubcookie. In the past this has been incredibly convenient because I haven’t had to implement any session authentication in order to get a user name; in PHP all I need to do is get $_SERVER[‘REMOTE_USER’] as long as the server is configured to require a valid user.

These past applications all require a login to see any content; the Apache configuration in .htaccess causes any unauthenticated users to redirect to the login server to obtain credentials. Now I’m considering an optional login system, like is used most everywhere else on the internet. I want the content to always be visible but allow the application to request a valid username.

Here’s the problem: If the user is not authenticated and I am forcing authentication, pubcookie redirects them to the login server to get authenticated. If the user is authenticated, and I am forcing authentication, I can get the authentication information in $_SERVER[‘REMOTE_USER’]. If, however, the user is authenticated but I am NOT requiring authentication, I cannot get the authentication information. In order to request that information I have to require it, which locks out anonymous users.

How do I get the Pubcookie authenticated user name if it exists, without requiring that it exist? Asked another way, is there a way to get the user name that might sometimes return “no, there is no user name”? I’ve looked into PubcookieOnDemand and it seems I can set up a login script that’s behind the .htaccess authentication requirement, which can set the ondemand cookie after login. However, this is not ideal as it requires the user to go to the login page whether or not the user is already authenticated. Also, there’s no way to remove the ondemand cookie if the authentication expires, because the scripts don’t get control until after authentication.

The only solution I’ve been able to find is to have a login link that stores the pubcookie authentication and hands it off to an application-managed session, but I’m feeling lazy and don’t want to tackle the problem of securely tracking a user session right now. If you have some good information on doing that, though, feel free to pass me a link in a comment.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:50:47+00:00Added an answer on May 24, 2026 at 2:50 am

    Well it looks like I’ve found my own answer in the PubcookieNoPrompt Apache directive. It does…exactly what I want. It just needs to be paired with a login script that has the directive turned off, like so:

    .htaccess:

    PubcookieAppID #APPID#
    PubcookieNoPrompt on
    AuthType NetID
    require valid-user
    
    <Files login.php>
      PubcookieNoPrompt off
    </Files>
    

    The login.php file can do anything, including redirect the user based on GET data back to the page that had the login link.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The first two paragraphs of this page explain that generic views are supposed to
How can I extract the common words between two or more paragraphs in php5?
Two related questions. First: does this repro for you or is it something local
Two general questions I'm wondering about both in the case for a given file(.js,
I have two paragraphs. The two paragraphs are located in the same column. Now
I have two paragraphs wrapped in a div. I want to make the first
I tried this on serverfault first, thinking it was a configuration error, but a
I have two paragraphs in a buffer which has only simple text in it:
I've got a massive problem, and i have no idea how to do this,
How can i check that element after id=id is paragraph? <div> <p id=id>one</p> <p>two</p>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.