Menu

Random Phoo Image

Random Phoo Image

Search

Category Cloud

Releaselog | RLSLOG.net

Oscars 2010 The Highlights WS PDTV XviD-watbath
Binverse - get 14 days of free Usenet access!
M-Zone (2010.03.10)
Brothers 2009 DVDRip XviD-Larceny
The Colbert Report (2010.03.08-2010.03.11)

www.VCDQuality.com Klip

Tyler Perrys House of Payne S06E14 *HDTV* *XviD* - TV - XII - 03/11/2010
Psych S04E16 Mr Yin Presents *HDTV* *XviD* - TV - FQM - 03/11/2010
Ugly Betty S04E15 Fire and Nice *HDTV* *XviD* - TV - FQM - 03/11/2010
Tyler Perrys House of Payne S06E13 *HDTV* *XviD* - TV - XII - 03/11/2010
Cougar Town S01E17 Counting on You *HDTV* *XviD* - TV - FQM - 03/11/2010

My GPS lost itself

OnLive Remote Gaming Service Launches In June
Serendipity :o)
Hospitalidade Norte Americana...
Las Vegas...here we go!
Um exemplo de transparência...

lms.ispgaya|pt ::: noticias

Novo site!
Vice do major acusado de burlar idosa com terreno
Oh k, tenho de admitir.
The Dears - Who Are You, Defenders of the Universe?
First-Person Shooter Modified For Fire Drill Simulation

Slashdot

An Early Look At <em>Civilization V</em>
Historic IEEE 802 Group Looks Back and Forward
Microsoft Shows Full 3D XNA Games On Windows Phone
The Future of Wind Power May Be Underground
New Phone Allows Bosses To Snoop On Staff

Neowin.net

Motorola partners with Bing Search for new Android phones in China
OnLive game service to launch on June 17 in the US for $15 a month
Sony announces 'Move', a motion based controller at GDC
Mark your calendar: Live blog - Microsoft MIX 2010 keynotes
Android growing; other platforms, not so much

Blog Archives

coding

pedro | funny stuff, coding | 20.10.07 | Comment on this

Vou deixar aqui uma função que pode dar jeito a alguém, visto que numa pesquisa por alto no Google não encontrei nada funcional e simples, por isso pesquisei (nunca tinha trabalhado com LDAP em php) e criei esta pequena função que devolve em binary o campo "jpegPhoto", para que assim seja possível criar a imagem.

function ldap_info_jpg($username)
{
        $ldapserver = "ldap.exemplo.com";
        $ds = ldap_connect($ldapserver);
        if ($ds) {
                //Alterar a var $dn para o dn do vosso ldap, aqui fica um exemplo:
                $dn = "uid=".$username.",ou=Users,dc=ispgaya,dc=pt";

                $filter="(objectClass= *)";
                $justthese = array("jpegphoto");

                $sr=ldap_read($ds, $dn, $filter, $justthese);
                if (ldap_count_entries($ds, $sr)==FALSE) {
                        return -2;
                        ldap_close($ds);
                } else {
                        $entry = ldap_first_entry($ds, $sr);
                        $binary = ldap_get_values_len($ds, $entry, "jpegphoto");
                        if ($binary==FALSE) {
                                return -3;
                                ldap_close($ds);
                        } else {
                                return $binary[0];
                                ldap_close($ds);
                        }
                }
        } else {
                return -1;
        }
}

Para quem quiser este código juntamente com um ficheiro para verem o output, podem fazer o download aqui.

pedro | coding | 18.10.07 | Comment on this
Online Visitors:5 Today Visitors:47 Total Visitors:54697