php-general Digest 6 Nov 2006 19:59:24 -0000 Issue 4444

2006-11-06 Thread php-general-digest-help

php-general Digest 6 Nov 2006 19:59:24 - Issue 

Topics (messages 244249 through 244266):

Re: WAP?
244249 by: clive
244250 by: clive

What is 'object class introspection '?
244251 by: John.H

Re: PHP Zip Question
244252 by: Matt Street

Help! PRINTF Function
244253 by: ngoc.truong-torche.vd.ch
244254 by: Dotan Cohen
244258 by: Roman Neuhauser

Re: PHP in Kenya
244255 by: tedd
244257 by: clive

Re: Sorting MySQL queries
244256 by: tedd
244265 by: Curt Zirzow

Re: Protecting Streaming Audio
244259 by: Ed Lazor

Freelance php project... clone a website's functionality [0T]
244260 by: Ryan A

fwrite() timeout
244261 by: Martin Cetkovsky
244264 by: Martin Cetkovsky

Re: Microsoft Partners With Zend
244262 by: Martin Cetkovsky
244263 by: Martin Cetkovsky

Pulling Data From a Page
244266 by: Phillip Baker

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---

Richard Lynch wrote:

On Fri, November 3, 2006 3:14 am, clive wrote:




The closest I can come is with a deck whose entire contents spew out
at once to a handset:


Is there any reason why you insist on using WAP 1.X?

clive
---End Message---
---BeginMessage---

Richard Lynch wrote:

On Fri, November 3, 2006 3:14 am, clive wrote:




http://www.acousticdemo.com/nationalsystems/pizzahut.com/wap/index.wml


tried the url on my nokia 6230i and get your first card displaying 
correctly.




---End Message---
---BeginMessage---

It is a shortage of PHP4?Right?
---End Message---
---BeginMessage---
Thanks for the response, I decided that it was easier to unpack the zip 
during the upload process and then delete the zip. I can then indicate 
which files I want to zip up and this works (opening the zip on the 
server), but, and it's a big but, when the zip is downloaded to the 
users machine it is being corrupted! 

To force the download I use: 

header('Content-type: application/zip'); 
header('Content-Disposition:  attachment; filename='.$tutorzipfile); 
readfile($filename); 

Which correctly gives me: 

Content-Type: application/zip 
Content-disposition: attachment; filename=tutorzipfile.zip 

when viewing the LiveHTTPHeaders extension in firefox. 

However, when I view the zip file that is downloaded to my machine, in 
Textpad, php has appended the directory information of the files I'm 
zipping up onto the front of the zip file, so it no longer starts PK!!! 

Anyone any ideas??? 

Thanks in advance 

Matt
---End Message---
---BeginMessage---

Hello,

The following examples don't work
   
   
   
  printf([%10s]\n,    $s); // justification à droite avec des espaces
  printf([%-10s]\n,  $s); // justification à gauche avec des espaces
   
   



but this one:
   
   
   
  printf([%'#10s]\n,  $s); // utilisation du caractère personnalisé de
  séparation '#' 
   
   

is ok (with any separator)

Source: http://ch2.php.net/manual/fr/function.sprintf.php

Is it related to French characters set I used for displaying my page ?

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=fr lang=fr

Thanks for your advice
N. TRUONG---End Message---
---BeginMessage---

On 06/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Hello,

The following examples don't work



  printf([%10s]\n, $s); // justification à droite avec des espaces
  printf([%-10s]\n, $s); // justification à gauche avec des espaces





but this one:



  printf([%'#10s]\n, $s); // utilisation du caractère personnalisé de
  séparation '#'



is ok (with any separator)

Source: http://ch2.php.net/manual/fr/function.sprintf.php

Is it related to French characters set I used for displaying my page ?



We'd only know if you told us what doesn't work means. Do you get
_any_ output? What? Error messages? Are you sure that you're using
UTF-8 encoding?

Dotan Cohen


[PHP] What is 'object class introspection '?

2006-11-06 Thread John . H

It is a shortage of PHP4?Right?


RE: [PHP] PHP Zip Question

2006-11-06 Thread Matt Street
Thanks for the response, I decided that it was easier to unpack the zip 
during the upload process and then delete the zip. I can then indicate 
which files I want to zip up and this works (opening the zip on the 
server), but, and it's a big but, when the zip is downloaded to the 
users machine it is being corrupted! 

To force the download I use: 

header('Content-type: application/zip'); 
header('Content-Disposition:  attachment; filename='.$tutorzipfile); 
readfile($filename); 

Which correctly gives me: 

Content-Type: application/zip 
Content-disposition: attachment; filename=tutorzipfile.zip 

when viewing the LiveHTTPHeaders extension in firefox. 

However, when I view the zip file that is downloaded to my machine, in 
Textpad, php has appended the directory information of the files I'm 
zipping up onto the front of the zip file, so it no longer starts PK!!! 

Anyone any ideas??? 

Thanks in advance 

Matt

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



[PHP] Help! PRINTF Function

2006-11-06 Thread ngoc . truong-torche

Hello,

The following examples don't work
   
   
   
  printf([%10s]\n,    $s); // justification à droite avec des espaces
  printf([%-10s]\n,  $s); // justification à gauche avec des espaces
   
   



but this one:
   
   
   
  printf([%'#10s]\n,  $s); // utilisation du caractère personnalisé de
  séparation '#' 
   
   

is ok (with any separator)

Source: http://ch2.php.net/manual/fr/function.sprintf.php

Is it related to French characters set I used for displaying my page ?

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=fr lang=fr

Thanks for your advice
N. TRUONG
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help! PRINTF Function

2006-11-06 Thread Dotan Cohen

On 06/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Hello,

The following examples don't work



  printf([%10s]\n, $s); // justification à droite avec des espaces
  printf([%-10s]\n, $s); // justification à gauche avec des espaces





but this one:



  printf([%'#10s]\n, $s); // utilisation du caractère personnalisé de
  séparation '#'



is ok (with any separator)

Source: http://ch2.php.net/manual/fr/function.sprintf.php

Is it related to French characters set I used for displaying my page ?



We'd only know if you told us what doesn't work means. Do you get
_any_ output? What? Error messages? Are you sure that you're using
UTF-8 encoding?

Dotan Cohen

http://what-is-what.com/what_is/xml.html


Re: [PHP] PHP in Kenya

2006-11-06 Thread tedd

At 4:27 PM +0300 11/5/06, Mark Steudel wrote:

I'm currently serving in Peace Corps in Kenya and I was looking for other
PHP web developers that are doing e-commerce that I could ping about what
requirements/paperwork etc is involved in setting up e-commerce accounts in
Kenya.

Thanks, Mark


Mark:

Why should it make any difference where you set it up?

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] Sorting MySQL queries

2006-11-06 Thread tedd

At 3:13 PM +0200 11/5/06, Dotan Cohen wrote:

I have a list of subjects, such as Linux, Open Source, and the
World Wide Web. The subjects are stored in a database and being
retrieved via php. I currently organize them alphabetically with SQL's
ORDER BY ASC argument, however, if there is a preceding the  or a 
then that is considered as part of the alphabetical order. Thus, all
the subjects starting with the  are grouped together, as are the
subjects starting with a . How can I order by ascending, without
taking the preceding the  or a  into account?

Thanks in advance.

Dotan Cohen



Dotan:

In your table, set up a sort field. That way there will be no 
interpolation as to what you want.


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] PHP in Kenya

2006-11-06 Thread clive

tedd wrote:


Mark:

Why should it make any difference where you set it up?


differant countries and there banks have different policy's when it come 
to online credit card transactions.




tedd


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



Re: [PHP] Help! PRINTF Function

2006-11-06 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-11-06 12:46:14 +0100:
 
 Hello,
 
 The following examples don't work

   printf([%10s]\n,    $s); // justification ? droite avec des espaces
   printf([%-10s]\n,  $s); // justification ? gauche avec des espaces

 but this one:

   printf([%'#10s]\n,  $s); // utilisation du caract?re personnalisé de
   séparation '#' 
 
 is ok (with any separator)

it works:

[EMAIL PROTECTED] ~ 1003:0  php tmp/scratch
[monkey]
[monkey]
[monkey]
[monkey]
[monkey]
[many monke]
[EMAIL PROTECTED] ~ 1004:0 

 Is it related to French characters set I used for displaying my page ?

No, it's related to your browser replacing multiple whitespace
characters with a single horizontal space.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Protecting Streaming Audio

2006-11-06 Thread Ed Lazor
use readfile to read the file and output it to the browser.  I don't  
know the specific ones, but you'll need to also send headers that  
declare the file as streaming media.



On Nov 4, 2006, at 10:08 PM, Adam Gittins wrote:


Thanks. :)
That's an idea... Few questions. Grab the file and sendt it to  
someone, that
would work with a download but would it work with a streaming audio  
file,
because that has to be opened in realOne player or windows media  
player? I
was searching PHP.net documentation for a way of grabbing a file -  
what

function would be used?? Sorry about the silly questions..

Sincerely,
Adam




On 11/4/06, Ed Lazor [EMAIL PROTECTED] wrote:


You put the data in a directory outside of the webspace and use PHP
to grab the file and send it to someone.  That way you're able to
control access to the file.

By webspace, I'm referring to the directories outside of the ones
used to store and serve your webpages.  This directory structure
would serve as an example for where you store your webpages and where
you store your data separately from the webpages:

/www/www.somesite.com/htdocs
/www/www.somesite.com/data




On Nov 3, 2006, at 9:29 PM, Adam Gittins wrote:

 Dear List,

 I have had a question that has been bugging me for a while now.
 Say
 that I need to have a members website. Which I want to protect
 streaming
 audio (Real, or Windows Media), now all the pages I can protect
 with a MYSQL
 DB and PHP. But when it comes to protecting a url of a file or
 audio feed it
 becomes tricky. What is the procedure? Would I have to use the
 htaccess
 file? But then when I open a realaudio file it will ask for a
 username and
 passworld again..

 How does one protect an url - or do I have to copy the file to a
 temp dir
 and then after a set time delete it?

 Help, there must be a way..

 Thanks for any ideas..

 Sincerely,
 Adam




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



[PHP] Freelance php project... clone a website's functionality [0T]

2006-11-06 Thread Ryan A
Hey all,

Most of you have seen me long enough on this list and helped me more times than 
I want to remember to know that this is not a spam email, that said...

A project has dropped into my lap to clone a site's functionality... rather 
than post it on the many freelance job sites as I dont have time to do this 
myself (and not sure about the skill either...even though i know i can come 
here for help if I hit a brick wall in the middle of the project) thought I 
would give it a shot here first.

I'll just skim the details so most of you will know if you're interested in a 
few seconds and can write back to me for details (offlist, we dont want to 
offend anyone :) )

===
Budget: around $800 USD

Skills needed:
===
PHP 4 (NOT 5)

MySql

Smarty (No designing needed, we'll get the designs later and connect them)

(This will be running on a Linux server so a little understanding/experience 
here would be a bonus but its not a requirment.)

Understanding the httpd.conf file of apache and (IMPORTANT) URL rewriting via 
directives in that file

Understanding PERL (as theres one client script that has to be in 
PERL...already created)

If you're serious about freelancing for a project please reply, I ask the 
simply curious to kindly ignore this post. Thanks in advance!
 
Questions? I'm just an email away :)

Cheers!
Ryan





--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
-
Everyone is raving about the all-new Yahoo! Mail.

[PHP] fwrite() timeout

2006-11-06 Thread Martin Cetkovsky

Hi,

I am using the fsockopen(), fwrite() and fread() functions to get a web 
page from a remote server. The remote server is currently down and I see 
the code hangs on the fwrite() call. Is there a way how to set a timeout 
for the fwrite() remote call?


I have found the stream_set_timeout(), but it seems not to be effective 
on the fwrite(), only on fread().


Thanks,

Martin

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



Re: [PHP] Microsoft Partners With Zend

2006-11-06 Thread Martin Cetkovsky
On Wed, 01 Nov 2006 23:23:15 +0100, Jay Blanchard  
[EMAIL PROTECTED] wrote:



[snip]
I guess that's sorta what I'm afraid of... PHP#
(like the did to Java - J++ - C# )

Don't get me wrong. C# is a great language (probably one of the few
things
that M$ did right), and I'd LOVE to use a real IDE like Visual
Studio to
dev in...

But I'm also terrified they'll pervert PHP.
[/snip]

Please NO PHP.NET === ACCCKKK


The .NET compiler for PHP exists for many years. It was created by  
students of the Charles University in Prague.


Martin

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



Re: [PHP] Microsoft Partners With Zend

2006-11-06 Thread Martin Cetkovsky

Jay Blanchard wrote:

[snip]
I guess that's sorta what I'm afraid of... PHP# 
(like the did to Java - J++ - C# )


Don't get me wrong. C# is a great language (probably one of the few
things
that M$ did right), and I'd LOVE to use a real IDE like Visual
Studio to
dev in... 


But I'm also terrified they'll pervert PHP.
[/snip]

Please NO PHP.NET === ACCCKKK


The .NET compiler for PHP exists for many years. It is created and 
managed by students of the Charles University in Prague.


Martin

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



[PHP] fwrite() timeout

2006-11-06 Thread Martin Cetkovsky

Hi,

I am using the fsockopen(), fwrite() and fread() functions to get a web  
page from a remote server. The remote server is currently down and I see  
the code hangs on the fwrite() call. Is there a way how to set a timeout  
for the fwrite() remote call?


I have found the stream_set_timeout(), but it seems not to be effective on  
the fwrite(), only on fread().


Thanks,

Martin

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



Re: [PHP] Sorting MySQL queries

2006-11-06 Thread Curt Zirzow

On 11/5/06, Roman Neuhauser [EMAIL PROTECTED] wrote:


If you used PostgreSQL I'd suggest a functional index and ordering
on the function... Does MySQL have anything like this?

CREATE FUNCTION fn(TEXT)
RETURNS TEXT
IMMUTABLE STRICT
LANGUAGE SQL
AS $$
  SELECT regexp_replace($1, '^(?:(?:a|the)[[:space:]]+)', '', 'i');
$$;

CREATE INDEX ON table(fn(subject));


Thats rather nifty, i dont think you can do that with mysql, but you
could achieve something close to that with a trigger for insert/update
to apply the regex to a different field that is used for sorting.

The other option would make a policy to put , The or , A at the
end of the string a simple function to render the text without the
comma at the end would be simple to do.

Curt

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



[PHP] Pulling Data From a Page

2006-11-06 Thread Phillip Baker

Greetings All,

Have something that I am sure is easy to do, just never done it before and
would like some guidance here.

I need to pull treasure yield percentage rates into a loan site I am working
on.

So basically I want to hit a page from another site.
Grab the HTML file.
Parse it for the values I am looking for.
And then plug it into variables for use on my site.

Any ideas on the best way to do this??

--
Blessed Be

Phillip


Re: [PHP] Pulling Data From a Page

2006-11-06 Thread Robert Cummings
On Mon, 2006-11-06 at 11:59 -0800, Phillip Baker wrote:
 Greetings All,
 
 Have something that I am sure is easy to do, just never done it before and
 would like some guidance here.
 
 I need to pull treasure yield percentage rates into a loan site I am working
 on.
 
 So basically I want to hit a page from another site.
 Grab the HTML file.
 Parse it for the values I am looking for.
 And then plug it into variables for use on my site.
 
 Any ideas on the best way to do this??

Probably preg_matchall()

http://www.php.net/manual/en/function.preg-match-all.php

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] Pulling Data From a Page

2006-11-06 Thread Google Kreme

On 06 Nov 2006, at 12:59 , Phillip Baker wrote:

So basically I want to hit a page from another site.


If you are going to be polling another site and parsing it for data  
you'd better have permission to do so.



--
I find Windows of absolutely no technical interest... Mac OS X is a  
rock-solid system that's beautifully designed. I much prefer it to  
Linux. -- Bill Joy


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



Re: [PHP] Microsoft Partners With Zend

2006-11-06 Thread Rory Browne

On 11/6/06, Martin Cetkovsky [EMAIL PROTECTED] wrote:


Jay Blanchard wrote:
 [snip]
 I guess that's sorta what I'm afraid of... PHP#
 (like the did to Java - J++ - C# )

 Don't get me wrong. C# is a great language (probably one of the few
 things
 that M$ did right), and I'd LOVE to use a real IDE like Visual
 Studio to
 dev in...

 But I'm also terrified they'll pervert PHP.
 [/snip]

 Please NO PHP.NET === ACCCKKK

The .NET compiler for PHP exists for many years. It is created and
managed by students of the Charles University in Prague.



There are already two such compilers, phlanger, and php4mono. You could
probably also user quercus, and ikvm if  you wanted to.

I can imagine playing around with php4mono, or quercus at some stage, but I
can't see myself going near Phalanger. This is mainly due to its dirty
licence:

A few extracts:

You may not modify the Software.,

You may not reverse engineer, decompile, or disassemble the Software,
except and only to the extent that such activity is expressly permitted by
applicable law notwithstanding this limitation.,

and

Your rights under the License end automatically if you breach it in any
way.

combined with

The Software includes libraries in its distribution package (directory
Extensions) that are part of the PHP software

I therefore have a negative viewpoint on the developers, given their failure
to distribute phlanger under an apahe-style licence similar to that  used by
the real PHP.


RE: [PHP] Microsoft Partners With Zend

2006-11-06 Thread Ray Hauge
I'd say to just use the Zend Core for Windows.  If you want to use
Visual Studio to edit PHP files, I have seen some information about how
to do it that doesn't involve any PHP compilers.  As Zend and MS work
together Zend Core for Windows will only get more and more stable.  I'm
pretty sure that Zend Core can be freely downloaded as well.

http://www.zend.com/products/zend_core/windows_preview

Ray

PS. Sorry about the top-post, but I recently moved to Outlook, and I
haven't bothered to configure it for bottom-posting yet.

-Original Message-
From: Rory Browne [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 06, 2006 2:50 PM
To: Martin Cetkovsky
Cc: php-general@lists.php.net
Subject: Re: [PHP] Microsoft Partners With Zend

On 11/6/06, Martin Cetkovsky [EMAIL PROTECTED] wrote:

 Jay Blanchard wrote:
  [snip]
  I guess that's sorta what I'm afraid of... PHP#
  (like the did to Java - J++ - C# )
 
  Don't get me wrong. C# is a great language (probably one of the few
  things
  that M$ did right), and I'd LOVE to use a real IDE like Visual
  Studio to
  dev in...
 
  But I'm also terrified they'll pervert PHP.
  [/snip]
 
  Please NO PHP.NET === ACCCKKK

 The .NET compiler for PHP exists for many years. It is created and
 managed by students of the Charles University in Prague.


There are already two such compilers, phlanger, and php4mono. You could
probably also user quercus, and ikvm if  you wanted to.

I can imagine playing around with php4mono, or quercus at some stage,
but I
can't see myself going near Phalanger. This is mainly due to its dirty
licence:

A few extracts:

You may not modify the Software.,

You may not reverse engineer, decompile, or disassemble the Software,
except and only to the extent that such activity is expressly permitted
by
applicable law notwithstanding this limitation.,

and

Your rights under the License end automatically if you breach it in any
way.

combined with

The Software includes libraries in its distribution package (directory
Extensions) that are part of the PHP software

I therefore have a negative viewpoint on the developers, given their
failure
to distribute phlanger under an apahe-style licence similar to that
used by
the real PHP.

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



Re: [PHP] Pulling Data From a Page

2006-11-06 Thread Richard Lynch
On Mon, November 6, 2006 1:59 pm, Phillip Baker wrote:
 Grab the HTML file.

You have correctly identified it as a FILE.

Try looking on the php.net site for FILE functions.

http://php.net/file_get_contents

echo htmlentities(file_get_contents('http://php.net/'));

 Parse it for the values I am looking for.

http://php.net/pcre
http://php.net/preg_match_all

 And then plug it into variables for use on my site.


If you need to login to get to the page you want, you'll probably want
to use curl:
http://php.net/curl

Also check if the data you want is provided by RSS feed instead of
web-scraping.

And the previous post regarding permission is definitely Right.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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



[PHP] fsockopen error messages

2006-11-06 Thread Philip Thompson

Hi.

I have not dealt much with fsockopen, but after looking at many  
examples, I'm not finding the answers I need. fsockopen is not  
returning anything and I'm trying to find out what the issue is. The  
error messages are not provided and I'm not sure what's going on.  
Help please!


?
$fp = fsockopen($host, $port, $errno, $errstr);

if (!$fp) {
echo fsock NOT opened!br/;
echo Error: $errstr ($errno)br /\n;
}
?

Thanks,
~Philip

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



RE: [PHP] PHP Zip Question

2006-11-06 Thread Richard Lynch
On Mon, November 6, 2006 6:28 am, Matt Street wrote:
 Thanks for the response, I decided that it was easier to unpack the
 zip
 during the upload process and then delete the zip. I can then indicate
 which files I want to zip up and this works (opening the zip on the
 server), but, and it's a big but, when the zip is downloaded to the
 users machine it is being corrupted!

 To force the download I use:

 header('Content-type: application/zip');
 header('Content-Disposition:  attachment; filename='.$tutorzipfile);
 readfile($filename);

 Which correctly gives me:

 Content-Type: application/zip
 Content-disposition: attachment; filename=tutorzipfile.zip

 when viewing the LiveHTTPHeaders extension in firefox.

Rant #37
http://richardlynch.blogspot.com/

 However, when I view the zip file that is downloaded to my machine, in
 Textpad, php has appended the directory information of the files I'm
 zipping up onto the front of the zip file, so it no longer starts
 PK!!!

PHP didn't do it.

Your zip routines may have done it.

Your code may have done it.

But PHP is not, no its own, just outputting the directory info for no
real reason.

Put an exit right before you readfile() and the headers.

You may need to move the headers down below all the code that
calculates what's getting zipped up and all that...

Dollars to donuts says you've left behind a debugging:
echo pwd();
or something similar.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] WAP?

2006-11-06 Thread Richard Lynch
On Mon, November 6, 2006 1:23 am, clive wrote:
 Richard Lynch wrote:
 On Fri, November 3, 2006 3:14 am, clive wrote:


 The closest I can come is with a deck whose entire contents spew out
 at once to a handset:

 Is there any reason why you insist on using WAP 1.X?

I dunno that I insist on it...

So far, in my limited reading, it seems like more than a few people
are saying the 1.x-only handsets are still out there

It pretty much has to just work for any user in the United States.
Or Canada.

At least, that's the closest thing I've got to a spec from the
client at this point on this particular sub-project of the project.

I'm very much in the research phase here though.

Have all 1.x-only handsets been retired/replaced?

I haven't made any kind of decision on this yet at all.

I'm just happy to have Hello World working.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] fsockopen error messages

2006-11-06 Thread Richard Lynch
Depending on your php.ini settings, it may be set up to wait FOREVER
for a socket to open...

What $host?
What $port?

Is it public? Private?

Is there any authentication scheme in place?

We've got nothing to work with here to help you...

On Mon, November 6, 2006 2:58 pm, Philip Thompson wrote:
 Hi.

 I have not dealt much with fsockopen, but after looking at many
 examples, I'm not finding the answers I need. fsockopen is not
 returning anything and I'm trying to find out what the issue is. The
 error messages are not provided and I'm not sure what's going on.
 Help please!

 ?
 $fp = fsockopen($host, $port, $errno, $errstr);

 if (!$fp) {
  echo fsock NOT opened!br/;
  echo Error: $errstr ($errno)br /\n;
 }
 ?

 Thanks,
 ~Philip

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] image commands (again)

2006-11-06 Thread Richard Lynch
On Sun, November 5, 2006 4:31 pm, Ron Piggott (PHP) wrote:
 I created a form that I have on my site --- it is at
 http://www.actsministrieschristianevangelism.org/development_tools/textart/details.html

 If I run this script it creates a graphic image of the text the user
 typed in with the appropriate options selected

 I would now like to have the image created to have some HTML around
 it ... I would like to have some text above the image and following
 it.
 How do I do this in PHP?

 I would like something like
.
.
.
 Content-type: image/

 the browser expects only the image to output to the screen and no HTML

You can't get it to work because you are not thinking the Right Way :-)

A single HTTP request can return an HTML document, *or* it can return
an IMAGE, but it can't do both. [*]

You *could* do something like this, however:

?php
  $_CLEAN['text'] = preg_replace('/[[:alnum:]]/', '', $_REQUEST['text']);
?
html
headtitlerequired by w3c/title/head
body
  pThe text you typed was: ?php echo $_CLEAN['text']?/p
  img src=image_maker.php?text=?php echo
urlencode($_CLEAN['text'])? /
  pThanks you for using our service./p
/body
/html

It seems like your existing solution DOES this already.

There's no way to do it as a single HTTP request, though. [*]


[*] Technically, you *can* embed the image data in the HTTP HTML
output stream, but it's very cludgy, doesn't scale well, usually, and
not supported well by all (ancient) browsers.  Don't do that.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] imageloadfont

2006-11-06 Thread Richard Lynch
On Sun, November 5, 2006 1:33 pm, Ron Piggott (PHP) wrote:
 How do you make .gdf files for use with imageloadfont ?  Ron

I would dig through all the user comments here:
http://php.net/imageloadfont

And then read the documentation referenced on the GD site and maybe
check out if source code is available for the font generator program,
or that other font generator program, or that one online font
generator web application...

But that's just me. :-)

I've never heard of a .gdf until today, so maybe there's another way.

Or you could just Google for .gdf and see if you can find some free
fonts to download/install instead.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] 301 redirect returning 302 instead

2006-11-06 Thread ianevans
Just upgraded to 5.2.0 and alas, the 301/302 issue still exists. Guess
I'll head off to bugs.php.net

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



Re: [PHP] fsockopen error messages

2006-11-06 Thread Philip Thompson
Ok, since my last post, I have slapped myself on the wrist. I made a  
newbie mistake. The function that I send the host, port, etc to was  
in the wrong order from an older version of the function I had. So...  
the port was MSIE... instead of 80. Way to go me! =\


Thanks Richard.

~Philip


On Nov 6, 2006, at 3:12 PM, Richard Lynch wrote:


Depending on your php.ini settings, it may be set up to wait FOREVER
for a socket to open...

What $host?
What $port?

Is it public? Private?

Is there any authentication scheme in place?

We've got nothing to work with here to help you...

On Mon, November 6, 2006 2:58 pm, Philip Thompson wrote:

Hi.

I have not dealt much with fsockopen, but after looking at many
examples, I'm not finding the answers I need. fsockopen is not
returning anything and I'm trying to find out what the issue is. The
error messages are not provided and I'm not sure what's going on.
Help please!

?
$fp = fsockopen($host, $port, $errno, $errstr);

if (!$fp) {
 echo fsock NOT opened!br/;
 echo Error: $errstr ($errno)br /\n;
}
?

Thanks,
~Philip


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



Re: [PHP] Sorting MySQL queries

2006-11-06 Thread Richard Lynch
On Sun, November 5, 2006 7:13 am, Dotan Cohen wrote:
 I have a list of subjects, such as Linux, Open Source, and the
 World Wide Web. The subjects are stored in a database and being
 retrieved via php. I currently organize them alphabetically with SQL's
 ORDER BY ASC argument, however, if there is a preceding the  or a 
 then that is considered as part of the alphabetical order. Thus, all
 the subjects starting with the  are grouped together, as are the
 subjects starting with a . How can I order by ascending, without
 taking the preceding the  or a  into account?

 ** Example:
 Now, the list is ordeded like this:
 a Distribution
 a Text Editor
 a Virus
 Bluetooth
 Copyleft
 DRM
 Fedora
 Firefox

 However, I'd like it to be ordered like this:
 Bluetooth
 Copyleft
 a Distribution
 DRM
 Fedora
 Firefox
 a Text Editor
 a Virus

 Current code:
 $query  = SELECT subject FROM table ORDER BY subject asc;
 $result = mysql_query($query);

I forget the SQL 'CASE' syntax, but it goes something like this:
$query = SELECT subject, case when substring(lower(subject, 0, 4) =
'the ') then substring(subject, 4)  when substring(lower(subject, 0,
3) = 'an ' then substring(subject, 3) when substring(lower(subject, 0,
2) = 'a ') then substring(subject, 2) else subject) as subject_alpha
FROM table ORDER BY subject_alpha;

'Course, that renders ineffective any index you got on 'subject',
almost for sure.

If the table is HUGE and/or performance is an issue, you could set up
a second field called subject_alpha which holds the alphabetized
version.

Then you need to be sure it's always kept in sync by your application.

Or triggers and all that in later MySQL.

Actually, super-recent MySQL has user-defined functions, I think, so
the previous solution by another post may be better in that case.

I do not think there is a magic built-in easy MySQL function for this,
though you never know unless you read MySQL docs and ask on the MySQL
mailing list.  (Hint, hint.)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] XML Sending problem

2006-11-06 Thread Richard Lynch
On Sun, November 5, 2006 5:28 am, Rosen wrote:
 I need to create an XML file and send it to another server, where
 script
 process the XML.
 With creation and processing of XML I don't have a promlems, but how I
 can
 send XML to the processing script on another server ?

Pigeons?

It would probably be EASIEST to just make your .xml file available on
YOUR server, and let that other server get it whenever it wants...

That pretty much describes RSS in a nutshell...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] Trying to create an encryption method

2006-11-06 Thread Richard Lynch
On Sat, November 4, 2006 10:15 pm, John Meyer wrote:
 I'm trying to create this encryption method for puzzles (nothing super
 secret, just those cryptograms), but this seems to time out, can
 anybody
 point out what I'm doing wrong here:

http://php.net/shuffle

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] postgreSQl and images

2006-11-06 Thread Richard Lynch
On Sat, November 4, 2006 11:26 am, Alain Roger wrote:
 I create a table with some large object (ref: OID) to store some
 images.
 When my PHP will display some data, it will also display the images
 stored
 as OID.

 However, i've read that before i must restore the image by exporting
 them to
 local (on server) file.

 isn't it easier in this case, to simply store the path and file name
 of file
 to DB and just read the data to display image on PHP pages ?
 what is the purpose in this case to store image a bytea / large object
 ?

 moreover, how my php code will load image from DB and stored there as
 OID ?
 isn't it too much complex in comparison with just storing path and
 name of
 image ?

Yes, it will probably be easier all around to de-clutter your DB and
just store the images on the file system, which is itself a
highly-tuned mass-storage specialized database system. :-)

You would *NOT* need to store the file temporarily on the hard drive:

?php
  $image_data = some_function_to_get_image_date_from_OID($OID);
  header(Content-type: image/jpeg);
  echo $image_data;
?

No temp file needed.

This DB versus file system for images has been debated on this list
before.  Check the archives.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] Trying to create an encryption method

2006-11-06 Thread Daevid Vincent
 -Original Message-
 (strlen(trim($normalAlphabet[$k])) === 0));

Not sure if this is it, but be careful with the === vs ==

DÆVID  

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



Re: [PHP] postgreSQl and images

2006-11-06 Thread Richard Lynch
On Sat, November 4, 2006 5:38 pm, Børge Holen wrote:
 either you end up with a had as method of grouping them together,
 moreover you can have thousands of small files inside one dir with an
 id name
 to it, and yes the last one, thousands of directories with one file
 inside...

Speaking as a guy who has 65,000+ mp3s on-line (though only a
fraction of them available to the general public) I'd go crazy if they
were all in the DB, not to mention that my webhost would kill me...

But I'm not dumb enough to put them all in one directory either.

foobar.mp3 goes in /f/o/foobar.mp3

Actually, which *drive* it is on is determined by the date the audio
was recorded, as I have about a Terabyte available spread across 4
cheap IDE drives, and just change a simple include file when one of
the drives is nearly full to start using up the next one.

So it really turnes into one of these:
drive1/f/o/foobar.mp3
drive2/f/o/foobar.mp3
drive3/f/o/foobar.mp3
.
.
.
based on what date the live performance occurred, which is in my
meta-data, which I need to get for the on-the-fly ID3 tags anyway. [*]

It's all very crude and shoestring budget, but it works.

Well, except until they turned off the A/C in the office last summer,
and then spilled coffee grounds all over the box... :-(

But I found an old computer in the closet that I had found in a
dumpster and threw the hard drives in that, and it works.  495 MHz
seems enough for my audio server. :-)

I'm finishing up a process of copying the files to a real host so
I'll have a crude 2-tier fail-over.

Anyway, you have to plan this out with some idea of what scale and
scope you are dealing with to avoid insanity, but cramming binary data
into the DB seems like the least attractive choice to me personally.

[*] It's a shame the MP3 players all seem to ignore my nifty JPEG ID3
data I'm pre-pending to the audio streams.  You have to download the
files just to see the artist photo.  Sigh.

PS
Feel free to give a listen if you like accoustic music:
http://uncommonground.com/radio_hifi.m3u
http://uncommonground.com/radio_lofi.m3u
(hifi, lofi, respectively, obviously)

iTunes Podcast version is in beta if you're interested in being a
beta-tester...
Same audio, just in RSS/XML format.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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] Sorting MySQL queries

2006-11-06 Thread Dotan Cohen

On 06/11/06, Richard Lynch [EMAIL PROTECTED] wrote:

On Sun, November 5, 2006 7:13 am, Dotan Cohen wrote:
 I have a list of subjects, such as Linux, Open Source, and the
 World Wide Web. The subjects are stored in a database and being
 retrieved via php. I currently organize them alphabetically with SQL's
 ORDER BY ASC argument, however, if there is a preceding the  or a 
 then that is considered as part of the alphabetical order. Thus, all
 the subjects starting with the  are grouped together, as are the
 subjects starting with a . How can I order by ascending, without
 taking the preceding the  or a  into account?

 ** Example:
 Now, the list is ordeded like this:
 a Distribution
 a Text Editor
 a Virus
 Bluetooth
 Copyleft
 DRM
 Fedora
 Firefox

 However, I'd like it to be ordered like this:
 Bluetooth
 Copyleft
 a Distribution
 DRM
 Fedora
 Firefox
 a Text Editor
 a Virus

 Current code:
 $query  = SELECT subject FROM table ORDER BY subject asc;
 $result = mysql_query($query);

I forget the SQL 'CASE' syntax, but it goes something like this:
$query = SELECT subject, case when substring(lower(subject, 0, 4) =
'the ') then substring(subject, 4)  when substring(lower(subject, 0,
3) = 'an ' then substring(subject, 3) when substring(lower(subject, 0,
2) = 'a ') then substring(subject, 2) else subject) as subject_alpha
FROM table ORDER BY subject_alpha;

'Course, that renders ineffective any index you got on 'subject',
almost for sure.

If the table is HUGE and/or performance is an issue, you could set up
a second field called subject_alpha which holds the alphabetized
version.

Then you need to be sure it's always kept in sync by your application.

Or triggers and all that in later MySQL.

Actually, super-recent MySQL has user-defined functions, I think, so
the previous solution by another post may be better in that case.

I do not think there is a magic built-in easy MySQL function for this,
though you never know unless you read MySQL docs and ask on the MySQL
mailing list.  (Hint, hint.)



I just subscribed back to the MySQL list (unsubscribed a few months
ago) to ask the question. If there's no super-smart way to do it, then
I'll use the pseudo-subject field and sort on it. Performance-wise, I
agree that it can't be beat.

Thanks.

Dotan Cohen

http://lyricslist.com/
http://what-is-what.com/what_is/xml.html

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



Re: [PHP] Protecting Streaming Audio

2006-11-06 Thread Richard Lynch
On Fri, November 3, 2006 11:29 pm, Adam Gittins wrote:
  I have had a question that has been bugging me for a while now.
 Say
 that I need to have a members website. Which I want to protect
 streaming
 audio (Real, or Windows Media), now all the pages I can protect with a
 MYSQL
 DB and PHP. But when it comes to protecting a url of a file or audio
 feed it
 becomes tricky. What is the procedure? Would I have to use the
 htaccess
 file? But then when I open a realaudio file it will ask for a username
 and
 passworld again..

 How does one protect an url - or do I have to copy the file to a temp
 dir
 and then after a set time delete it?

 Help, there must be a way..

If you use Apache it's pretty trivial to set up a ForceType in
.htaccess on:
stream_the_file_you_want.rm
stream_other_file.wma
so that that's REALLY a PHP script, which can check all kinds of
things to make sure access is legitimate, and then the script that is
masquereding as the .rm (or .wma) file can do a readfile() on the REAL
audio file.

Of course, both Real (ugh!) and WMA (ugh!) have their own DRM models
(ugh!) that you could employ...

Or you could just heed the lastest news in Billboard magazine that DRM
is broken, ineffective, and counter-productive to increasing your
revenue. :-)

Even the Major Labels are finally starting to figure this out, after
screwing it up for over a decade now...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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



[PHP] Re: fsockopen error messages

2006-11-06 Thread Myron Turner
You may have your host incorrectly set.  I posted an example yesterday 
of how to use sockets with POST under the thread : [PHP] XML Sending 
problem



Philip Thompson wrote:

Hi.

I have not dealt much with fsockopen, but after looking at many 
examples, I'm not finding the answers I need. fsockopen is not returning 
anything and I'm trying to find out what the issue is. The error 
messages are not provided and I'm not sure what's going on. Help please!


?
$fp = fsockopen($host, $port, $errno, $errstr);

if (!$fp) {
echo fsock NOT opened!br/;
echo Error: $errstr ($errno)br /\n;
}
?

Thanks,
~Philip



--

_
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] Protecting Streaming Audio

2006-11-06 Thread Richard Lynch
On Mon, November 6, 2006 10:24 am, Ed Lazor wrote:
 use readfile to read the file and output it to the browser.  I don't
 know the specific ones, but you'll need to also send headers that
 declare the file as streaming media.

Alas, things get a bit more complicated than that, really...

For starters, the authentication process can get tricky, as the web
browser is generally used to find the file, authenticate the access,
and then you send out a playlist (authenticated access is trivial),
which is then handed off to a different piece of software (the player,
be it Real, WMP, or even WinAmp) which does not continue the session
cookie/data paradigm.

So at that point you need to embed some kind of authentication token
into the playlist, or rely on Security by Obscurity (usually
bad/ineffective), or have the actual audio stream expire (bad, annoys
users), or rely on proprietary DRM (bad, annoys users *and*
ineffective), assuming you absolutely HAVE to have some kind of
authentication on the audio data.

Because the player won't do diddly-squat useful with your
cookie/session/whatever, as it's not the web browser doing the URL
reading/playing.

There is also the question of what transport you stream over -- These
days it's largely just more HTTP data, with a standard web-server, but
there were specialized streaming servers such as Real had back in the
day, and presumably they are still suckering people into using that
pile of [bleep]. [Not that I'm biased against it, or anything...] or
perhaps an iTunes RSS feed.

Still, the authentication mechanism being transferred from GUI to find
the audio and the player to play the audio is not really a solvable
problem, unless you want to go whole-hog with something the way Apple
had to with iTunes to cater to the Major Labels.

You may actually want to look into Apple's RSS docs about this, as
that's probably the least-annoying and most flexible of the available
proprietary DRMs.  Which ain't saying much...

If you have any wiggle room at all, and want to keep your sanity, a
clear Usage Policy and no DRM is the way to go, honestly.  The DRM
will only annoy legit users, and be about as effective at stopping the
thieves as mosquito netting is against a Sherman tank.

Oh yeah.  You can't just send the headers for the streaming media. 
You have to have the URL *look* like a static plain old media URL, or
some players *will* reject it, sight unseen, as invalid input.
http://richardlynch.blogspot.com/
shows one simple way to do that in PHP.

You could trivially extend that to read an embedded PHP Session ID in
a URL, very much like the GET arg that trans_sid does, and propogate
your session that way.  'Course that also exposes your session to a
hijack, which opens up a whole 'nother can of worms...

Did I mention that to keep your sanity you're much better of avoiding
the whole authentication and DRM model and just having a clear Usage
Policy and relying on user honesty? :-)

I been down, I been down, I been down this road before...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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



[PHP] Code execution speed

2006-11-06 Thread Eric
I was looking for some ways to speed up the execution of my code. Im 
connecting to and displaying information from a newsgroup via sockets. 
The socket_recv's are slowing it down. What things other than the 
socket_recv's can I change to make the code faster. Just general tips. 
Thanks in advance.


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



Re: [PHP] Sorting MySQL queries

2006-11-06 Thread Børge Holen
On Monday 06 November 2006 08:15, clive wrote:
  Current code:
  $query  = SELECT subject FROM table ORDER BY subject asc;
  $result = mysql_query($query);

 I dont seen any php code to do any sorting,just a mysql query, perhaps a
 mysql list or maybe you should try doing it in php yourself first.

 Not that I know the answer, but mysql does have a substring function,
 perhaps it can help.

substring is quite powerful. Never tried one of those though

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

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



Re: [PHP] Code execution speed

2006-11-06 Thread Curt Zirzow

On 11/6/06, Eric [EMAIL PROTECTED] wrote:

I was looking for some ways to speed up the execution of my code. Im
connecting to and displaying information from a newsgroup via sockets.
The socket_recv's are slowing it down. What things other than the
socket_recv's can I change to make the code faster. Just general tips.
Thanks in advance.


Cache what you recieve by the message id in a database or something,
if it exists in the database use that, otherwise fetch it via the
socket.

I can't think of a more general way to speed things up.

Curt.

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



Re: [PHP] Frameworks

2006-11-06 Thread Ed Lazor
I think you pegged it... the benefit is that you save time, the  
drawback is that you're limited in what you can do.  I think you have  
to review each framework and chose one based on your personal  
preferences, the project at hand, etc.



On Nov 2, 2006, at 7:37 AM, [EMAIL PROTECTED] wrote:

I know this subject has been covered in the past, but my question  
is why

use them?  I'm hoping to not create a religious war...  I see that
frameworks would probably help you develop some things faster, but  
most
of the time they don't do the things the way I would want them to  
work.

If I did use one, it almost seems like I would use it to get through
something  until I had time to do things the way I wanted/needed to do
them.  There's a lot of talk about frameworks lately, and especially
the Zend Framework, so I'd like to look into what it's all about.  I
think I might be missing out the framework issue, so I'd like to hear
other people's opinions.

I do like the mail, pdf, and a few other parts of the Zend  
Framework.  I

also like that it's more like a set of tools than a monolithic beast
that would take a lot of memory just to load up into your application.

Your thoughts?

Thanks,
Ray

--
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] Trying to create an encryption method

2006-11-06 Thread John Meyer
Adapted something from this list and that worked,  thanks for the help.
Richard Lynch wrote:
 On Sat, November 4, 2006 10:15 pm, John Meyer wrote:
   
 I'm trying to create this encryption method for puzzles (nothing super
 secret, just those cryptograms), but this seems to time out, can
 anybody
 point out what I'm doing wrong here:
 

 http://php.net/shuffle

   

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



Re: [PHP] postgreSQl and images

2006-11-06 Thread Børge Holen
aaight... I get yer point there,
BUT

you see, what do you do when an artists changes it name... forget it, that was 
a bad choice...
anyway...
you see, in one of my fields of interests, you got dogs... see, dogs can 
change name, not just the calling name, but I mean completely change it all.
second, they change apperance with growth. 

So to keep track on stuff you need to make a system work for you, not the 
other way around... Hence, all in the db... but no way someone would be * 
enought to put ... you know what.. NOone would EVER put a single mp3 file in 
a db ;) lol. There we agree.

My problem originated with the planning... or rather lack of. Now? I think it 
works flawlessly so why fix it


On Monday 06 November 2006 23:00, Richard Lynch wrote:
 On Sat, November 4, 2006 5:38 pm, Børge Holen wrote:
  either you end up with a had as method of grouping them together,
  moreover you can have thousands of small files inside one dir with an
  id name
  to it, and yes the last one, thousands of directories with one file
  inside...

 Speaking as a guy who has 65,000+ mp3s on-line (though only a
 fraction of them available to the general public) I'd go crazy if they
 were all in the DB, not to mention that my webhost would kill me...

 But I'm not dumb enough to put them all in one directory either.

 foobar.mp3 goes in /f/o/foobar.mp3

 Actually, which *drive* it is on is determined by the date the audio
 was recorded, as I have about a Terabyte available spread across 4
 cheap IDE drives, and just change a simple include file when one of
 the drives is nearly full to start using up the next one.

 So it really turnes into one of these:
 drive1/f/o/foobar.mp3
 drive2/f/o/foobar.mp3
 drive3/f/o/foobar.mp3
 .
 .
 .
 based on what date the live performance occurred, which is in my
 meta-data, which I need to get for the on-the-fly ID3 tags anyway. [*]

 It's all very crude and shoestring budget, but it works.

 Well, except until they turned off the A/C in the office last summer,
 and then spilled coffee grounds all over the box... :-(

 But I found an old computer in the closet that I had found in a
 dumpster and threw the hard drives in that, and it works.  495 MHz
 seems enough for my audio server. :-)

 I'm finishing up a process of copying the files to a real host so
 I'll have a crude 2-tier fail-over.

 Anyway, you have to plan this out with some idea of what scale and
 scope you are dealing with to avoid insanity, but cramming binary data
 into the DB seems like the least attractive choice to me personally.

 [*] It's a shame the MP3 players all seem to ignore my nifty JPEG ID3
 data I'm pre-pending to the audio streams.  You have to download the
 files just to see the artist photo.  Sigh.

 PS
 Feel free to give a listen if you like accoustic music:
 http://uncommonground.com/radio_hifi.m3u
 http://uncommonground.com/radio_lofi.m3u
 (hifi, lofi, respectively, obviously)

 iTunes Podcast version is in beta if you're interested in being a
 beta-tester...
 Same audio, just in RSS/XML format.

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

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



[PHP] Preventing users from inserting malicious HTML into comments

2006-11-06 Thread Dotan Cohen

I'm setting up a comments system on a site, with the comments stored
in a mysql database. To prevent sql-injection, I run
mysql_real_escape_string() on ingoing data. This should be enough to
protect the database (tell me if otherwise), but I'd like to prevent
people from posting Javascript and other malicious html. Basically,
I'd like the comments to be bbcode and text only, using this bbcode
parser:
http://il.php.net/manual/en/function.preg-replace.php#69398

How can I strip the remaining html, javascript, and whatnot from the
posts? If somebody has already invented this wheel, then I'd rather
not risk a security breach by trying to reinvent it myself.

Dotan Cohen

http://lyricslist.com/
http://song-lirics.com/

--

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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



RE: [PHP] Preventing users from inserting malicious HTML into comments

2006-11-06 Thread Daevid Vincent
 -Original Message-
 From: Dotan Cohen [mailto:[EMAIL PROTECTED] 
 Sent: Monday, November 06, 2006 3:24 PM
 
 I'm setting up a comments system on a site, with the comments stored
 in a mysql database. To prevent sql-injection, I run
 mysql_real_escape_string() on ingoing data. This should be enough to
 protect the database (tell me if otherwise), but I'd like to prevent
 people from posting Javascript and other malicious html. Basically,
 I'd like the comments to be bbcode and text only, using this bbcode
 parser:
 http://il.php.net/manual/en/function.preg-replace.php#69398
 
 How can I strip the remaining html, javascript, and whatnot from the
 posts? If somebody has already invented this wheel, then I'd rather
 not risk a security breach by trying to reinvent it myself.

http://us2.php.net/manual/en/function.strip-tags.php
http://us2.php.net/manual/en/function.htmlspecialchars.php
http://us2.php.net/manual/en/function.str-replace.php

DÆVID 

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



Re: [PHP] Protecting Streaming Audio

2006-11-06 Thread Adam Gittins

Thanks for that informative post. It really is a can of worms. How far to go
with it is a good question.. Honesty, the glass in half full (No harm in
thinking like that is there)..

Sincerely,
Adam

On 11/7/06, Richard Lynch [EMAIL PROTECTED] wrote:


On Mon, November 6, 2006 10:24 am, Ed Lazor wrote:
 use readfile to read the file and output it to the browser.  I don't
 know the specific ones, but you'll need to also send headers that
 declare the file as streaming media.

Alas, things get a bit more complicated than that, really...

For starters, the authentication process can get tricky, as the web
browser is generally used to find the file, authenticate the access,
and then you send out a playlist (authenticated access is trivial),
which is then handed off to a different piece of software (the player,
be it Real, WMP, or even WinAmp) which does not continue the session
cookie/data paradigm.

So at that point you need to embed some kind of authentication token
into the playlist, or rely on Security by Obscurity (usually
bad/ineffective), or have the actual audio stream expire (bad, annoys
users), or rely on proprietary DRM (bad, annoys users *and*
ineffective), assuming you absolutely HAVE to have some kind of
authentication on the audio data.

Because the player won't do diddly-squat useful with your
cookie/session/whatever, as it's not the web browser doing the URL
reading/playing.

There is also the question of what transport you stream over -- These
days it's largely just more HTTP data, with a standard web-server, but
there were specialized streaming servers such as Real had back in the
day, and presumably they are still suckering people into using that
pile of [bleep]. [Not that I'm biased against it, or anything...] or
perhaps an iTunes RSS feed.

Still, the authentication mechanism being transferred from GUI to find
the audio and the player to play the audio is not really a solvable
problem, unless you want to go whole-hog with something the way Apple
had to with iTunes to cater to the Major Labels.

You may actually want to look into Apple's RSS docs about this, as
that's probably the least-annoying and most flexible of the available
proprietary DRMs.  Which ain't saying much...

If you have any wiggle room at all, and want to keep your sanity, a
clear Usage Policy and no DRM is the way to go, honestly.  The DRM
will only annoy legit users, and be about as effective at stopping the
thieves as mosquito netting is against a Sherman tank.

Oh yeah.  You can't just send the headers for the streaming media.
You have to have the URL *look* like a static plain old media URL, or
some players *will* reject it, sight unseen, as invalid input.
http://richardlynch.blogspot.com/
shows one simple way to do that in PHP.

You could trivially extend that to read an embedded PHP Session ID in
a URL, very much like the GET arg that trans_sid does, and propogate
your session that way.  'Course that also exposes your session to a
hijack, which opens up a whole 'nother can of worms...

Did I mention that to keep your sanity you're much better of avoiding
the whole authentication and DRM model and just having a clear Usage
Policy and relying on user honesty? :-)

I been down, I been down, I been down this road before...

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving 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




[PHP] Spam using email on website

2006-11-06 Thread Pieter du Toit
Hi guys

I have a website that is being crawled or whatever and i have a submission 
form for an event.

I keep on getting random mail from this form.

I have even disabled the submit button on the form, but keep on getting it.

What can i do? 

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



Re: [PHP] Spam using email on website

2006-11-06 Thread Robert Cummings
On Tue, 2006-11-07 at 08:42 +0200, Pieter du Toit wrote:
 Hi guys
 
 I have a website that is being crawled or whatever and i have a submission 
 form for an event.
 
 I keep on getting random mail from this form.
 
 I have even disabled the submit button on the form, but keep on getting it.
 
 What can i do? 

Check for keywords in the spam, excessive links, or block the source IP
address. You could also route the entry into your email spam filter
system if you have one and then delete it if it fails. Either way,
spammers don't use web browsers. They do direct posting once they've
profiled your page's form and that doesn't require a button.

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] Code execution speed

2006-11-06 Thread clive

Eric wrote:
I was looking for some ways to speed up the execution of my code. Im 
connecting to and displaying information from a newsgroup via sockets. 
The socket_recv's are slowing it down. What things other than the 
socket_recv's can I change to make the code faster. Just general tips. 
Thanks in advance.




Also have a look at opening a socket in non-blocking mode.

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



Re: [PHP] Spam using email on website

2006-11-06 Thread Robert Cummings
On Tue, 2006-11-07 at 02:20 -0500, Robert Cummings wrote:
 On Tue, 2006-11-07 at 08:42 +0200, Pieter du Toit wrote:
  Hi guys
  
  I have a website that is being crawled or whatever and i have a submission 
  form for an event.
  
  I keep on getting random mail from this form.
  
  I have even disabled the submit button on the form, but keep on getting it.
  
  What can i do? 
 
 Check for keywords in the spam, excessive links, or block the source IP
 address. You could also route the entry into your email spam filter
 system if you have one and then delete it if it fails. Either way,
 spammers don't use web browsers. They do direct posting once they've
 profiled your page's form and that doesn't require a button.

And on the subject of spam, how about you use a real email address so I
don't the following afte rbeing so nice to respond to your question...

[EMAIL PROTECTED]: host mail.telkomsa.net[196.25.211.150] said:
554
Sorry, no mailbox here by that name. (#5.1.1) (in reply to RCPT TO
command)

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