Re: [PHP] help me :)
Arvydas, I did something like this using a "tree" structure, using stacks. Each item on the stack could have 1 to 3 properties: Name, Parent, URL. If the object on the stack has only a Name property (i.e. Parent and URL are empty) it is assumed that this item is a root node. If the item has a Name and a Parent, is is a child node to the parent, and if it has a Name, Parent and URL, then it is a leaf node to the parent. For example: FolderA FolderB --FolderB(1) --FolderB(2) --ItemB(2)(1) I push onto my stack directory items that have the following properties: AddDirItem(FolderA) AddDirItem(FolderB) AddDirItem(FolderB(1), FolderB) AddDirItem(FolderB(2), FolderB) AddDirItem(ItemB(2)(1), FolderB(2), http://itemb21.whatever) Then, you loop through all of the items, setting the root items as the top of the tree, and continue nesting subitems until you get to a new root item. If you want, I can send you the PHP objects I used to implement this in a dynamic tree. It works quite well, and is extensible to 'n', where 'n' is the number of items allowed due to system/browser constraints. Cheers, Jason "Arvydas" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > i'm new in php but i have very difficult exercise i must make hierarchical menu witch can be released for example so : > > First i will get main menu : for example menu1, menu2, menu3... and these menu will have links (this must be released with so - the question is "How to make recursive menu ?" > (menu mus be repaint after any click...) > > (I have an idea to make function that will "produce" recursive arrays...) > > P.S.sorry for poor english :) > sincerely, > Arvys. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Encryption (Browser Side)
Greets, I have a question about PHP and browser-side encryption. I currently authenticate my users to an LDAP system using the PHP LDAP APIs. The user enters their login name and password on a browser form, with the password box being set to all '*'s for password. However, this information is sent 'plaintext' to the LDAP server, so an interloper could potentially sniff the password off of the network. The second issue is that I am also presented with a way in which to grab the user's password, simply by saving the contents of the password field and dumping it to a text file or database from the PHP code. My question is: what is the best way for me to do an LDAP bind without having access to the password in plaintext? Can I encrypt the password as the user types it in on the browser window, so that no form type variables can be "trapped" by PHP? SSL will address the encryption of the passwords after they are sent to the LDAP server, but it is probably a little bit of overkill to encrypt the entire stream. It also permits me to "steal" passwords from the PHP side, which is a security consideration. What is the best, easiest solution for me to follow? Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passthru Problems
Greets, Just to elaborate: I want my user to be able to click on a hyperlink that points to my PDF file, and have a new window pop up, displaying the contents of the PDF file in the browser window (without prompting if they should save the file) as well as set the HTML tag to the name of the report. My passthru() function works fine, when I send a header() of PDF first, and then dump the raw PDF out. But, I cannot set any HTML properties with tags (like ); it doesn't show the PDF in PDF format then, it shows it all raw encoded. Hope that helps clarifying my wants and needs :-) Cheers, Jason ""Jason Mowat"" <[EMAIL PROTECTED]> wrote in message 9b4lso$2gb$[EMAIL PROTECTED]">news:9b4lso$2gb$[EMAIL PROTECTED]... > Greetings, > > I am having a small problem displaying PDF files to my users via passthru. > This is the situation: I have a bunch of PDF files on my server directory. > I show the user a listing of the PDF files they can view, and allow them to > hyperlink click on the PDF they wish to browse. When the user clicks the > link, I execute a header() and then my passthru on my PDF file. The code is > essentially: > header("Content-type: application/pdf"); > passthru($pdf_file); > > Now, my problem is that the title of the HTML window that pops up is of the > URL path. I want to set the title to something meaningful (like the name of > the PDF file the user is looking at). But, if I try to print a "PDF > File" after the header, my PDF document does not show up (it shows > the raw encoding of the PDF document). > > Does anyone have any suggestions to allow me to show a title on a > header/passthru page? Is there a better way to do this? > > Cheers, > Jason > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] passthru Problems
Greetings, I am having a small problem displaying PDF files to my users via passthru. This is the situation: I have a bunch of PDF files on my server directory. I show the user a listing of the PDF files they can view, and allow them to hyperlink click on the PDF they wish to browse. When the user clicks the link, I execute a header() and then my passthru on my PDF file. The code is essentially: header("Content-type: application/pdf"); passthru($pdf_file); Now, my problem is that the title of the HTML window that pops up is of the URL path. I want to set the title to something meaningful (like the name of the PDF file the user is looking at). But, if I try to print a "PDF File" after the header, my PDF document does not show up (it shows the raw encoding of the PDF document). Does anyone have any suggestions to allow me to show a title on a header/passthru page? Is there a better way to do this? Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sorting LDAP Entries - Please Help
Greets all, I have been playing around with LDAP sorting, but I can't seem to get it to work. Essentially, I do an ldap_search() with a filter condition, and use a ldap_get_entries() to get all of the results. The ldap_get_entries() function returns a multi-dimensional array contain my result set. I am assuming it looks something like this: Entries = array( "count" => x, array( array ( "sn" => "Mowat", "givenname" => "Jason", ... ), array ( "sn" => "Anderson", "givenname" => "Peter", ... ), array ( ... ) ) Now, I want to sort all of the internal "person" data by "sn". But, when I try usort, it does not work. I have tried uasort as well. Basically, I need to be able to sort a nested array without touching the outside arrays based on a value in the nested array's element.. The examples I have seen on the 'Net don't seem to work (for me anyways). I have even copied them verbatim, and I get the same results. I'm not sure if their Entries array is the same as mine. Mine is the Entries returned from ldap_get_entries(). Any help is appreciated! Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] list() = each() Question
Hehehe, I searched around on PHP.net, and found this tidbit of information. It sounds to me that list() is written to only accept the first two elements from the each(). Please correct me if I am misinformed :-) Cheers, Jason [EMAIL PROTECTED] 16-Feb-2000 03:41 Ok, for you folks who are learning this, here's something that should help your comprehension of each(), because I bashed my brains for a while on this one. The first example indicates that each() spits out a 4-cell 1 dimensional array. This is all fine and dandy until you get to the second example, where that seems to be thrown out the window, because though each() is still spitting out 4 array elements, the list() being used is set up to only accept 2 values, as it's being executed with only wo variables in it! For some folks, this might not be a problem, but I couldn't understand the mismatch - why was it done, and where did the array go that each() generated?? Well, upon executing that code, it turns out that the first two array elements of the 4 element array that each() creates are assigned to those two variables, and the last two array element values are just thrown away - they're totally ignored. It's how PHP is written. Now, why do that? Well, the example was definitely written more to show folks how to use each() to make life much easier when dealing with a particular operations array in PHP that a lot of people work with, but it also has the side effect (which hopefully my little explaination has made more palatable) of demonstrating how each() can act when being used with other functions that don't necessarily want all of each()'s input. ""Jason Mowat"" <[EMAIL PROTECTED]> wrote in message 95rrbg$p3i$[EMAIL PROTECTED]">news:95rrbg$p3i$[EMAIL PROTECTED]... > Greets, > > I have a quick question: > > $Array = array( > "val1" => "Value 1", > "val2" => "Value 2", > "val3" => "Value 3" > ); > > while(list($a,$b,$c,$d) = each($Array)) { > print "$a = $c and $b = $d "; > } > > Doesn't the "each" construct return a 4 element array, where element 1's > index is 0, element 2's index is 1, element 3's index is "key" and element > 4's index is "value"? Now, if that is the case, the above should work, > right? I should create a list containing $a, $b, $c and $d, where $a and $c > contain key information, and $b and $d contain value information? For some > reason, $c and $d are NULL... > > What am I missing here? > > Cheers, > Jason > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] list() = each() Question
Greets, I have a quick question: $Array = array( "val1" => "Value 1", "val2" => "Value 2", "val3" => "Value 3" ); while(list($a,$b,$c,$d) = each($Array)) { print "$a = $c and $b = $d "; } Doesn't the "each" construct return a 4 element array, where element 1's index is 0, element 2's index is 1, element 3's index is "key" and element 4's index is "value"? Now, if that is the case, the above should work, right? I should create a list containing $a, $b, $c and $d, where $a and $c contain key information, and $b and $d contain value information? For some reason, $c and $d are NULL... What am I missing here? Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] usort Issues and Classes
Greets, I am playing around with usort and an LDAP class. Basically, I want to sort the results of an LDAP search based on a specific criterion. class CLDAP { var $m_Entries; var $m_LinkIdentifier; ... function Connect() { ... } function Bind() { ... } function FindEntries($BaseDN, $Filter) { $ProcName="CLDAP::FindEntries"; $LDAPSearchResult=ldap_search($this->m_LinkIdentifier, "$BaseDN", "$Filter"); if($LDAPSearchResult) { $Entries=ldap_get_entries($this->m_LinkIdentifier, $LDAPSearchResult); if($Entries) { //print "$ProcName: Entries found for filter of $Filter"; $this->m_Entries = $Entries; } else { // No entries //print "$ProcName: No entries found for filter of $Filter"; } } } //* //* SORT CLASS MEMBERS //* function MySort() { $ProcName = "CLDAP::MySort"; // Sort the entries; print "$ProcName: BEFORE: " . $this->m_Entries["count"] . ""; usort($this->m_Entries, array($this,"cmp")); print "$ProcName: AFTER: " . $this->m_Entries["count"] . ""; } function cmp ($a, $b) { $ProcName = "CLDAP:cmp"; print "$ProcName: IN COMPARE: " . $this->m_Entries["count"] . ""; return strcmp($a["sn"],$b["sn"]); } } Now, with the above (hacked up) example, I create my LDAP object, connect to an LDAP server and retrieve values based on a DN and Filter. Essentially, I get a multi-dimensional array populated with the results from my LDAP filter, with key references to their attributes ("givenname" = first name, "sn" = last name, etc...). This works! I can populate my object property '$this->m_Entries' with my UNSORTED LDAP results. When I run the $LDAP->MySort() routine, '$this->m_Entries' has values BEFORE the usort function call, but has NULL entries AFTER the function call. '$this->cmp' has values each time it is called. Somehow, my data is being wiped out by usort after I return from '$this->cmp'. The above example is attempting to sort my LDAP results by "sn", or last name in LDAP-ese. What is happening here? Why is my array of results disappearing after the usort? I played with globals, and I even saved my array into a temp variable and used that instead. The temp variable is fine before the usort, but is totally gone after. Any help is appreciated! Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]