[PHP] uksort wisdom
Hi Guys! I'm looking to get a *deeper understanding* of uksort. My quandry: $array[listing1][name] = listing 1; $array[listing1][premiere] = ; $array[listing2][name] = listing 2; $array[listing2][premiere] = ; $array[listing3][name] = listing 3; $array[listing3][premiere] = yes; I'd like the result to come out as: $array[listing3] //(this is the one with the premiere set to yes) $array[listing1] // (no premiere, but in order) $array[listing2] // (again, no premiere, but again in order) So far, I've got: function cmp= ($a,$b) { global $array; if ($array [$a][premiere] == yes) { return -1; } else { return ($a $b) ? -1 : 1; } } uksort($array_array,cmp); But that ends up, strangely with: $array[listing3] $array[listing2] $array[listing1] Any wisdom? Just would like a better idea of the inner workings of uksort. Best, Sondra -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
re: [PHP] Paypal Instant Payment Notification
hi guys! i've been working on this darn instant payment notification script for weeks now. I've gotten pretty close based on some recent posts that use the great Rasmus' postToHost function to talk to paypal and get the confirmation. However, the reply from paypal, instead of being one word (VALID or INVALID), is a whole web page. I'm thinkin' the problem is that I'm not posting to https://www.paypal.com/blah, but to http://www.paypal.com/. How do I use the posttohost function (or some other function) to post securely? Best, Sondra -- 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] Image Resampling
Dear Friends, I'm working on a tool where my dear user can upload a large jpg for use with a store. The tool would upload the jpeg, resample (as opposed to resize - image quality is appalling on that!) it to thumbnail, and then be done with the whole thing and go smoke a cigarette. Sounds simple, right? Well, here's my challenge: my hosting company isn't quite up to GD v.2x (they're staying behind in gif-land with GD v.1.6). So, I successfully installed ImageMagick to call from system() or exec(). BUT, my hosting company runs php in safe mode, forbidding any system or exec calls. Now, I KNOW I'm not the first person on the planet to have this challenge. Anyone? Bueller? Share with me. Best, Sondra -- 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] Ezmlm Hosts besides csoft.net?
Hello everyone! I'm wondering if you guys could suggest a hosting company that provides: php4 mySql qmail ezmlm (or ezmlm-idx). I have been with csoft.net, which was wonderful and which provided all of these things, but last night they decided to pull down my web site for six hours without notification based on an erroneous accusation of sending spam. They've reinstated the account, of course, but I'm still very unhappy with those guys and need to change! I would tell anyone else to proceed with caution when hosting with them, btw. Any suggestions would be welcome! Best, Sondra Russell -- 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] High-Volume Newsletter Techniques?
Yes, I saw the discussion a few days earlier on this topic, but I'm wondering if there is still some unmined wisdom out there about building a script that sends a newsletter out to 25,000+ people The very impressive class I found (phpmailer-1.41) looked great, but it didn't *directly* address the high-volume issue in the readme so I'm still a little nervous. And, unfortunately, it's not one of those types of technical challenges you can keep testing over and over without seriously annoying the first 100 or so people on your list who *do* get the email before the script times out. I think the amount of trash email I get each day proves that vast mailings aren't TOO difficult, but I think I could use a little wisdom before I give it a shot. Anyone? I'll buy you a coke! Thank you in advance, Sondra Russell -- 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] Thank You Friends
Dear Venerable PHP List, I hope this isn't viewed as impolite on this list. I just wanted to write all of you to thank you for the immeasurable contributions you have made to the project I've been working on for the last three months: http://www.readfrank.com/ It is a site supporting an English language literary magazine published here in Paris, and has new stories and articles every day. While it is hard to see through the pretty pictures and words to the infinitely recursing arrays (which this list helped me debug) and the amazing grep challenge 2000 (which this list polished for me), we all know how crucial those invisible little combinations of syntax can be to bringing beautiful things to the surface. Please feel free to visit the site *if you want*. I just wanted to let you ALL know that even though we've never met, you've made me a smarter person and have helped bring the work of perhaps otherwise obscured talented writers and artists to the masses. Thank You Friends, Sondra -- 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] paypal instant notification
Hi guys! I'm going to use paypal with my site, and they have a cool instant notification feature which sends, to a page I preassign, information about a transaction as it happens. My script is supposed to: a) receive this information (as a post) b) send it back to them with a sort of is this really coming from you? message c) get a confirmation from them, yes, this came from us d) take the post and insert it into my database or whatever else I'd like to do with it. They have provided a perl sample script (see below). Mostly I'm just trying to figure out how to replicate the whole receiving, sending, and receiving again thing in PHP. This is especially tricky since I apparently can't test my work without actually going through a transaction on paypal (and spending money). I sorta have to get it right the first time. Anyone done this before? Thanks again! Sondra sample perl script: # read the post from PayPal system and add 'cmd' read (STDIN, $query, $ENV{'CONTENT_LENGTH'}); $query .= 'cmd=_notify-validate'; # post back to PayPal system to validate use LWP::UserAgent; $ua = new LWP::UserAgent; $req = new HTTP::Request 'POST','https://www.paypal.com/cgi-bin/webscr'; $req-content_type('application/x-www-form-urlencoded'); $req-content($query); $res = $ua-request($req); # split posted variables into pairs @pairs = split(//, $query); $count = 0; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $variable{$name} = $value; $count++; } # assign posted variables to local variables $receiver_email = $variable{'receiver_email'}; $item_name = $variable{'item_name'}; $item_number = $variable{'item_number'}; $custom = $variable{'custom'}; $payment_status = $variable{'payment_status'}; $payment_date = $variable{'payment_date'}; $payment_gross = $variable{'payment_gross'}; $payment_fee = $variable{'payment_fee'}; $txn_id = $variable{'txn_id'}; $first_name = $variable{'first_name'}; $last_name = $variable{'last_name'}; $address_street = $variable{'address_street'}; $address_city = $variable{'address_city'}; $address_state = $variable{'address_state'}; $address_zip = $variable{'address_zip'}; $address_country = $variable{'address_country'}; $payer_email = $variable{'payer_email'}; if ($res-content eq 'VERIFIED') { # check transaction for uniqueness # process payment } elsif ($res-content eq 'INVALID') { # possible fraud } else { # error } -- 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] Whacky WGET issue...
Hello everyone! Crazy question: I've created a little script that reads in .txt files and, with the help of phplib templates, matches them up with a collection of templates and spits out the beautiful html page. In order to avoid sending variables through the URL I've stolen this bizarre workaround where, when you call http://www.mysite.com/somepage.html for example, the apache configuration realizes it's a 404 and redirects all 404s through my cms script. Then my script looks for http://www.mysite.com/somepage.txt and does the rest. This works beautifully, and my plan was to have a dev environment that runs against the little CMS system and then wget the whole site periodically for the live server (so, the live site actually *is* a collection of flat pages). Beautiful plan, but it turns out that WGET doesn't see the apache configuration change that runs all 404s through my CMS script. It sees a 404 and tells me its a 404 and then goes back to its coffee break, you know? Anyone else tried this workaround before with similar results? Anyone else have a better workaround? Bueller? Anyway, best, Sondra -- 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] Grep Challenge 2001
Hello everyone! Here's my grep challenge. Turn: !--begin variable: variable_blah-- blah blah blah blah blah blah blah blah !--begin variable: variable_blah2-- blah 2 blah 2 blah 2 blah 2 blah 2 blah 2 blah 2 blah 2 into: (variable_blah) (blah blah blah blah blah blah blah blah) (variable_blah2) (blah 2 blah 2 blah 2 blah 2 blah 2 blah 2 blah 2 ) Where the blahs (that are not part of the variable name) contain practically anything but the next comment !--begin variable:. Also the blahs maintain their \n and such (I just flattened those values out for demo purposes here). I've tried:/!--begin variable:?([\w\s]*)--([\w\s]*)/m, but that misses out on any punctuation and /!--begin variable:?([\w\s]*)--(.*)/m gives me some other weirdness-- it doesn't find anything at all for the second substring. Any suggestions! Thanks cowboys! Sondra -- 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] Function to Build Trees
Hello everyone, I've been tearing my hair out trying to write a function in PHP that will accomplish the following: Given a multidimensional array with words as keys, I want to match the values of each array with the keys of the array and build a new array that reflects these relationships as a sort of tree. So, in the list below, fruit, apples, oranges, red are the keys and in the fruit array are the values apples and oranges, so I want the function to create a new array that looks like: ORIGINAL ARRAY: $array['fruits'] = array(apples,oranges,pears); $array['apples'] = array(red,granny smith); $array['oranges'] = array('mandarin'); $array['red'] = array(big red,small red); NEW ARRAY: $array['fruits'] = array(apples,oranges,pears); $array['fruits']['apples'] = array(red,granny smith); $array['fruits']['oranges'] = array('mandarin'); And then I want it further to figure out that red, now in the array found at: $array['fruits']['apples'] matches a key in the original array so the final result looks like: FINAL ARRAY: $array['fruits'] = array(apples,oranges,pears); $array['fruits']['oranges'] = array('mandarin'); $array['fruits']['apples'] = array(red,granny smith); $array['fruits']['apples']['red'] = array(big red,small red); So, you see how it builds a little tree, right? AND, I'd like this function to be able to handle any number (probably less that 30, but whatever) of initial array elements in an unpredictable order and the final tree could have up to five or six levels. You know? Is this impossible, or am I just going about the end result wrong?? It seemed like such a simple thing three days ago, but now I am about to cry uncle. Anyway, please write if you have any thoughts. Best, Sondra Russell -- 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]