Jump to content

blirette

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Everything posted by blirette

  1. Thanks PFM. I had a similar function that had a bug in it. Yours works great! Here's the buggy code I had : // tableau temporaire pour trier les valeurs $aTableauTemporaire = array(); // boucler sur toutes les lignes de $aProduits foreach($aProduits as &$aProduit) { // $aTableauTemporaire[] = &$aProduit["intNbReservation"]; }; // trier par ordre descendant array_multisort($aTableauTemporaire, SORT_DESC, $aProduits); Thanks to HuggieBear too! ... but if I don't need globals, I'll prefer the other way shown above.
  2. Is it possible to pass a value to the 'compare' function? Something like : uasort($products, 'compare("price")'); ...that would make the function reusable? Thanks!
  3. Thanks man, used that too. Peace from Quebec City.
  4. Thanks for the reply. I've tried this : RewriteEngine on RewriteRule /fr/forum(/?.*) /forum$1 [R=301,L] ... but it sends me back to the "This forum is disabled" message. I tried to enabled the forum back but it just send me to the old forum post (fr/forum), not in the new forum (/forum). I know the .htaccess works because I had this before and it was working : DirectoryIndex index.php
  5. Hello Dolly! I've just update a PHPBB forum and moved it to a new location. I'd like all links directing to the old forum redirecting to the new one. Here's the change of URLs : www.website.com/fr/forum/viewtopic.php?t=1234 to www.website.com/forum/viewtopic.php?t=1234 so, I'd try this : RewriteEngine on RewriteRule ^/fr/forum/viewtopic.php([a-z/.]*)$ /forum/viewtopic.php$1 [R=301,L] ...but I'm not sure it'll work. Any help please? Thanks for your time.
  6. Hi, I'm trying to setup an intranet to manage file in the entreprise. But I have a question regarding the upload via PHP. Some files are going to be a couple of megabits in size. Since I can connect to the server locally, is there a way to prevent the files from going out of the local network only to comeback from the Internet... as in using the local upload speed instead of the Internet slow upload speed? Hope it's clear, sorry I don't write english really well. Thanks for your time.
  7. Well it's not that hard. Start with only one file upload then separate your functions so you can loop on all the files. Be sure to catch any errors and it should be ok. Start small and robust, and then, build up!
  8. Hey, I've always used ISO8859 to code my PHP apps but I want to move to UTF8 now. I've converted my home-made CMS to manage everything in UTF8. Great. But now I have to use some results from .csv files and informations coming from an LDAP service which are encoded in ISO8859. Can anyone point me to a resource on how to work with different encodings? I'd hate to have to use ISO8859 again now that I finally made the switch. Thanks a lot, have a nice day.
  9. I love to solve things by myself! I had to eval() it. var JSONFile = xmlhttp.responseText; eval(JSONFile);
  10. Hi all, I'm pretty new to using this JSON thing and would like to know why this isn't working. I'm trying to get via AJAX some infos that I'd like to be formatted in JSON so I can parse them easily. A PHP page is generating this string : {"lastName":"Hope","firstName":"Bob","email":"bobhope@hotmail.com"} I'm trying to retrieve it from another PHP page via this : var aInfos = xmlhttp.responseText; alert(aInfos.firstName); alert(aInfos.lastName); alert(aInfos.email); But it doesn't seems to work. It says "undefined". When I replace "xmlhttp.responseText" with "{"lastName":"Hope","firstName":"Bob","email":"bobhope@hotmail.com"}", it works. What am I missing? Thanks for your time and have a nice day!
  11. Finally found it : $sr = ldap_search($ds, "ou=idul,ou=comptes,dc=ulaval,dc=ca", "cn=belir") or die('search error'); If it can help someone...
  12. Hey guys, I've been working with PHP/MySQL for a long time but never had a chance of trying to use it in conjonction with LDAP. So, here I am. I've tried to found the basics of it on the Net but now I seem so close to solving it, I thought maybe someone here could figure out it in secs. I'm trying to retrieve informations with LDAP. The problem is I have no clue how to tell which info I want. Here's the code I have atm : // Connecting $ds=ldap_connect("ldaps://uldc1.ulaval.ca"); // must be a valid LDAP server! // Checkingif the connection worked if ($ds) { // Binding $r = ldap_bind($ds, "belir@ulaval.ca", "password"); // Search entry $sr = ldap_search($ds, "dc=ulaval,dc=ca,ou=comptes,ou=idul", "cn=_MAC01"); // Show the number of entries echo "Number of entires returned is ".ldap_count_entries($r, $sr)."<br />"; // Getting entries $info = ldap_get_entries($ds, $sr); // Show data echo "Data for ".$info["count"]." items returned:<br />"; for ($i=0; $i<$info["count"]; $i++) { echo "dn is: " . $info[$i]["dn"] . "<br />"; echo "first cn entry is: " . $info[$i]["cn"][0] . "<br />"; echo "first email entry is: " . $info[$i]["mail"][0] . "<br /><hr />"; } // Close the connection ldap_close($ds); } else { echo "<h4>Unable to connect to LDAP server</h4>"; } I'd like to get the info "logonCount" as shown in the screenshot. Thanks for the tip! [attachment deleted by admin]
  13. ok...? And do you know such tool that has already been developped?
  14. Exploding should be the way. Explode the search string and construct with a 'for' or 'foreach' a serie of 'fieldName LIKE '%word1%' AND ...'. Well, you get the idea... Good luck!
  15. This is what you're looking for I think : http://elgg.org/ It's a Facebook-like open-source project. ... but good luck, I think you'll more than just "will" if you barely have any PHP skills...!
  16. Hey, I've tried to find if such thing exists on the Web... I'd like to find an app in PHP/MySQL that could fill a schedule with courses in rooms at different times. Think of it like an app that could be used at the beginning of a school semester to distribute all the courses across many available rooms at different times. I'm sure such thing exist?? If not, I think I just found myself an idea that could get me rich! (idea patented!)
  17. So... I've check some websites and I think another way would be to redirect all hits to a webpage and then redirecting to another page with only the url displayed in another language but calling the real file.php. What do you think about that?
  18. Hi! I'm fairly new to all this « mod_rewrite » thing but it seems to be the only way to help me with something. Here's what I have to do : Let's say I have this website « www.website.com ». I'd like any URLs to point to the same file for 3 URLs (languages) entered. Example : www.website.com/nouvelles.php should be displyed as www.website.com/nouvelles.php BUT use the file news.php to display the content of the website. In short : www.website.com/nouvelles.php www.website.com/destacados.php www.website.com/news.php ...should use the file « news.php » to display the content BUT the URL should stay as entered. Is « mod_rewrite » the answer to this? This would improve the SEO of the website because now I use things like « news.php?lang=es » while it should be (at best) « destacados.php » or « destacados.php?lang=es ». Thanks a lot for your precious time!
  19. I'd go just like you were going to the first time. I don't get it how it would be a hassle? Just recreate the XML file on the "save" and "voilà"!
  20. But sure to put the code at the bottom of the page so it loads all the content before strating the countdown (or maybe JavaScript client-side only starts when the page is fully loaded....?). Dynamically write the JS function depending on the referal page maybe? Should be ok to do that.
  21. Should be simple but long. Make SQL queries with an array that contains all those filthy keywords. Run the queries, store the informations (IDs) in an array and delete all the bad things after with a good ol' DELETE! That's how I'd do it.
  22. Hey, I used this kind of thing to generate a file from an SQL query before. Worked great. header('Content-type: application/x-msexcel; charset=utf-8'); header('Content-Disposition: attachment; filename="somefile.csv"'); Then here you echo() all your information. Hope it helps!
  23. Hi, I've search other topics and couldn't quite find the answer I needed. Anyway, here's the problem. I usually have an upload function that works on different hosts. Normally, it's just a cut/paste and voilà! But now I have some trouble. Weird behaviors are : - $_SERVER['DOCUMENT_ROOT'] not returning anything - is_writable() return true on the upload folder but I get a permission error on that said folder when I use move_uploaded_file() Here are the errors: Warning: move_uploaded_file(D:\vhosts\somerandom.ca\httpdocs\fr\medias\images\nouvelles\petites\test_francais_tn.gif) [function.move-uploaded-file]: failed to open stream: Permission denied in D:\vhosts\somerandom.ca\httpdocs\testupload_01.php on line 26 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\Temp\php16B.tmp' to 'D:\vhosts\somerandom.ca\httpdocs\fr\medias\images\nouvelles\petites\test_francais_tn.gif' in D:\vhosts\somrandom.ca\httpdocs\testupload_01.php on line 26 I used the PHP manual upload example just to be sure the code was ok. Anyone able to help me with this weird behavior? Thanks! I'll go see if I can help others in some other posts while I wait for a desperate answer! PS: The "somerandom.ca" is bogus
  24. If you use PHP (sorry, I'm only using that) you could store all ID which are not duplicated in an array ($aUniques). Then make an array of all the ID of the table ($aAllRows). There's a PHP array compare function that remove duplicate numbers from two arrays if I'm correct. So the last array would contain only the duplicate rows... or something like that. Yeah, it's a vague explanation of how I would do it but you should get the point... Hope it helps you!
×
×
  • 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.