01hanstu Posted January 6, 2012 Share Posted January 6, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/ Share on other sites More sharing options...
AyKay47 Posted January 6, 2012 Share Posted January 6, 2012 print_r($_SERVER); this will show you what keys are available on your server through the $_SEVER superglobal array. when you post what you receive, we will go from there. Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1304844 Share on other sites More sharing options...
Adam Posted January 6, 2012 Share Posted January 6, 2012 Are you using IIS, Apache or something else? Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1304845 Share on other sites More sharing options...
01hanstu Posted January 6, 2012 Author Share Posted January 6, 2012 Hi, At the monent I am using Apache to rebuild the site. I had it installed previously on an Windows IIS machine. WQe are now going to move it to our website hostinbg provider. Thanks, Stuart Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1304848 Share on other sites More sharing options...
Adam Posted January 6, 2012 Share Posted January 6, 2012 Windows doesn't just pass your username around to any old site. What are the specs of your remote hosting provider? Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1304851 Share on other sites More sharing options...
Adam Posted January 6, 2012 Share Posted January 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1304888 Share on other sites More sharing options...
01hanstu Posted January 9, 2012 Author Share Posted January 9, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1305634 Share on other sites More sharing options...
01hanstu Posted January 9, 2012 Author Share Posted January 9, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1305687 Share on other sites More sharing options...
Muddy_Funster Posted January 9, 2012 Share Posted January 9, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1305713 Share on other sites More sharing options...
Adam Posted January 9, 2012 Share Posted January 9, 2012 This doesn't exactly sound secure. What does this form do? Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1305721 Share on other sites More sharing options...
01hanstu Posted January 9, 2012 Author Share Posted January 9, 2012 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) Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1305898 Share on other sites More sharing options...
Muddy_Funster Posted January 9, 2012 Share Posted January 9, 2012 Turn on IIS sevices on your AD server? Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1305906 Share on other sites More sharing options...
01hanstu Posted January 9, 2012 Author Share Posted January 9, 2012 Turn on IIS sevices on your AD server? I now have no control over the internal servers anymore, as I have done in the past. This is why this is giving me a headache Stu Quote Link to comment https://forums.phpfreaks.com/topic/254484-getting-username-via-php/#findComment-1305919 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.