Jump to content

Help with an iPrint via PHP/LDAP Script


pjcox

Recommended Posts

I'm hoping that someone might be able to help with this.

We're currently using a NW 6.5 sp6 box to host our iPrint, we'd like to upgrade to

OES but we use the PHP-LDAP iPrint cool solution by Daniel Bray

(http://www.health-first.org/internal_access/technical_docs/iPrint/iPrint_via_LDAPandPHP.html). We're a hospital and floors get changed a little too much to use Novell's  Map tool, Daniel's

scripts have been a godsend for us in offering our users an iPrint solution for printing. The issue we run into is that when we tried to upgrade (to Novell's OES) we found that the PHP  script generated errors when running on the new box (which uses PHP5 vs PHP4 and on the NW6.5 box). I've emailed Bray about it and he thought it was an issue between PHP versions but he's no longer working with Novell products, we don't have enough PHP experience to figure it out and when

I tried Novell I was asked for the info and told they'd get back to me (9 months now....... still nothing).

    I figure I'd ask (beg, plead, etc) the members of this group to see if anyone else has had any experience. We'd really like to stay with Novell and iPrint but not 6.5 and not the mapping tool.

 

Here's a copy of the original script:

Original-Script

<?php

 

$host="ldapserver.company.com"; //change this to your ldap server

$basedn = "ou=iPrint,o=organization"; //change this to your basedn

$auth_user="cn=iPrint_Admin,ou=iPrint,o=organization"; //change this to your ldap user

$auth_password="i.love.OpenSource";  //change this to your ldap user's password

 

$facility_selected = $_POST['facility'];

$floor_selected = $_POST['floor'];

$location_selected = $_POST['location'];

 

error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR |

E_COMPILE_ERROR | E_CORE_WARNING | E_USER_ERROR |

E_USER_WARNING | E_USER_NOTICE);

 

 

$ldapconnect = @ldap_connect($host);

if(!($ldapconnect))

{

die ("Nope, didn't connect to $host....try again later<br>");

}

 

$ldapbind = @ldap_bind($ldapconnect, $auth_user, $auth_password);

if(!($ldapbind))

{

die("Nope, didn't authenticate to $host.....try another user name or password<br>");

}

?>

 

<html><head><title>iPrint - Printer Selection</title></head>

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

 

<body style="margin-left: 0%; margin-right: 0%; margin-bottom: 0%; margin-top: 0%;">

 

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td colspan="3">

<table width="100%" border="0" bgcolor="white"

background="IMAGES/title_bkgrnd.gif" style="background-repeat: no-repeat">

<tr>

<td>

<a href="http://www.novell.com/iprint" target=_top style="text-decoration:none;color:black" >

<H3 style="font-family:'Trebuchet MS', Arial, Helvetica, Geneva, Swiss, SunSans-Regular; margin-top:0">

iPrint</H3></a>

<br><img src="IMAGES/1x1blank.gif" height="35"><br>

</td>

</tr>

</table>

</td>

</tr>

 

<tr>

<td valign="top" align="left" style="padding: 5px" bgcolor="#dfddd5">

<form action="<?echo $PHP_SELF?>" name="printers" method="post">

<B>1.)  Select A Facility</B><BR>

 

<select name="facility" onChange="javascript:form.submit();">

<?php //ok, let's see if we can list out the facilities...HFBC....HRMC....etc.

echo "\n\t\t\t<option value=\"select\">Select Facility</option>\n";

 

$facility_list = @ldap_list($ldapconnect, $basedn, "ou=*");

if($facility_list)

{

@ldap_sort ($ldapconnect, $facility_list,"ou");

$facility_results = @ldap_get_entries($ldapconnect, $facility_list);

for ($f=0; $f<$facility_results["count"]; $f++)

{

echo "\t\t\t<option value=\"".$facility_results[$f]["ou"][0]."\"";

if($facility_selected == $facility_results[$f]["ou"][0])

{

echo "selected"; //not too tricky, just seeing if the selected is selected ;-)

}

echo ">".$facility_results[$f]["ou"][0]."</option>\n";

}

}

 

?>

 

</select>

 

<br><br><br>

 

<B>2.) Select A Floor / Site</B><BR>

 

<select name="floor" onChange="javascript:form.submit();">

<?php

echo "<option value=\"select\">Select Floor / Site</option>\n";

if($facility_selected!="select")

{ //groovy, if the facility was chosen, let's list out some floors

 

$floor_dn = "ou=$facility_selected, $basedn";

$floor_list = @ldap_list($ldapconnect, $floor_dn, "ou=*");

 

if($floor_list)

{

@ldap_sort ($ldapconnect, $floor_list,"ou");

$floor_results = @ldap_get_entries($ldapconnect, $floor_list);

for ($flr=0; $flr<$floor_results["count"]; $flr++)

{

echo "\t\t\t<option value=\"".$floor_results[$flr]["ou"][0]."\"";

if($floor_selected == $floor_results[$flr]["ou"][0])

{

echo " selected"; //same as above

}

echo ">".$floor_results[$flr]["ou"][0]."</option>\n";

}

}

}

?>

 

</select>

<br><br><br>

 

<B>3.) Select A Location</B><BR>

 

<select name="location" onChange="javascript:form.submit();">

<?php

echo "<option value=\"select\">Select Location</option>\n";

if(($floor_selected!="select") and ($facility_selected!="select"))

{ //woo hoo, a 3 tier FORM call.....impressive ain't it......list out the locations....PBS....IT....7W....etc.

 

$location_dn = "ou=$floor_selected, ou=$facility_selected, $basedn";

$location_list = @ldap_list($ldapconnect, $location_dn, "ou=*");

 

if($location_list)

{

@ldap_sort ($ldapconnect, $location_list,"ou");

$location_results = @ldap_get_entries($ldapconnect, $location_list);

for ($l=0; $l<$location_results["count"]; $l++)

{

echo "\t\t\t<option value=\"".$location_results[$l]["ou"][0]."\"";

if($location_selected == $location_results[$l]["ou"][0])

{

echo " selected";

}

echo ">".$location_results[$l]["ou"][0]."</option>\n";

}

}

 

} //ok, that's all for this FORM, you should now have the http://blah.blah?facility=blah&floor=blah&location=blah

?>

 

</select>

</form>

<br>

 

<br><img src="IMAGES/1x1blank.gif" width="200" height="35"><br>

<form action="<? echo $PHP_SELF ?>" method="post">

<center><input type="submit" name="startoverbutton" value="Start Over"></center>

</form>

 

<br>

 

 

<img src="IMAGES/1x1blank.gif" width="200" height="575"><br>

</td>

 

<td bgcolor="white">

<br><img src="IMAGES/1x1blank.gif" width="10">

</td>

 

<td valign="top" align="left" bgcolor="white">

<table cellspacing="0" cellpadding="4" border="0" width="100%" align="center">

<tr>

<td>

<?php

 

if($facility_selected)

{

echo "<h3>$facility_selected printers:</h3>\n";

echo "\t<blockquote>\n";

 

$printer_dn = "ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

 

if($floor_selected == "select")

{

$floor_dn = "ou=$facility_selected, $basedn";

$floor_list = @ldap_list($ldapconnect, $floor_dn, "ou=*");

@ldap_sort ($ldapconnect, $floor_list,"ou");

$floor_results = @ldap_get_entries($ldapconnect, $floor_list);

 

if (!($floor_results))

{

echo "\t\t<b>LDAP Error:  " . @ldap_error($ldapconnect) . "</b><br>\n";

}

 

for ($f=0; $f<$floor_results["count"]; $f++)

{

$currentfloor = $floor_results[$f]["ou"][0];

echo "\t\t<b>$currentfloor</b><br>\n";

 

$printer_dn = "ou=$currentfloor, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

 

$location_dn = "ou=$currentfloor, ou=$facility_selected, $basedn";

$location_list = @ldap_list($ldapconnect, $location_dn, "ou=*");

@ldap_sort ($ldapconnect, $location_list,"ou");

$location_results = @ldap_get_entries($ldapconnect, $location_list);

 

echo "\t\t<blockquote>\n";

 

if (!($location_results))

{

echo "\t\t\t<b>LDAP Error:  " . @ldap_error($ldapconnect) . "</b><br>\n";

}

 

for ($l=0; $l<$location_results["count"]; $l++)

{

$currentlocation = $location_results[$l]["ou"][0];

echo "\t\t\t<b>$currentlocation</b><br>\n";

 

$printer_dn = "ou=$currentlocation, ou=$currentfloor, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

}

echo "\t\t</blockquote>\n";

}

}

else

{

echo "\t\t\t<b>$floor_selected</b><br>\n";

 

$printer_dn = "ou=$floor_selected, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

 

if($location_selected == "select")

{

$location_dn = "ou=$floor_selected, ou=$facility_selected, $basedn";

$location_list = @ldap_list($ldapconnect, $location_dn, "ou=*");

@ldap_sort ($ldapconnect, $location_list,"ou");

$location_results = @ldap_get_entries($ldapconnect, $location_list);

 

echo "\t\t\t<blockquote>\n";

 

if (!($location_results))

{

echo "\t\t\t\t<b>LDAP Error:  " . @ldap_error($ldapconnect) . "</b><br>\n";

}

 

for ($l=0; $l<$location_results["count"]; $l++)

{

$currentlocation = $location_results[$l]["ou"][0];

echo "\t\t\t\t<b>$currentlocation</b><br>\n";

 

$printer_dn = "ou=$currentlocation, ou=$floor_selected, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

}

echo "\t\t\t</blockquote>\n";

}

else

{

echo "\t\t\t<blockquote>\n";

echo "\t\t\t\t<b>$location_selected</b><br>\n";

 

$printer_dn = "ou=$location_selected, ou=$floor_selected, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

}

echo "\t\t\t</blockquote>\n";

 

}

echo "\t<blockquote>\n";

}

?>

</td>

</tr>

</table>

<br>

 

<br>

<table cellspacing="0" cellpadding="4" border="0" width="100%" align="center">

<tr>

<td valign="top" align="left">

<center><img src="IMAGES/printer.gif"></center>

<br>

<h4>Instructions </h4>

<blockquote>

To install a printer, select the appropriate items from the list. 

Once you select your location, you will be automatically taken to a printer list.

Choose your printer and install the drivers if prompted.  If at anytime you need to

start over, simply click the Start Over button at the bottom left.

</blockquote>

</td>

</tr>

</table>

 

</td>

 

</tr>

</table>

 

</body>

</html>

 

 

Here's a copy of our modified script (sans server addreses and passwords)

 

<?php

 

$host="x.x.x.x"; //change this to your ldap server

$basedn = "ou=iPrinters,o=NYM"; //change this to your basedn

$auth_password="admin's_password";  //change this to your ldap user's password

$auth_user="cn=Admin,o=NYM"; //change this to your ldap user

 

$facility_selected = $_POST['facility'];

$floor_selected = $_POST['floor'];

$location_selected = $_POST['location'];

 

error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR |

E_COMPILE_ERROR | E_CORE_WARNING | E_USER_ERROR |

E_USER_WARNING | E_USER_NOTICE);

 

 

$ldapconnect = @ldap_connect($host);

if(!($ldapconnect))

{

die ("Nope, didn't connect to $host....try again later<br>");

}

 

$ldapbind = @ldap_bind($ldapconnect, $auth_user, $auth_password);

if(!($ldapbind))

{

die("Nope, didn't authenticate to $host.....try another user name or password<br>");

}

?>

 

 

<html><head>

<script type="text/javascript">

function show_alert()

{

window.location.href="http://our.iprint.server"

 

}

</script>

 

<title>iPrint - NYM Printer Selection</title></head>

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

 

<body style="margin-left: 0%; margin-right: 0%; margin-bottom: 0%; margin-top: 0%;">

 

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td colspan="3">

<table width="100%" border="0" bgcolor="white"

background="IMAGES/title_bkgrnd.gif" style="background-repeat: no-repeat">

<tr>

<td>

<a href="http://www.novell.com/iprint" target=_top style="text-decoration:none;color:black" >

<H3 style="font-family:'Trebuchet MS', Arial, Helvetica, Geneva, Swiss, SunSans-Regular; margin-top:0">

iPrint</H3></a>

<br><img src="IMAGES/1x1blank.gif" height="35"><br>

</td>

</tr>

</table>

</td>

</tr>

 

<tr>

<td valign="top" align="left" style="padding: 5px" bgcolor="#dfddd5" width="20%">

<form action="<?echo $PHP_SELF?>" name="printers" method="post">

 

<B>3. Select A Building</B><BR>

 

<select name="facility" onChange="javascript:form.submit();">

<?php //ok, let's see if we can list out the facilities...HFBC....HRMC....etc.

echo "\n\t\t\t<option value=\"select\">Not Selected</option>\n";

 

$facility_list = @ldap_list($ldapconnect, $basedn, "ou=*");

if($facility_list)

{

@ldap_sort ($ldapconnect, $facility_list,"ou");

$facility_results = @ldap_get_entries($ldapconnect, $facility_list);

for ($f=0; $f<$facility_results["count"]; $f++)

{

echo "\t\t\t<option value=\"".$facility_results[$f]["ou"][0]."\"";

if($facility_selected == $facility_results[$f]["ou"][0])

{

echo "selected"; //not too tricky, just seeing if the selected is selected ;-)

}

echo ">".$facility_results[$f]["ou"][0]."</option>\n";

}

}

 

?>

 

</select>

 

 

<br><br><br>

 

<B>2. Select A Floor</B><BR>

 

<select name="floor" onChange="javascript:form.submit();">

<?php

echo "<option value=\"select\">Not Selected</option>\n";

if($facility_selected!="select")

{ //groovy, if the facility was chosen, let's list out some floors

 

$floor_dn = "ou=$facility_selected, $basedn";

$floor_list = @ldap_list($ldapconnect, $floor_dn, "ou=*");

 

if($floor_list)

{

@ldap_sort ($ldapconnect, $floor_list,"ou");

$floor_results = @ldap_get_entries($ldapconnect, $floor_list);

for ($flr=0; $flr<$floor_results["count"]; $flr++)

{

echo "\t\t\t<option value=\"".$floor_results[$flr]["ou"][0]."\"";

if($floor_selected == $floor_results[$flr]["ou"][0])

{

echo " selected"; //same as above

}

echo ">".$floor_results[$flr]["ou"][0]."</option>\n";

}

}

}

?>

 

</select>

 

<br><br><br>

 

<B>3. Select A Department</B><BR>

 

<select name="location" onChange="javascript:form.submit();">

<?php

echo "<option value=\"select\">Not Selected</option>\n";

if(($floor_selected!="select") and ($facility_selected!="select"))

{ //woo hoo, a 3 tier FORM call.....impressive ain't it......list out the locations....PBS....IT....7W....etc.

 

$location_dn = "ou=$floor_selected, ou=$facility_selected, $basedn";

$location_list = @ldap_list($ldapconnect, $location_dn, "ou=*");

 

if($location_list)

{

@ldap_sort ($ldapconnect, $location_list,"ou");

$location_results = @ldap_get_entries($ldapconnect, $location_list);

for ($l=0; $l<$location_results["count"]; $l++)

{

echo "\t\t\t<option value=\"".$location_results[$l]["ou"][0]."\"";

if($location_selected == $location_results[$l]["ou"][0])

{

echo " selected";

}

echo ">".$location_results[$l]["ou"][0]."</option>\n";

}

}

 

} //ok, that's all for this FORM, you should now have the http://blah.blah?facility=blah&floor=blah&location=blah

 

 

 

?>

 

</select>

 

 

<?php

if(($floor_selected=="select") and ($facility_selected=="select")){

echo "You have not selected a valid option, Please Try Again.";

}

?>

 

 

</form>

<br>

 

<br><img src="IMAGES/1x1blank.gif" width="200" height="35"><br>

<form>

<center>

<input type="button" value="Start Over" name="myButton" onClick="show_alert()" />

</center>

</form>

 

<br>

 

 

<img src="IMAGES/1x1blank.gif" width="200" height="575"><br>

</td>

 

<td bgcolor="white">

<br><img src="IMAGES/1x1blank.gif" width="10">

</td>

 

<td valign="top" align="left" bgcolor="white">

<table cellspacing="0" cellpadding="4" border="0" width="100%" align="center">

<tr>

<td>

<?php

 

if($facility_selected)

{

echo "<h3>$facility_selected printers:</h3>\n";

echo "\t<blockquote>\n";

 

$printer_dn = "ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ippdocs/ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

 

if($floor_selected == "select")

{

$floor_dn = "ou=$facility_selected, $basedn";

$floor_list = @ldap_list($ldapconnect, $floor_dn, "ou=*");

@ldap_sort ($ldapconnect, $floor_list,"ou");

$floor_results = @ldap_get_entries($ldapconnect, $floor_list);

 

if (!($floor_results))

{

echo "You have selected an invalid option, Please startover again";

//echo "\t\t<b>LDAP Error:  " . @ldap_error($ldapconnect) . "</b><br>\n";

}

 

for ($f=0; $f<$floor_results["count"]; $f++)

{

$currentfloor = $floor_results[$f]["ou"][0];

echo "\t\t<b>$currentfloor</b><br>\n";

 

$printer_dn = "ou=$currentfloor, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ippdocs/ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

 

$location_dn = "ou=$currentfloor, ou=$facility_selected, $basedn";

$location_list = @ldap_list($ldapconnect, $location_dn, "ou=*");

@ldap_sort ($ldapconnect, $location_list,"ou");

$location_results = @ldap_get_entries($ldapconnect, $location_list);

 

echo "\t\t<blockquote>\n";

 

if (!($location_results))

{

echo "You have selected an invalid option, Please startover again";

//echo "\t\t\t<b>LDAP Error:  " . @ldap_error($ldapconnect) . "</b><br>\n";

}

 

for ($l=0; $l<$location_results["count"]; $l++)

{

$currentlocation = $location_results[$l]["ou"][0];

echo "\t\t\t<b>$currentlocation</b><br>\n";

 

$printer_dn = "ou=$currentlocation, ou=$currentfloor, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ippdocs/ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

}

echo "\t\t</blockquote>\n";

}

}

else

{

echo "\t\t\t<b>$floor_selected</b><br>\n";

 

$printer_dn = "ou=$floor_selected, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ippdocs/ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

 

if($location_selected == "select")

{

$location_dn = "ou=$floor_selected, ou=$facility_selected, $basedn";

$location_list = @ldap_list($ldapconnect, $location_dn, "ou=*");

@ldap_sort ($ldapconnect, $location_list,"ou");

$location_results = @ldap_get_entries($ldapconnect, $location_list);

 

echo "\t\t\t<blockquote>\n";

 

if (!($location_results))

{

echo "You have selected an invalid option, Please startover again";

//echo "\t\t\t\t<b>LDAP Error:  " . @ldap_error($ldapconnect) . "</b><br>\n";

}

 

for ($l=0; $l<$location_results["count"]; $l++)

{

$currentlocation = $location_results[$l]["ou"][0];

echo "\t\t\t\t<b>$currentlocation</b><br>\n";

 

$printer_dn = "ou=$currentlocation, ou=$floor_selected, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ippdocs/ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

}

echo "\t\t\t</blockquote>\n";

}

else

{

echo "\t\t\t<blockquote>\n";

echo "\t\t\t\t<b>$location_selected</b><br>\n";

 

$printer_dn = "ou=$location_selected, ou=$floor_selected, ou=$facility_selected, $basedn";

 

$printer_filter = array("cn","ndpsprinterxri");

$printer_list = @ldap_list($ldapconnect, $printer_dn, "cn=*", $printer_filter);

@ldap_sort($ldapconnect, $printer_list,"cn");

$printer_list_results = @ldap_get_entries($ldapconnect, $printer_list);

 

if ($printer_list_results != 0)

{

echo "\t<blockquote>\n";

 

for ($p=0; $p<$printer_list_results["count"]; $p++)

{

$printer = $printer_list_results[$p]["cn"][0];

$url = $printer_list_results[$p]["ndpsprinterxri"][0];

 

if($url)

{

$url = ereg_replace('uri=', '', $url);

echo "\t<a href=\"ippdocs/ISINSTF.HTM?ippPrinterURL=$url&onInstalled=status&onNotInstalled=install\"

target\"=_top\">$printer</a> <br><br>\n";

}

else

{

echo "\t<b>$printer</b><br><br>\n";

}

}

echo "\t</blockquote>\n";

}

}

echo "\t\t\t</blockquote>\n";

 

}

echo "\t<blockquote>\n";

}

?>

</td>

</tr>

</table>

<br>

 

<br>

 

 

</td>

 

</tr>

</table>

 

</body>

</html>

 

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.