Getting the logged on windows user in your apache server

I was recently involved in a discussion where a company was developing an intra-net site using Apache and PHP on a Windows server. All clients were windows and they wanted to know who was connecting to the intra-net site (only accessible inside the company firewall). And they wanted a SSO (single sign-on) experience for the users….

1

ntlm.php

<?php // This a copy taken 2008-08-21 from http://siphon9.net/loune/f/ntlm.php.txt to make sure the code is not lost. // For more information see: // http://blogs.msdn.com/cellfish/archive/2008/08/26/getting-the-logged-on-windows-user-in-your-apache-server.aspx // NTLM specs http://davenport.sourceforge.net/ntlm.html $headers = apache_request_headers(); if (!isset($headers[‘Authorization’])){ header(‘HTTP/1.1 401 Unauthorized’); header(‘WWW-Authenticate: NTLM’); exit; } $auth = $headers[‘Authorization’]; if (substr($auth,0,5) == ‘NTLM ‘) { $msg = base64_decode(substr($auth, 5)); if (substr($msg,…

8

The implementation of iterators in C# and its consequences

Recently oldnewthing wrote a series av articles on C# iterators. Especially part four is interesting since it describes how iterators can be used to simplify asynchronous code. I’m not a big fan of this kind of exploit of a programming language since there is a risk the code is harder to understand for new developers…

0

Being agile when there is no project

Sometimes I come across a team saying; “We can’t use Scrum because there is no project. We just do what needs to be done on a daily basis.” These are typically support teams, teams with a large support responsibility or teams with a lot of small projects running in parallel. On a rare occasion it…

1

How to avoid having too much work in progress

Most teams I worked with have at some point had a lot of work in progress. Sometimes virtually the complete sprint back log have been in progress. This is definitely a bad sign. The reasons for this situation to arise are many. It can be bad break down of tasks meaning several tasks need to…

1

Building robots with your windows mobile as a brain

I just read this article in MSDN magazine about a robot controlled by a windows mobile. As I wrote before, I love robots. So this is yet another spare time project I fear will never be launched… Yet another up-side with the WiMo code is that it serves as an excellent example on how to…

0

Using CSS to fetch user browser history

If you know what you’re looking for in the user’s browser history there is a pretty simple way to check if the user have visited a certain site recently or not. Basically you can create an invisible iframe with the link(s) you want to check and then use java script to query the appearance of…

0

Spending money to improve team productivity

When adapting to agile philosophy some managers get carried away and want to spend some money on improving the team productivity. Especially if you have an external consultant coaching the team, the manager tends to ask the coach what they should buy. Often the budget is presented as “$X per developer”. As a coach it…

0

Hiding or disabling menu items not available?

About a month ago Joel Spolsky wrote a very short post instructing people to not hide or disable menu items that are not available. This I’ve been working on one of my spare time projects this summer – a project that involves a web based user interface I’ve given this some thought. At a first…

0