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
[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
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
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
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,
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
> 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
> 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
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
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
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
> 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,
Maybe try the normal Windows System Logs?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
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
> 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
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
>>> 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
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
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
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
> 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
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
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
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/
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
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
> $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
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
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
> * 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
> 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
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
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
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
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
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
> 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
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
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
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
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
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
Try this, maybe:
($className)::$STEPS
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
> 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
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
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
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
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
>> 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
> 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
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.
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 :-)
_
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
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
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
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
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
>> 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
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
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
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
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
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
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
> 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
> 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
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
> 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.
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
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
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
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
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.
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
> 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
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/)
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
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
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
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
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
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
>> 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
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
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
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
> $ 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
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
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
> 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
> 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
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
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
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,
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
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
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
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 - 100 of 165 matches
Mail list logo