PHP: Hypertext Preprocessor (original) (raw)

`<?php ds=ldapconnect("localhost");//assumingtheLDAPserverisonthishostif(ds=ldap_connect("localhost"); // assuming the LDAP server is on this hostif (ds=ldapconnect("localhost");//assumingtheLDAPserverisonthishostif(ds) { r=ldapbind(r=ldap_bind(r=ldapbind(ds,"cn=root, o=My Company, c=US", "secret");
$info["cn"]="Roberto Celestino";
$info["sn"]="Roberto";
$info["mail"]="rcelestino@here.and.now"; info["objectclass"]="person";//adddatatodirectory<spanclass="katex"><spanclass="katex−mathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>r</mi><mo>=</mo><mi>l</mi><mi>d</mi><mi>a</mi><msub><mi>p</mi><mi>a</mi></msub><mi>d</mi><mi>d</mi><mostretchy="false">(</mo></mrow><annotationencoding="application/x−tex">r=ldapadd(</annotation></semantics></math></span><spanclass="katex−html"aria−hidden="true"><spanclass="base"><spanclass="strut"style="height:0.4306em;"></span><spanclass="mordmathnormal"style="margin−right:0.02778em;">r</span><spanclass="mspace"style="margin−right:0.2778em;"></span><spanclass="mrel">=</span><spanclass="mspace"style="margin−right:0.2778em;"></span></span><spanclass="base"><spanclass="strut"style="height:1em;vertical−align:−0.25em;"></span><spanclass="mordmathnormal"style="margin−right:0.01968em;">l</span><spanclass="mordmathnormal">d</span><spanclass="mordmathnormal">a</span><spanclass="mord"><spanclass="mordmathnormal">p</span><spanclass="msupsub"><spanclass="vlist−tvlist−t2"><spanclass="vlist−r"><spanclass="vlist"style="height:0.1514em;"><spanstyle="top:−2.55em;margin−left:0em;margin−right:0.05em;"><spanclass="pstrut"style="height:2.7em;"></span><spanclass="sizingreset−size6size3mtight"><spanclass="mordmathnormalmtight">a</span></span></span></span><spanclass="vlist−s">​</span></span><spanclass="vlist−r"><spanclass="vlist"style="height:0.15em;"><span></span></span></span></span></span></span><spanclass="mordmathnormal">dd</span><spanclass="mopen">(</span></span></span></span>ds,"cn=CelestinoRoberto,o=MiCompania,c=US",info["objectclass"]="person";// add data to directory <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>r</mi><mo>=</mo><mi>l</mi><mi>d</mi><mi>a</mi><msub><mi>p</mi><mi>a</mi></msub><mi>d</mi><mi>d</mi><mo stretchy="false">(</mo></mrow><annotation encoding="application/x-tex">r=ldap_add(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">d</span><span class="mord mathnormal">a</span><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">a</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">dd</span><span class="mopen">(</span></span></span></span>ds, "cn=Celestino Roberto, o=Mi Compania, c=US", info["objectclass"]="person";//adddatatodirectory<spanclass="katex"><spanclass="katexmathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>r</mi><mo>=</mo><mi>l</mi><mi>d</mi><mi>a</mi><msub><mi>p</mi><mi>a</mi></msub><mi>d</mi><mi>d</mi><mostretchy="false">(</mo></mrow><annotationencoding="application/xtex">r=ldapadd(</annotation></semantics></math></span><spanclass="katexhtml"ariahidden="true"><spanclass="base"><spanclass="strut"style="height:0.4306em;"></span><spanclass="mordmathnormal"style="marginright:0.02778em;">r</span><spanclass="mspace"style="marginright:0.2778em;"></span><spanclass="mrel">=</span><spanclass="mspace"style="marginright:0.2778em;"></span></span><spanclass="base"><spanclass="strut"style="height:1em;verticalalign:0.25em;"></span><spanclass="mordmathnormal"style="marginright:0.01968em;">l</span><spanclass="mordmathnormal">d</span><spanclass="mordmathnormal">a</span><spanclass="mord"><spanclass="mordmathnormal">p</span><spanclass="msupsub"><spanclass="vlisttvlistt2"><spanclass="vlistr"><spanclass="vlist"style="height:0.1514em;"><spanstyle="top:2.55em;marginleft:0em;marginright:0.05em;"><spanclass="pstrut"style="height:2.7em;"></span><spanclass="sizingresetsize6size3mtight"><spanclass="mordmathnormalmtight">a</span></span></span></span><spanclass="vlists"></span></span><spanclass="vlistr"><spanclass="vlist"style="height:0.15em;"><span></span></span></span></span></span></span><spanclass="mordmathnormal">dd</span><spanclass="mopen">(</span></span></span></span>ds,"cn=CelestinoRoberto,o=MiCompania,c=US",info);
//Close the link apointed by the identified $ds (get with ldap_connect)
ldap_close($ds);

}

?>`