/**
 * Set the Windows Desktop Wallpaper to a given file.
 *
 * This function uses the FFI module, a really cool package that lets you load
 * native system libraries and call them from PHP. Obviously, it needs to be
 * installed.
 *
 * @param   string  $bmpFilePath Full path to the BMP file.
 * @return  void
*/
function setWindowsDesktop($bmpFilePath)
{
    define('SPI_SETDESKWALLPAPER', 0x14);
    define('SPIF_UPDATEINIFILE', 0x1);
    define('SPIF_SENDWININICHANGE', 0x2);
    assert(file_exists($bmpFilePath));
    // Load the extension
    if (!dl("php_ffi.dll")) {
        throw new Exception('Cound not load the FFI extension.');
    }
    // declare the Win32 API function used to change desktop settings.
    $ffi = new FFI(<<<IDL
[lib='User32.dll']
int SystemParametersInfoA(int uAction, int uParam, char *lpvParam, int fuWinIni);
[lib='Kernel32.dll']
int GetLastError();
IDL
);
    // call the Windows API to update the desktop background.
    $ret = $ffi->SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, $bmpFilePath, SPIF_UPDATEINIFILE || SPIF_SENDWININICHANGE);
    if ($ret == 0) {
        $error = $ffi->GetLastError();
        throw new Exception("The call to the Windows API failed (error {$error}).");
    }
}
<?php

$ffi = new FFI("[lib='msvcrt.dll'] int _getch();");
while (true) {
    // get a character from the keyboard
    $c = chr($ffi->_getch());
    if ("\r" == $c || "\n" == $c) {
        // if it's a newline, break out of the loop, we've got our password
        break;
    } elseif ("" == $c) {
        /* if it's a backspace, delete the previous char from $password */
        $password = substr_replace($password, '', -1, 1);
    } elseif ("" == $c) {
        // if it's Control-C, clear $password and break out of the loop
        $password = NULL;
        break;
    } else {
        // otherwise, add the character to the password
        $password .= $c;
    }
}