PHP LDAP change password page

I have recently implemented an SSO (Single Sign On) mechanism in one of my places and then I started to look for a simple quick-and-dirty way to allow the users to change their passwords via PHP.

I have found many complicated examples but I thought, come on, this is really one page I am looking for. So, I have written my own and now I am   sharing it with you.

The page has only two variables at the beginning, letting you set the LDAP server hostname and the binding DN. The script behaves like this:

  1. It connects to ldap via anonymous binding.
  2. Searches for the user specified in the username field by doing a search on the uid= part of DN for any object matching the username.
  3. The found object (if only 1)  is returned to get a full DN with real CommonName.
  4. PHP re-binds as the user using the “current” user password.
  5. New password is being hashed and ldap_modify is called on the DN.
  6. Optionally a confirmation email is sent to the address from mail attribute.

You will have to customize for your needs obviously but it is as simple as modyfying one function. Just for curiosity, write a comment if you have used it for your site in any way.

How to change the default Picasa cache directory?

I love Picasa! So what… I am having now around 30,000 photos (at least if Picasa doesn’t lie) and… a problem. Picasa for ages have a problem with big database caching file.  I have a system partition that is only 20GB in size. The problem is that Picasa is holding the thumbnails cached in my home directory that is on the system drive..

With this amount of photos, and a lot of software installed, it had filled my partition effectively. So, one solution is to resize the partition, but I didn’t want that. The other solution I thought of was… symlinks that I love in linux.

Because I had a second big disk available, I wanted to move the whole picture cache database to the other disk. The problem is that Windows XP as such does not support symbolic links. But … it was easy anyway. Want to know how?

Jak słuchać “Trójki” przez foobar’a?

Trójka

Trójka

Uwielbiam Polską Trójkę.

No i oczywiście jak to w Polsce bywa, musieli utrudnić życie słuchaczom i zamiast używać jakiegoś normalnego formatu streamingu on-line, używają Microsoftowego WMA. Używam FooBar’a więc pojawił się problem, bo on standardowo nie ma odpowiednich wtyczek do odtwarzania takich bajerów. No to co zrobić żeby można się było rozkoszować trójką z foobar’a zamiast winampa tudzież Microsoft Windows Media Player’a?

Creating Debian Lenny Bootable USB key in Windows

Today I had to recover a machine from a disastrous power failure (yes, I had a UPS but it didn’t manage :P).
The results was as usual:

Kernel panic: Not syncing!!
/sbin/init not found

Doesn’t sound nice, does it? It wasn’t. My whole /lib was gone…
I had to boot with root mounted to my disk (which I failed with, because /bin/bash was not working, but that’s another story), and I didn’t have a CD, so I had to create a bootable USB key.
Unfortunately all articles on Debian Live and stuff didn’t work.. so.. here is how it worked for me in two simple steps.

datePicker and jqModal z-index problem

It appears that jqModal and datePicker have z-index problems. My datepicker appeared below the form inside jqModal. The fix for this is very simple. We have to modify CSS for UI and jqmodal.
This is because they don’t set z-index property properly. But we can change it on our own…

QuickTip: Styling jqModal with blockUI and AJAX requests

This is just a quick tip how to style a jqModal window when we are loading contents via AJAX. There are two possibilites:

  • use ajaxText, but this sometimes is not handy if you have complex styled content from AJAX
  • use blockUI and style the jqModal to show only after the AJAX has been loaded.

My idea is to block the user interface with a “Please wait…” message and then to slide down nicely the jqModal and unblock the page.

Grepping Oracle’s database dumps = awk hints.

I’ve just got a database dump from Oracle and I wanted to load it into mysql database. It turned out that it has a lot of Oracle specific things, so I decided to play a little with grep and awk to get the things I want.

How to fully update Windows XP from command-line?

Recently I’ve needed to upgrade my PC from a command line.
After a lot of searching, including Microsoft tech-support where I was told that it’s not possible, I’ve managed to do it using Windows Scripting. Here is a VBS script that does the thing and reboots the machine afterwards:

Bootable FreeDOS USB stick/CF Card

Today I needed to create a bootable USB stick that does nothing else but just a reboot of the machine.

Why? The machine is booting up from network, but the problem is what happens when the network is down or doesn’t reply fast enough. Unfortunately, the PXE didn’t have the option of booting in an endless loop.

The solution is to:

  1. try boot from the network first
  2. fall back to booting from USB/CF and reboot the machine

Debranding and upgrading Nokia E65

nokiaupgradeSome time ago I got myself a Nokia E-65 phone in UK’s Three network. It was quite new shiny and fancy. It had Skype running with Three, a bit underfeatured but prepared by Three. The phone however was slow like hell, it didn’t have Polish writing dictionary and hanged from time to time.

So I started to search for upgrades, and then I’ve learned that Three is not providing them very often. In the meanwhile I went from UK to Poland, so I decided to search how to hack the phone to work faster.

The Nokia Software Updater didn’t help because it constantly said that there are no software updates available. The reason for that was that the phone was branded for Three. The difference in version was quite big, in my phone the Software was 1.0633.18.02 whereas the software available from Nokia was already 4.0633.74.00. Of course, look on the things after 0633, because the 1 and 4 at the beginning mean that the software is branded.