+ Post New Thread
Results 1 to 4 of 4
Web Development Thread, PHP server and authentication in Coding and Web Development; Ok, I've been banging my head against user authentication and PHP for 2 days trying to get the username to ...
  1. #1

    TechMonkey's Avatar
    Join Date
    Dec 2005
    Location
    South East
    Posts
    3,316
    Thank Post
    226
    Thanked 426 Times in 309 Posts
    Rep Power
    171

    PHP server and authentication

    Ok, I've been banging my head against user authentication and PHP for 2 days trying to get the username to check they should have access to the page or system they are on. I think I've got the backend all sorted (samba, winbind etc) & I've got the adLdap scripts and that all just about works, it is just the coding that is now causing me grief, getting the remote user variable.

    & then the thought came to me, should I just run up a new Server 2012 R2 instance and WAMP it up, transfer the current apps over and just use IIS and standard permissions?

    Thoughts?

  2. #2
    zag
    zag is online now
    zag's Avatar
    Join Date
    Mar 2007
    Posts
    3,949
    Thank Post
    968
    Thanked 461 Times in 388 Posts
    Blog Entries
    12
    Rep Power
    94
    Do you have the username in a variable already?

    It should be easy once you have that, just include it at the top of the page in the header file, something like this

    Code:
    IF (($user->data['user_id'] == ANONYMOUS))
    		{
    		    echo "<li><img src='/images/icons/user.png'> <a href='/forum/ucp.php?mode=login'>Login</a> | <a href='/forum/ucp.php?mode=register'>Reg?</a></li>";
    		} ELSE 
    		{ 
    		    echo "<li><img src='/images/icons/user.png'> <a href='/user/".$user->data['username_clean']."'>".$user->data['username_clean']."</a></li>";
    		}

  3. Thanks to zag from:

    TechMonkey (22nd May 2014)

  4. #3
    SovietRussia's Avatar
    Join Date
    Mar 2013
    Location
    Powys, Wales
    Posts
    695
    Thank Post
    76
    Thanked 158 Times in 123 Posts
    Rep Power
    49
    Or just use IIS with Windows Authentication, the variable of the username is then $_SERVER['AUTHENTICATED_USER'] (Which is actually domain\user - and then you can use explode to split it in an array and then just use the username)

  5. Thanks to SovietRussia from:

    TechMonkey (22nd May 2014)

  6. #4

    TechMonkey's Avatar
    Join Date
    Dec 2005
    Location
    South East
    Posts
    3,316
    Thank Post
    226
    Thanked 426 Times in 309 Posts
    Rep Power
    171
    Ta all. I had a brilliant idea over lunch. I can be really decadent and have both. An Apache server on 2012R2 for internal apps that need SSO and a LAMP server for external apps that include their own auth systems. Best of both worlds.



SHARE:
+ Post New Thread

Similar Threads

  1. [PHP] PHP Server Monitor
    By zag in forum Web Development
    Replies: 40
    Last Post: 22nd May 2013, 01:05 PM
  2. Squid and authentication with server 2008 R2
    By ind1ekid in forum Internet Related/Filtering/Firewall
    Replies: 17
    Last Post: 31st October 2011, 10:40 AM
  3. Replies: 8
    Last Post: 14th January 2010, 01:35 PM
  4. Replies: 19
    Last Post: 2nd November 2005, 01:11 PM
  5. OSX server and iMac
    By dagza in forum Mac
    Replies: 13
    Last Post: 14th October 2005, 08:46 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •