PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/username_lookup.php

https://github.com/adamfranco/segue-1.x
PHP | 84 lines | 62 code | 16 blank | 6 comment | 8 complexity | f4470b0aa273e32f277cce502a7e42ae MD5 | raw file
  1. <? /* $Id$ */
  2. include("objects/objects.inc.php");
  3. $content = '';
  4. $message = '';
  5. ob_start();
  6. session_start();
  7. // include all necessary files
  8. include("includes.inc.php");
  9. if ($_REQUEST['name']) {
  10. $usernames=userlookup($_REQUEST['name'],LDAP_BOTH,LDAP_WILD,LDAP_LASTNAME,0);
  11. }
  12. // sort alphabetically
  13. if (count($usernames)) {
  14. asort($usernames);
  15. reset($usernames);
  16. }
  17. /* print "<pre>"; */
  18. /* print_r($usernames); */
  19. /* print "</pre>"; */
  20. ?>
  21. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  22. <html>
  23. <head>
  24. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  25. <title>Username Lookup</title>
  26. <? include("themes/common/logs_css.inc.php"); ?>
  27. <?
  28. ?>
  29. </head>
  30. <body onload="document.searchform.name.focus()">
  31. <table cellspacing='1' width='100%' id='maintable'>
  32. <tr>
  33. <td colspan='3'>
  34. <form action="<? echo $PHP_SELF ?>" method='get' name='searchform'>
  35. Name: <input type='text' name='name' size='20' value='<?echo $_REQUEST['name']?>'/> <input type='submit' value='Find' />
  36. </form>
  37. <? if (!$usernames) print "No matching names found. Enter a name or part of a name above."; ?>
  38. </td>
  39. </tr>
  40. <tr>
  41. <th>Num</th>
  42. <th>Full Name</th>
  43. <th>Username</th>
  44. </tr>
  45. <?
  46. if (count($usernames)) {
  47. $c = 1;
  48. foreach ($usernames as $u=>$f) {
  49. if (!$u || $u=='') next;
  50. if (!ereg("[a-z]",$u)) next;
  51. print "\n\t\t<tr>";
  52. print "\n\t\t\t<td align='center'>$c</td>";
  53. print "\n\t\t\t<td>".htmlentities($f)."</td>";
  54. print "\n\t\t\t<td>".htmlentities($u)."</td>";
  55. print "\n\t\t</tr>";
  56. $c++;
  57. }
  58. } else {
  59. //print "<tr><td colspan='3'>No usernames. Enter a name or part of a name above.</td></tr>";
  60. }
  61. ?>
  62. </table>
  63. <br />
  64. <div align='right'>
  65. <input type='button' value='Close Window' onclick='window.close()' />
  66. </div>
  67. </body>
  68. </html>