Jump to content

anner

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

anner's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. If the value being passed is the country ID, as in the code in the last post, you probably won't need a join, you'll probably just need your query to look like this: [code]$sql="Select * from personal where countryID = '".$_POST['countryid']."'";[/code]
  2. It appears ldap_sort is case sensitive and puts all the capitals before any lowercase, so my results are A-Z then a-z.  Is there any way to do a caseless ldap sort?
  3. I have a bunch of code (40+ scripts) for an admin interface, many of which perform ldap searches, adds, and/or modifies.  All need to bind to the same server with the same ID, so I tried putting the connection into and included file: [code]function open_ldap_conn() { $host = get_my_host(); if (strstr($host,"test")) { $ldapServer = "test.ldap.server";} else { $ldapServer = "live.ldap.server"; } //try and connect to ldap server $ds = ldap_connect($ldapServer); if (!$ds) {die('Cannot Connect to LDAP server');} $domadlogin = "cn=admin"; $domadpw = "mypass"; //bind to ldap server $ldapBind = ldap_bind($ds,$domadlogin,$domadpw); if (!$ldapBind) {die('Cannot Bind to LDAP server');} return($ds); }[/code] Now, it appears to be executing the included code without issue, but when I try and us the connection it fails: [code]//Check for list existance $ds = open_ldap_conn(); $Base = "ou=whitepages,o=my_o,c=us"; list($List, $dummy) = split("@",$ListName); $Filter = "(cn=$List)";    # LDAP search filter $sr = ldap_search($ds,$Base,$Filter); if (!$sr) {log_error("List duplicate check failed<br>", 1); return(1);} if (ldap_first_entry($ds, $sr))         { ncmail_log_error("A list already exists with this name.  Please choose a new name for your list.<br>", 1);         return(1);         } [/code] With error: warning: ldap_search(): supplied argument is not a valid ldap link resource and my output: List duplicate check failed Is it not possible to do this?  It seems silly to have to include the code for the connect in more than 40 different places when it's the exactly the same code over and over. 
  4. I have a JS chooser in a form.  When I use it in firefox, all of the data gets submitted and processed just perfectly...I thought I was all good.  Then I tested on Internet Explorer.  In IE the array that is passed contains the correct number of fields, items get removed correctly, and if there was data already in the selected side of the chooser, it is passed correctly, but any newly selected item gets passed as a blank field in the array.  This, of course, screws up my code that processes the data.  Ideas?
  5. ok, I did find the right spot in the spec file where I can copy my .conf file over.  And now I'm almost done...then I get this [code]RPM build errors:     File not found: /var/tmp/php-root/usr/lib/php/build[/code] Does this mean I need php-devel to build a php rpm?
  6. This may be the completely wrong place for this, but I couldn't figure out where it should go... I'm building an rpm of the newest php (5.1.5) on Redhat ES4 and keep getting this error in the install portion: [code]apxs:Error: Config file /var/tmp/php-root/etc/httpd/conf/httpd.conf not found. make: *** [install-sapi] Error 1 [/code] I can't find any reference to httpd.conf in my spec file.  I think, upon inspection, that my apxs is fine, but I could be wrong.  That file definitely is not there (/var/tmp/php-root/etc/httpd/conf/ is empty).  If I get the spec file to copy it into that dir from the live location (/etc/httpd/conf/httpd.conf), I get the same problem. I really feel like I am banging my head against the wall, so any pointers would be much appreciated. My spec file is 500 lines, so I don't want to post the whole thing unless someone specifically asks.  I've tried 2 different ones.  I took a fedora core 5 php 5.1.4 rpm spec file and editted and tried that, and the latest I could find for a RHEL4 rpm, which was 4.2.3.  Both give the identical error in the identical location.  The build does complete, as does the ./configure <args> and make by hand...it's the install part having problems.
  7. AHHA!  Figured it out!  My multiple select box was set up like this: [code] <select size=10 multiple name=Domains> [/code] Which is apparently not good enough for php.  I changed it to: [code] <select size=10 multiple name=Domains[] id=Domains> [/code] and now I get [tt] Array (     [User] => anne.ramey     [AdminID] => bogus.admin     [Datafile] => /admin_auth/bogus.admin.dat     [Password] => XXXXXX     [Admin] => Bogus Administrator     [Phone] => 919-431-1591     [Domains] => Array         (             [0] => first.net.grp             [1] => test.net.grp         )     [Rights] => ldaponly another     [Modify] => Submit Changes ) [/tt] I seem to be losing my \n, but I can work with that.
  8. It just doesn't appear to be recognizing that that is a multi-select box. My text box works fine, all other posted variables work fine, it's just the fancy JS multi-select box.  arrrg
  9. [tt]Array (     [User] => anne.ramey     [AdminID] => bogus.admin     [Datafile] => /admin_auth/bogus.admin.dat     [Password] => XXXXXX     [Admin] => Bogus Administrator     [Phone] => 919-431-1591     [Domains] => its.net.grp     [Rights] =>     [Modify] => Submit Changes )[/tt] Here is the snippet again of the code that creates the array to be posted: There is this JS in the head [code] # Java script   print "<SCRIPT LANGUAGE=\"JavaScript\"><!--\n";   print "function deleteOption(object,index) {\n";   print "    object.options[index] = null;\n";   print "}\n";   print "function addOption(object,text,value) {\n";   print "    var defaultSelected = true;\n";   print "    var selected = true;\n";   print "    var optionName = new Option(text, value, defaultSelected, selected)\n";   print "    object.options[object.length] = optionName;\n";   print "}\n";   print "function copySelected(fromObject,toObject) {\n";   print "    for (var i=0, l=fromObject.options.length;i<l;i++) {\n";   print "        if (fromObject.options[i].selected)\n";   print "        addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);\n";   print "    }\n";   print "    for (var i=fromObject.options.length-1;i>-1;i--) {\n";   print "        if (fromObject.options[i].selected)\n";   print "            deleteOption(fromObject,i);\n";   print "    }\n";   print "}\n";   print "function copyAll(fromObject,toObject) {\n";   print "    for (var i=0, l=fromObject.options.length;i<l;i++) {\n";   print "        addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);\n";   print "    }\n";   print "    for (var i=fromObject.options.length-1;i>-1;i--) {\n";   print "        deleteOption(fromObject,i);\n";   print "    }\n";   print "}\n";   print "function selectAll(fromObject) {\n";   print "    for (var i=0, l=fromObject.options.length;i<l;i++) {\n";   print "        fromObject.options[i].selected = true;\n";   print "    }\n";   print "}\n";   print "//--></SCRIPT>\n"; [/code] And this in the body: [code]           print "<table cellpadding=3 border=2>\n";             print "<tr><th $trshade>Available Groups</th><th $trshade>&nbsp;</th><th $trshade>Current Groups</th></tr>\n";             # drop-down of available groups             print "<tr><td align=center><select size=10 multiple name=Allgrps>\n";             foreach $Group (@Groups)             {               print "<option>$Group</option>\n";             }             print "</select></td>";             # dynamic add/remove buttons             print "<td valign=center><input type=button name=grp-add value='--- Add ---&gt;&gt;'";             print " onClick=\"if (document.images) copySelected(this.form.Allgrps,this.form.Domains)\">";             print "<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>";             print "<input type=button name=grp-remove value='&lt;&lt;- Remove'";             print " onClick=\"if (document.images) copySelected(this.form.Domains,this.form.Allgrps)\">";             print "</td>";             # Text box list of all groups for contact             print "<td align=center><select size=10 multiple name=Domains>";                  foreach $line(@Domains)             {             if ($line) {print "<option>$line\n</option>";}             }             print "</select></td></tr>\n";             # end table             print "</table>\n"; [/code] And is posted with this: [code]   print "<input type=submit name=Modify value='Submit Changes' onClick=\"if (document.images) selectAll(this.form.Domains)\">\n"; [/code] When running this included perl script by itself, I read this variable back in with the line: [code] my @Groups = param('Domains'); # A single variable to contain the domains passed from the calling cgi [/code] And it contains all the data.
  10. [quote author=kenrbnsn link=topic=102863.msg409487#msg409487 date=1154697337] Is there a live URL where this problem can be seen? Ken [/quote] Unfortunately not.  These are secure admin functions for my organization and I'd be in deep kimshe if I let anyone not "authorize" view these pages.  I'm really appreciative of your help and will try and answer any questions about the setup. And just to clarify another point, it's the JS select box that is creating the array, not just adding \n to the end.  That's why I tried other characters.  It appears the array is not being seen as an array.  I'll try your suggestion ken and post the results.  Thanks,
  11. I'm passing them into an array (appended with a \n) because that's how the JS textbox handles it's submission. If I try: [code] if ($_POST['Domains']) {  $Domains = "";   foreach($_POST['Domains'] as $key => $value)   {     $Domains .= $value;   }   $send = $send . "&Domains=" . urlencode($Domains); } [/code] I get: warning: Invalid argument supplied for foreach() If I do: [code] $i = 0; $Domains = ""; while ($_POST['Domains'][$i]) {      $Domains .= $_POST['Domains'][$i];     $i++; } echo $Domains; if ($Domains != "") { $send = $send . "&Domains=" . urlencode($Domains); } [/code] I still only get the last domain.  ?
  12. Nah, I'm pretty sure I don't want to do that.  This is inside a CMS...there are headers, etc already. I've tried \t and , as well as \n and get the same result, so it's definitely not that...I'm think it's because the variable is an array.  How can I grab a posted array correctly?  I tried: [code] if ($_POST['Domains']) {$Domains = array($_POST['Domains']); echo $Domains; $send = $send . "&Domains=" . urlencode($Domains); } [/code] But this had 2 problems.  First, it didn't print out the whole array anyway, so it didn't seem to make a difference.  Second, I can't pass an array in a URL.  I can work around the second if I can just get the first figured out.
  13. It's in the first code box in my post above, as indicated. This is what it ends up looking like in the source code: [code] <html><head>           <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">           <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">           <META HTTP-EQUIV="Expires" CONTENT="-1">           </head>           <body bgcolor=#aaaaaa> <table align=center width=100%>           <tr>           <td></td>           <td><h1 align=center><font size=5>Modify Administrator Data for bogus.admin</font></h1></td>           <td></td>           </tr></table><hr size=5> <head><script language='JavaScript'> function Confirm() {   return confirm('Are you sure you want to delete this Administrator?'); } </script> <SCRIPT LANGUAGE="JavaScript"><!-- function deleteOption(object,index) {     object.options[index] = null; } function addOption(object,text,value) {     var defaultSelected = true;     var selected = true;     var optionName = new Option(text, value, defaultSelected, selected)     object.options[object.length] = optionName; } function copySelected(fromObject,toObject) {     for (var i=0, l=fromObject.options.length;i<l;i++) {         if (fromObject.options[i].selected)         addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);     }     for (var i=fromObject.options.length-1;i>-1;i--) {         if (fromObject.options[i].selected)             deleteOption(fromObject,i);     } } function copyAll(fromObject,toObject) {     for (var i=0, l=fromObject.options.length;i<l;i++) {         addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);     }     for (var i=fromObject.options.length-1;i>-1;i--) {         deleteOption(fromObject,i);     } } function selectAll(fromObject) {     for (var i=0, l=fromObject.options.length;i<l;i++) {         fromObject.options[i].selected = true;     } } //--></SCRIPT> </head> Any data in a text entry box can be changed, including the password.<br> <form action=http://my.admin.server/AdminModify.cgi method=POST>       <hr size=5>       <input type=hidden name=User value=anne.ramey>       <input type=hidden name=AdminID value=bogus.admin>       <input type=hidden name=Datafile value=/adminfile/bogus.admin.dat>Password: <input type=text size=20 value='XXXXXX' name=Password><br> Admin Name: <input type=text size=30 value="Bogus Administrator" name=Admin><br> E-Mail Address: <input type=text size=30 value='test.admin@mydomain.com' name=Email><br> Phone Number: <input type=text size=30 value='919-431-1590' name=Phone><br> <h3>Domains</h3><table cellpadding=3 border=2> <tr><th >Available Groups</th><th >&nbsp;</th><th >Current Groups</th></tr> <tr><td align=center><select size=10 multiple name=Allgrps> <option>admin.ah.net.grp</option> <option>admin.net.grp</option> <option>com.grp</option> </select></td><td valign=center><input type=button name=grp-add value='--- Add ---&gt;&gt;' onClick="if (document.images) copySelected(this.form.Allgrps,this.form.Domains)"><br>&nbsp;<br>&nbsp;<br>&nbsp;<br><input type=button name=grp-remove value='&lt;&lt;- Remove' onClick="if (document.images) copySelected(this.form.Domains,this.form.Allgrps)"></td><td align=center><select size=10 multiple name=Domains><option>test.domain.one </option><option>test.this.net </option></select></td></tr> </table> <br><h3>Right Limitations (if any)</h3><textarea name=Rights cols=50 rows=5></textarea><hr><input type=submit name=Modify value='Submit Changes' onClick="if (document.images) selectAll(this.form.Domains)"> </body> </html>[/code] Just to be really clear: The first snippet of code in the above post is the perl script that is included and actually does the posting.  I know this part is working correctly because it works fine when used by itself.  It only fails when included in the php script (the second snippet of code above).
  14. Also, If I have my php echo Domains: [code] echo $_POST['Domains']; [/code] I only see that last domain from the list.
×
×
  • 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.