Article

PHP - Web-Display of Last NetWare Logins

About this article:

About:
Author: Dr. Duncan J. Potter, May 2008.

What you need

How it Works

Here's how the HTML code for the NDS context list might look for three contexts and one Novell Group (the last entry)
(using CSS might be an option, I wrote this a long time ago).

Selecting an eDirectory/NDS Context to search in:
(Click on the thumbnail, right, to see what this should look like - depending on your CSS style sheet).

    <form method=post action="<?php echo $PHP_SELF;?>">
	<table width="80%" border="0" cellspacing="2" cellpadding="3">   
	<tr>
	<td colspan="2">
	Please Select  an eDirectory Context below
    <tr>
      <td align"right"> </td>
      <td>
	<INPUT TYPE="RADIO" NAME="context" VALUE="somusers" CHECKED="true">SML Main context: som.staff.hw</INPUT>
	<INPUT TYPE="RADIO" NAME="context" VALUE="lanusers">Languages Staff: staff.lan.hw</INPUT><P>
	<INPUT TYPE="RADIO" NAME="context" VALUE="logmsc">Logistics Msc Microlab users: loglab.som.staff.hw</INPUT><P>
	<INPUT TYPE="RADIO" NAME="context" VALUE="langmsc">Languages MSc Microlab users: som.staff.hw</INPUT> 
    </tr>
    <tr>
	<td> 
      <td><input type="submit" value="Submit" name="Submit">   
      <input type="reset" value="Cancel" name="cancel"></td>
    </tr>
  </table>

  • Immediately following this code we can place the PHP-enhanced code to check for a submitted search above, and construct the query that will be passed through to DOS to execute, using JRB Utils.

    Notice how the fully-qualified context name is identified from the form variable passed e.g. somusers is matched to eDirectory context .som.staff.hw.

    (Click on the thumbnail, right, to see what this should look like - depending on your CSS style sheet).

    <?php
    if ( isset($_POST['context']) ) {
         // Handle eDirectory Contexts
    	 	 
    	 if ($_POST['context']=='somusers'){
    		$nds = 'som.staff.hw';
    	 }
    	 if ($_POST['context']=='lanusers'){
    	 	$nds = 'staff.lan.hw';
    	 }
    	 if ($_POST['context']=='logmsc'){
    	 	 	$nds = 'loglab.som.staff.hw';
    	 }
    	 if ($_POST['context']=='langmsc'){
    	 	 	$nds = '#.lanpgmicrolab.som.staff.hw';
    	 }
    	 
    	//  Handle eDirectory Groups
    	if ($_POST['context']<>'langmsc'){
    		// When performing a last login for members of a group the syntax is slightly different 
    		echo "<P><h3>Last Login Dates for users in <font color=\"red\">" .  $nds ."</font></h3><pre>\n";
    		$lookup = 'N:\School\utils\JRButils\jrb32\getrest .*.' . $nds .  ' lld /sv';	
    	} else {
    		echo "<P><h3>Last Login Dates for users in <font color=\"red\">" .  $nds ."</font></h3><pre>\n";
    		$lookup = 'N:\School\utils\JRButils\jrb32\getrest ' . $nds .  ' lld /sv';	
    	}
    	// Send the command to DOS for execution
    	passthru($lookup);
    
    	echo "</PRE>\n";
    }
    ?> 
    

    Summary

    That's it!