RE: [PHP] List

2007-04-25 Thread George Pitcher
 Does anyone else have this problem with the list. It seems that
 every time I
 check my email there is one or more messages from the list that royally
 screws up Outlook. I usually have to delete all list messages from the
 actual server and reboot. It only happens with emails from
 [EMAIL PROTECTED]

 Just trying to narrow down the problem. Not sure if this is spam that's
 sneaking into the list messing things up or what.

I've had no problem using Outlook 2000 on XP, and also not using digest
mode.

George

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to detect type of image

2007-04-25 Thread Satyam
Sorry I'm late to this thread, I don't know if it has been mentioned, but 
most files have a 'magic number' at the begining of the file, which usually 
reads as a couple of letters or more.  I think EXE files start with MZ, gifs 
with GIFxx where xx is the last two digits of the year of the standard. 
Just open files of the types you are concerned about and check the first few 
characters.


Satyam

- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Wednesday, April 25, 2007 4:30 AM
Subject: Re: [PHP] Re: how to detect type of image



On Sun, April 22, 2007 10:35 am, Jonathan wrote:

Alain Roger wrote:

Hi,

In my web application, end user is able to load images (png, jpeg,
gif,..)
into database.
I would like to know how can i detect automatically the type of
image (pnd,
jpeg,...) ?
i do not want to check the extension because this is easily faked...
just by
renaming it.

Does it exist a technique for that ?

thanks a lot,



Is there anything wrong with just using
$_FILES['upload_name']['type']?


Yes.

The first thing wrong, is that the idiot browser-makers can't even
agree on what to cram into that when a user uploads a simple JPEG,
much less some more esoteric document.  So, right there, what you have
in there under normal circumstances is pretty much garbage.

The second thing wrong is that the Bad Guys can cram any dang thing
they want in there, regardless of what they are uploading.  So they
can upload a nice .exe binary file and cram image/jpeg into the
type.  If your script is equally insecure throughout, then you could
easily end up having an executable file up on your server that the Bad
Guy wrote, and all they have to do is surf to it for it to run.  That
would be bad, just in case it's not terribly obvious. :-)

Other than that, though, it's fine and dandy to use it... :-)

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.6.0/775 - Release Date: 24/04/2007 
17:43





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: posting variables to parent frame

2007-04-25 Thread Stut

Richard Lynch wrote:

Maybe he's thinking FRAMESET???


My comment would still stand. Frames are not obsolete, and there are 
(very few) legitimate uses for them.


-Stut


On Tue, April 24, 2007 9:39 am, Stut wrote:

Al wrote:

iFrames are obsolete and only IE handles them.  I don't even know if
IE7
does.

Well that's just a complete load of rubbish. The iframe tag is not
obsolete, and I don't know where you got the idea that they are.
Several
legitimate uses for iframes exist, and they're unlikely to go away any
time soon.


Use css div tags instead.

They don't do the same thing, not by a long shot.

-Stut


Hans wrote:

Hi there,

I'm trying to post variables to a parent frame, I'm working from a
page that
is in an iFrame. However, I don't know how to accomplish this. I
tried
target='top' to include in the form tag (form action=?=$formurl?
target=top) but this didn't succeed.

Can you please help me?

Thanks in advance!
Hans

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Separating words based on capital letter

2007-04-25 Thread Robin Vickery

On 25/04/07, Dotan Cohen [EMAIL PROTECTED] wrote:

On 25/04/07, Richard Lynch [EMAIL PROTECTED] wrote:
 On Tue, April 24, 2007 4:16 pm, Dotan Cohen wrote:
  I have some categories named in the database as such:
  OpenSource
  HomeNetwork
 
  I'd like to add a space before each capital letter, ideally not
  including the first but I can always trim later if need be. As I'm
  array_walking the database, I have each value at the moment I need it
  in a string $item. Other than pregging for A-Z how can I accomplish
  this? I haven't been able to get it down to less than 54 lines of
  code, which in my opinion means that I'm doing something wrong.

 Why rule out PCRE, which is probably the best weapon for the job?

 $string = ltrim(preg_replace('([A-Z])', ' \\1', $string));

 You can wrap that in a function or even use create_function for
 something that simple, in your array_walk.


$string = preg_replace('/(?=\w)([[:upper:]])/', ' $1', $string);

turns this is OpenSourceCode to this is Open Source Code

-robin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] script timeout

2007-04-25 Thread Henning Eiben
Hi,

I have a small sample-application, that uses smarty for the presentation
layer. Unfortunately I might encounter script-timeouts (not necessarily
from smarty, could also be the DB-connection or something). In this case
I would like to return an appropriate HTTP status-code (might be 500 or
something). Right now I just receive a blank page, as well as a HTTP
status-code of 200, which would indicate that everything is OK!

So what do I need to do?


-- 
 Gentlemen:  Start your debuggers...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] slow performance

2007-04-25 Thread Henning Eiben
Hi,

I wrote a small sample-application once using PHP (with propel and
smarty) and once using Java (JBoss, EJB3, JSP  Servlets). Both apps are
being served from a windows server (2x Xeon 1,3GHz, 2 GB RAM), but the
performance of the PHP version is much slower than the Java version.

I already installed an php-accelerator (eAccelator) which increased the
overall performance, but still the performance is quite poor.

Are there any tweaks to tune PHP performance?


-- 
... Does killing time harm eternity?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread Zoltán Németh
2007. 04. 25, szerda keltezéssel 11.33-kor Henning Eiben ezt írta:
 Hi,
 
 I wrote a small sample-application once using PHP (with propel and
 smarty) and once using Java (JBoss, EJB3, JSP  Servlets). Both apps are
 being served from a windows server (2x Xeon 1,3GHz, 2 GB RAM), but the
 performance of the PHP version is much slower than the Java version.

I think this is because Java is compiled once, PHP is compiled at every
request...

 
 I already installed an php-accelerator (eAccelator) which increased the
 overall performance, but still the performance is quite poor.

I would not say php performace is poor, I think it is quite fast (at
least on my linux boxes, I know nothing about php on windows...)

 
 Are there any tweaks to tune PHP performance?

I do not know about tweaks but there might be ;)

greets
Zoltán Németh

 
 
 -- 
 ... Does killing time harm eternity?
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread Henning Eiben
Zoltán Németh schrieb:

 I wrote a small sample-application once using PHP (with propel and
 smarty) and once using Java (JBoss, EJB3, JSP  Servlets). Both apps are
 being served from a windows server (2x Xeon 1,3GHz, 2 GB RAM), but the
 performance of the PHP version is much slower than the Java version.
 
 I think this is because Java is compiled once, PHP is compiled at every
 request...

Well, but using something like eAccelerator should compensate this,
shouldn't it? As far as I understand, scripts are being compiled and
then store in memory to access them faster.

 I already installed an php-accelerator (eAccelator) which increased the
 overall performance, but still the performance is quite poor.
 
 I would not say php performace is poor, I think it is quite fast (at
 least on my linux boxes, I know nothing about php on windows...)

Well ... I did some stress-testing. I create 20 concurrent requests to
my application: random pages, randomizing the post parameter, which
causes to load different data from the database (MySQL 5.0.37, running
on a separate server). My webserver is the same for java and php.

Running my test for about 5 minutes, I get about 31.000 request for the
java application, but only about 3.000 for the php.



-- 
... Does killing time harm eternity?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Separating words based on capital letter

2007-04-25 Thread Dotan Cohen

On 25/04/07, Robin Vickery [EMAIL PROTECTED] wrote:

$string = preg_replace('/(?=\w)([[:upper:]])/', ' $1', $string);

turns this is OpenSourceCode to this is Open Source Code



Another great solution, Robin, thanks. I've learned a LOT from this thread.

Dotan Cohen

http://what-is-what.com/what_is/open_office.html
http://hardtofindlyrics.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Preventing SQL Injection/ Cross Site Scripting

2007-04-25 Thread Dotan Cohen

On 25/04/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Mon, April 23, 2007 9:48 am, WeberSites LTD wrote:
 I'm trying to understand from the examples why anyone
 that has get_magic_quotes_gpc() returning true would
 need to use stripslashes() and then mysql_real_escape_string().

 wouldn't that just add slashes to the same places?

If you were 100% sure that everybody on the planet spoke only English,
and only used the ASCII codeset, sure, it's the same thing...

Oh, wait.

Earth has more than one language, doesn't it?

:-)

mysql_real_escape_string() takes into account the charset[s] being used.

addslashes assumes ASCII charset.
Don't do that.

YOU may not be expecting the Spanish Inquisition, but somebody will be
trying to send it to you.


Actually, over half the site visitors are _not_ going to be speaking
English. Everything on the site is in UTF-8 as Israelis speak Hebrew,
Arabic, Russian, Romanian, and another small language called English.

Dotan Cohen

http://what-is-what.com/what_is/zero_day_exploit.html
http://dotancohen.com/eng/thunderstang.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread Zoltán Németh
2007. 04. 25, szerda keltezéssel 11.53-kor Henning Eiben ezt írta:
 Zoltán Németh schrieb:
 
  I wrote a small sample-application once using PHP (with propel and
  smarty) and once using Java (JBoss, EJB3, JSP  Servlets). Both apps are
  being served from a windows server (2x Xeon 1,3GHz, 2 GB RAM), but the
  performance of the PHP version is much slower than the Java version.
  
  I think this is because Java is compiled once, PHP is compiled at every
  request...
 
 Well, but using something like eAccelerator should compensate this,
 shouldn't it? As far as I understand, scripts are being compiled and
 then store in memory to access them faster.

not exactly. it pre-compiles them to opcodes and stores the opcode
blocks. the interpreter normally first pre-compiles the code to opcodes
then runs the opcode. this pre-compilation can be cached with
accelerators, that's how they increase performance.

 
  I already installed an php-accelerator (eAccelator) which increased the
  overall performance, but still the performance is quite poor.
  
  I would not say php performace is poor, I think it is quite fast (at
  least on my linux boxes, I know nothing about php on windows...)
 
 Well ... I did some stress-testing. I create 20 concurrent requests to
 my application: random pages, randomizing the post parameter, which
 causes to load different data from the database (MySQL 5.0.37, running
 on a separate server). My webserver is the same for java and php.
 
 Running my test for about 5 minutes, I get about 31.000 request for the
 java application, but only about 3.000 for the php.

well, that's strange. I think there should not be that much difference.
maybe your php code is written poorly?
or maybe your apache serves php in a way which limits the number of
threads or some other resource?
or else I don't know. (but I'm not a performance guru, wait for answers
from some other list members who know much more about this topic than
me ;) )

greets
Zoltán Németh

 
 
 
 -- 
 ... Does killing time harm eternity?
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread Henning Eiben
Zoltán Németh wrote:

 I already installed an php-accelerator (eAccelator) which increased the
 overall performance, but still the performance is quite poor.
 I would not say php performace is poor, I think it is quite fast (at
 least on my linux boxes, I know nothing about php on windows...)
 Well ... I did some stress-testing. I create 20 concurrent requests to
 my application: random pages, randomizing the post parameter, which
 causes to load different data from the database (MySQL 5.0.37, running
 on a separate server). My webserver is the same for java and php.

 Running my test for about 5 minutes, I get about 31.000 request for the
 java application, but only about 3.000 for the php.
 
 well, that's strange. I think there should not be that much difference.
 maybe your php code is written poorly?

could be ... but my java code might be poorly as well :). Using propel
an smarty might not be the way to go, to get the fastest performance,
but from the architectural point of view this is somehow similar to
using EJB3 and JSP.

 or maybe your apache serves php in a way which limits the number of
 threads or some other resource?

well, I'm using IIS not apache :), but I also tried Apache 2.2.4
(Windows), and the performance increase was just about 10%



-- 
... Gentlemen:  Start your debuggers...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] sorting multi array

2007-04-25 Thread Jon Bennett

hi,

I have the following array, which I need to sort by quantity...

Array
(
   [2408] = Array
   (
   [name] = Havaianas Top Pink Crystal
   [size] = 5 (37/38)
   [quantity] = 4
   )

   [3388] = Array
   (
   [name] = Havaianas Brazil Silver
   [size] = 6/7 (39/40)
   [quantity] = 6
   )

   [2666] = Array
   (
   [name] = Havaianas Brasil Black
   [size] = 8/9 (41/42)
   [quantity] = 1
   )

   [3210] = Array
   (
   [name] = Havaianas Margaridas Yellow
   [size] = 5 (37/38)
   [quantity] = 1
   )

   [2552] = Array
   (
   [name] = Havaianas Flash White
   [size] = 5 (37/38)
   [quantity] = 1
   )
)

I need to keep the indexes if poss.

Many thanks,

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread Richard Davey

Henning Eiben wrote:


Running my test for about 5 minutes, I get about 31.000 request for the
java application, but only about 3.000 for the php.


No offence, but the problem is almost 100% certainly in your PHP code 
then. I'd look very carefully at what is going on there before trying to 
'tweak' PHP itself.


Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

Never trust a computer you can't throw out of a window

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sorting multi array

2007-04-25 Thread Frank Arensmeier
Jon, I would suggest that you should have a look at the function  
array_multisort. See the manual for details on what this function  
is capable of.


//frank
25 apr 2007 kl. 01.58 skrev Jon Bennett:


hi,

I have the following array, which I need to sort by quantity...

Array
(
   [2408] = Array
   (
   [name] = Havaianas Top Pink Crystal
   [size] = 5 (37/38)
   [quantity] = 4
   )

   [3388] = Array
   (
   [name] = Havaianas Brazil Silver
   [size] = 6/7 (39/40)
   [quantity] = 6
   )

   [2666] = Array
   (
   [name] = Havaianas Brasil Black
   [size] = 8/9 (41/42)
   [quantity] = 1
   )

   [3210] = Array
   (
   [name] = Havaianas Margaridas Yellow
   [size] = 5 (37/38)
   [quantity] = 1
   )

   [2552] = Array
   (
   [name] = Havaianas Flash White
   [size] = 5 (37/38)
   [quantity] = 1
   )
)

I need to keep the indexes if poss.

Many thanks,

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread Henning Eiben
Richard Davey wrote:

 Running my test for about 5 minutes, I get about 31.000 request for the
 java application, but only about 3.000 for the php.
 
 No offence, but the problem is almost 100% certainly in your PHP code
 then. I'd look very carefully at what is going on there before trying to
 'tweak' PHP itself.

well, I was curios if there would be any obvious things to do. If this
rather poor performance is due to the fact, that I used 3-tier
architecture and an OR-mapper, than this would be conclusion of my tests.



-- 
... The UART's won't take this speed, Captain

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sorting multi array

2007-04-25 Thread Chris Boget
 I have the following array, which I need to sort by quantity...
 I need to keep the indexes if poss.

This may not be the most elegant solution.  Let's call your array
$origArray

$tmpArray = array();
foreach( $origArray as $elKey = $elArray ) {
  $tmpArray[$elArray['quantity']] = $elKey;

}

if( ksort( $tmpArray )) {
  $sortedArray = array();
  foreach( $tmpArray as $elKey ) {
$sortedArray[$elKey] = $origArray[$elKey];

  }
  echo 'Original: pre' . print_r( $origArray, TRUE ) '/prebr';
  echo 'Sorted: pre' . print_r( $sortedArray, TRUE ) '/pre';

} else {
  echo 'Sorry, couldn\'t sort';

}

thnx,
Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sorting multi array

2007-04-25 Thread Zoltán Németh
2007. 04. 25, szerda keltezéssel 11.39-kor Chris Boget ezt írta:
  I have the following array, which I need to sort by quantity...
  I need to keep the indexes if poss.
 
 This may not be the most elegant solution.  Let's call your array
 $origArray
 
 $tmpArray = array();
 foreach( $origArray as $elKey = $elArray ) {
   $tmpArray[$elArray['quantity']] = $elKey;
 
 }
 
 if( ksort( $tmpArray )) {
   $sortedArray = array();
   foreach( $tmpArray as $elKey ) {
 $sortedArray[$elKey] = $origArray[$elKey];
 
   }
   echo 'Original: pre' . print_r( $origArray, TRUE ) '/prebr';
   echo 'Sorted: pre' . print_r( $sortedArray, TRUE ) '/pre';
 
 } else {
   echo 'Sorry, couldn\'t sort';
 
 }

this won't work if he has the same quantity for several keys, I think

greets
Zoltán Németh

 
 thnx,
 Chris
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread Henning Eiben
Zoltán Németh wrote:

 I wrote a small sample-application once using PHP (with propel and
 smarty) and once using Java (JBoss, EJB3, JSP  Servlets). Both apps are
 being served from a windows server (2x Xeon 1,3GHz, 2 GB RAM), but the
 performance of the PHP version is much slower than the Java version.
 I think this is because Java is compiled once, PHP is compiled at every
 request...
 Well, but using something like eAccelerator should compensate this,
 shouldn't it? As far as I understand, scripts are being compiled and
 then store in memory to access them faster.
 
 not exactly. it pre-compiles them to opcodes and stores the opcode
 blocks. the interpreter normally first pre-compiles the code to opcodes
 then runs the opcode. this pre-compilation can be cached with
 accelerators, that's how they increase performance.

But as far as I understand, java kinda does the same thing, doesn't it?
Java programs are being compiled into some intermediate language, and
this is being interpreted at runtime. So using an accelerator should
mimic the same setup for php.

Do you know any resource, describing how php works (like the thing about
compiling opcode, and stuff)? How does php handle simultaneous requests?
Are there multiple threads spawned?



-- 
... There are 10 kinds of people. Those who know binary code, and those
who don't.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-WIN] Re: [PHP] slow performance

2007-04-25 Thread Stanislav Malyshev

But as far as I understand, java kinda does the same thing, doesn't it?
Java programs are being compiled into some intermediate language, and
this is being interpreted at runtime. So using an accelerator should
mimic the same setup for php.


Java is much less dynamic language than PHP (try doing $foo = $$bar in 
Java :) which allows it to generate more low-level and more efficient 
bytecode and also use JIT compiling to further improve its performance. 
PHP opcodes is more high-level and not JIT-ed (unless somebody writes 
JIT for PHP, which didn't happen yet :)



Do you know any resource, describing how php works (like the thing about
compiling opcode, and stuff)? How does php handle simultaneous requests?


Try these:
http://www.php.net/manual/en/internals.php
http://blog.libssh2.org/index.php?/archives/24-Extending-and-Embedding-PHP.html


Are there multiple threads spawned?


Depends on server API. ISAPI does, fastCGi doesn't.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread clive



Do you know any resource, describing how php works (like the thing about
compiling opcode, and stuff)? How does php handle simultaneous requests?
Are there multiple threads spawned?


PHP doesn't do threading, apache does however every request it receives 
spawns a new thread ( there is however a thread limit in apache if Im 
not mistaken), but a single php cant unless you simulate it with arrays 
and loops.


clive

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] slow performance

2007-04-25 Thread Tijnema !

On 4/25/07, clive [EMAIL PROTECTED] wrote:


 Do you know any resource, describing how php works (like the thing about
 compiling opcode, and stuff)? How does php handle simultaneous requests?
 Are there multiple threads spawned?

PHP doesn't do threading, apache does however every request it receives
spawns a new thread ( there is however a thread limit in apache if Im
not mistaken), but a single php cant unless you simulate it with arrays
and loops.

clive



No threading?? :O
Threads are a must have for Compilers (also JIT), no?
PHP is fast already, but it should make PHP even faster i think.

Tijnema

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-WIN] Re: [PHP] slow performance

2007-04-25 Thread Henning Eiben
Stanislav Malyshev wrote:

 But as far as I understand, java kinda does the same thing, doesn't it?
 Java programs are being compiled into some intermediate language, and
 this is being interpreted at runtime. So using an accelerator should
 mimic the same setup for php.
 
 Java is much less dynamic language than PHP (try doing $foo = $$bar in
 Java :) which allows it to generate more low-level and more efficient
 bytecode and also use JIT compiling to further improve its performance.
 PHP opcodes is more high-level and not JIT-ed (unless somebody writes
 JIT for PHP, which didn't happen yet :)

ok, sounds reasonable.

 Do you know any resource, describing how php works (like the thing about
 compiling opcode, and stuff)? How does php handle simultaneous requests?
 
 Try these:
 http://www.php.net/manual/en/internals.php
 http://blog.libssh2.org/index.php?/archives/24-Extending-and-Embedding-PHP.html

ah, this saves my good-night-reading for today! :)

 Are there multiple threads spawned?
 
 Depends on server API. ISAPI does, fastCGi doesn't.

OK; so for serving multiple concurrent clients ISAPI would sound to me
like the better choice, since it can use threads, or what would be the
advantage of using fastcgi?




-- 
... ERROR:  CPU not found.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] script timeout

2007-04-25 Thread Tijnema !

On 4/25/07, Henning Eiben [EMAIL PROTECTED] wrote:

Hi,

I have a small sample-application, that uses smarty for the presentation
layer. Unfortunately I might encounter script-timeouts (not necessarily
from smarty, could also be the DB-connection or something). In this case
I would like to return an appropriate HTTP status-code (might be 500 or
something). Right now I just receive a blank page, as well as a HTTP
status-code of 200, which would indicate that everything is OK!

So what do I need to do?


I don't think this is possible in PHP. But i guess you need to do
something in Apache, to return some special error message. A thing to
keep in mind:
PHP max_execution_time set in php.ini or set with set_time_limit does
not affect system calls, such as database operations.
So, you'd be better off setting the time limit in Apache, and do some
stuff with Apache configuration files to return something.

Of course, every Apache could be replaced by IIS in above text :)

Tijnema

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sorting multi array

2007-04-25 Thread Chris Boget

this won't work if he has the same quantity for several keys, I think


Yes, you are correct.  If that is the case, then you would just need to 
change the following line


$tmpArray[$elArray['quantity']] = $elKey;

to

$tmpArray[$elArray['quantity']][] = $elKey;

then change logic in this loop:

foreach( $tmpArray as $elKey ) {

to handle the additional array.  If additional sorting needs to occur for 
those keys that have the same quantity then I think recursion will be in 
order.


thnx,
Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to detect type of image

2007-04-25 Thread Tijnema !

On 4/25/07, Satyam [EMAIL PROTECTED] wrote:

Sorry I'm late to this thread, I don't know if it has been mentioned, but
most files have a 'magic number' at the begining of the file, which usually
reads as a couple of letters or more.  I think EXE files start with MZ, gifs
with GIFxx where xx is the last two digits of the year of the standard.
Just open files of the types you are concerned about and check the first few
characters.

Satyam


I believe that mime_content_type does this, by reading a .magic file.
In a magic file, there are these described i believe. But how would
you detect (by a magic number) if a script is HTML or PHP? No way :P
Of course, It's both not valid for an image file, but you might be
worried when the first magic bytes are faked. Does somebody care if
there are a few magic bytes displayed at the top of his page?

Tijnema

Ps. Please don't top post.


- Original Message -
From: Richard Lynch [EMAIL PROTECTED]
To: Jonathan [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Wednesday, April 25, 2007 4:30 AM
Subject: Re: [PHP] Re: how to detect type of image


 On Sun, April 22, 2007 10:35 am, Jonathan wrote:
 Alain Roger wrote:
 Hi,

 In my web application, end user is able to load images (png, jpeg,
 gif,..)
 into database.
 I would like to know how can i detect automatically the type of
 image (pnd,
 jpeg,...) ?
 i do not want to check the extension because this is easily faked...
 just by
 renaming it.

 Does it exist a technique for that ?

 thanks a lot,


 Is there anything wrong with just using
 $_FILES['upload_name']['type']?

 Yes.

 The first thing wrong, is that the idiot browser-makers can't even
 agree on what to cram into that when a user uploads a simple JPEG,
 much less some more esoteric document.  So, right there, what you have
 in there under normal circumstances is pretty much garbage.

 The second thing wrong is that the Bad Guys can cram any dang thing
 they want in there, regardless of what they are uploading.  So they
 can upload a nice .exe binary file and cram image/jpeg into the
 type.  If your script is equally insecure throughout, then you could
 easily end up having an executable file up on your server that the Bad
 Guy wrote, and all they have to do is surf to it for it to run.  That
 would be bad, just in case it's not terribly obvious. :-)

 Other than that, though, it's fine and dandy to use it... :-)

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 --
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.5.463 / Virus Database: 269.6.0/775 - Release Date: 24/04/2007
 17:43



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to detect type of image

2007-04-25 Thread Richard Davey

Tijnema ! wrote:


I believe that mime_content_type does this, by reading a .magic file.
In a magic file, there are these described i believe. But how would
you detect (by a magic number) if a script is HTML or PHP? No way :P


mime_content_type is deprecated, use the FileInfo functions instead.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

Never trust a computer you can't throw out of a window

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sorting multi array

2007-04-25 Thread [EMAIL PROTECTED]
array_multisort accepts column arrays but here you try to sort row based  
arrays.


try this:
?
class ArrayUtility
{
/* Sorts an array by a member */
static private $sortMember;
static function sortByMember($array, $member)
{
self::$sortMember = $member;
usort($array, array('ArrayUtility', 'compareMember'));
}

static function compareMember($a, $b)
{
return $a[self::$sortMember]  $b[self::$sortMember];
}
}


ArrayUtility::sortByMember($array, 'quantity');

?
Am 25.04.2007, 12:36 Uhr, schrieb Frank Arensmeier  
[EMAIL PROTECTED]:


Jon, I would suggest that you should have a look at the function  
array_multisort. See the manual for details on what this function is  
capable of.


//frank
25 apr 2007 kl. 01.58 skrev Jon Bennett:


hi,

I have the following array, which I need to sort by quantity...

Array
(
   [2408] = Array
   (
   [name] = Havaianas Top Pink Crystal
   [size] = 5 (37/38)
   [quantity] = 4
   )

   [3388] = Array
   (
   [name] = Havaianas Brazil Silver
   [size] = 6/7 (39/40)
   [quantity] = 6
   )

   [2666] = Array
   (
   [name] = Havaianas Brasil Black
   [size] = 8/9 (41/42)
   [quantity] = 1
   )

   [3210] = Array
   (
   [name] = Havaianas Margaridas Yellow
   [size] = 5 (37/38)
   [quantity] = 1
   )

   [2552] = Array
   (
   [name] = Havaianas Flash White
   [size] = 5 (37/38)
   [quantity] = 1
   )
)

I need to keep the indexes if poss.

Many thanks,

jon

--

jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-WIN] Re: [PHP] slow performance

2007-04-25 Thread Stanislav Malyshev

OK; so for serving multiple concurrent clients ISAPI would sound to me
like the better choice, since it can use threads, or what would be the
advantage of using fastcgi?


Non-threaded PHP is faster than threaded PHP, because it doesn't need to 
do locks between threads and keep the thread context through the code, 
etc. So FastCGI usually would be faster and also more stable since the 
memory space is not shared. It forgoes some advantages of threaded 
application, but overall it is faster.

--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sorting multi array

2007-04-25 Thread Myron Turner

Jon Bennett wrote:

hi,

I have the following array, which I need to sort by quantity...

Array
(
   [2408] = Array
   (
   [name] = Havaianas Top Pink Crystal
   [size] = 5 (37/38)
   [quantity] = 4
   )

   [3388] = Array
   (
   [name] = Havaianas Brazil Silver
   [size] = 6/7 (39/40)
   [quantity] = 6
   )

   [2666] = Array
   (
   [name] = Havaianas Brasil Black
   [size] = 8/9 (41/42)
   [quantity] = 1
   )

   [3210] = Array
   (
   [name] = Havaianas Margaridas Yellow
   [size] = 5 (37/38)
   [quantity] = 1
   )

   [2552] = Array
   (
   [name] = Havaianas Flash White
   [size] = 5 (37/38)
   [quantity] = 1
   )
)

I need to keep the indexes if poss.

Many thanks,

jon


This works for me:


function cmp($a, $b)
{
   $aq = $a['quantity'];
   $bq = $b['quantity'];

   if ($a == $b) {
   return 0;
   }
   return ($aq  $bq) ? -1 : 1;
}

uasort($data, cmp);

To reverse the sort order:  return ($aq  $bq) ? -1 : 1;

--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] List

2007-04-25 Thread tedd

At 1:53 PM -0400 4/24/07, Beauford wrote:

Does anyone else have this problem with the list. It seems that every time I
check my email there is one or more messages from the list that royally
screws up Outlook. I usually have to delete all list messages from the
actual server and reboot. It only happens with emails from
[EMAIL PROTECTED]

Just trying to narrow down the problem. Not sure if this is spam that's
sneaking into the list messing things up or what.

Thanks


No problems here, but I use Mac and it's always boring that way.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ${}

2007-04-25 Thread Man-wai Chang

where can I find the documentation about this symbol?

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.7
  ^ ^   21:22:01 up 6 days 2:08 0 users load average: 1.00 1.00 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting (after output has started)

2007-04-25 Thread Don Don
  Hi all,  whats the best way to perform a redirect after out put has started ? 
 using header:location will not work unless theres been no output.
   
  I usuall use the method below, however am concerned for browsers that do not 
support javascript.
   
  $location = 'index.php';
  echo script language='javascript'\n;
  echo document.location.href = ' . $location . ';\n;
  echo /script\n;

   
-
Ahhh...imagining that irresistible new car smell?
 Check outnew cars at Yahoo! Autos.

[PHP] Re: PHP Text Messaging

2007-04-25 Thread tedd

Am 2007-04-20 17:58:20, schrieb Stut:
You should spool the message, send it to the first GSM-Provicer and
wait for bounces before sending it to the next one...

I would accept sending the message to 3-5 GSM-Providers @once but
creating a database of successfull send messages and bounces...
and use it the next time someone send a message.

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant



That's a good idea. But, do you create an entry for every someone or 
is there a way to use suffixes or something?


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] script timeout

2007-04-25 Thread Henning Eiben
Tijnema ! wrote:

 I have a small sample-application, that uses smarty for the presentation
 layer. Unfortunately I might encounter script-timeouts (not necessarily
 from smarty, could also be the DB-connection or something). In this case
 I would like to return an appropriate HTTP status-code (might be 500 or
 something). Right now I just receive a blank page, as well as a HTTP
 status-code of 200, which would indicate that everything is OK!

 So what do I need to do?

 I don't think this is possible in PHP. But i guess you need to do
 something in Apache, to return some special error message. A thing to
 keep in mind:
 PHP max_execution_time set in php.ini or set with set_time_limit does
 not affect system calls, such as database operations.
 So, you'd be better off setting the time limit in Apache, and do some
 stuff with Apache configuration files to return something.

Well, looking at my error.log in my PHP directory tells me, that
several php-files exceeded maximum scripting time. That's why I asked.

And I observed receiving a blank page, which is not satisfying ... so
what would I do in Apache (or IIS) to get an error-code (HTTP code that is)?




-- 
... Black holes suck.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-WIN] Re: [PHP] slow performance

2007-04-25 Thread Henning Eiben
Stanislav Malyshev wrote:

 OK; so for serving multiple concurrent clients ISAPI would sound to me
 like the better choice, since it can use threads, or what would be the
 advantage of using fastcgi?
 
 Non-threaded PHP is faster than threaded PHP, because it doesn't need to
 do locks between threads and keep the thread context through the code,
 etc. So FastCGI usually would be faster and also more stable since the
 memory space is not shared. It forgoes some advantages of threaded
 application, but overall it is faster.

OK, so I will give that a try. As far as I understand, I basically just
have to replace the association of .php to php5isapi.dll with
php-cgi.exe; and then set the global path to include my php-folder, right?




-- 
... ERROR:  CPU not found.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ${}

2007-04-25 Thread Robert Cummings
On Wed, 2007-04-25 at 21:23 +0800, Man-wai Chang wrote:
 where can I find the documentation about this symbol?

Maybe in the documentation? A cursory glance from me though didn't turn
anything up. Either way I can inform you of the purpose...

The following two expression have the same result:

$foo = 5;
${'foo'} = 5;

The difference being that the code between { and } is first evaluated to
determine the name of the variable. $foo is preferred and faster but
there may be the odd time when you find doing something like the
following useful:

${'foo_'.$i} = $someValue;

So let's imagine $i = 3, then a variable called $foo_3 has been created
and can even be accessed as $foo_3.

If you are familiar with variable variables then you may be aware that
the above can also be achieved as follows:

$name = 'foo_'.$i;
$$name = $someValue;

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: posting variables to parent frame

2007-04-25 Thread tedd

At 11:12 AM -0400 4/24/07, Al wrote:
Provide an example of an iFrame that will work on all modern 
browsers and that can't be done with DIVs or OBJECTS


Al:

Okay, try this:

http://sperling.com/examples/captcha/

I use iframe to deliver the sound without a refresh via ajax.

Show me how you can use a DIV or OBJECT to do the same -- I don't think so.

And from the Web Design Group:

The OBJECT element is used to include objects such as images, audio, 
videos, Java applets, and Flash animations. OBJECT is intended to 
replace the more specific IMG and APPLET elements, as well as the 
proprietary EMBED and BGSOUND elements, though a lack of browser 
support and severe bugs in supporting browsers make the other 
elements a better choice in many cases.


Also, iframe is not obsolete and IE 7 does handle them.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] script timeout

2007-04-25 Thread Stut

Henning Eiben wrote:

Tijnema ! wrote:


I have a small sample-application, that uses smarty for the presentation
layer. Unfortunately I might encounter script-timeouts (not necessarily
from smarty, could also be the DB-connection or something). In this case
I would like to return an appropriate HTTP status-code (might be 500 or
something). Right now I just receive a blank page, as well as a HTTP
status-code of 200, which would indicate that everything is OK!

So what do I need to do?


I don't think this is possible in PHP. But i guess you need to do
something in Apache, to return some special error message. A thing to
keep in mind:
PHP max_execution_time set in php.ini or set with set_time_limit does
not affect system calls, such as database operations.
So, you'd be better off setting the time limit in Apache, and do some
stuff with Apache configuration files to return something.


Well, looking at my error.log in my PHP directory tells me, that
several php-files exceeded maximum scripting time. That's why I asked.

And I observed receiving a blank page, which is not satisfying ... so
what would I do in Apache (or IIS) to get an error-code (HTTP code that is)?


Use register_shutdown_function to, erm, register a shutdown function. 
Call ob_start at the very top of the script. Initialise $finished to 
false on the line after that. At the end of the script set it to true. 
If your shutdown function gets called and $finished is false then the 
script did not finish. Call ob_end_clean and output the header/body to 
return the HTTP error code you want.


-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] ${}

2007-04-25 Thread Buesching, Logan J
Heh, lucky me I was just looking into that earlier today.

http://us.php.net/manual/en/language.types.string.php

Around the Simple Syntax area.

-Logan

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 25, 2007 9:42 AM
To: Man-wai Chang
Cc: php-general@lists.php.net
Subject: Re: [PHP] ${}

On Wed, 2007-04-25 at 21:23 +0800, Man-wai Chang wrote:
 where can I find the documentation about this symbol?

Maybe in the documentation? A cursory glance from me though didn't turn
anything up. Either way I can inform you of the purpose...

The following two expression have the same result:

$foo = 5;
${'foo'} = 5;

The difference being that the code between { and } is first evaluated to
determine the name of the variable. $foo is preferred and faster but
there may be the odd time when you find doing something like the
following useful:

${'foo_'.$i} = $someValue;

So let's imagine $i = 3, then a variable called $foo_3 has been created
and can even be accessed as $foo_3.

If you are familiar with variable variables then you may be aware that
the above can also be achieved as follows:

$name = 'foo_'.$i;
$$name = $someValue;

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ${}

2007-04-25 Thread Satyam


- Original Message - 
From: Man-wai Chang [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Wednesday, April 25, 2007 3:23 PM
Subject: [PHP] ${}




where can I find the documentation about this symbol?




It is one of those almost hidden treasures that is documented, a little bit 
here and there, but it doesn't have a page on its own.


It is used to dissambiguate complex variables, specially when embedded 
within double-quoted strings, so the interpreter knows how far does the 
variable name and its parts go and when the rest of the string goes.  For 
example, if withing a double-quoted or heredoc string, the variable name is 
immediately followed by a text or number without any spaces in between, the 
interpreted can't know whether those characters are part of the variable 
name or not.   Also, when you want to refer to an array element or an object 
property, the resulting expression might get somewhat more complicated and 
there might be ambiguities as to how far does the variable goes and where 
the rest of the string goes.


It might also be used to generate variable names on the fly,  ${'variable' . 
$i}  will produce the contents of $variable0 for $i = 0.


I think it was also used to refer to individual characters within a string 
as if it was a character array, but that is deprecated in favour of square 
brackets.


Satyam



--
 .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.7
 ^ ^   21:22:01 up 6 days 2:08 0 users load average: 1.00 1.00 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.6.0/775 - Release Date: 24/04/2007 
17:43





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] script timeout

2007-04-25 Thread Stut

Stut wrote:

Henning Eiben wrote:

Tijnema ! wrote:

I have a small sample-application, that uses smarty for the 
presentation

layer. Unfortunately I might encounter script-timeouts (not necessarily
from smarty, could also be the DB-connection or something). In this 
case

I would like to return an appropriate HTTP status-code (might be 500 or
something). Right now I just receive a blank page, as well as a HTTP
status-code of 200, which would indicate that everything is OK!

So what do I need to do?


I don't think this is possible in PHP. But i guess you need to do
something in Apache, to return some special error message. A thing to
keep in mind:
PHP max_execution_time set in php.ini or set with set_time_limit does
not affect system calls, such as database operations.
So, you'd be better off setting the time limit in Apache, and do some
stuff with Apache configuration files to return something.


Well, looking at my error.log in my PHP directory tells me, that
several php-files exceeded maximum scripting time. That's why I asked.

And I observed receiving a blank page, which is not satisfying ... so
what would I do in Apache (or IIS) to get an error-code (HTTP code 
that is)?


Use register_shutdown_function to, erm, register a shutdown function. 
Call ob_start at the very top of the script. Initialise $finished to 
false on the line after that. At the end of the script set it to true. 
If your shutdown function gets called and $finished is false then the 
script did not finish. Call ob_end_clean and output the header/body to 
return the HTTP error code you want.


Oh, I forgot to add that you should look at the set_time_limit function 
as a possible means to avoiding the script ending. When I write a script 
that will sit in a loop that could potentially loop a lot I'll call 
set_time_limit with a reasonable time allowed for a single loop 
execution. This means as long as the script is actually doing something 
it will not time out.


-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-WIN] Re: [PHP] slow performance

2007-04-25 Thread Stanislav Malyshev

OK, so I will give that a try. As far as I understand, I basically just
have to replace the association of .php to php5isapi.dll with
php-cgi.exe; and then set the global path to include my php-folder, right?


No, that probably would make it CGI, which is slow. For FastCGI, you 
need FastCGI module for IIS. Zend Core contains one, and Microsoft has 
its own here: http://www.iis.net/default.aspx?tabid=151


Also see: 
http://blogs.iis.net/rickjames/archive/2007/04/19/fastcgi-tp2-unofficial-update-70419.aspx

--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ${}

2007-04-25 Thread Colin Guthrie
Robert Cummings wrote:
 On Wed, 2007-04-25 at 21:23 +0800, Man-wai Chang wrote:
 where can I find the documentation about this symbol?
 
 Maybe in the documentation? A cursory glance from me though didn't turn
 anything up. Either way I can inform you of the purpose...
 
 The following two expression have the same result:
 
 $foo = 5;
 ${'foo'} = 5;

It's also useful to separate out your vars when using replacements in
double quotes..

cf.

$like = Hmmm;
$var1 = Something $like_this;
vs.
$var2 = Something ${like}_that;


$var1 = Something  + PHP Notice
$var2 = Something Hmmm_that;

Col.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ${}

2007-04-25 Thread Dave Goodchild

You can also use that in interpolations where the variable name may be
ambiguous ie

My name is Stephen and I am a {$type}drone

..or to interpolate array lookups:

This is {$desc['mood']} don't you know!


[PHP] Re: ${}

2007-04-25 Thread Man-wai Chang
Buesching, Logan J wrote:
 Heh, lucky me I was just looking into that earlier today.
 http://us.php.net/manual/en/language.types.string.php
 Around the Simple Syntax area.

Thanks. Foxpro called this macro substitution.

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.7
  ^ ^   22:14:01 up 6 days 3:00 0 users load average: 1.02 1.03 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ${}

2007-04-25 Thread Man-wai Chang
 Heh, lucky me I was just looking into that earlier today.
 http://us.php.net/manual/en/language.types.string.php
 Around the Simple Syntax area.

Foxpro called this Macro Substitution. There is also a eval() function
that works the same.



-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.7
  ^ ^   22:19:01 up 6 days 3:05 0 users load average: 0.28 0.76 0.91
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: ${}

2007-04-25 Thread Robert Cummings
On Wed, 2007-04-25 at 22:15 +0800, Man-wai Chang wrote:
 Buesching, Logan J wrote:
  Heh, lucky me I was just looking into that earlier today.
  http://us.php.net/manual/en/language.types.string.php
  Around the Simple Syntax area.
 
 Thanks. Foxpro called this macro substitution.

Only if used as a variable interpolation delimiter within heredoc or a
double quoted string. You didn't originally mention a string context, in
which case it's for accessing variables with dynamic names.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] List

2007-04-25 Thread Børge Holen
On Tuesday 24 April 2007 19:53, Beauford wrote:
 Does anyone else have this problem with the list. It seems that every time
 I check my email there is one or more messages from the list that royally
 screws up Outlook. I usually have to delete all list messages from the
 actual server and reboot. It only happens with emails from
 [EMAIL PROTECTED]

 Just trying to narrow down the problem. Not sure if this is spam that's
 sneaking into the list messing things up or what.

 Thanks

kmail, no probs... 

-- 
---
Børge
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Separating words based on capital letter

2007-04-25 Thread Al
Note: several of the folks used / as the delimiter.  Actually, it can be almost anything that will not be in the 
$string.  Generally, I use % simply because it's easier to spot when I forget the delimiters.


Also, note Robin's use of the metachar [[:upper:]].  metacharacters can very useful.  My favorites are [:punct:] and 
[:space:]


Dotan Cohen wrote:

On 25/04/07, Robin Vickery [EMAIL PROTECTED] wrote:

$string = preg_replace('/(?=\w)([[:upper:]])/', ' $1', $string);

turns this is OpenSourceCode to this is Open Source Code



Another great solution, Robin, thanks. I've learned a LOT from this thread.

Dotan Cohen

http://what-is-what.com/what_is/open_office.html
http://hardtofindlyrics.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: posting variables to parent frame

2007-04-25 Thread Al

Sorry about that guys. I just fixed it.

Stut wrote:
FYI: Every time I reply to you I get a bounce back saying your email 
address ([EMAIL PROTECTED]) does not exist. It's starting to get annoying.


-Stut

Stut wrote:

Al wrote:
Provide an example of an iFrame that will work on all modern browsers 
and that can't be done with DIVs or OBJECTS


I didn't say it couldn't be done, I said it was different. Take Google 
Ads for example. These are currently served in an iframe. To do it in 
a div is possible but leads to other problems.


But to get back to the point, the iframe tag will not be obsolete 
until the HTML spec says so, and at the time of writing it does not.


-Stut


Stut wrote:

Al wrote:
iFrames are obsolete and only IE handles them.  I don't even know 
if IE7 does.


Well that's just a complete load of rubbish. The iframe tag is not 
obsolete, and I don't know where you got the idea that they are. 
Several legitimate uses for iframes exist, and they're unlikely to 
go away any time soon.



Use css div tags instead.


They don't do the same thing, not by a long shot.

-Stut


Hans wrote:

Hi there,

I'm trying to post variables to a parent frame, I'm working from a 
page that
is in an iFrame. However, I don't know how to accomplish this. I 
tried

target='top' to include in the form tag (form action=?=$formurl?
target=top) but this didn't succeed.

Can you please help me?

Thanks in advance!
Hans








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] List

2007-04-25 Thread jgodish
Quoting Børge Holen [EMAIL PROTECTED]:

 On Tuesday 24 April 2007 19:53, Beauford wrote:
  Does anyone else have this problem with the list. It seems that every time
  I check my email there is one or more messages from the list that royally
  screws up Outlook. I usually have to delete all list messages from the
  actual server and reboot. It only happens with emails from
  [EMAIL PROTECTED]
 
  Just trying to narrow down the problem. Not sure if this is spam that's
  sneaking into the list messing things up or what.
 
  Thanks

 kmail, no probs...

 --
 ---
 Børge
 http://www.arivene.net
 ---

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


No problems with Thunderbird (Home) or Outlook Express (Work)
John

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to detect type of image WAY OT (but not that far)

2007-04-25 Thread Børge Holen
On Wednesday 25 April 2007 14:14, Richard Davey wrote:
 Tijnema ! wrote:
  I believe that mime_content_type does this, by reading a .magic file.
  In a magic file, there are these described i believe. But how would
  you detect (by a magic number) if a script is HTML or PHP? No way :P

 mime_content_type is deprecated, use the FileInfo functions instead.

 Cheers,

 Rich
 --
 Zend Certified Engineer
 http://www.corephp.co.uk

 Never trust a computer you can't throw out of a window

I loved this signature.


-- 
---
Børge
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ${}

2007-04-25 Thread Man-wai Chang
 $var1 = Something  + PHP Notice
 $var2 = Something Hmmm_that;

I wonder whether Smarty's way of specifying variables is based on this...

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.7
  ^ ^   22:18:02 up 6 days 3:04 0 users load average: 0.58 0.91 0.96
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Something to pass the time while programming....

2007-04-25 Thread Daniel Brown

   I wasn't even paying attention yesterday and I played two songs for
seven hours and forty-nine minutes straight, on replay, through my
headphones.  No break, no pause, nothing I guess that explains why I'm a
little loopy.

   Anyway, if you haven't heard The Picard Song or The Worf Song, I
recommend downloading them.  I don't like dance music, and I'm not a big fan
of Star Trek, but this combines the two and it's hilarious.  Very, very well
done, too.  There's a third song called Frame Of Mind, but I haven't
listened to that one.

   Here's the link:  http://tborgax.homepage.dk/audio.html

   I still get a kick out of listening to them (listening again now,
because each time I hear something I hadn't noticed before).  Oh, and trust
me, at least part of at least one of the songs will get stuck in your head
if you listen to them all the way through.  You'll catch yourself with it in
your head later.

   Just thought I'd pass on something to keep your day going while your
eyes bug out to code

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] List

2007-04-25 Thread Daniel Brown

   Yeah, no problems on Gmail (webmail), or on the following configurations
(set up on a different address to receive list mail only):

Linux: Ximian Evolution, KMail
Windows: Outlook, Outlook Express, Thunderbird



On 4/25/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Quoting Børge Holen [EMAIL PROTECTED]:

 On Tuesday 24 April 2007 19:53, Beauford wrote:
  Does anyone else have this problem with the list. It seems that every
time
  I check my email there is one or more messages from the list that
royally
  screws up Outlook. I usually have to delete all list messages from the
  actual server and reboot. It only happens with emails from
  [EMAIL PROTECTED]
 
  Just trying to narrow down the problem. Not sure if this is spam
that's
  sneaking into the list messing things up or what.
 
  Thanks

 kmail, no probs...

 --
 ---
 Børge
 http://www.arivene.net
 ---

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


No problems with Thunderbird (Home) or Outlook Express (Work)
John

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


[PHP] Re: posting variables to parent frame

2007-04-25 Thread Al

I stand corrected by pros.

One should always double check their memory before posting, even when in a 
hurry.

Al wrote:
iFrames are obsolete and only IE handles them.  I don't even know if IE7 
does.


Use css div tags instead.

Hans wrote:

Hi there,

I'm trying to post variables to a parent frame, I'm working from a 
page that

is in an iFrame. However, I don't know how to accomplish this. I tried
target='top' to include in the form tag (form action=?=$formurl?
target=top) but this didn't succeed.

Can you please help me?

Thanks in advance!
Hans


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting (after output has started)

2007-04-25 Thread Philip Thompson

On Apr 25, 2007, at 8:25 AM, Don Don wrote:

  Hi all,  whats the best way to perform a redirect after out put  
has started ?  using header:location will not work unless theres  
been no output.


  I usuall use the method below, however am concerned for browsers  
that do not support javascript.


  $location = 'index.php';
  echo script language='javascript'\n;
  echo document.location.href = ' . $location . ';\n;
  echo /script\n;


Use this at the beginning of the script (before output is displayed):

ob_start();


~Philip

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting (after output has started)

2007-04-25 Thread tedd

At 6:25 AM -0700 4/25/07, Don Don wrote:
  Hi all,  whats the best way to perform a redirect after out put 
has started ?  using header:location will not work unless theres 
been no output.
  
  I usuall use the method below, however am concerned for browsers 
that do not support javascript.
  
  $location = 'index.php';

  echo script language='javascript'\n;
  echo document.location.href = ' . $location . ';\n;
  echo /script\n;



Check out ob_start  http://us.php.net/ob_start

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] List

2007-04-25 Thread Philip Thompson

On Apr 25, 2007, at 8:21 AM, tedd wrote:


At 1:53 PM -0400 4/24/07, Beauford wrote:
Does anyone else have this problem with the list. It seems that  
every time I
check my email there is one or more messages from the list that  
royally
screws up Outlook. I usually have to delete all list messages from  
the

actual server and reboot. It only happens with emails from
[EMAIL PROTECTED]

Just trying to narrow down the problem. Not sure if this is spam  
that's

sneaking into the list messing things up or what.

Thanks


No problems here, but I use Mac and it's always boring that way.

tedd


Has anyone thought oh we are sending him bulk mail from php- 
general and causing his Outlook to crash! Haha. I just thought that  
was funny.


Oh... me too. Apple Mail (with filters), non-digest works just fine.

~Phil

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Open source web Catalog ?

2007-04-25 Thread Joey
Hey Guys,

 

Can anyone recommend a good open source catalog program that is NOT a
shopping cart, but a simple way for a person to maintain their products,
pictures descriptions etc?

 

Thanks!

 

Joey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-WIN] Re: [PHP] slow performance

2007-04-25 Thread Henning Eiben
Stanislav Malyshev wrote:

 OK, so I will give that a try. As far as I understand, I basically just
 have to replace the association of .php to php5isapi.dll with
 php-cgi.exe; and then set the global path to include my php-folder,
 right?
 
 No, that probably would make it CGI, which is slow. For FastCGI, you
 need FastCGI module for IIS. Zend Core contains one, and Microsoft has
 its own here: http://www.iis.net/default.aspx?tabid=151

OK, I installed FCGI and ran my testsuite. I did get more requests in a
timeperiod of 5 minutes, but unfortunatly I also got a lot of errors
(HTTP 500). But the performance of successful pages was increased by
almost 15%.



-- 
... ERROR:  CPU not found.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] TrueType font changes size when rotated?

2007-04-25 Thread tedd

At 10:26 PM -0500 4/24/07, Seth Price wrote:

Hi all! I've been programming GD and PHP for a while, but I haven't
done much with font drawing. I'm trying to layout and draw text, but
the text actually changes size and shape depending on the angle it's
drawn at. This is making it extremely difficult to lay the text out
properly.

Am I doing something wrong? Is there a bug in FreeType? How can I
consistently draw text?

For example:
The following code draws 'Hello world' at differing angles. But all
drawings are at right angles to each other. FreeType shouldn't even
need to do any resampling or interpolating, but each text is drawn
with a unique length and look. You can see the output of the
following code here:
http://leopold.sage.wisc.edu/test2.php


Seth:

Everything looks fine to me. On my browser all the text is the same 
size (I measured it). But then again, I'm using Safari for the Mac. 
Maybe it's a browsers problem.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] TrueType font changes size when rotated?

2007-04-25 Thread Seth Price
I'm using Safari for Mac also. What are the numbers after 'Hello  
world' coming out for you?

~Seth


On Apr 25, 2007, at 11:05 AM, tedd wrote:


At 10:26 PM -0500 4/24/07, Seth Price wrote:

Hi all! I've been programming GD and PHP for a while, but I haven't
done much with font drawing. I'm trying to layout and draw text, but
the text actually changes size and shape depending on the angle it's
drawn at. This is making it extremely difficult to lay the text out
properly.

Am I doing something wrong? Is there a bug in FreeType? How can I
consistently draw text?

For example:
The following code draws 'Hello world' at differing angles. But all
drawings are at right angles to each other. FreeType shouldn't even
need to do any resampling or interpolating, but each text is drawn
with a unique length and look. You can see the output of the
following code here:
http://leopold.sage.wisc.edu/test2.php


Seth:

Everything looks fine to me. On my browser all the text is the same  
size (I measured it). But then again, I'm using Safari for the Mac.  
Maybe it's a browsers problem.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] TrueType font changes size when rotated? (the plot thickens)

2007-04-25 Thread Seth Price

So I've rewritten my script in C. You can find the source here:
http://leopold.sage.wisc.edu/testing/gd_ft_ang.c

This script links directly to GD and produces a still different  
output. On my home system, the output image is correct and the length  
89 px. On the web server, the output image is not correct, but a bit  
more consistent than the output from PHP. You can see it here:

http://leopold.sage.wisc.edu/testing/gd35_ft15.3.png

What is the difference between my home system and the web server? The  
web server is running the most current versions, but my home system  
is not. So, that's odd. Could some of you with GD and FreeType  
installed take a look at my source code and see if my output image  
matches yours?


To help eliminate variables, you can download a copy of the font file  
I'm using here:

http://leopold.sage.wisc.edu/testing/Verdana.ttf

It sounds like this may be a bug in GD or FreeType.
Thanks,
Seth



On Apr 25, 2007, at 12:29 AM, jekillen wrote:



On Apr 24, 2007, at 8:26 PM, Seth Price wrote:


Hi all! I've been programming GD and PHP for a while, but I haven't
done much with font drawing. I'm trying to layout and draw text, but
the text actually changes size and shape depending on the angle it's
drawn at. This is making it extremely difficult to lay the text out
properly.

Am I doing something wrong? Is there a bug in FreeType? How can I
consistently draw text?

For example:
The following code draws 'Hello world' at differing angles. But all
drawings are at right angles to each other. FreeType shouldn't even
need to do any resampling or interpolating, but each text is drawn
with a unique length and look. You can see the output of the
following code here:
http://leopold.sage.wisc.edu/test2.php


?php
header('Content-Type:image/png');

$img = imagecreatetruecolor(300, 300);
$bak = imagecolorexact($img, 255,255,255);
imagefill($img, 0,0, $bak);
$col = imagecolorexact($img, 0,0,0);

for($i = 0; $i  360; $i += 90){
$b = imageftbbox(12, $i, '/Library/WebServer/Verdana.ttf', 'Hello
world');
$len = sqrt(($b[2] - $b[0])*($b[2] - $b[0]) + ($b[3] - $b[1])*(($b
[3] - $b[1])));
imagefttext($img, 12, $i, 150, 150, $col, '/Library/WebServer/
you're using Mac OSX, did you have to install gd or does it now  
come with
gd included in the php installation? (after looking further down  
the message,

I see you are running Server, so that is probably the difference)
Mine did not (OSX 1.4x). I have it installed on a FreeBSD system.
www.brushandbard.com - web design - dynamic image generation  
demonstration

and Word Wise the Tile Puzzle are some of my projects using gd.

Verdana.ttf', 'Hello world '.$len);
}

imagepng($img);
?

When using more interesting fonts, this 'resampling' is causing text
drawn at 90 deg to look fugly. What can I do to prevent this? Is this
a known issue? The output doesn't seem to change if I use the 'ttf'
functions vs. the 'ft' functions.
I went looking for some samples, as I have played with this some in  
the
past, but did not find anything current to show. I do not remember  
having
this problem. There may be a distortion that is being entered into  
the mix

when the fonts are rendered by your code. $len is the hypoteneus of a
right triangle, right off hand I would say that is your problem or  
some of it.
The length should be a linear measurement and not a diagonal  
measurement.
But I am rusty at this point. Also there is a function for  
explicitly specifying

the angle of the font in degrees, and, as I remember the angle of the
rendering box also. This is so each font can be rendered at an  
individual

angle and the whole enclosing box, so the whole word is rotated.
 you will have to look in the manual for gd related functions if  
you are

not aware of this.
Jeff K


System info:
Mac v10.4 Server running PHP v5.2.1  FreeType v2.3.4

Compiled with:
'./configure' '--with-apxs' '--with-mysqli=/usr/local/mysql/bin/
mysql_config' '--with-gd' '--with-png-dir=/usr/local' '--with-zlib-
dir=/usr' '--with-jpeg-dir=/usr/local' '--disable-short-tags' '-- 
with-

iconv' '--enable-exif' '--enable-mbstring' '--enable-gd-native-ttf'
'--with-freetype-dir=/usr/local'

Thanks,
Seth

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] everything printed suddenly has blue text, as if were a link

2007-04-25 Thread Thufir
When I print out my list of apartments, everything after
http://vancouver.craigslist.org/apa/318594679.html, which is grabbed via
http://code.google.com/p/feed-on-feeds/ is suddenly blue.  So, the first few
are fine, have black text, after that it's all blue.

Do I put some html in the loop to make sure that the color is blue?  seems kinda
silly.

[EMAIL PROTECTED] ~]# 
[EMAIL PROTECTED] ~]# cat /var/www/html/apartments.php -n
 1  html
 2  headtitleapartments/title/head
 3  body
 4  ?php
 5  $user=feeds;
 6  $host=localhost;
 7  $password=password;
 8  $database = feeds;
 9  
10  $connection = mysql_connect($host,$user,$password)
11  or die (couldn't connect to server);
12  $db = mysql_select_db($database,$connection)
13  or die (Couldn't select database);
14  
15  $query = SELECT id, link, title, content FROM px_items WHERE
feed_id=1 ORDER BY id DESC;
16  $result = mysql_query($query)
17  or die (Couldn't execute query.);
18
19
20  $count =1;
21
22  while ($row = mysql_fetch_array($result)) 
23  {
24  extract ($row);
25
26  echo bigbigb;
27  echo $id;
28  echo /b/big/big;
29
30  echo br;
31  echo $title;
32
33  echo br;
34  echo $content;
35  echo br;
36
37  echo a href=\;
38  echo $link;
39  echo \;
40  echo $link;
41  echo /a;
42
43  echo brbr;
44
45  }//while
46  ?
47  /body
48  /html 
[EMAIL PROTECTED] ~]# 
[EMAIL PROTECTED] ~]# date
Wed Apr 25 19:23:20 BST 2007
[EMAIL PROTECTED] ~]# 


thanks,

Thufir

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] printing a one-to-many relationship

2007-04-25 Thread Thufir
There's a one-to-many relationship between px_items.id and contacts.id, and I
want a printout of some data from each.

I want to print out the query results px_items.id field once and once only, but
the contacts.notes field many times, as there could be many entries.

Right now it prints out each row, which is workable for now, but could get
annoying.  I'm trying for something like


entry one
note a
note b
note c

entry two
note a

entry three
notb a
note b



Here's my schema and code:

[EMAIL PROTECTED] ~]# 
[EMAIL PROTECTED] ~]# cat /var/www/html/items_notes.php -n
 1  html
 2  headtitleitems and notes/title/head
 3  body
 4  ?php
 5  $user=feeds;
 6  $host=localhost;
 7  $password=password;
 8  $database = feeds;
 9  
10  $connection = mysql_connect($host,$user,$password)
11  or die (couldn't connect to server);
12  $db = mysql_select_db($database,$connection)
13  or die (Couldn't select database);
14
15
16  $query = SELECT * FROM contacts, px_items WHERE
contacts.id=px_items.id ORDER BY px_items.id DESC;
17
18  $result = mysql_query($query)
19  or die (Couldn't execute query.);
20
21  while ($row = mysql_fetch_array($result)) 
22  {
23  extract ($row);
24
25  echo bigbigb;
26  echo $id;
27  echo /b/big/big;
28
29  echo br;
30  echo $title;
31
32  echo br;
33  echo $content;
34  echo br;
35
36  echo br;
37  echo $timestamp;
38  echo br;
39
40  echo br;
41  echo $notes;
42  echo br;
43
44  echo a href=\;
45  echo $link;
46  echo \;
47  echo $link;
48  echo /a;
49
50  echo brbr;
51
52  }//while
53  ?
54  /body
55  /html 
[EMAIL PROTECTED] ~]# 
[EMAIL PROTECTED] ~]# 
[EMAIL PROTECTED] ~]# 
[EMAIL PROTECTED] ~]# mysql -u feeds -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 25 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql use feeds;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql show tables;
+-+
| Tables_in_feeds |
+-+
| contacts| 
| px_feeds| 
| px_items| 
+-+
3 rows in set (0.00 sec)

mysql describe contacts;
+---+---+--+-+---+---+
| Field | Type  | Null | Key | Default   | Extra |
+---+---+--+-+---+---+
| id| int(11)   | YES  | MUL | NULL  |   | 
| timestamp | timestamp | NO   | | CURRENT_TIMESTAMP |   | 
| notes | longtext  | YES  | | NULL  |   | 
+---+---+--+-+---+---+
3 rows in set (0.07 sec)

mysql describe px_items;
+---+--+--+-+---++
| Field | Type | Null | Key | Default   | Extra  |
+---+--+--+-+---++
| id| int(11)  | NO   | PRI | NULL  | auto_increment | 
| feed_id   | int(11)  | NO   | MUL | 0 || 
| timestamp | timestamp| NO   | | CURRENT_TIMESTAMP || 
| link  | text | YES  | | NULL  || 
| title | varchar(250) | YES  | | NULL  || 
| content   | text | YES  | | NULL  || 
| dcdate| text | YES  | | NULL  || 
| dccreator | text | YES  | | NULL  || 
| dcsubject | text | YES  | | NULL  || 
| read  | tinyint(4)   | YES  | MUL | NULL  || 
+---+--+--+-+---++
10 rows in set (0.00 sec)

mysql quit
Bye
[EMAIL PROTECTED] ~]# 
[EMAIL PROTECTED] ~]# date
Wed Apr 25 19:30:38 BST 2007
[EMAIL PROTECTED] ~]# 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: posting variables to parent frame

2007-04-25 Thread Al

Very clever use of iFrame.  So clever it doesn't show in your html source code.

Looks more like you are using DIV tags, with simple POST values, just like I'd 
have done it.

Incidentally, br/ is an error for html.

tedd wrote:

At 11:12 AM -0400 4/24/07, Al wrote:
Provide an example of an iFrame that will work on all modern browsers 
and that can't be done with DIVs or OBJECTS


Al:

Okay, try this:

http://sperling.com/examples/captcha/

I use iframe to deliver the sound without a refresh via ajax.

Show me how you can use a DIV or OBJECT to do the same -- I don't think so.

And from the Web Design Group:

The OBJECT element is used to include objects such as images, audio, 
videos, Java applets, and Flash animations. OBJECT is intended to 
replace the more specific IMG and APPLET elements, as well as the 
proprietary EMBED and BGSOUND elements, though a lack of browser support 
and severe bugs in supporting browsers make the other elements a better 
choice in many cases.


Also, iframe is not obsolete and IE 7 does handle them.

Cheers,

tedd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] TrueType font changes size when rotated?

2007-04-25 Thread tedd
Yep, I'm calculating the length from the returned bounding box and 
printing it out. The box seems to randomly expand and shrink 
depending on the angle.

~Seth


~Seth:

I think it's your calculation of the bounding box that's throwing you 
off -- maybe round off errors -- I don't know. However, I don't see 
any difference in the length of the text.


The following shows Hello World . at one degree increments over 360 degrees.

http://sperling.com/a/font/

It looks like a circle to me. If there was a difference, then it 
would be elliptical.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Server side speech

2007-04-25 Thread tedd

Hi gang:

Most text to speech techniques concentrate on making the browser or 
desktop application do the translation of web text to speech. For 
example, there are several listed here:


http://www.oatsoft.org/Software/listing/Repository

However, server-side text to speech is possible by delivering the 
sound to the browser via EMBED or BGSOUND tags -- an example of this 
can be seen here:


http://nihseniorhealth.gov/

I contacted NIH, but they said that they hired a firm to do that for 
them and as such the source code is not subject to the freedom of 
information act.


So, my question is -- is there anywhere I could get free code to do that?

Thanks,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread Richard Lynch
On Wed, April 25, 2007 2:00 pm, tedd wrote:
 However, server-side text to speech is possible by delivering the
 sound to the browser via EMBED or BGSOUND tags -- an example of this
 can be seen here:

I have run Festival server side via PHP to generate audio snippets
of spoken word.

All you really need is one of the desktop packages to have a command
line interface and http://php.net/exec

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread Daniel Brown

   I had actually done something almost exactly like this as an experiment
a few months back at http://isawit.com/tts/login.php.  The audio download
portion may no longer work, though I can't remember if I removed the
code from that specific server or not.  It was just for my own fun and
edification, not any kind of project.

   What it did was allow someone to go to the site, type in a phrase, the
server converted it to audio (WAV) and the user could download it.  However,
it could easily be embedded into the page.  Then my desktop computer would
access the database on the server once per minute to read unread phrases
through a PHP/BASh hybrid to read aloud the phrases users entered.  I had a
simple CLI email script on my end, too, that allowed me to zip a response to
the user in either audio or text format.

   I used Festival's TTS engine, which worked just fine for me.  I did some
modifications to it and then wrote some simple script wrappers for it.

   Summary: check out Festival's TTS.  The voices need work, but it's
understandable, and it definitely does work.

On 4/25/07, tedd [EMAIL PROTECTED] wrote:


Hi gang:

Most text to speech techniques concentrate on making the browser or
desktop application do the translation of web text to speech. For
example, there are several listed here:

http://www.oatsoft.org/Software/listing/Repository

However, server-side text to speech is possible by delivering the
sound to the browser via EMBED or BGSOUND tags -- an example of this
can be seen here:

http://nihseniorhealth.gov/

I contacted NIH, but they said that they hired a firm to do that for
them and as such the source code is not subject to the freedom of
information act.

So, my question is -- is there anywhere I could get free code to do that?

Thanks,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


RE: [PHP] List

2007-04-25 Thread Chris W. Parker
On Tuesday, April 24, 2007 6:02 PM Richard Lynch mailto:[EMAIL PROTECTED]
said:

 I do not have any problems, but I'm not using Outlook, and never will.

Okay...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread Robert Cummings
Ditto on Festival. I've used it in the past as a trigger on MUD text to
vocalize messages sent by players.

Cheers,
Rob.


On Wed, 2007-04-25 at 15:08 -0400, Daniel Brown wrote:
 I had actually done something almost exactly like this as an experiment
 a few months back at http://isawit.com/tts/login.php.  The audio download
 portion may no longer work, though I can't remember if I removed the
 code from that specific server or not.  It was just for my own fun and
 edification, not any kind of project.
 
 What it did was allow someone to go to the site, type in a phrase, the
 server converted it to audio (WAV) and the user could download it.  However,
 it could easily be embedded into the page.  Then my desktop computer would
 access the database on the server once per minute to read unread phrases
 through a PHP/BASh hybrid to read aloud the phrases users entered.  I had a
 simple CLI email script on my end, too, that allowed me to zip a response to
 the user in either audio or text format.
 
 I used Festival's TTS engine, which worked just fine for me.  I did some
 modifications to it and then wrote some simple script wrappers for it.
 
 Summary: check out Festival's TTS.  The voices need work, but it's
 understandable, and it definitely does work.
 
 On 4/25/07, tedd [EMAIL PROTECTED] wrote:
 
  Hi gang:
 
  Most text to speech techniques concentrate on making the browser or
  desktop application do the translation of web text to speech. For
  example, there are several listed here:
 
  http://www.oatsoft.org/Software/listing/Repository
 
  However, server-side text to speech is possible by delivering the
  sound to the browser via EMBED or BGSOUND tags -- an example of this
  can be seen here:
 
  http://nihseniorhealth.gov/
 
  I contacted NIH, but they said that they hired a firm to do that for
  them and as such the source code is not subject to the freedom of
  information act.
 
  So, my question is -- is there anywhere I could get free code to do that?
 
  Thanks,
 
  tedd
  --
  ---
  http://sperling.com  http://ancientstones.com  http://earthstones.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Preventing SQL Injection/ Cross Site Scripting

2007-04-25 Thread Justin Frim

Dotan Cohen wrote:


On 25/04/07, Justin Frim [EMAIL PROTECTED] wrote:


I'm assuming then you want the data to be able to contain _some_ mark-up
considered to be safe?



Not at this stage, no. Maybe if the users ask for it, but not now in
the beginning. The universe's best engineer, Scotty, once advised us
tell them that it's impossible, and only then to implement what they
want.



You should decide now before going any further, do you want the future 
capability to add mark-up codes?  And if so, are they going to be 
similar to HTML using the  and  characters, or are they going to be 
like BBcode using the [ and ] characters?
This decision will determine if filters to gaurd against XSS attacks 
really are the best solution or not.


See, you should only use filters to prevent XSS attacks if you plan on 
using the  and  characters for mark-up codes (now or in the future).  
Otherwise, use htmlspecialchars() or htmlentities().  If you use a 
filter that strips  and  characters, you'll have a lot of angry / 
frustrated / confused users when they find they can't type  and  as 
literals if they're not aware that  and  are reserved for special 
mark-up codes.


Consider:
Suppose a bunch of mathematicians are having a discussion on the message 
board, and one of them decides to state that variable x is greater than 
3.  They might type x  3, but your filter will end up garbling it 
up.  Not good!  If you use htmlspecialchars(), then anything they type 
will appear as typed.


If you want future capability for mark-up, you should inform the users 
which characters are reserved, and how they can represent them as 
literals.  Basically, you're informing the users if they should speak 
HTML, speak BBcode, or speak the natural language when they post on 
the site.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Preventing SQL Injection/ Cross Site Scripting

2007-04-25 Thread Dotan Cohen

On 25/04/07, Justin Frim [EMAIL PROTECTED] wrote:

Dotan Cohen wrote:

 On 25/04/07, Justin Frim [EMAIL PROTECTED] wrote:

 I'm assuming then you want the data to be able to contain _some_ mark-up
 considered to be safe?


 Not at this stage, no. Maybe if the users ask for it, but not now in
 the beginning. The universe's best engineer, Scotty, once advised us
 tell them that it's impossible, and only then to implement what they
 want.


You should decide now before going any further, do you want the future
capability to add mark-up codes?  And if so, are they going to be
similar to HTML using the  and  characters, or are they going to be
like BBcode using the [ and ] characters?
This decision will determine if filters to gaurd against XSS attacks
really are the best solution or not.


It would be BBcode if anything. It may be the product of the lazy, but
I feel more secure parsing it than [x]HTML.


See, you should only use filters to prevent XSS attacks if you plan on
using the  and  characters for mark-up codes (now or in the future).
Otherwise, use htmlspecialchars() or htmlentities().  If you use a
filter that strips  and  characters, you'll have a lot of angry /
frustrated / confused users when they find they can't type  and  as
literals if they're not aware that  and  are reserved for special
mark-up codes.

Consider:
Suppose a bunch of mathematicians are having a discussion on the message
board, and one of them decides to state that variable x is greater than
3.  They might type x  3, but your filter will end up garbling it
up.  Not good!  If you use htmlspecialchars(), then anything they type
will appear as typed.


I currently an using htmlencode, so  and  show as expected. I do
expect the math faculty to use those symbols :).


If you want future capability for mark-up, you should inform the users
which characters are reserved, and how they can represent them as
literals.  Basically, you're informing the users if they should speak
HTML, speak BBcode, or speak the natural language when they post on
the site.


Right now it's speak the natural language, but I do not want to
encumber the possibility of change. Thanks for the insight.

Dotan Cohen

http://dotancohen.com/eng/army_pictures.php
http://iphanatics.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread tedd

At 2:07 PM -0500 4/25/07, Richard Lynch wrote:

On Wed, April 25, 2007 2:00 pm, tedd wrote:

 However, server-side text to speech is possible by delivering the
 sound to the browser via EMBED or BGSOUND tags -- an example of this
 can be seen here:


I have run Festival server side via PHP to generate audio snippets
of spoken word.

All you really need is one of the desktop packages to have a command
line interface and http://php.net/exec


Richard:

I've read about Festival and there are even some php routines that 
use it. But I'm doing this from/for a virtual host. I'm looking for a 
set of routines that I could place server-side and thus use to speak 
web text.


I need something that I can share with others, not something special 
for just my site.


-OR-

Is there a standard *nix package that I could access via exec to do 
this? Is Festival commonly found on *nix?


You see, what I'm thinking is, if I can get the code/technique, then 
I might be able to provide a way for non-technical types to have 
their sites speak. Maybe it's just foolish thinking, but I'm prone to 
that. :-)


Thanks for your help.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread Daniel Brown

   Tedd,

   On all of the *nix boxes I use (and have used) I've had to install
Festival manually, so I would definitely not say that it's commonly found on
there especially for a server configuration.



On 4/25/07, tedd [EMAIL PROTECTED] wrote:


At 2:07 PM -0500 4/25/07, Richard Lynch wrote:
On Wed, April 25, 2007 2:00 pm, tedd wrote:
  However, server-side text to speech is possible by delivering the
  sound to the browser via EMBED or BGSOUND tags -- an example of this
  can be seen here:

I have run Festival server side via PHP to generate audio snippets
of spoken word.

All you really need is one of the desktop packages to have a command
line interface and http://php.net/exec

Richard:

I've read about Festival and there are even some php routines that
use it. But I'm doing this from/for a virtual host. I'm looking for a
set of routines that I could place server-side and thus use to speak
web text.

I need something that I can share with others, not something special
for just my site.

-OR-

Is there a standard *nix package that I could access via exec to do
this? Is Festival commonly found on *nix?

You see, what I'm thinking is, if I can get the code/technique, then
I might be able to provide a way for non-technical types to have
their sites speak. Maybe it's just foolish thinking, but I'm prone to
that. :-)

Thanks for your help.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] printing a one-to-many relationship

2007-04-25 Thread Jim Lucas

give this a shot

html
headtitleitems and notes/title/head
body
?php
$user=feeds;
$host=localhost;
$password=password;
$database = feeds;

$connection = mysql_connect($host,$user,$password) or die (couldn't connect to 
server);
$db = mysql_select_db($database,$connection) or die (Couldn't select 
database);

$query = SELECT * FROM contacts, px_items WHERE contacts.id=px_items.id ORDER BY 
px_items.id DESC;

$result = mysql_query($query) or die (Couldn't execute query.);

$title = '';
while ($row = mysql_fetch_array($result)) {
if ( $title != $row['title'] ) {
$title = $row['title'];
echo h2{$title}/h2;
}
echonbsp;nbsp;{$id} - {$content} - {$timestamp} - {$notes} - .
a href=\{$link}\{$link}/abr;
}//while
?
/body
/html


This should do the trick

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different strings. But there are times 
for you and me when all such things agree.


- Rush

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread Brad Bonkoski

Daniel Brown wrote:

   Tedd,

   On all of the *nix boxes I use (and have used) I've had to install
Festival manually, so I would definitely not say that it's commonly 
found on

there especially for a server configuration.

But it IS commonly available, so why not just make it a prerequisite for 
utilizing this utility?





On 4/25/07, tedd [EMAIL PROTECTED] wrote:


At 2:07 PM -0500 4/25/07, Richard Lynch wrote:
On Wed, April 25, 2007 2:00 pm, tedd wrote:
  However, server-side text to speech is possible by delivering the
  sound to the browser via EMBED or BGSOUND tags -- an example of this
  can be seen here:

I have run Festival server side via PHP to generate audio snippets
of spoken word.

All you really need is one of the desktop packages to have a command
line interface and http://php.net/exec

Richard:

I've read about Festival and there are even some php routines that
use it. But I'm doing this from/for a virtual host. I'm looking for a
set of routines that I could place server-side and thus use to speak
web text.

I need something that I can share with others, not something special
for just my site.

-OR-

Is there a standard *nix package that I could access via exec to do
this? Is Festival commonly found on *nix?

You see, what I'm thinking is, if I can get the code/technique, then
I might be able to provide a way for non-technical types to have
their sites speak. Maybe it's just foolish thinking, but I'm prone to
that. :-)

Thanks for your help.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread Daniel Brown

   That's fine if you can find a shared host (as the OP states he's using)
that's willing to install it on their servers.


On 4/25/07, Brad Bonkoski [EMAIL PROTECTED] wrote:


Daniel Brown wrote:
Tedd,

On all of the *nix boxes I use (and have used) I've had to install
 Festival manually, so I would definitely not say that it's commonly
 found on
 there especially for a server configuration.

But it IS commonly available, so why not just make it a prerequisite for
utilizing this utility?



 On 4/25/07, tedd [EMAIL PROTECTED] wrote:

 At 2:07 PM -0500 4/25/07, Richard Lynch wrote:
 On Wed, April 25, 2007 2:00 pm, tedd wrote:
   However, server-side text to speech is possible by delivering the
   sound to the browser via EMBED or BGSOUND tags -- an example of
this
   can be seen here:
 
 I have run Festival server side via PHP to generate audio snippets
 of spoken word.
 
 All you really need is one of the desktop packages to have a command
 line interface and http://php.net/exec

 Richard:

 I've read about Festival and there are even some php routines that
 use it. But I'm doing this from/for a virtual host. I'm looking for a
 set of routines that I could place server-side and thus use to speak
 web text.

 I need something that I can share with others, not something special
 for just my site.

 -OR-

 Is there a standard *nix package that I could access via exec to do
 this? Is Festival commonly found on *nix?

 You see, what I'm thinking is, if I can get the code/technique, then
 I might be able to provide a way for non-technical types to have
 their sites speak. Maybe it's just foolish thinking, but I'm prone to
 that. :-)

 Thanks for your help.

 Cheers,

 tedd
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php









--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] Re: posting variables to parent frame

2007-04-25 Thread Zoltán Németh
2007. 04. 25, szerda keltezéssel 14.35-kor Al ezt írta:
 Very clever use of iFrame.  So clever it doesn't show in your html source 
 code.
 
 Looks more like you are using DIV tags, with simple POST values, just like 
 I'd have done it.
 
 Incidentally, br/ is an error for html.

can you tell me why br/ is an error

greets
Zoltán Németh

 
 tedd wrote:
  At 11:12 AM -0400 4/24/07, Al wrote:
  Provide an example of an iFrame that will work on all modern browsers 
  and that can't be done with DIVs or OBJECTS
  
  Al:
  
  Okay, try this:
  
  http://sperling.com/examples/captcha/
  
  I use iframe to deliver the sound without a refresh via ajax.
  
  Show me how you can use a DIV or OBJECT to do the same -- I don't think so.
  
  And from the Web Design Group:
  
  The OBJECT element is used to include objects such as images, audio, 
  videos, Java applets, and Flash animations. OBJECT is intended to 
  replace the more specific IMG and APPLET elements, as well as the 
  proprietary EMBED and BGSOUND elements, though a lack of browser support 
  and severe bugs in supporting browsers make the other elements a better 
  choice in many cases.
  
  Also, iframe is not obsolete and IE 7 does handle them.
  
  Cheers,
  
  tedd
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread Brad Bonkoski

Daniel Brown wrote:
   That's fine if you can find a shared host (as the OP states he's 
using)

that's willing to install it on their servers.

I guess I am just thinking the alternative is creating your own package 
and using that, which again would force an external entity for the 
system to support, unless there is some way for PHP to do text-to-speech 
translation, which seems way out of scope for a scripting language




On 4/25/07, Brad Bonkoski [EMAIL PROTECTED] wrote:


Daniel Brown wrote:
Tedd,

On all of the *nix boxes I use (and have used) I've had to install
 Festival manually, so I would definitely not say that it's commonly
 found on
 there especially for a server configuration.

But it IS commonly available, so why not just make it a prerequisite for
utilizing this utility?



 On 4/25/07, tedd [EMAIL PROTECTED] wrote:

 At 2:07 PM -0500 4/25/07, Richard Lynch wrote:
 On Wed, April 25, 2007 2:00 pm, tedd wrote:
   However, server-side text to speech is possible by 
delivering the

   sound to the browser via EMBED or BGSOUND tags -- an example of
this
   can be seen here:
 
 I have run Festival server side via PHP to generate audio snippets
 of spoken word.
 
 All you really need is one of the desktop packages to have a 
command

 line interface and http://php.net/exec

 Richard:

 I've read about Festival and there are even some php routines that
 use it. But I'm doing this from/for a virtual host. I'm looking for a
 set of routines that I could place server-side and thus use to speak
 web text.

 I need something that I can share with others, not something special
 for just my site.

 -OR-

 Is there a standard *nix package that I could access via exec to do
 this? Is Festival commonly found on *nix?

 You see, what I'm thinking is, if I can get the code/technique, then
 I might be able to provide a way for non-technical types to have
 their sites speak. Maybe it's just foolish thinking, but I'm prone to
 that. :-)

 Thanks for your help.

 Cheers,

 tedd
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php











--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server side speech

2007-04-25 Thread Daniel Brown

   No, that's one of my servers.  In all honesty, though, a dedicated
server or VPS is so cheap nowadays that it's almost not worth going with a
shared host anymore for any real programming.  Because if you pay for your
own server (this one is less than $60 per month) and administer it yourself
(or hire someone --- plug shame=offlike me!/plug) you can do a lot
more than a shared host, of course.

   It could be possible, though, depending on your host's system
configuration, to put a pre-compiled Festival binary in your home directory
and calling it from there.  Right off the top of my head, aside from
security policies on the box, I can't think of any reason this wouldn't
work.



On 4/25/07, tedd [EMAIL PROTECTED] wrote:


I had actually done something almost exactly like this as an
experiment
a few months back at http://isawit.com/tts/login.php.  The audio download
portion may no longer work, though I can't remember if I removed the
code from that specific server or not.  It was just for my own fun and
edification, not any kind of project.

What it did was allow someone to go to the site, type in a phrase,
the
server converted it to audio (WAV) and the user could download
it.  However,
it could easily be embedded into the page.  Then my desktop computer
would
access the database on the server once per minute to read unread phrases
through a PHP/BASh hybrid to read aloud the phrases users entered.  I had
a
simple CLI email script on my end, too, that allowed me to zip a response
to
the user in either audio or text format.

I used Festival's TTS engine, which worked just fine for me.  I did
some
modifications to it and then wrote some simple script wrappers for it.

Summary: check out Festival's TTS.  The voices need work, but it's
understandable, and it definitely does work.

Far-out!

Is it your server, or a hosted account, or does it not matter?

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] Server side speech

2007-04-25 Thread Daniel Brown

On 4/25/07, Brad Bonkoski [EMAIL PROTECTED] wrote:


 unless there is some way for PHP to do text-to-speech
translation, which seems way out of scope for a scripting language



   Give it a couple of years.  ;-P

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] TrueType font changes size when rotated?

2007-04-25 Thread Seth Price
I downloaded your image, enlarged it, and measured it out in  
photoshop. The distance from the center to the left side is 131px,  
and center to right side is 129px. Diameter to top is 129px, and to  
bottom is 130px.


While it may not be an obvious ellipse, it's enough to throw off my  
calculations.

~Seth


On Apr 25, 2007, at 1:38 PM, tedd wrote:

Yep, I'm calculating the length from the returned bounding box and  
printing it out. The box seems to randomly expand and shrink  
depending on the angle.

~Seth


~Seth:

I think it's your calculation of the bounding box that's throwing  
you off -- maybe round off errors -- I don't know. However, I don't  
see any difference in the length of the text.


The following shows Hello World . at one degree increments over  
360 degrees.


http://sperling.com/a/font/

It looks like a circle to me. If there was a difference, then it  
would be elliptical.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] List

2007-04-25 Thread Justin Frim

Have you considered using something other than Outlook?


Beauford wrote:


Does anyone else have this problem with the list. It seems that every time I
check my email there is one or more messages from the list that royally
screws up Outlook. I usually have to delete all list messages from the
actual server and reboot. It only happens with emails from
[EMAIL PROTECTED]

Just trying to narrow down the problem. Not sure if this is spam that's
sneaking into the list messing things up or what.

Thanks

 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] List

2007-04-25 Thread Daniel Brown

   It's those new Microsoft filters that crash on or block out anything
mentioning open source.  Try running the following code prior to the mail
getting to your inbox like so:
   ? str_replace(PHP,ASP,$message); ?

   Heh.  I'm getting a little loopy already it it Friday yet?!?  ;-P



On 4/25/07, Justin Frim [EMAIL PROTECTED] wrote:


Have you considered using something other than Outlook?


Beauford wrote:

Does anyone else have this problem with the list. It seems that every
time I
check my email there is one or more messages from the list that royally
screws up Outlook. I usually have to delete all list messages from the
actual server and reboot. It only happens with emails from
[EMAIL PROTECTED]

Just trying to narrow down the problem. Not sure if this is spam that's
sneaking into the list messing things up or what.

Thanks




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


[PHP] Result problem

2007-04-25 Thread Dan Shirah

Any ideas why my query only returns the very last record that matches the
criteria specified??

$sql_record =SELECT * FROM payment_request WHERE status_code = 'P';
$result_record = mssql_query($sql_record) or die(mssql_error());
 if(!empty($result_record)) {
 while ($row_record = mssql_fetch_array($result_record)) {
$id_record = $row_record['id'];
  }
 }
 print_r ($sql_record);

The result of the print_r displays only the last record that matches the
query criteria.  I tried a foreach instead of a while with no luck.


Re: [PHP] List

2007-04-25 Thread Zoltán Németh
2007. 04. 25, szerda keltezéssel 16.42-kor Daniel Brown ezt írta:
 It's those new Microsoft filters that crash on or block out anything
 mentioning open source.  Try running the following code prior to the mail
 getting to your inbox like so:
 ? str_replace(PHP,ASP,$message); ?
 
 Heh.  I'm getting a little loopy already it it Friday yet?!?  ;-P

heh that was coool :DD

sorry pal it's only wednesday...

greets
Zoltán Németh


 
 
 
 On 4/25/07, Justin Frim [EMAIL PROTECTED] wrote:
 
  Have you considered using something other than Outlook?
 
 
  Beauford wrote:
 
  Does anyone else have this problem with the list. It seems that every
  time I
  check my email there is one or more messages from the list that royally
  screws up Outlook. I usually have to delete all list messages from the
  actual server and reboot. It only happens with emails from
  [EMAIL PROTECTED]
  
  Just trying to narrow down the problem. Not sure if this is spam that's
  sneaking into the list messing things up or what.
  
  Thanks
  
  
  
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Result problem

2007-04-25 Thread Zoltán Németh
2007. 04. 25, szerda keltezéssel 16.56-kor Dan Shirah ezt írta:
 Any ideas why my query only returns the very last record that matches the
 criteria specified??
 
 $sql_record =SELECT * FROM payment_request WHERE status_code = 'P';
 $result_record = mssql_query($sql_record) or die(mssql_error());
   if(!empty($result_record)) {
   while ($row_record = mssql_fetch_array($result_record)) {
  $id_record = $row_record['id'];
}
   }
   print_r ($sql_record);

in the above line you are printing out the query. I think that's not
what you want...

greets
Zoltán Németh

 
 The result of the print_r displays only the last record that matches the
 query criteria.  I tried a foreach instead of a while with no luck.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: posting variables to parent frame

2007-04-25 Thread tedd

At 2:35 PM -0400 4/25/07, Al wrote:
Very clever use of iFrame.  So clever it doesn't show in your html 
source code.


If you used a browser that could see generated html (like FireFox), 
then you will see it -- try it. It's good to know about tools like 
that.


Looks more like you are using DIV tags, with simple POST values, 
just like I'd have done it.


Yeah, but mine is designed for the blind and using div's with a 
simple post would have required a screen refresh, which is not 
desirable for screen readers.


You simply don't understand what I did nor the requirements of the task

Now, you made the statement below and asked for an example -- I 
provided one. Either let it drop, or mimic my efforts and show me an 
example where you don't use iframe and it works under the 
requirements my example met. In other words, prove me wrong.



Incidentally, br/ is an error for html.


Really -- why don't you tell the w3c about that?

http://www.w3schools.com/tags/tag_br.asp

OR maybe tell me why my site passes w3c HTML validation:

http://validator.w3.org/check?uri=http://sperling.com/examples/captcha/

If it's an error, they didn't catch it.

It's probably best if you defend just one error at a time.

Cheers,

tedd

PS: Please don't top post.

---




tedd wrote:

At 11:12 AM -0400 4/24/07, Al wrote:
Provide an example of an iFrame that will work on all modern 
browsers and that can't be done with DIVs or OBJECTS


Al:

Okay, try this:

http://sperling.com/examples/captcha/

I use iframe to deliver the sound without a refresh via ajax.

Show me how you can use a DIV or OBJECT to do the same -- I don't think so.

And from the Web Design Group:

The OBJECT element is used to include objects such as images, 
audio, videos, Java applets, and Flash animations. OBJECT is 
intended to replace the more specific IMG and APPLET elements, as 
well as the proprietary EMBED and BGSOUND elements, though a lack 
of browser support and severe bugs in supporting browsers make the 
other elements a better choice in many cases.


Also, iframe is not obsolete and IE 7 does handle them.

Cheers,

tedd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Result problem

2007-04-25 Thread Dan Shirah

Okay, print_r($result_record) for the query result.

But I still don't know why it's only returning the last record of the query
instead of all the results.

On 4/25/07, Zoltán Németh [EMAIL PROTECTED] wrote:


2007. 04. 25, szerda keltezéssel 16.56-kor Dan Shirah ezt írta:
 Any ideas why my query only returns the very last record that matches
the
 criteria specified??

 $sql_record =SELECT * FROM payment_request WHERE status_code = 'P';
 $result_record = mssql_query($sql_record) or die(mssql_error());
   if(!empty($result_record)) {
   while ($row_record = mssql_fetch_array($result_record)) {
  $id_record = $row_record['id'];
}
   }
   print_r ($sql_record);

in the above line you are printing out the query. I think that's not
what you want...

greets
Zoltán Németh


 The result of the print_r displays only the last record that matches the
 query criteria.  I tried a foreach instead of a while with no luck.




Re: [PHP] Re: posting variables to parent frame

2007-04-25 Thread Lori Lay

Zoltán Németh wrote:



Incidentally, br/ is an error for html.



can you tell me why br/ is an error

greets
Zoltán Németh


  
br/ is xhtml.  It's not an error in xhtml, but might confuse older 
browsers.  I tried it, even with a strict HTML 4.01 doctype and didn't 
get any errors, but who knows.  I have read that br/ might confuse 
older browsers, so it is usually written br / to avoid problems.


The basic HTML version is br.

Lori

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Result problem

2007-04-25 Thread Lori Lay

Dan Shirah wrote:

Okay, print_r($result_record) for the query result.

But I still don't know why it's only returning the last record of the 
query

instead of all the results.


Because it's a cursor and you're not resetting the position.  You can't 
print the entire result set this way - you have to iterate through the 
result set in a loop, printing out the row on each iteration.


Lori


On 4/25/07, Zoltán Németh [EMAIL PROTECTED] wrote:


2007. 04. 25, szerda keltezéssel 16.56-kor Dan Shirah ezt írta:
 Any ideas why my query only returns the very last record that matches
the
 criteria specified??

 $sql_record =SELECT * FROM payment_request WHERE status_code = 'P';
 $result_record = mssql_query($sql_record) or die(mssql_error());
   if(!empty($result_record)) {
   while ($row_record = mssql_fetch_array($result_record)) {
  $id_record = $row_record['id'];
}
   }
   print_r ($sql_record);

in the above line you are printing out the query. I think that's not
what you want...

greets
Zoltán Németh


 The result of the print_r displays only the last record that 
matches the

 query criteria.  I tried a foreach instead of a while with no luck.






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Result problem

2007-04-25 Thread Richard Lynch
On Wed, April 25, 2007 3:56 pm, Dan Shirah wrote:
 Any ideas why my query only returns the very last record that matches
 the
 criteria specified??

 $sql_record =SELECT * FROM payment_request WHERE status_code = 'P';
 $result_record = mssql_query($sql_record) or die(mssql_error());
   if(!empty($result_record)) {
   while ($row_record = mssql_fetch_array($result_record)) {
  $id_record = $row_record['id'];
}
   }
   print_r ($sql_record);

 The result of the print_r displays only the last record that matches
 the
 query criteria.  I tried a foreach instead of a while with no luck.

You do the 'print_r' *AFTER* you've run through all the records.

Move that line *INSIDE* the loop, and it will print each one as it
goes through.

This will be more clear if you indent better, though that may just be
email messing up, not your real code.

Every time you type a '{', indent by one tab.
Stay indented until you type a '}'

The flow of the program is then seen by skimming with the eyes
downward on the left side, and the 'print_r' being outside the loop
will be more obvious, with practice.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Result problem

2007-04-25 Thread Zoltán Németh
2007. 04. 25, szerda keltezéssel 17.03-kor Dan Shirah ezt írta:
 Okay, print_r($result_record) for the query result.

$result_record is a resource identifier. you are not interested in that
too, I think... ;)
if you want all records, then stuff them into an array and use that:

while ($row_record = mssql_fetch_array($result_record)) {
  $id_record[] = $row_record['id'];
}
print_r ($id_record);

greets
Zoltán Németh

  
 But I still don't know why it's only returning the last record of the
 query instead of all the results.
  
 On 4/25/07, Zoltán Németh [EMAIL PROTECTED] wrote: 
 2007. 04. 25, szerda keltezéssel 16.56-kor Dan Shirah ezt
 írta:
  Any ideas why my query only returns the very last record
 that matches the 
  criteria specified??
 
  $sql_record =SELECT * FROM payment_request WHERE
 status_code = 'P';
  $result_record = mssql_query($sql_record) or
 die(mssql_error());
if(!empty($result_record)) { 
while ($row_record = mssql_fetch_array($result_record)) {
   $id_record = $row_record['id'];
 }
}
print_r ($sql_record);
 
 in the above line you are printing out the query. I think
 that's not 
 what you want...
 
 greets
 Zoltán Németh
 
 
  The result of the print_r displays only the last record that
 matches the
  query criteria.  I tried a foreach instead of a while with
 no luck.
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Result problem

2007-04-25 Thread Daniel Brown

   Just a first glance, Dan, but try this:

$sql_record =SELECT * FROM payment_request WHERE status_code = 'P';
$result_record = mssql_query($sql_record) or die(mssql_error());
 if(!empty($result_record)) {
 while ($row_record = mssql_fetch_array($result_record)) {
echo $row_record['id'];
  }
 }

   That should echo all of the data in the 'id' column from the matching
rows.


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] Result problem

2007-04-25 Thread Dan Shirah

I'm sorry, perhaps I confused everyone by including the print_r.

My table has 79 records all with a status_code of 'P' that this should be
returning.  But instead of all the results returning, all I am getting back
is row 79.



On 4/25/07, Richard Lynch [EMAIL PROTECTED] wrote:


On Wed, April 25, 2007 3:56 pm, Dan Shirah wrote:
 Any ideas why my query only returns the very last record that matches
 the
 criteria specified??

 $sql_record =SELECT * FROM payment_request WHERE status_code = 'P';
 $result_record = mssql_query($sql_record) or die(mssql_error());
   if(!empty($result_record)) {
   while ($row_record = mssql_fetch_array($result_record)) {
  $id_record = $row_record['id'];
}
   }
   print_r ($sql_record);

 The result of the print_r displays only the last record that matches
 the
 query criteria.  I tried a foreach instead of a while with no luck.

You do the 'print_r' *AFTER* you've run through all the records.

Move that line *INSIDE* the loop, and it will print each one as it
goes through.

This will be more clear if you indent better, though that may just be
email messing up, not your real code.

Every time you type a '{', indent by one tab.
Stay indented until you type a '}'

The flow of the program is then seen by skimming with the eyes
downward on the left side, and the 'print_r' being outside the loop
will be more obvious, with practice.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




Re: [PHP] Preventing SQL Injection/ Cross Site Scripting

2007-04-25 Thread Justin Frim

Dotan Cohen wrote:


I currently an using htmlencode, so  and  show as expected. I do
expect the math faculty to use those symbols :).



Then you're already protected from XSS attacks, no HTML filters 
necessary.  Easy as pi.  ;-)



(ok, that one was lame)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   >