[PHP] PostgeSQL LIMIT pg_numrows

2002-12-13 Thread ceo
In PostgreSQL, I'd like to be able to use a UNION and a LIMIT clause and have some kind of function to determine how many rows could have come back without the LIMIT clause. Is there some kind of function like pg_numrows() that IGNORES the LIMIT clause? I sure couldn't find it, but maybe I'm just

[PHP] Re: Mysql not functioning after upgrade to 4.2.3

2002-11-05 Thread ceo
[PLEASE do NOT reply-all to this message!] > Richard - > I hired Richard Lynch ([EMAIL PROTECTED]) to fix it for me and he did. It > appeared to be problems created by the new version of PHP and he had to > tweak some things to make it work. I'd talk to him. > Jeff > Richard <[EMAIL PROTECTED]> w

Re: [PHP] SQL - RANDOM

2008-11-24 Thread ceo
For large tables, I generally create a "static_rand" column, and pre-populated it with random numbers and create an index on it. Then, after "using up" the records, I have application logic to reset those records (and only those records) to new random numbers. This provides MUCH better per

Re: [PHP] getStatic

2008-11-25 Thread ceo
str_replace will take arrays for "before" and "after" sequences. So, build arrays, and do ONE str_replace and Bob's your uncle. Another option, a bit crude, but effective, would be to wrap your template-y bit in a function that calls 'extract' on an array of variable names. class Templat

[PHP] HTMLEntities as NUMERIC for XML

2008-11-25 Thread ceo
After reading this: http://validator.w3.org/feed/docs/error/UndefinedNamedEntity.html (all praise W3.org!) I am searching for a PHP library function that will convert all my &abc; into { I have a zillion of these things from converting stupid MS Word characters into something that will,

[PHP] Re: HTMLEntities as NUMERIC for XML

2008-11-25 Thread ceo
I already had a function to go from weird MS-Word characters to HTML Entities, which I was putting into the DB as such. In retrospect, that function should have been called at output... Actually, I knew it should have, but convincing my co-workers was the proverbial brick wall, so I cheated

Re: [PHP] HTMLEntities as NUMERIC for XML

2008-11-25 Thread ceo
> I came across a similar problem using an AJAX thing, with MSWord > characters in the text. The way round the problem was to enclose > everything inside CDATA blocks, which made the browsers happy to > receive as the entities only had to be understood by the HTML browser > now, not the XML pa

Re: [PHP] PHP friendly web software?

2008-11-25 Thread ceo
> Life's too short to not have code completion! :D I tried to help a guy out yesterday, and his silly code completion thingie ended up writing bogus HTML as I typed... I don't NEED code completion, thank you very much, I know what I'm doing, so get out of my way! :-p (I've tried them

Re: [PHP] Voting methodology

2008-11-26 Thread ceo
You have to have them registered and logged in with their Union ID to have any accountability at all... Anything else is just to wide open to ballot stuffing. You will need to provide reassurances of anonimity, presumably, and possibly some process/permissions/control/authentication/author

Re: [PHP] Voting methodology

2008-11-26 Thread ceo
You should probably also wrap a "vote" in a transaction, so a user is not locked out from voting unless you are 100% sure their vote got counted, nor vice versa. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Curl with asp pages....

2008-11-28 Thread ceo
The one thing that's always tripped me up with ASP sites is that you have to add EVERY input, even the type="submit" with the correct value from the one and only submit button on the page. Not sure what the ASP code monkeys are doing with their point-and-click UI, but I presume it's just a b

[PHP] Curl with asp pages....

2008-11-28 Thread ceo
> There is a slight difference in how ASP handles multiple form fields > that share the same name (as well as SELECT MULTIPLE lists) such that > ASP does not need (and should not use) square brackets in field names > the way PHP does. Alas, not only doesn't it need them, it CANNOT use them,

Re: [PHP] question about corrupt db?

2008-12-01 Thread ceo
Maybe try the normal Windows System Logs? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] category and sub category traversal

2008-12-02 Thread ceo
Google for "SELF JOIN" You also may want to just put the parent_id in the category table, rather than a second table. Your query would then look like this: select parent.tid, child.tid from term_data as parent, term_data as child where child.parent_id = parent.tid and child.vid = 16

Re: [PHP] How to hide MySQL password in connection string in PHP script?

2008-12-02 Thread ceo
On a shared server, you rarely can really protect your MySQL user/pass from other users on the same server. The problem is that your PHP process is probably an Apache module, and you probably don't have your own separate pool of Apache User processes. So, by definition, if YOUR script can

Re: [PHP] XML RSS installation

2008-12-02 Thread ceo
> htdocs <-- This the document root of your website pear + HTML + Mail > + Net If you're going to set your include path properly, you might as well not put PEAR in htdocs, since none of those files are front-facing URLs that should be visited by an end user. They belong in a non web roo

Re: [PHP] Short circuit evaluation and include

2008-12-02 Thread ceo
include and require are not functions. They are language constructs. They probably don't "return values" nor short-circuit in the usual way. Ditto for "echo" If you can strip the parens and have it still work, it's for sure not a function. is perfectly valid code. PS All th

Re: [PHP] XML RSS installation

2008-12-02 Thread ceo
>>> htdocs <-- This the document root of your website pear + HTML + >>> Mail >>> + Net > >That's not what I wrote: > >htdocs <-- This the document root of your website pear + HTML + Mail > + Net I apologize for the misunderstanding. -- PHP General Mailing List (http://www.php.n

Re: [PHP] Slow file download

2008-12-02 Thread ceo
If the files are LARGE, file_get_contents is a Bad Idea (tm). You're trying to suck the whole thing into RAM, which it can't, which swaps and thrashes the bleep out of your RAM/swap space... Use fopen and an fread loop instead, and you'll probably see much better performance. Also, cons

Re: [PHP] stream_socket_accept() on an SSL socket

2008-12-02 Thread ceo
First thing I would check is and make sure you have OpenSSL compiled in. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Accessing the 'media' attribute in php

2008-12-02 Thread ceo
I think you just want to have a CSS sheet for print media and be done with it. You could, in theory, add some kind of listener with JS, that would detect the 'media' attribute and then Ajax back to the server to do something, but that's an awful Rube Goldberg compared to just one more tag wit

Re: [PHP] Accessing the 'media' attribute in php

2008-12-03 Thread ceo
> but I gather from your reply that the browser issues the new (printer) > page without reference to the server. > Is this what actually happens? Yes, this is what actually happens for the browser "print" button. You could do something like a "Printer Friendly" button to generate a PDF on

RE: [PHP] How to type arguments

2008-12-03 Thread ceo
I'm surprised nobody mentioned: http://php.net/assert in this thread yet. Perhaps I missed it? You should really consider doing this: 1) At the outer API layer, do a typecast (possibly with preg_match first) to convert the input data to acceptable form. 2) For inner API layer[s], sp

Re: [PHP] imap4 search criterias

2008-12-03 Thread ceo
As I recall, there needs to be a \SENTSINCE instead of just SENTSINCE, and the PHP online manual ended up stripping out the \ business... Or maybe that was in some kind of "flags" somewhere else... Check the user contributed notes -- Those are invaluable for "what can go wrong" type of ins

Re: [PHP] SELECT into array of arrays

2008-12-03 Thread ceo
I actually would do more like: $myArray[$study][$symbol] = true; No need to call in_array. Probably won't matter, really, but it's a good practice for when you end up doing the same kind of code for an array with thousands of elements. -- PHP General Mailing List (http://www.php.net/

Re: [PHP] $_POST suddenly empty; $_GET and _$REQUEST fine

2008-12-03 Thread ceo
There are httpd.conf settings to reject POST requests, but I don't think it would behave like that... But maybe it's a bit more complicated than what I've ever seen for httpd.conf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Help with IF ELSE

2008-12-05 Thread ceo
Please do NOT use addslashes. Replace it with this: http://php.net/mysql_real_escape_string It is CRUCIAL if your database might maybe ever consider going international and having charset other than ISO-8856-1 or Latin1 [or the MySQL default of Monty's native language, which is very ver

Re: [PHP] Will not report errors what can I do

2008-12-05 Thread ceo
> $result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__)); > > // to show dB errors == > > function report($query, $line, $file) > { >echo($query . '' .$line . '' . $file . '' . > mysql_error()); >} > > This does t

Re: [PHP] PEAR Help

2008-12-05 Thread ceo
I found the PEAR tarballs to be corrupt a day or two ago... The PEAR bug report captcha continually rejected my correct answers to simple math questions. :-( I snagged a re-packaged version from: http://pizzaseo.com/ ymmv -- PHP General Mailing List (http://www.php.net/) To unsubscr

Re: [PHP] A MySQL Question

2008-12-08 Thread ceo
Presumable, the EXISTS sub-query can be optimized sometimes to just stop processing the sub-query and kick things back out to the outer query. IN has to process them all and find them all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Request to bash/jump/screw my code

2008-12-08 Thread ceo
> * Your output isn't cleaned up when coming from the database. You need > to put a few stripslashes() instances in there. Actually, if you think you have to use stripslashes, then, in fact, you've used addslashes and/or Magic Quotes TWICE, and your db has BAD DATA in it. Fix the data int

[PHP] Re: Poll of sorts: Javascript Form validation or PHP

2008-12-09 Thread ceo
> Being JSON immediately parsable by both Javascript and PHP it is > possible to exploit it to keep the regular expressions for the input > fields in a single place, and avoid mantaining them synched between the > Js and PHP scripts! Yes, but... The Regex engines are not the same, so you

Re: [PHP] A MySQL Question

2008-12-09 Thread ceo
Perhaps you couldn't hear the big bang in this universe, but what about in the universe that spawned it? :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] echo SESSION var doesn't work if unset after echo

2008-12-09 Thread ceo
Fire up Live HTTP Headers in Firefox. My theory is that the browser is RE-requesting the data because of the private, must-revalidate. So it goes like this: Browser -> GET -> Ecomm: fooie ; unset Ecomm Browser -> GET -> Ecomm: [not set] If you are using Ajax and JS and whatnot, the p

Re: [PHP] file_exists and wildcard/regex

2008-12-09 Thread ceo
I'm not sure how glob works in the guts, but I know it is dog-slow for large numbers of files (or maybe just large numbers of results). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread ceo
You can use a (base) object Comparable with a method compareTo as the callback function for http://php.net/usort That gives you 99% of what you want, for the tiny price of having to pass in the array('Comparable','compareTo') as the callback arg. Given that one frequently calls usort and f

Re: [PHP] foreach and destroying variables for memory saving

2008-12-10 Thread ceo
PHP does have garbage_collection, and it's crucial in long-running CLI scripts. Per is right, though, in that if your web-page Apache PHP script needs GC, you are doing something terribly wrong. It is not as aggressive/thorough as, say, the Lisp GC, but it's there. ymmv -- PHP Genera

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread ceo
> Inefficiency for me is when it takes longer to code. How long can this take? Even if you go full-blown with an Interface and static methods that have to be fleshed out in the implementations, you're still talking about an hour or so. Quit complaining and start typing. :-) > PHP is

Re: [PHP] Can GD make a JPG thumbnail of a PDF?

2008-12-11 Thread ceo
If system("convert -version") does nothing, it is probably erroring out. Mess around with exec and using 2>&1 to try to get the error message. It's going to boil down to paths and permissions. The PHP user probably doesn't have convert in $PATH. Use a FULL PATH for system/exec calls fo

Re: [PHP] Need a brain to bounce some Mysql/DB thoughts off of!!

2008-12-12 Thread ceo
I would set it up that a person could elect to work with one or more Departments. If they work on a College, they work on all Departments in that college. Another option is to just let them do one Dept at a time, and that's it. Kind of depends on what people actually DO in this work, most

Re: [PHP] new xampp server problem w/mail

2008-12-15 Thread ceo
Assuming your local box is not wide open to the 'net for mail relaying, install Pegasus/Mercury mail server and call it done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] dynamic forms

2008-12-16 Thread ceo
If you have their ID when you generate the HTML FORM, there is no need for anything as exotic as Ajax... //get their $ID //query the DB using $ID to get $whatever echo "", htmlentities($whatever), ""; If you don't know their ID until the interact with other form elements, then, yeah, go

Re: [PHP] FPDF Printing Ideas?

2008-12-16 Thread ceo
Just generate a much larger PDF with all the pages they asked for and call it done. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] runtime access to static variable

2008-12-16 Thread ceo
Try this, maybe: ($className)::$STEPS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] error flashing on redirect

2008-12-17 Thread ceo
Change php.ini (or .htacces or ini_set) so that display_errors is OFF and log_errors is ON and log them to some file you do this to, all day, every day: tail -f /var/log/httpd/error_log You'll definitely need this as you get more complex site interaction, particularly with Ajax calls that

[PHP] Re: runtime access to static variable

2008-12-18 Thread ceo
> Unfortunately, in the inherited DeployTask::execute(), "self::$STEPS" > does not refer to UpdateTask::$STEPS, it refers to DeployTask::$STEPS Use parent::$STEPS and call it done? Yes, I know, if you add another layer of class in between, then it's not parent:: anymore, but it seems a bit

Re: [PHP] fread question

2008-12-18 Thread ceo
PHP does *not* do the addslashes on $_POST when you cram something into it in your PHP code. It does it during the process of auto-filling up $_POST. So either: A) you have magic_quotes_runtime turned on LOCALLY. Use phpinfo() to see. B) you actually managed to put the backslashes into yo

Re: [PHP] Read/decode barcodes from an image

2008-12-18 Thread ceo
AIUI: The barcodes are on faxes and whatnot, with no predictable skew, position, nor orientation. You've tried JOCR/GOCR, and they don't do very well. Here are your options: 1) Shell out the money for that PaperPort OMNI or whatever it is commercial OCR product. It *is* better than JOC

RE: [PHP] Read/decode barcodes from an image

2008-12-18 Thread ceo
Certainly if the quality of the input can be improved by using some digital transfer that is not a fax, go for it... I assumed the OP already knew that, but perhaps not. The fax is going to cost you a LOT of accuracy, probably too much to make OCR even viable, really, but it depends on the

Re: [PHP] utf8 php howto?

2008-12-19 Thread ceo
For IE, you also want to add the META tags for HTTP-EQUIV for you charset. In some circumstances, with "mixed" charsets on a page, and with IE in quirks mode, IE will try to "guess" the charset and get it (very) wrong. You really do want a DOCTYPE and a document that validates if at all pos

Re: [PHP] utf8 php howto?

2008-12-19 Thread ceo
>> In some circumstances, with "mixed" charsets on a page, and with IE in >> quirks mode, IE will try to "guess" the charset and get it (very) >> wrong. > > A single page or response can only have one characterset, there is no > mixing possible. Allow me to re-explain. Step 1. Gener

Re: [PHP] Re: HTTP Error 500 - IsapiModule

2008-12-19 Thread ceo
> Sorry didn't try your suggestion php -1 ... not sure how to!! Open up MS-DOS prompt. Figure out where your php.exe lives. Let's pretend it's in C:\\php5\php.exe cd to the directory where your script lives. cd C:\\inetpub\wwwroot\search C:\\php5\php.exe -l search.php After yo

Re: [PHP] search for person by comparing his data with data in mysql

2008-12-19 Thread ceo
select first_name like '%$first_name%' + 3 * last_name like '%$last_name%' + 7 * email = '$email' as score, first_name, last_name, email, person_id from person . . . order by score desc limit 10 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.

RE: [PHP] Re: imap_rfc822_parse_adrlist problem

2008-12-28 Thread ceo
File a bug report at http://bugs.php.net You have a pretty clear-cut case of a built-in function gone awry, and it will probably be fixed pretty fast. I also rely on this function quite a bit, so it needs to work right when I end up at 5.2.8 some day :-) _

[PHP] Re: Segmentation fault in php5-imap

2008-12-29 Thread ceo
Perhaps compile everything in debug versions and get some core dumps and file a bug report at http://bugs.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Where I can find the PHP5 grammar/specification?

2008-12-29 Thread ceo
The PHP source uses bison/flex, I believe, so that's your best bet for finding the grammar. Chris Shifflet (sp?) mentioned the other day somewhere that he was considering soon releasing some code that he uses in security audits for the boring grunt work part. You may want to try to follow

Re: [PHP] PHP telnet server

2008-12-30 Thread ceo
I often thought PHP would be a nice language for a MUD, if one could get the performance out of it... 'Course you could always write some of the heaviest bits as extensions... Anyway, I don't think you need the connections to be "shared" in any special way. Just update your data store a

Re: [PHP] Is MD5 still considered safe for storing application user passwords?

2008-12-31 Thread ceo
For a bank? No, MD5 would not be acceptable. For you gramma's blog? Sure, MD5 for passwords is fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Encryption/decryption of PHP data

2008-12-31 Thread ceo
As I understand it: You can LINK your commercial binary with GPL binaries, and keep closed source. You cannot co-mingle the two C source codes together and keep it closed. I am fairly certain you can find commercial C++ offerings to generate PGP key pairs, instead of using the GnuPG OSS

Re: [PHP] PHP telnet server

2008-12-31 Thread ceo
>> I often thought PHP would be a nice language for a MUD, if one could >> get the performance out of it... > > Design your code such that you can just throw more hardware at it > whenever you need more performance. That's easily said, but a MUD means all the users have to share a signific

Re: [PHP] =.='' what wrong ? just simple code, however error.

2008-12-31 Thread ceo
If it's money, store everything in pennies INTEGER, and format as dollars on output. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] IE Problem Detecting Post Variables

2008-12-31 Thread ceo
Whatever is SENDING the request data is broken, almost for sure. PHP doesn't *do* much to the HTTP Request data except urldecode it for you. There's not much that can go wrong there. If your theme switcher, presumably in JS, isn't sending the data properly, there's not much PHP can do ab

[PHP] When is an Exception not an Exception?

2008-12-31 Thread ceo
We have code like this: try { $details = $this->__client->getData($email); //Line 274 } catch (SoapFault $sf) { //do stuff } catch (Exception $e) { //do more general stuff } SoapFault: No data found in C:\classes\Client.php on line 274 Hello? What is the point of all t

Re: [PHP] When is an Exception not an Exception?

2008-12-31 Thread ceo
I'm afraid I wasn't clear enough. I thought the "catch" block was not actually 'catching' anything, since I'm seeing an error message with the line of code that is causing the Fault. Turns out, XDebug is kindly splatting out the exception even though it's being caught. Which I'm sure it

Re: [PHP] IE Problem Detecting Post Variables

2009-01-02 Thread ceo
My thesis is: Your Javascript that intercepts the .submit and then does whatever it does, is "broken" in FF but not in MSIE. Post your JS to a JS mailing list and ask there to be sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] MySQL client version problem

2009-01-05 Thread ceo
PHP had a built-in MySQL for awhile as I recall. You had to explicitly use --with-mysql=/usr/local (or wherever you put your mysql headers/libs) to make it choose the one you wanted. Even if it's not using built-in, it may have found an "old" install of your MySQL rather than your shiny ne

Re: [PHP] Re: Re: How to count transfered kBytes in File-Download

2009-01-05 Thread ceo
> I'm still a little confused on this though. How would a browser send > this to notify of a download that was only partially completed before? As I understand it, it was more of a "partially cached" document issue. If the browser has the first N bytes of a document in its cache, it will se

Re: [PHP] How to count transfered kBytes in File-Download

2009-01-05 Thread ceo
> echo fread($HANDLER, $FSIZE); This is your problem child right here... Sucking in an entire OGG File to RAM, for a large OGG file, will be quite painful. And, on a busy server, even moderate size files will be problematic. You could probably relieve a lot of stress and keep full

Re: [PHP] MySQL client version problem

2009-01-05 Thread ceo
Historically, mysql has been both an external extension, and a built-in part of the source, depending on the version of PHP. Your current experience would indicate that it's only external in 5.2.8, but I cannot confirm nor deny that. How is MySQL installed? If it's rpm, do you have mysq

Re: [PHP] How to count transfered kBytes in File-Download

2009-01-05 Thread ceo
> When mentioning the RAM usage problem, one might consider calling > flush() after each echo, just to make sure that they don't run over > PHPs memory limit. Oh yeah. Make sure you've run through and cleared all ob_buffers for any kind of non-HTML output, specifically for file downloads.

Re: [PHP] get file from object

2009-01-06 Thread ceo
As far as I know, that's not readily available... However, you could do an ob_start() and/or a try/catch and try to re-define the class, and then ignore the error and continue. I believe the PHP error message you get will have the file and line where the original class was defined, so you

Re: [PHP] Request A Collection of YouTube Videos From Multiple User Accounts using YouTube API

2009-01-07 Thread ceo
It is the wrong list to ask. The answer is that the YouTube API does not support that. You'll have to merge and sort in PHP. I recommend you cache the results for all external web services, as a general principle. For a large number of videos, you'll want to merge/sort in DB, not in P

Re: [PHP] Remote File Variable Injection Safety?

2009-01-07 Thread ceo
If register_globals is "on" (ewww!) at otherhost.com, then "?safe_flag" on the URL will get in. This is one of the reasons why register_globals should be OFF. NOTE: The code you gave does not describe the circumstances whereby $safe_flag is "set". There could be all manner of other issue

Re: [PHP] php-gtk2, anyone?

2009-01-07 Thread ceo
Irrespective of the GTK2 bit, PHP can connect just fine with other servers using sockets and stream wrappers and good ol' file_get_contents on a URL. Whether you can tweak those in useful ways at fast enough speeds to do what you want is more up to your skill than PHP's feature-set. -- PH

Re: [PHP] trigger_error() when using php cli

2009-01-07 Thread ceo
As I recall, PHP CLI overrides the error_log setting and uses STDERR by design. You'll have to re-direct it elsewhere in the shell. Or a custom error_handler that uses a specific file name in error_log call. Using error_log alone will not help. -- PHP General Mailing List (http://www.

Re: [PHP] XML package on PHP

2009-01-07 Thread ceo
XML in PHP4? Don't. :-) It was very painful and with all kinds of quirks, from my limited experience. PHP5 was a breeze. Consider hosting a quick/easy service on a PHP5 box to convert XML to PHP serialized data or something as well. Could be less painful. Or just upgrade, since PHP4

Re: [PHP] Re: hello

2009-01-08 Thread ceo
> Fact is if you want to be secure just disconnect you're machine from > the internet, remove cd/dvd/floppy drives and unplug the keyboard. You forgot to cut the internal USB cables. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.ph

Re: [PHP] how does one bind a gui representation and a container object.

2009-01-08 Thread ceo
You'll have to use Ajax to make another HTTP request. HTTP is not really designed for this, and it will make the site quite sluggish most likely... You should certainly make it an async call and not slow users down with this "feature". -- PHP General Mailing List (http://www.php.net/)

Re: [PHP] Adressing XML Objects

2009-01-09 Thread ceo
Try it with just one "/" at the start of the xpath. "/anbieter/immobilie/..." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Editing in a text area field

2009-01-09 Thread ceo
Rule #1. Never, ever, ever, alter the user's input, EXCEPT for sanitizing/filtering. Specifically, do NOT add tags in place of newlines. Store the newlines. Upon OUTPUT, you can use nl2br() to get tags. Or str_replace if you want instead. This is crucial as a habit, down the road, whe

Re: [PHP] imagejpeg, imagecreatefromjpeg both choke

2009-01-09 Thread ceo
Do other images work? Open and re-save the image. Strip out comments and EXIF data while you are at it -- Some versions of GD had problems with EXIF/comments as I recall. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Create image from HTML

2009-01-09 Thread ceo
I know there was an OSS package that took any URL and made a screenshot of it... Thumbnailer or somesuch?... Commercial folks do it. http://browsercam.com/ Compare cost to dev costs for roll your own... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://w

Re: [PHP] Couple of beginner questions

2009-01-09 Thread ceo
The slowdown of just running raw HTML through PHP was once benchmarked as about 5 to 10 %. You could, in theory, use .htaccess and to ForceType specific .html files as PHP, while leaving the rest of your .html files as static. I am not recommending this, just being pedantic. :-) Defini

Re: [PHP] imagejpeg, imagecreatefromjpeg both choke

2009-01-09 Thread ceo
The browser cheerfully rendering a badly-broken JPEG is quite common, if it can figure out what the JPEG was supposed to have been. (Think bad HTML and quirks mode.) So you really want to validate it with something more strict than a browser. -- PHP General Mailing List (http://www.php.ne

Re: [PHP] Editing in a text area field

2009-01-09 Thread ceo
>> Rule #1. >> Never, ever, ever, alter the user's input, EXCEPT for >> sanitizing/filtering. > >Probably shouldn't recommend sanitizing then. Only validate & reject. :P mea culpa I meant ESCAPING, of course. If it doesn't pass sanitizing/filtering, it's probably better to just "reje

Re: [PHP] Couple of beginner questions

2009-01-09 Thread ceo
With all due respect, Eric, you're not testing what we're discussing. A "real" CLI test would be more like: time cat foo.html time php -q foo.html I.E., how long does PHP take to read/write foo.html without breaking into PHP "mode" for static HTML. Of course, it's still a lousy bench

Re: [PHP] Couple of beginner questions

2009-01-09 Thread ceo
I'm talking about having PHP rip through .html files without any inside of them. You added Don't do that. :-) ln -s foo.html foo.php Surf to both and time it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Convert CMYK values to RGB values?

2009-01-09 Thread ceo
Short Answer: You can't. :-) http://en.wikipedia.org/wiki/CMYK Long Answer: You probably can, but not in some way that makes sense to discuss here on PHP-general. The external links in the above article should get you started. -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Couple of beginner questions

2009-01-12 Thread ceo
> $ mv hello-world.php hello-world.html Isn't this backwards?... :-) 39% seems awfully high overhead for what is essentially an extra readfile. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] is_readable() returns 1 if file is still uploading

2009-01-12 Thread ceo
You should be able to fairly quickly fopen/fread/fseek/fread and compare the opening/ending XML tags. If it's well-formed XML, it should be trivial to detect an incomplete file versus a complete one. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.n

Re: [PHP] Editing in a text area field

2009-01-12 Thread ceo
Google for BBCode. It's just str_replace(array('[b]','[/b]'),array('',''),$text) in the end. And it's not really going to be any better than just letting them type and if that is needed. Your sanitization process will be the same no matter what, and will have the same flaws/risks eith

Re: [PHP] RSS feeder in PHP5?

2009-01-12 Thread ceo
> You actually mean application/xml not text/xml That depends on if you want the Userland RSS standard or the Other [blanking on name] RSS standard. Unfortunately, the RSS camps are still at war over syntax and required elements, and there are 9 mutually-incompatible often-used versions of

Re: [PHP] Couple of beginner questions

2009-01-12 Thread ceo
> are you really ever in a situation where some HTML weenie is coding > HTML pages and you're somewhere else doing the PHP work? Yes. I have been there several times, and am there now. In a well-run organization with good communication and a decent framework, it works out well. Other

Re: [PHP] downloading xls files corrupts them

2009-01-12 Thread ceo
For starters, three calls to header("Content-type: "); is just plain silly :-) Read this for sure: http://php.net/header You may find this interesting, or not, to pick the right Content-type http://richardlynch.blogspot.com/2006/06/php-downloads-content-disposition.html -- PHP Genera

Re: [PHP] PHP unlink Permission Error

2009-01-13 Thread ceo
Not only do you need to check the return value of chmod to see if it worked, but also, I *think*: The file withing the directory can have entirely different permissions, and making the directory world writable won't help that, I don't think... I could be wrong, and a 000 file in a 777 dir

Re: [PHP] ecommerce related question

2009-01-13 Thread ceo
For now, as already said, go with PayPal or similar. Do not store the CC#s in your DB or anywhere at all, for any length of time. Not in the SESSION either. Get it and send it to PayPal and wipe it out with http://php.net/unset all in one single HTTP request. For long-term, to learn more,

Re: [PHP] PHP unlink Permission Error

2009-01-13 Thread ceo
touch foo.txt chmod 000 foo.txt rm foo.txt rm: remove write-protected regular empty file `foo.txt'? So the behaviour is at least partially shell/profile dependent... I have no idea how this would affect PHP unlink, if at all. ymmv naiaa ianasg [*] [*] sg: shell guru -- PHP Ge

Re: [PHP] Suggestions?

2009-01-13 Thread ceo
Hard to say without knowing the data structures... You can't do a simple count of the holidays and add that, because you might end up with yet another holiday in the result. Start at 12/23 and want to add 6 business days. You find 1 holiday in between, so you add 7 business days and end

Re: [PHP] switch vs elseif

2009-01-13 Thread ceo
I think if they didn't want us to use expressions in the case, then they wouldn't have put support into the language for that. I daresay you are reading more into the text than was intended... I certainly have found switch(true) with complex expressions for case quite handy and very clear

Re: [PHP] Quotes in querys

2009-01-14 Thread ceo
You can only interpolate ONE level of array or object indirection in a string. WORKS: "... $foo[x] ..." "... $foo->x ..." FAILS: "... $foo[x][y] ..." "... $foo->x->y ..." //almost for sure it fails, never tried... You can use curly braces in side a string to evaluate something: WOR

  1   2   >