This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Public License along with this package; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Change Log: 2002.12.13 - fix a bug with new version PHP variables are case sensitive 2001.03.23 - fix a bug that certain characters have special significance in HTML, e.g. '&', '"', '<', '>' can not be displayed correctly in "detail" window reported by Thierry Cornilleau 2001.01.11 - split right frame into right top and right bottom frames. Display entry details in the top; displaying action buttons in the bottom. 2000.11.16 - rename files from *.php3 to *.php 2000.11.09 - change to ldap_get_values () to ldap_get_values_len () (PHP3 >= 3.0.13, PHP4 >= 4.0RC2). New function is full compatible with old one and do not need patch for PHP any more. 2000.03.25 - fix a bug that "LDAP result entry index is 0" 2000.03.20 - fix a secure hole in temporary file "/tmp/LE00****". which never check the link is followed. - a bug on solaris that temporary file directory default is "/var/tmp" 2000.03.17 - fix a minor bug that Netscape Directory Server will return "Unable to bind to server" if $bindpw is empty 2000.03.14 - cascading Style Sheet support added - use function rawurlencode () to pass parameters - rename DN feature added 2000.02.29 - fix bug that caused by new attribute called "info" reported by Ilkka Torvinen 1999.10.20 - .png image file format support 1999.10.19 - substitute double quotes - """ with """ in inputting field 1999.9.22 - upload files feature 1999.9.17 - JPEG/GIF image files support 1999.9.14 - fix bug that can only display one attribute which multiple same attributes in on entries */ require ("template/header.inc"); require ('default.php'); $ds = ldap_connect ($host, $port); if ($ds) { /* Netscape Directory Server will return "Unable to bind to server" if $bindpw is empty */ if ((strcmp ($binddn, "") == 0) or (strcmp ($bindpw, "") == 0)) $r = ldap_bind ($ds); else $r = ldap_bind ($ds, $binddn, $bindpw); $sr = ldap_read ($ds, $dn, $filter); $entries_count = ldap_count_entries ($ds, $sr); if ($entries_count == 0) { /* force $filter to be "objectclass=*" this time */ $sr = ldap_read ($ds, $dn, "objectclass=*"); $entries_count = ldap_count_entries ($ds, $sr); if ($entries_count == 0) { echo "

\n"; echo "
\n"; echo ""; echo "No entry details returned
"; echo "
"; echo "
\n"; require ("template/footer.inc"); return; } } echo "

"; // echo "
\n"; echo "\n"; $entry = ldap_first_entry ($ds, $sr); $attrs = ldap_get_attributes ($ds, $entry); echo ""; echo ""; echo ""; echo "\n"; for ($i = 0; $i < $attrs["count"]; $i++) { $attribute = $attrs[$i]; $attributevalue = ldap_get_values_len ($ds, $entry, $attribute); for ($j = 0; $j < $attrs[$attribute]["count"]; $j++) { echo ""; echo ""; echo ""; echo "\n"; } } ldap_unbind ($ds); } else { echo "Can not create LDAP connection\n"; } echo ""; echo ""; echo ""; echo "\n"; for ($i = 0; $i < $default->newattrnum; $i++) { echo ""; echo ""; echo ""; echo "\n"; echo ""; echo ""; echo ""; echo "\n"; echo ""; echo ""; echo ""; echo "\n"; echo "\n"; } /* echo ""; echo ""; echo "\n"; */ echo "
"; echo "Distinguished Name" . " =   "; echo "
"; echo $attrs[$i] . " =   "; // $value = $attrs[$attribute][$j]; $value = $attributevalue[$j]; /* MIME type data output support */ if (strstr ($attribute, ";jpeg") or strstr ($attribute, ";jpg") or strstr ($attribute, ";jpe") or strstr ($attribute, ";gif") or strstr ($attribute, ";png") or !strcmp ($attribute, "jpegPhoto")) { $mm = strlen ($value); // echo "attribute = $attribute
"; // echo "value = $value
"; // echo "mm = $mm
"; /* Because gd 1.6.3 creates PNG images, not GIF images. PNG is a more compact format, and full compression is available. Existing code will need modification to call gdImagePng instead of gdImageGif. Unisys holds a patent on the LZW compression algorithm, which is used in fully compressed GIF images. Which ask each website $5000 bucks if they have gif images. Damn Unisys!!! Following codes is another way can let web server output graph directly with generating temporary file. $tmpfname = tempnam (".", $default->tmpfile_prefix); // get rid of nasty prefix in file path "." $tmpfname = substr ($tmpfname, 1); $tmpfname = $tmpfname . ".gif"; $fp = fopen ($tmpfname, "w+"); fputs ($fp, $value, strlen ($value)); fclose ($fp); $imagesize = GetImageSize ($tmpfname); echo ""; */ $tmpfname = tempnam (".", $default->tmpfile_prefix); /* get rid of nasty prefix in file path "." */ $tmpfname = substr ($tmpfname, 1); if (strstr ($attribute, ";jpeg") or strstr ($attribute, ";jpg") or strstr ($attribute, ";jpe")) $tmpfname = $tmpfname . ".jpg"; elseif (strstr ($attribute, ";gif")) $tmpfname = $tmpfname . ".gif"; elseif (strstr ($attribute, ";png")) $tmpfname = $tmpfname . ".png"; $fulltmpfname = $default->root_html . $default->tmpdir . $tmpfname; $fp = fopen ($fulltmpfname, "w+"); fputs ($fp, $value, strlen ($value)); fclose ($fp); $imagesize = GetImageSize ($fulltmpfname); echo "tmpdir . $tmpfname . "\" "; echo $imagesize[3]; echo " border=0>"; echo "
"; echo "prefix_submit; if ($j == 0) echo $attrs[$i] . " "; else echo $attrs[$i] . ";" . $j . " "; echo "type=text"; echo " value=" . $default->tmpdir . $tmpfname; echo " size=" . strlen ($default->tmpdir . $tmpfname) . ">"; echo "
"; echo ""; echo ""; } else { /* NOT MIME type data */ $isascii = 1; for ($k = 0; $k < strlen ($value); $k++) { $chstr = substr ($value, $k, 1); /* if there is non-print character */ if ((ord ($chstr) < 20) or (ord ($chstr) > 126)) { $isascii = 0; break; } } if ($isascii == 0) { echo "prefix_submit . $attrs[$i] . ";" . $j . " "; echo "value=\"" . base64_encode ($value) . "\" size="; if (strlen (base64_encode ($value)) > $default->maxinputlength ) echo $default->maxinputlength; else echo strlen (base64_encode ($value)); echo ">"; } else { /* Netscape LDAP aci has double quotes symbols - """ */ /* ascii 20 - 126, only character """ need to be substitutedin INPUT field so far */ /* $value = str_replace ("\"", """, $value); */ /* $value = rawurlencode ($value); */ $value4size = $value; $value = htmlspecialchars ($value); echo "prefix_submit . $attrs[$i] . ";" . $j . " "; if (strstr ($attrs[$i], "userpassword")) { echo "type=password "; echo "value=\"" . $value; } else { echo "type=text "; echo "value=\"" . $value; } echo "\" size="; if (strlen ($value4size) > $default->maxinputlength ) echo $default->maxinputlength; else echo strlen ($value4size); echo ">"; } } echo "
  
"; echo "New Attr Name : " . "  "; echo "
"; echo "Text Value :   "; echo "
"; echo "OR Binary File :   "; echo "


"; echo "
"; echo "
\n"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
\n"; echo "
\n"; echo ""; echo "
\n"; require ("template/footer.inc"); ?>