Jump to content

Recommended Posts

Hi,

I used to be able to get the username of the user who was loggd onto the computer and use that as a session variable, so when they are on the intranet, they need not to add any data.

 

The code I used to use was

$logon_name = basename($_SERVER['AUTH_USER']);

 

Since I updated the webserver and put an up-to-date version of PHP on this no longer works.

 

If you have any ideas, such as maybe using Javascript to get this variable and passing it to PHP...

 

Your help is appreciated.

Stuart

Link to comment
https://forums.phpfreaks.com/topic/254484-getting-username-via-php/
Share on other sites

If you're planning on moving this to a remote network then you'll need connect to your private network and use LDAP to authenticate users accessing the remote network. This shouldn't be a problem on IIS or Apache, but if you have a shared host then it's probably not going to happen without using PHP to perform the authentication.

To make it easier, my plan was to have a form that the user would complete on the first visit, then it would save the 'username' field to a cookie, then everytime they visited, the have to repeat the process of entering a username.

 

Is there a way of making a cookie last longer that the session? Everytime IE closes a new cookie seems to be needed. This system is only internal so there is no real need for passwords etc like a login system.

 

Any ideas?

Bit of background:

 

I used to have IIS running internally and pointing to AD (from within IIS). We now have a Managed network and I have no chance of doing any of that, so my plan is to host it externally on our website.

 

My problem is that the PHP form they complete when they are on the site is no longer filling out the username field, so if you know how to do that, I would be so happy.

 

Hope this makes sence as to what I am trying to achieve.

 

Stu

 

To make it easier, my plan was to have a form that the user would complete on the first visit, then it would save the 'username' field to a cookie, then everytime they visited, the have to repeat the process of entering a username.

 

Is there a way of making a cookie last longer that the session? Everytime IE closes a new cookie seems to be needed. This system is only internal so there is no real need for passwords etc like a login system.

 

Any ideas?

I'm confused, why does having a managed network stop you running an intranet server?

 

as for setting the duration of a cookie - check out this page,  perticularly the "expire" section:

http://php.net/manual/en/function.setcookie.php

 

We have moved into a new building and we are not allowed to touch the network install new server etc which means I cannot install my webserver internally. The network belongs to our Managed Service Provider ... and its a long process logging a call.

 

This system is just a room booking system, so the idea is that when staff login they select the name of the room, and click the period that is free and type the name of the class in ... that simple. The variable for the name of the staff member who is booking the room is ready taken , from the username of the user logged in (as IIS looked as AD). Now we are unable to do this, hence the need for a solution.

 

Thanks (and hope this is making sence, sorry if it is not)

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.