Note that there are some explanatory texts on larger screens.

plurals
  1. POLDAP PHP last logon timestamp
    primarykey
    data
    text
    <p>i have this code that can get the tag of a computer, the operting system and the lastlogon timestamp.</p> <p>The problem is that i cant get the timestamp code to be displayed so humans can understand it.</p> <p>Is there a way to implement this in this code?</p> <pre><code> &lt;?php header('Content-Type: text/html; charset=iso-8859-1'); $host = "ldap://server.server.net"; $user = "domain\user"; $pswd = "passw"; $ad = ldap_connect($host) or die( "Could not connect!" ); ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3) or die ("Could not set ldap protocol"); // Binding to ldap server $bd = ldap_bind($ad, $user, $pswd) or die ("Could not bind"); // Create the DN $dn = "OU=NotebookM2,OU=WorkstationsM2,OU=PT1,DC=heiway,DC=net"; $attrs = array("cn","operatingsystem","lastlogon"); // Create the filter from the search parameters $filter = $_POST['filter']."=".$_POST['keyword']."*"; $search = ldap_search($ad, $dn, $filter, $attrs) or die ("ldap search failed"); $entries = ldap_get_entries($ad, $search); if ($entries["count"] &gt; 0) { echo "&lt;table border='1' width='100%'&gt;"; echo "&lt;tr&gt;"; echo "&lt;td&gt;TAG:&lt;/td&gt;"; echo "&lt;td&gt;OS:&lt;/td&gt;"; echo "&lt;td&gt;Last Logon:&lt;/td&gt;"; echo "&lt;/tr&gt;"; for ($i=0; $i&lt;$entries["count"]; $i++) { echo "&lt;tr&gt;"; echo "&lt;td&gt;".$entries[$i]["cn"][0]."&lt;/td&gt;"; echo "&lt;td&gt;".$entries[$i]["operatingsystem"][0]."&lt;/td&gt;"; echo "&lt;td&gt;".$entries[$i]["lastlogon"][0]."&lt;/td&gt;"; echo "&lt;/tr&gt;"; } echo "&lt;/table&gt;"; } else { echo iconv("UTF-8", "ISO-8859-1","&lt;p&gt;Ops Nothing Found&lt;/p&gt;"); } ldap_unbind($ad); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload