coldfusion与LDAP

本文提供了一个使用 ColdFusion 查询 LDAP 目录服务器的示例。通过连接到康涅狄格大学公共 LDAP 服务器,演示了如何搜索名称并展示结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下面是一个demo,from:http://livedocs.adobe.com/coldfusion/6.1/htmldocs/function.htm#wp3082862
<h3>cfldap Example</h3>
<p>Provides an interface to LDAP directory servers. The example uses the 
University of Connecticut public LDAP server. For more public LDAP servers,
see <a href="http://www.emailman.com">http://www.emailman.com</a>.</p>
<p>Enter a name and search the public LDAP resource. 
An asterisk before or after the name acts as a wildcard.</p>
<!--- If form.name exists, the form was submitted; run the query. --->
<cfif IsDefined("form.name")>
    <!--- Check to see that there is a name listed. --->
    <cfif form.name is not "">
        <!--- Make the LDAP query. --->
        <cfldap 
             server = "ldap.uconn.edu"
             action = "query"
             name = "results"
             start = "dc=uconn,dc=edu"
             filter = "cn=#name#"
             attributes = "cn,o,title,mail,telephonenumber"
             sort = "cn ASC">
        <!--- Display results. --->
        <center>
        <table border = 0 cellspacing = 2 cellpadding = 2>
            <tr>
                <th colspan = 5>
                    <cfoutput>#results.recordCount# matches found </cfoutput></TH>
            </tr>
            <tr>
                <th><font size = "-2">Name</font></TH>
                <th><font size = "-2">Organization</font></TH>
                <th><font size = "-2">Title</font></TH>
                <th><font size = "-2">E-Mail</font></TH>
                <th><font size = "-2">Phone</font></TH>
            </tr>
            <cfoutput query = "results">
                <tr>
                    <td><font size = "-2">#cn#</font></td>
                    <td><font size = "-2">#o#</font></td>
                    <td><font size = "-2">#title#</font></td>
                    <td><font size = "-2">
                        <A href = "mailto:#mail#">#mail#</A></font></td>
                    <td><font size = "-2">#telephonenumber#</font></td>
                </tr>
            </cfoutput>
            </table>
            </center>
        </cfif>
</cfif>

<form action="#cgi.script_name#" method="POST">
    <p>Enter a name to search in the database.</p>
    <input type="Text" name="name">
    <input type="Submit" value="Search" name="">
</form>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值