|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 7 Nov 2006 08:32:44 -0000 Issue 4445
php-general-digest-help
lists.php.net
Date: Tue Nov 07 2006 - 02:32:44 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 7 Nov 2006 08:32:44 -0000 Issue 4445
Topics (messages 244267 through 244303):
Re: Pulling Data From a Page
244267 by: Robert Cummings
244268 by: Google Kreme
244271 by: Richard Lynch
Re: Microsoft Partners With Zend
244269 by: Rory Browne
244270 by: Ray Hauge
fsockopen error messages
244272 by: Philip Thompson
244275 by: Richard Lynch
244279 by: Philip Thompson
244288 by: Myron Turner
Re: PHP Zip Question
244273 by: Richard Lynch
Re: WAP?
244274 by: Richard Lynch
Re: image commands (again)
244276 by: Richard Lynch
Re: imageloadfont
244277 by: Richard Lynch
Re: 301 redirect returning 302 instead
244278 by: ianevans.digitalhit.com
Re: Sorting MySQL queries
244280 by: Richard Lynch
244286 by: Dotan Cohen
244291 by: Børge Holen
Re: XML Sending problem
244281 by: Richard Lynch
Re: Trying to create an encryption method
244282 by: Richard Lynch
244284 by: Daevid Vincent
244294 by: John Meyer
Re: postgreSQl and images
244283 by: Richard Lynch
244285 by: Richard Lynch
244295 by: Børge Holen
Re: Protecting Streaming Audio
244287 by: Richard Lynch
244289 by: Richard Lynch
244298 by: Adam Gittins
Code execution speed
244290 by: Eric
244292 by: Curt Zirzow
244301 by: clive
Re: Frameworks
244293 by: Ed Lazor
Preventing users from inserting malicious HTML into comments
244296 by: Dotan Cohen
244297 by: Daevid Vincent
Spam using email on website
244299 by: Pieter du Toit
244300 by: Robert Cummings
244302 by: Robert Cummings
244303 by: clive
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
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. |
`------------------------------------------------------------'
attached mail follows:
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
attached mail follows:
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?
attached mail follows:
On 11/6/06, Martin Cetkovsky <alik.list
seznam.cz> 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 LOOOOOVE 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 === ACCCKKKKKKKKKKKKKKKKKKKKKKK
>
> 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.
attached mail follows:
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:rory.browne
gmail.com]
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 <alik.list
seznam.cz> 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 LOOOOOVE 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 === ACCCKKKKKKKKKKKKKKKKKKKKKKK
>
> 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.
attached mail follows:
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
attached mail follows:
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?
attached mail follows:
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
attached mail follows:
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/
attached mail follows:
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?
attached mail follows:
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?
attached mail follows:
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>
<head><title>required by w3c</title></head>
<body>
<p>The text you typed was: <?php echo $_CLEAN['text']?></p>
<img src="image_maker.php?text=<?php echo
urlencode($_CLEAN['text'])?>" />
<p>Thanks 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?
attached mail follows:
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?
attached mail follows:
Just upgraded to 5.2.0 and alas, the 301/302 issue still exists. Guess
I'll head off to bugs.php.net
attached mail follows:
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?
attached mail follows:
On 06/11/06, Richard Lynch <ceo
l-i-e.com> 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
attached mail follows:
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
---
attached mail follows:
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?
attached mail follows:
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?
attached mail follows:
> -----Original Message-----
> (strlen(trim($normalAlphabet[$k])) === 0));
Not sure if this is it, but be careful with the === vs ==
DÆVID
attached mail follows:
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
>
>
attached mail follows:
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?
attached mail follows:
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?
attached mail follows:
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
---
attached mail follows:
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?
attached mail follows:
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?
attached mail follows:
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 <ceo
l-i-e.com> 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
>
>
attached mail follows:
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.
attached mail follows:
On 11/6/06, Eric <eaw2397
rit.edu> 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.
attached mail follows:
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.
attached mail follows:
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, ray.hauge
americanstudentloan.com 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
>
attached mail follows:
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?
attached mail follows:
> -----Original Message-----
> From: Dotan Cohen [mailto:dotancohen
gmail.com]
> 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
attached mail follows:
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?
attached mail follows:
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. |
`------------------------------------------------------------'
attached mail follows:
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...
<pieterdt
telkomsa.net>: 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. |
`------------------------------------------------------------'
attached mail follows:
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?
you could use a CAPTCHA image (although not entirely spam proof)
you could have a random variable in a hidden input field, perhaps the
session id and check this variable when the form is submitted.
also form validation is important and having certain fields that are
required makes it a little harder for spammers.
>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]