php-general Digest 13 Jan 2007 12:07:06 -0000 Issue 4567

2007-01-13 Thread php-general-digest-help

php-general Digest 13 Jan 2007 12:07:06 - Issue 4567

Topics (messages 247020 through 247024):

Extracting XMP text from Jpeg
247020 by: Dotan Cohen
247024 by: zerof

Unbuffered Query
247021 by: Richard Lynch
247022 by: Jim Lucas
247023 by: Roman Neuhauser

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---

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg
(beware, it's 1.8 MB)

This pic has three tags:
TEST
MILOTTEST
גילי

I can see the tags using linux's strings and grep commands, but how
can I get them into an array in php? I have been playing with the PHP
JPEG Metadata Toolkit but I can't seem to get the XMP tags into an
array and I'm getting frustrated! This is time that I should be with
Meirav (her name), not googling for hours on end. Any advice,
suggestions, and code examples are very, very welcome at this point.
Those who know me from the list know that I never ask for code
examples (not the best way to learn) but I'm really stumped now, and
I've got a little girl to feed / give attention to / take care of the
house because the wife is nursing / study / work. Thanks in advance.

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/655/fozzy.html
http://what-is-what.com/what_is/spyware.html
---End Message---
---BeginMessage---

Dotan Cohen escreveu:

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg
(beware, it's 1.8 MB)

This pic has three tags:
TEST
MILOTTEST
גילי

.

http://www.ozhiker.com/electronics/pjmt/library/list_contents.php4?show_fn=XMP.php

--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
--
Você deve, sempre, consultar uma segunda opião!
--  
You must hear, always, one second opinion! In all cases.
--
---End Message---
---BeginMessage---
I have this process that dumps out database records to static HTML pages.

The basic algorithm goes like:

//Set any un-parented item (a root in the thread) to be its own parent:
update entry set original_id = entry_id where original_id is null

//collect any dirty entries (changed in db, need to re-publish)
$dirty = select entry_id from entry where dirty = 1

while (list($entry_id) = mysql_fetch_row($dirty)){
  //find the whole thread:
  $followups = select entry_id, X, Y from entry where original_id =
$dirty_id
  //there is an ORDER BY which is not relevant

  //get some thread metadata from the first row's X field
  list($junk, $X) = mysql_fetch_row($followups);
  //$X is the same for all rows...
  echo h1$X/h1\n;

  //reset to row 0
  mysql_data_seek($followups, 0);
  while (list($entry_id, $X, $Y) = mysql_fetch_row($followups)){
echo p$Y/p\n;
  }
}

So, how come *SOMETIMES*, seemingly at random, I get:

Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index
116 (or the
query data is unbuffered) in
/www/acousticdemo.com/web/complaints/publish.cron on
line 26

Line 26 is, obviously, the mysql_data_seek call above...

I do not *THINK* there is any other process anywhere deleting rows
from the table -- it should be an ever-growing table...

So is the query data being unbuffered out from under me due to some
my.cnf setting?...

Or am I just plain wrong, and *something* is deleting from the entry
table?

I Googled for the error message, and found about a 26,000 web sites
that are exhibiting this error, rather than the folks discussing this
error. :-v

The few I was able to weed out were obvious logic errors, which I
don't think I have.

I've read the mysql_unbuffered_query on php.net and think I understand
it in respect to mysql_query et al.

I guess I'm looking for reassurance that it's definitely my mistake
somewhere in the mess I've made, and that I'm looking for a delete
query, and it's not a subtle bug or feature I'm failing to understand.

:-)

-- 
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?
---End Message---
---BeginMessage---

Richard Lynch wrote:

I have this process that dumps out database records to static HTML pages.

The basic algorithm goes like:

//Set any un-parented item (a root in the thread) to be its own parent:
update entry set original_id = entry_id where 

php-general Digest 14 Jan 2007 01:00:15 -0000 Issue 4568

2007-01-13 Thread php-general-digest-help

php-general Digest 14 Jan 2007 01:00:15 - Issue 4568

Topics (messages 247025 through 247046):

Re: Extracting XMP text from Jpeg
247025 by: zerof
247026 by: Dotan Cohen
247033 by: tedd
247035 by: Dotan Cohen
247037 by: tedd
247039 by: Dotan Cohen

Re: Normalized Numbers
247027 by: Roman Neuhauser
247029 by: Jochem Maas

Anyone would like to test my open source application 
http://sourceforge.net/projects/dfo/ ?
247028 by: Gert Cuykens
247045 by: Jürgen Wind

Re: Anybody have any experience with outsite-in? [Quite a bit 0T]
247030 by: Ryan A
247031 by: Ryan A
247032 by: Skip Evans

Include file error, common one I think
247034 by: Chris Carter
247038 by: João Cândido de Souza Neto
247040 by: Chris Carter
247042 by: Jochem Maas
247043 by: tedd

Re: Javascript detection , working version
247036 by: tedd

The php file type
247041 by: Edward

Re: Variance Function
247044 by: tedd

Hello
247046 by: Edward

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---

Dotan Cohen escreveu:

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg
(beware, it's 1.8 MB)
.


http://www.educar.pro.br/abc/gdlib/index.php?pageNum_rsNVER=22totalRows_rsNVER=97

--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
--
Você deve, sempre, consultar uma segunda opião!
--  
You must hear, always, one second opinion! In all cases.
--
---End Message---
---BeginMessage---

On 13/01/07, zerof [EMAIL PROTECTED] wrote:

Dotan Cohen escreveu:
 The birth of my first daughter has inpired me to get the photo gallery
 on my site up to date. To do so, I need to extract XMP data from Jpeg
 pictures. Here is a test pic:
 http://dotancohen.com/gili.jpg
 (beware, it's 1.8 MB)
.


http://www.ozhiker.com/electronics/pjmt/library/list_contents.php4?show_fn=XMP.php


Thanks, Zerof, I have been playing with this with no success. Has
anybody successfully used this to extract XMP data?



http://www.educar.pro.br/abc/gdlib/index.php?pageNum_rsNVER=22totalRows_rsNVER=97


I don't see where XMP data is discussed on your site. I'll check back
frequently, maybe your intention is to discuss it? Thanks.



zerof


Dotan Cohen

http://essentialinux.com/locale.php
http://music-lyriks.com
---End Message---
---BeginMessage---

At 2:40 AM +0200 1/13/07, Dotan Cohen wrote:

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg


Dotan:

Whoa, when you said birth of my first daughter  that's not what I 
expected.  :-)


tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com
---End Message---
---BeginMessage---

On 13/01/07, tedd [EMAIL PROTECTED] wrote:

At 2:40 AM +0200 1/13/07, Dotan Cohen wrote:
The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg

Dotan:

Whoa, when you said birth of my first daughter  that's not what I
expected.  :-)

tedd


Hehehe... Good thing that I didn't post a picture of Gush:
http://dotancohen.com/gallery/img-122.html

Here's Meirav (proud father, I have to show her off):
http://dotancohen.com/gallery/img-7.html

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/305/lennon_john.html
http://what-is-what.com/what_is/virus.html
---End Message---
---BeginMessage---

At 8:05 PM +0200 1/13/07, Dotan Cohen wrote:

On 13/01/07, tedd [EMAIL PROTECTED] wrote:

At 2:40 AM +0200 1/13/07, Dotan Cohen wrote:

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg


Dotan:

Whoa, when you said birth of my first daughter  that's not what I
expected.  :-)

tedd


Hehehe... Good thing that I didn't post a picture of Gush:
http://dotancohen.com/gallery/img-122.html

Here's Meirav (proud father, I have to show her off):
http://dotancohen.com/gallery/img-7.html




Very cute!  Congratulations.  :-)

Have you looked into: exif_read_data()  ?

I wrote 

Re: [PHP] Unbuffered Query

2007-01-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-12 23:30:15 -0600:
 Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index
 116 (or the
 query data is unbuffered) in
 /www/acousticdemo.com/web/complaints/publish.cron on
 line 26
 
http://www.php.net/manual/en/function.mysql-unbuffered-query.php:

You cannot use mysql_num_rows() and mysql_data_seek() on a result set
returned from mysql_unbuffered_query().

-- 
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



[PHP] Re: Extracting XMP text from Jpeg

2007-01-13 Thread zerof

Dotan Cohen escreveu:

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg
(beware, it's 1.8 MB)

This pic has three tags:
TEST
MILOTTEST
גילי

.

http://www.ozhiker.com/electronics/pjmt/library/list_contents.php4?show_fn=XMP.php

--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
--
Você deve, sempre, consultar uma segunda opião!
--  
You must hear, always, one second opinion! In all cases.
--

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



[PHP] Re: Extracting XMP text from Jpeg

2007-01-13 Thread zerof

Dotan Cohen escreveu:

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg
(beware, it's 1.8 MB)
.


http://www.educar.pro.br/abc/gdlib/index.php?pageNum_rsNVER=22totalRows_rsNVER=97

--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
--
Você deve, sempre, consultar uma segunda opião!
--  
You must hear, always, one second opinion! In all cases.
--

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



Re: [PHP] Re: Extracting XMP text from Jpeg

2007-01-13 Thread Dotan Cohen

On 13/01/07, zerof [EMAIL PROTECTED] wrote:

Dotan Cohen escreveu:
 The birth of my first daughter has inpired me to get the photo gallery
 on my site up to date. To do so, I need to extract XMP data from Jpeg
 pictures. Here is a test pic:
 http://dotancohen.com/gili.jpg
 (beware, it's 1.8 MB)
.


http://www.ozhiker.com/electronics/pjmt/library/list_contents.php4?show_fn=XMP.php


Thanks, Zerof, I have been playing with this with no success. Has
anybody successfully used this to extract XMP data?



http://www.educar.pro.br/abc/gdlib/index.php?pageNum_rsNVER=22totalRows_rsNVER=97


I don't see where XMP data is discussed on your site. I'll check back
frequently, maybe your intention is to discuss it? Thanks.



zerof


Dotan Cohen

http://essentialinux.com/locale.php
http://music-lyriks.com

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



Re: [PHP] Normalized Numbers

2007-01-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-12 14:40:04 +:
 # [EMAIL PROTECTED] / 2007-01-12 13:39:59 +0100:
  Roman Neuhauser wrote:
   # [EMAIL PROTECTED] / 2007-01-12 01:57:27 +0100:
   Brian P. Giroux wrote:
   If anyone can help me out with that or provide any other advice about
   the rest of it, I'd be grateful.
   The file can be found at http://www.senecal.ca/normnums.php.txt
   
   keep commenting all your code to that extent! you do us proud :-)
   
   I find the *inline* comments superfluous and cluttering the code. They
   don't add any insight, they simply repeat what the code already says very
   succintly:
  
  it is anything but superfluous imho - the comment describes what the line of
  code *should* be doing - given that the code itself maybe changed (and
  possibly broken)
 
 That's exactly one of the things that make comments dangerous: they can easily
 diverge from the code!
 
 Use lots of small functions, well named, with well defined tasks.
 It's easy to see where the code lies about itself then.
 Use automated tests. You won't need to check whether the code actually
 does what a comment says: the test either succeeded or failed.

I converted the original tests (they don't evaluate the results,
that's up to the user) into a few Testilence-based test cases, and then
modified the code a bit. I removed almost all inline comments to let the
code come forward and speak for itself, and then reduced the code to
speak more clearly. It's not something I'd consider finished, but you
get the idea.

Regarding the digit_sum() bug, I don't understand why you just don't
strrev() the input string. You'll need to swap the weights as well if
the string consists of an even number of characters. There's a test case
showing this as well.

The tests are really straight conversions of the old ones. I don't think
they're good, tests should IMO represent boolean questions about the
code, and provide answers to them. The old tests didn't ask any clear
questions, this is carried over to the new ones.

You can see my version at http://codex.sigpipe.cz/tmp/normnums.phps,
Testilence is at http://www.testilence.org/.

-- 
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



[PHP] Anyone would like to test my open source application http://sourceforge.net/projects/dfo/ ?

2007-01-13 Thread Gert Cuykens

It's a web based sql console that you can use instead of phpmyadmin.

http://sourceforge.net/projects/dfo/

Firefox 2 only because of the extensive use of xmlhttprequests. Maybe
one day somebody could make it IE7 compatible by adding a activex
patch.

Also need webspace to host a demo, sourceforge only has php4 and i
need php5 for my static objects?

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



Re: [PHP] Normalized Numbers

2007-01-13 Thread Jochem Maas
Roman,

thank you for the detailed argument/explanation. I am definitely going to
take the time to think about what you said and re-evaluate my stance.

additionally I found you practical example of unit testing of great value,
time for me to STFU and go do some reading about Testilence.

rgds,
Jochem

Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2007-01-12 13:39:59 +0100:
 Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2007-01-12 01:57:27 +0100:
 Brian P. Giroux wrote:
 If anyone can help me out with that or provide any other advice about
 the rest of it, I'd be grateful.
 The file can be found at http://www.senecal.ca/normnums.php.txt

...

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



Re: [PHP] Anybody have any experience with outsite-in? [Quite a bit 0T]

2007-01-13 Thread Ryan A


Skip Evans [EMAIL PROTECTED] wrote: Hey all,

When you say it lets you run it off a CD does that 
mean the CD is totally self contained, as in you 
can pop it into any machine, sans web server DB, 
etc, and it runs just peachy?

Skip

Yep, thats what its supposed to do...


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
-
Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.

Re: [PHP] Anybody have any experience with outsite-in? [Quite a bit 0T]

2007-01-13 Thread Ryan A
Hmmm, I didnt know of this list, thanks... will go through it.

Cheers!
R



Satyam [EMAIL PROTECTED] wrote: It is not a new concept, even Wikipedia has a 
long list of them:

http://en.wikipedia.org/wiki/List_of_LiveDistros

Most of those distros have individual articles ... not the one mentioned 
below, though.

Satyam

- Original Message - 
From: Skip Evans 
To: Ryan A 
Cc: php php 

Sent: Thursday, January 11, 2007 10:35 PM
Subject: Re: [PHP] Anybody have any experience with outsite-in? [Quite a bit 
0T]


 Hey all,

 When you say it lets you run it off a CD does that mean the CD is totally 
 self contained, as in you can pop it into any machine, sans web server DB, 
 etc, and it runs just peachy?

 Skip

 Ryan A wrote:
 Hey all!

 This is a bit OT as its not really php programming, but it does involve 
 PHP and MySql etc so The company I work for has decided to use the 
 software from outsite-in.com,
 for those of you who dont know (and i'm guessing a lot of you dont, as I 
 kinda just found out about it myself) their software allows you to run 
 php+mysql etc on a CD/DVD.

 Just curious to know if anybody has had any experience with their 
 software?
 I have tried their free demo's and it looks pretty good.

 Note: Others on this list have in the past advised me on how to do this 
 using different methods, but my company wants to go with this... needless 
 to say I am in NO way connected to outsite-in.com and i have *nothing* to 
 gain if you visit their site, buy anything from them, shoot them, kiss 
 them or whatever. :)

 Thanks!
 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 beta.

 -- 
 Skip Evans
 Big Sky Penguin, LLC
 61 W Broadway
 Butte, Montana 59701
 406-782-2240
 =-=-=-=-=-=-=-=-=-=
 Check out PHPenguin, a lightweight and
 versatile PHP/MySQL development framework.
 http://phpenguin.bigskypenguin.com/

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

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





--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
-
Access over 1 million songs - Yahoo! Music Unlimited.

Re: [PHP] Anybody have any experience with outsite-in? [Quite a bit 0T]

2007-01-13 Thread Skip Evans

eric cartmanSweet!/ec

So what recommendations would any of you make for 
a, say, CD linux distro that one could burn with 
my own PHP app, so someone could boot it up in a 
machine and see my PHP/MySQL web app run right 
there on their machine?


This is something for which I've had a nagging 
need a while now.


Anyone do this with a few of the different distros 
out there and have some experience and wisdom to lend?


Mucho thanky, Spanky!

Skip

Ryan A wrote:


Skip Evans [EMAIL PROTECTED] wrote: Hey all,

When you say it lets you run it off a CD does that 
mean the CD is totally self contained, as in you 
can pop it into any machine, sans web server DB, 
etc, and it runs just peachy?


Skip

Yep, thats what its supposed to do...


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
-
Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.


--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240

=-=-=-=-=-=-=-=-=-=-=

Check out PHPenguin, a lightweight and versatile 
PHP/MySQL development framework.


http://phpenguin.bigskypenguin.com

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



Re: [PHP] Extracting XMP text from Jpeg

2007-01-13 Thread tedd

At 2:40 AM +0200 1/13/07, Dotan Cohen wrote:

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg


Dotan:

Whoa, when you said birth of my first daughter  that's not what I 
expected.  :-)


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] Extracting XMP text from Jpeg

2007-01-13 Thread Dotan Cohen

On 13/01/07, tedd [EMAIL PROTECTED] wrote:

At 2:40 AM +0200 1/13/07, Dotan Cohen wrote:
The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg

Dotan:

Whoa, when you said birth of my first daughter  that's not what I
expected.  :-)

tedd


Hehehe... Good thing that I didn't post a picture of Gush:
http://dotancohen.com/gallery/img-122.html

Here's Meirav (proud father, I have to show her off):
http://dotancohen.com/gallery/img-7.html

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/305/lennon_john.html
http://what-is-what.com/what_is/virus.html

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



Re: [PHP] Javascript detection , working version

2007-01-13 Thread tedd

At 9:32 PM -0800 1/11/07, Jürgen Wind wrote:

tedd wrote:

index.php, jstest110.php) , make it one.

ok
---8---

It would be cool if I could send js value via a
POST instead of GET-- can that be done?

have a look http://149.222.235.16/jstest/70112/index.php ( POST version )


tedd



PS: I read somewhere that using noscript is not recommended.

any info?


Yes, I knew I read it somewhere (my memory is not as good as it used to be).

In the book PPK on Javascript (most excellent 
book btw http://www.quirksmode.org/book/), on 
page 57 he says Therefore, it's best not to use 
the noscript tag at all.


I leave it to you to buy the book to find out 
why. But basically, browsers that don't use 
javascript don't see that tag and those that do, 
don't use it. As such, the tag has no real use.


Cheers,

tedd

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

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



Re: [PHP] Extracting XMP text from Jpeg

2007-01-13 Thread tedd

At 8:05 PM +0200 1/13/07, Dotan Cohen wrote:

On 13/01/07, tedd [EMAIL PROTECTED] wrote:

At 2:40 AM +0200 1/13/07, Dotan Cohen wrote:

The birth of my first daughter has inpired me to get the photo gallery
on my site up to date. To do so, I need to extract XMP data from Jpeg
pictures. Here is a test pic:
http://dotancohen.com/gili.jpg


Dotan:

Whoa, when you said birth of my first daughter  that's not what I
expected.  :-)

tedd


Hehehe... Good thing that I didn't post a picture of Gush:
http://dotancohen.com/gallery/img-122.html

Here's Meirav (proud father, I have to show her off):
http://dotancohen.com/gallery/img-7.html




Very cute!  Congratulations.  :-)

Have you looked into: exif_read_data()  ?

I wrote something on it, but I needed PHP to be compiled with 
--enable-exif and my server wouldn't do it.


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

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



[PHP] Re: Include file error, common one I think

2007-01-13 Thread Jo�o C�ndido de Souza Neto
Is it the whole code of your file, or is there any other html code?

Chris Carter [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]

 Hi,

 Here is code that I got from the internet for random image. This file 
 works
 perfect if I try it independently but not on any existing file. I think 
 the
 error that I am getting is quite common on the net but its new for me.

 I am getting this error:

 Warning: Cannot modify header information - headers already sent by 
 (output
 started at /folder/test.php:12) in /folder/randomimage.php on line 19

 the code that I got from net:

 ?
 $folder = 'images/';
 $exts = 'jpg jpeg png gif';
 $files = array(); $i = -1;
 if ('' == $folder) $folder = './';
 $handle = opendir($folder);
 $exts = explode(' ', $exts);
 while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) {
if (preg_match('/\.'.$ext.'$/i', $file, $test)) {
$files[] = $file;
++$i;
}
}
}
 closedir($handle);
 mt_srand((double)microtime()*100);
 $rand = mt_rand(0, $i);


 Line 19 is below:

 header('Location: '.$folder.$files[$rand]);
 ?

 Thanks a bunch.
 Chris
 -- 
 View this message in context: 
 http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8316202
 Sent from the PHP - General mailing list archive at Nabble.com. 

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



Re: [PHP] Extracting XMP text from Jpeg

2007-01-13 Thread Dotan Cohen

On 13/01/07, tedd [EMAIL PROTECTED] wrote:

Very cute!  Congratulations.  :-)


Thank you!


Have you looked into: exif_read_data()  ?


Yes, but it won't handle XMP. There is a link in the comments to a
user-written function that reads exif data from XMP that PhotoShop CS
stores, but I cannot seem to modify it for my purpose. I'm having a
hell of a time with the regex and I don't post regex questions until
I've fought with them for a few days at least (I usually don't need to
post in the end).


I wrote something on it, but I needed PHP to be compiled with
--enable-exif and my server wouldn't do it.

tedd


Good luck with that, then. I wish that I could give you SSH access to
test, but the server is not my own, and I'm sworn to security!

Dotan Cohen

http://what-is-what.com/what_is/electromagnet.html
http://dapot.com

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



Re: [PHP] Include file error, common one I think

2007-01-13 Thread Chris Carter

Hi,

I have used this file in my index file. When I run this file separately it
shows the random image but not when I include on my index.php.

Thanks in advance,


João Cândido de Souza Neto wrote:
 
 Is it the whole code of your file, or is there any other html code?
 
 Chris Carter [EMAIL PROTECTED] escreveu na mensagem 
 news:[EMAIL PROTECTED]

 Hi,

 Here is code that I got from the internet for random image. This file 
 works
 perfect if I try it independently but not on any existing file. I think 
 the
 error that I am getting is quite common on the net but its new for me.

 I am getting this error:

 Warning: Cannot modify header information - headers already sent by 
 (output
 started at /folder/test.php:12) in /folder/randomimage.php on line 19

 the code that I got from net:

 ?
 $folder = 'images/';
 $exts = 'jpg jpeg png gif';
 $files = array(); $i = -1;
 if ('' == $folder) $folder = './';
 $handle = opendir($folder);
 $exts = explode(' ', $exts);
 while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) {
if (preg_match('/\.'.$ext.'$/i', $file, $test)) {
$files[] = $file;
++$i;
}
}
}
 closedir($handle);
 mt_srand((double)microtime()*100);
 $rand = mt_rand(0, $i);


 Line 19 is below:

 header('Location: '.$folder.$files[$rand]);
 ?

 Thanks a bunch.
 Chris
 -- 
 View this message in context: 
 http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8316202
 Sent from the PHP - General mailing list archive at Nabble.com. 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8316921
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] The php file type

2007-01-13 Thread Edward

 *
*|Hello, I need to ask a question regarding the note below:|*
*

   /**Stewart*
   05-Jan-2007 02:55
   http://www.php.net/manual/en/tutorial.firstpage.php#72181*|* No
   need to go through these contortions each time to make sure the file
   is properly saved with the .php extension.  Just register .php as a
   file type in Windows, and then saving as hello.php without the
   quotes will work fine.*|//|
   |/

|I need to know how I can 'register' the .php file type in Windoze so 
that this OS can recognize it automatically in the future.


Thanks,

Edward|
||

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



Re: [PHP] Include file error, common one I think

2007-01-13 Thread Jochem Maas
Chris Carter wrote:
 Hi,
 
 I have used this file in my index file. When I run this file separately it
 shows the random image but not when I include on my index.php.

your image script shouldn't be included in your [index] page.
instead it should be referenced by the src attribute of an img
tag that your [index] page outputs e.g. in your [index] page
have a line something like:

echo 'img src=/randomimage.php alt= /';

 
 Thanks in advance,
 
 
 João Cândido de Souza Neto wrote:
 Is it the whole code of your file, or is there any other html code?

 Chris Carter [EMAIL PROTECTED] escreveu na mensagem 
 news:[EMAIL PROTECTED]
 Hi,

 Here is code that I got from the internet for random image. This file 
 works
 perfect if I try it independently but not on any existing file. I think 
 the
 error that I am getting is quite common on the net but its new for me.

 I am getting this error:

 Warning: Cannot modify header information - headers already sent by 
 (output
 started at /folder/test.php:12) in /folder/randomimage.php on line 19

 the code that I got from net:

 ?
 $folder = 'images/';
 $exts = 'jpg jpeg png gif';
 $files = array(); $i = -1;
 if ('' == $folder) $folder = './';
 $handle = opendir($folder);
 $exts = explode(' ', $exts);
 while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) {
if (preg_match('/\.'.$ext.'$/i', $file, $test)) {
$files[] = $file;
++$i;
}
}
}
 closedir($handle);
 mt_srand((double)microtime()*100);
 $rand = mt_rand(0, $i);


 Line 19 is below:

 header('Location: '.$folder.$files[$rand]);
 ?

 Thanks a bunch.
 Chris
 -- 
 View this message in context: 
 http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8316202
 Sent from the PHP - General mailing list archive at Nabble.com. 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 

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



Re: [PHP] Include file error, common one I think

2007-01-13 Thread tedd

At 9:44 AM -0800 1/13/07, Chris Carter wrote:

Hi,

Here is code that I got from the internet for random image. This file works
perfect if I try it independently but not on any existing file. I think the
error that I am getting is quite common on the net but its new for me.

I am getting this error:

Warning: Cannot modify header information - headers already sent by (output
started at /folder/test.php:12) in /folder/randomimage.php on line 19


Chris :

Whenever I get that error, I look to:

http://us2.php.net/ob_start

I think ob_start and ob_flush might solve your problem.

Cheers,

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

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



Re: [PHP] Variance Function

2007-01-13 Thread tedd

At 4:19 AM + 1/12/07, Andrew Brampton wrote:

- Original Message - From: Richard Lynch [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, January 11, 2007 11:29 PM
Subject: [PHP] Variance Function


Any advice?

Anybody got a good variance function to do what I'm trying to do?



Hey,
I've seen you solve many questions on this list, and I feel honour 
to be able to try and help :)


Well the solution that pops into my head is clustering. Since you 
have a set of numbers and 1 or more of them may be abnormal, then 
you can cluster them into one or more groups of similar values.

-snip-


Very impressive work Andrew.

You might also look into cluster analysis, which will also provide 
the degree of similarity between items. It's often surprising how 
hidden data falls out of such analyses.


Cheers,

tedd

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

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



Re: [PHP] Anyone would like to test my open source application http://sourceforge.net/projects/dfo/ ?

2007-01-13 Thread Jürgen Wind



Gert Cuykens wrote:
 
 It's a web based sql console that you can use instead of phpmyadmin.
 
nice idea, 
but i got lots of js errors (i.e. resulting from an orphaned colon in almost
every .js file)
i tried db5c28.tar.bz2 from sf.net
-- 
View this message in context: 
http://www.nabble.com/Anyone-would-like-to-test-my-open-source-application-http%3A--sourceforge.net-projects-dfotf2971271.html#a8321262
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] Hello

2007-01-13 Thread Edward
How do I create a php document so that people in my nonprofit can vote 
on issues online through the organization's website?


Thanks,

Edward

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



Re: [PHP] Hello

2007-01-13 Thread John Meyer
Edward wrote:
 How do I create a php document so that people in my nonprofit can vote
 on issues online through the organization's website?
 
 Thanks,
 
 Edward
 
Start with PHP, add MySQL or your database of choice, mix and prepare.
Serves 500+.

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



Re: [PHP] Hello

2007-01-13 Thread David Giragosian

On 1/13/07, John Meyer [EMAIL PROTECTED] wrote:


Edward wrote:
 How do I create a php document so that people in my nonprofit can vote
 on issues online through the organization's website?

 Thanks,

 Edward

Start with PHP, add MySQL or your database of choice, mix and prepare.
Serves 500+.

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



Edward,

Maybe start by telling the group your level of experience with PHP, MySQL,
(Javascript), ...

Just a thought.

David


Re: [PHP] Hello

2007-01-13 Thread Skip Evans
I think David is going to need to install 
something like PostNuke that comes with a polls 
module or something like that.


But David's suggestion is a good one... how much 
PHP/MySQL experience do you have?


Skip

David Giragosian wrote:

On 1/13/07, John Meyer [EMAIL PROTECTED] wrote:



Edward wrote:
 How do I create a php document so that people in my nonprofit can vote
 on issues online through the organization's website?

 Thanks,

 Edward

Start with PHP, add MySQL or your database of choice, mix and prepare.
Serves 500+.

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



Edward,

Maybe start by telling the group your level of experience with PHP, MySQL,
(Javascript), ...

Just a thought.

David



--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240

=-=-=-=-=-=-=-=-=-=-=

Check out PHPenguin, a lightweight and versatile 
PHP/MySQL development framework.


http://phpenguin.bigskypenguin.com

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



[PHP] multidimensional array problems

2007-01-13 Thread nitrox doe

hi all,
im very new to php but i think i jumped on the
toughest thing to learn. Im trying to create a
team roster that will show game, game type
and league and then show each member based
on the game type. Ive worked out alot of code
but just cant figure where im going wrong. so
here is my code. Any pointers would be greatly
appreciated.

this is an example of what im trying to do
http://www.chalkthree.com/exampleroster.html

php code
?php
//begin member league table
$memroster = SELECT inf_league.game, inf_league.type, inf_member.user_name, 
inf_member.rank,  .

inf_member.country, inf_member.email  .
FROM inf_league  .
INNER JOIN inf_memberleague ON inf_league.gid = 
inf_memberleague.l_id  .
INNER JOIN inf_member ON inf_member.user_id = 
inf_memberleague.m_id;

$memrosterresults = mysql_query($memroster)
 or die(mysql_error());
 while ($row = mysql_fetch_array($memrosterresults)) {

foreach ($row as $game = $type) {
echo p;
echo $type;
 foreach ($row as $type = $user_name) {
echo $user_name .  -  . $rank .  -  . $country .  -  . $email; 
}

print '/p';
}
}
//end member league table
?








mysql


CREATE TABLE `inf_league` (  `gid` int(11) NOT NULL auto_increment,  `game` 
varchar(255) NOT NULL,  `type` varchar(255) NOT NULL,  `league` varchar(255) 
NOT NULL,  `season` varchar(255) NOT NULL,  PRIMARY KEY  (`gid`)) 
TYPE=MyISAM  AUTO_INCREMENT=4 ;-- -- Dumping data for table `inf_league`-- 
INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES 
(1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st Quarter');INSERT INTO `inf_league` 
(`gid`, `game`, `type`, `league`, `season`) VALUES (2, 'CoD2', 'CTF', 'TWL', 
'2006 2nd QTR');INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, 
`season`) VALUES (3, 'CoD2', 'Search  Destroy', 'CAL', '2006 4th QTR');-- 
-- -- Table 
structure for table
`inf_member`-- CREATE TABLE `inf_member` (  `user_id` int(11) NOT NULL 
auto_increment,  `user_level` int(2) NOT NULL default '0',  `list_order` 
int(3) NOT NULL default '0',  `user_name` varchar(100) NOT NULL default '',  
`password` varchar(25) NOT NULL default '',  `email` varchar(100) NOT NULL 
default '',  `country` text NOT NULL,  `game` text,  `rank` varchar(40) 
default NULL,  `qoute` longtext,  `config` int(1) default '0',  `map` 
varchar(100) default '',  `gun` varchar(100) default '',  `brand` 
varchar(100) default '',  `cpu` varchar(20) default '',  `ram` varchar(20) 
default '',  `video` varchar(100) default '',  `sound` varchar(100) default 
'',  `monitor` varchar(100) default '',  `mouse` varchar(100) default '',  
PRIMARY KEY  (`user_id`)) TYPE=MyISAM  AUTO_INCREMENT=3 ;--
-- Dumping data for table `inf_member`-- INSERT INTO `inf_member` 
(`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`, 
`country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`, 
`ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (1, 1, 0, 'nitrox', 
'test', '[EMAIL PROTECTED]', 'United States', 'CoD2', 'Founder', NULL, 0, NULL, 
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);INSERT INTO `inf_member` 
(`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`, 
`country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`, 
`ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (2, 1, 1, 'raze', 
'itsme', '[EMAIL PROTECTED]', 'United States', NULL, 'Leader', NULL, 0, '', 
'', '', '', '', '', '', '', '');-- 
-- -- Table 
structure for table
`inf_memberleague`-- CREATE TABLE `inf_memberleague` (  `l_id` int(4) NOT 
NULL,  `m_id` int(4) NOT NULL) TYPE=MyISAM;-- -- Dumping data for table 
`inf_memberleague`-- INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES 
(1, 2);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 1);INSERT 
INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 1);INSERT INTO 
`inf_memberleague` (`l_id`, `m_id`) VALUES (2, 2);


_
Get live scores and news about your team: Add the Live.com Football Page 
www.live.com/?addtemplate=footballicid=T001MSN30A0701


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



[PHP] fopen and fwrite r+

2007-01-13 Thread Richard Kolseth
I'm collecting data from a form and using it to write to a flat file  
like so:

Quote:
//this removes line breaks in an text field box and substitutes  
double breaks

$postbody = str_replace(\r\n, br/br/,$postbody);
$thepost = $postitle | $postdate | $postbody | $author \r\n;
if ($posttype==add) {
// the r+ flag reads and writes at the top of the file, a writes at  
the bottom

$file = fopen(../includes/news.txt, 'r+');
fwrite ($file, $thepost\r\n);
fclose($file);
}
else { }
I can write to the bottom of the file, no problem, but if I want to  
put new entries at the top of the file I have problems:

the previous entry is partially overwritten and mangled..
like so: (this is the top line from the text file


Site Redesign | Jan 9, 07, 9:31 am | The site has a new look...etc


becomes


new look!...etc


a 20 character post overwrites 22
a 50 character post overwrites 62
61 character post overwrites 64
260 character post overwrites 260 characters.. it seems to be random,  
somewhat...

any ideas?



Re: [PHP] Extracting XMP text from Jpeg

2007-01-13 Thread Bill Guion

At 8:05 PM +0200 1/13/07, Dotan Cohen wrote:



Hehehe... Good thing that I didn't post a picture of Gush:
http://dotancohen.com/gallery/img-122.html



I presume Gush is an advanced computer mouse?

 -= Bill =-

--

Jury: a panel of 12 men and women selected
to decide who has the better lawyer.
  


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



Re: [PHP] Anyone would like to test my open source application http://sourceforge.net/projects/dfo/ ?

2007-01-13 Thread Gert Cuykens

On 1/14/07, Jürgen Wind [EMAIL PROTECTED] wrote:

Gert Cuykens wrote:

 It's a web based sql console that you can use instead of phpmyadmin.

nice idea,
but i got lots of js errors (i.e. resulting from an orphaned colon in almost
every .js file)
i tried db5c28.tar.bz2 from sf.net


it doesnt work in ie because of xmlhttprequest (ajax) please try
firefox 2 and it will work perfectly without any errors. Everything is
w3c validated.

IE uses activex instead of xmlhttprequest. First i would like to make
db5 stable for firefox2 and then IE.


Re: [PHP] fopen and fwrite r+

2007-01-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-13 17:32:00 -0500:
 I can write to the bottom of the file, no problem, but if I want to  
 put new entries at the top of the file I have problems:
 the previous entry is partially overwritten and mangled..
 
you cannot prepend to a file. to do that you need to create a new
file, write the new data in it, and append data from the old file.

class newLiner extends IteratorIterator
{
function current()
{
return $this-getInnerIterator()-current() . \n;
}
}

$lines = array('line 1', 'line 2', 'line 3');
$data = new newLiner(new ArrayObject($lines));
$file = new SPLFileObject('file', 'r');
$temp = new SPLFileObject('temp', 'w');

$all = new AppendIterator;
$all-append($data);
$all-append($file);

foreach ($all as $line) {
$temp-fwrite($line);
}

$file-fflush();
$temp-fflush();
unset($file); unset($temp);

-- 
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] Anyone would like to test my open source application http://sourceforge.net/projects/dfo/ ?

2007-01-13 Thread Jürgen Wind



Gert Cuykens wrote:
 
 On 1/14/07, Jürgen Wind [EMAIL PROTECTED] wrote:
 Gert Cuykens wrote:
 
  It's a web based sql console that you can use instead of phpmyadmin.
 
 nice idea,
 but i got lots of js errors (i.e. resulting from an orphaned colon in
 almost
 every .js file)
 i tried db5c28.tar.bz2 from sf.net
 
 it doesnt work in ie because of xmlhttprequest (ajax) please try
 firefox 2 and it will work perfectly without any errors. Everything is
 w3c validated.
 
 IE uses activex instead of xmlhttprequest. First i would like to make
 db5 stable for firefox2 and then IE.
 
 
I never use IE.
The errors trigger the error console in FF2 and Opera as well.

here are the last lines from edit.js for example:

  server.send('function',false,f,'sha1='+v)
  window.close()
 },  //-- offending colon

}

-- 
View this message in context: 
http://www.nabble.com/Anyone-would-like-to-test-my-open-source-application-http%3A--sourceforge.net-projects-dfotf2971271.html#a8327318
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] Stripslashes

2007-01-13 Thread Beauford
Hi,

Anyone know how I can strip slashes from $_POST variables. I have tried
about a hundred different ways of doing this and nothing works.

i.e.

if(!empty($_POST)){
foreach($_POST as $x = $y){
$_POST[$x] = stripslashes($y);
}
}

This came about after someone tried to enter O'Toole in a form, and it
appeared as O\'Toole.

Thanks

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



Re: [PHP] Javascript detection , working version

2007-01-13 Thread Casey Chu

That book is so cool! =P

Anyways, it said that browsers with Javascript, but not a recent
enough Javascript would not display the Noscript.

On 1/13/07, tedd [EMAIL PROTECTED] wrote:

At 9:32 PM -0800 1/11/07, Jürgen Wind wrote:
tedd wrote:
index.php, jstest110.php) , make it one.
ok
---8---
It would be cool if I could send js value via a
POST instead of GET-- can that be done?
have a look http://149.222.235.16/jstest/70112/index.php ( POST version )

tedd

PS: I read somewhere that using noscript is not recommended.
any info?

Yes, I knew I read it somewhere (my memory is not as good as it used to be).

In the book PPK on Javascript (most excellent
book btw http://www.quirksmode.org/book/), on
page 57 he says Therefore, it's best not to use
the noscript tag at all.

I leave it to you to buy the book to find out
why. But basically, browsers that don't use
javascript don't see that tag and those that do,
don't use it. As such, the tag has no real use.

Cheers,

tedd

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

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




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



Re: [PHP] multidimensional array problems

2007-01-13 Thread Larry Garfield
It's better to just leave the record as an array and read it that way.

while ($row = mysql_fetch_assoc($result)) {
print trtd{$row['game']}/td td{$row['type']}/td/tr\n;
}

And so on.  You're not actually dealing with a multi-dimensional array yet; 
$result is an object from which you are extracting data records as 
one-dimensional associative arrays.

On Saturday 13 January 2007 7:40 pm, nitrox doe wrote:
 hi all,
 im very new to php but i think i jumped on the
 toughest thing to learn. Im trying to create a
 team roster that will show game, game type
 and league and then show each member based
 on the game type. Ive worked out alot of code
 but just cant figure where im going wrong. so
 here is my code. Any pointers would be greatly
 appreciated.

 this is an example of what im trying to do
 http://www.chalkthree.com/exampleroster.html

 php code
 ?php
 //begin member league table
 $memroster = SELECT inf_league.game, inf_league.type,
 inf_member.user_name, inf_member.rank,  .
  inf_member.country, inf_member.email  .
  FROM inf_league  .
  INNER JOIN inf_memberleague ON inf_league.gid =
 inf_memberleague.l_id  .
  INNER JOIN inf_member ON inf_member.user_id =
 inf_memberleague.m_id;
 $memrosterresults = mysql_query($memroster)
   or die(mysql_error());
   while ($row = mysql_fetch_array($memrosterresults)) {

 foreach ($row as $game = $type) {
 echo p;
 echo $type;
   foreach ($row as $type = $user_name) {
 echo $user_name .  -  . $rank .  -  . $country .  -  .
 $email; }
 print '/p';
 }
 }
 //end member league table
 ?








 mysql


 CREATE TABLE `inf_league` (  `gid` int(11) NOT NULL auto_increment,  `game`
 varchar(255) NOT NULL,  `type` varchar(255) NOT NULL,  `league`
 varchar(255) NOT NULL,  `season` varchar(255) NOT NULL,  PRIMARY KEY 
 (`gid`))
 TYPE=MyISAM  AUTO_INCREMENT=4 ;-- -- Dumping data for table `inf_league`--
 INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES
 (1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st Quarter');INSERT INTO `inf_league`
 (`gid`, `game`, `type`, `league`, `season`) VALUES (2, 'CoD2', 'CTF',
 'TWL', '2006 2nd QTR');INSERT INTO `inf_league` (`gid`, `game`, `type`,
 `league`, `season`) VALUES (3, 'CoD2', 'Search  Destroy', 'CAL', '2006 4th
 QTR');-- -- --
 Table structure for table
 `inf_member`-- CREATE TABLE `inf_member` (  `user_id` int(11) NOT NULL
 auto_increment,  `user_level` int(2) NOT NULL default '0',  `list_order`
 int(3) NOT NULL default '0',  `user_name` varchar(100) NOT NULL default '',
 `password` varchar(25) NOT NULL default '',  `email` varchar(100) NOT NULL
 default '',  `country` text NOT NULL,  `game` text,  `rank` varchar(40)
 default NULL,  `qoute` longtext,  `config` int(1) default '0',  `map`
 varchar(100) default '',  `gun` varchar(100) default '',  `brand`
 varchar(100) default '',  `cpu` varchar(20) default '',  `ram` varchar(20)
 default '',  `video` varchar(100) default '',  `sound` varchar(100) default
 '',  `monitor` varchar(100) default '',  `mouse` varchar(100) default '',
 PRIMARY KEY  (`user_id`)) TYPE=MyISAM  AUTO_INCREMENT=3 ;--
 -- Dumping data for table `inf_member`-- INSERT INTO `inf_member`
 (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`,
 `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`,
 `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (1, 1, 0, 'nitrox',
 'test', '[EMAIL PROTECTED]', 'United States', 'CoD2', 'Founder', NULL, 0, 
 NULL,
 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);INSERT INTO `inf_member`
 (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`,
 `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`,
 `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (2, 1, 1, 'raze',
 'itsme', '[EMAIL PROTECTED]', 'United States', NULL, 'Leader', NULL, 0, '',
 '', '', '', '', '', '', '', '');--
 -- -- Table
 structure for table
 `inf_memberleague`-- CREATE TABLE `inf_memberleague` (  `l_id` int(4) NOT
 NULL,  `m_id` int(4) NOT NULL) TYPE=MyISAM;-- -- Dumping data for table
 `inf_memberleague`-- INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES
 (1, 2);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 1);INSERT
 INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 1);INSERT INTO
 `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 2);

 _
 Get live scores and news about your team: Add the Live.com Football Page
 www.live.com/?addtemplate=footballicid=T001MSN30A0701

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; 

Re: [PHP] Anyone would like to test my open source application http://sourceforge.net/projects/dfo/ ?

2007-01-13 Thread Gert Cuykens

On 1/14/07, Jürgen Wind [EMAIL PROTECTED] wrote:

Gert Cuykens wrote:

 On 1/14/07, Jürgen Wind [EMAIL PROTECTED] wrote:
 Gert Cuykens wrote:
 
  It's a web based sql console that you can use instead of phpmyadmin.
 
 nice idea,
 but i got lots of js errors (i.e. resulting from an orphaned colon in
 almost
 every .js file)
 i tried db5c28.tar.bz2 from sf.net

 it doesnt work in ie because of xmlhttprequest (ajax) please try
 firefox 2 and it will work perfectly without any errors. Everything is
 w3c validated.

 IE uses activex instead of xmlhttprequest. First i would like to make
 db5 stable for firefox2 and then IE.


I never use IE.
The errors trigger the error console in FF2 and Opera as well.

here are the last lines from edit.js for example:

  server.send('function',false,f,'sha1='+v)
  window.close()
 },  //-- offending colon

}


ah ok i am sorry, you can just remove the , (the offending colon)
somehow my ff2 setup on ubuntu doesnt make a fuss about it not even a
warning ? I only put it there to make my json code look nicer lol :)

I will change all }, } into } } in next release. Thanks anything else ?


Re: [PHP] multidimensional array problems

2007-01-13 Thread Larry Garfield
Copying back to the list...

Actually, I'd suggest doing a PHP-side grouping.  See this article for 
details:

http://www.garfieldtech.com/blog/php-group-by

On Saturday 13 January 2007 10:50 pm, nitrox . wrote:
 I hope this is returning to the mail list so all can read.
 Thanks for the reply Larry, i appreciate your time spent to reply to me. If
 i print the way your showing it prints for every instance. Im trying to
 create a team roster like the following url shows:
 http://www.chalkthree.com/exampleroster.html

 I have 3 tables in my db, league table, lookup table and member table. Do
 you think it would be better possably to do seperate querys and then match
 them in php? would that be possable the given the setup i have?

 From: Larry Garfield [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Subject: Re: [PHP] multidimensional array problems
 Date: Sat, 13 Jan 2007 21:51:08 -0600
 
 It's better to just leave the record as an array and read it that way.
 
 while ($row = mysql_fetch_assoc($result)) {
 print trtd{$row['game']}/td td{$row['type']}/td/tr\n;
 }
 
 And so on.  You're not actually dealing with a multi-dimensional array
  yet; $result is an object from which you are extracting data records as
  one-dimensional associative arrays.
 
 On Saturday 13 January 2007 7:40 pm, nitrox doe wrote:
   hi all,
   im very new to php but i think i jumped on the
   toughest thing to learn. Im trying to create a
   team roster that will show game, game type
   and league and then show each member based
   on the game type. Ive worked out alot of code
   but just cant figure where im going wrong. so
   here is my code. Any pointers would be greatly
   appreciated.
  
   this is an example of what im trying to do
   http://www.chalkthree.com/exampleroster.html
  
   php code
   ?php
   //begin member league table
   $memroster = SELECT inf_league.game, inf_league.type,
   inf_member.user_name, inf_member.rank,  .
inf_member.country, inf_member.email  .
FROM inf_league  .
INNER JOIN inf_memberleague ON inf_league.gid =
   inf_memberleague.l_id  .
INNER JOIN inf_member ON inf_member.user_id =
   inf_memberleague.m_id;
   $memrosterresults = mysql_query($memroster)
 or die(mysql_error());
 while ($row = mysql_fetch_array($memrosterresults)) {
  
   foreach ($row as $game = $type) {
   echo p;
   echo $type;
 foreach ($row as $type = $user_name) {
   echo $user_name .  -  . $rank .  -  . $country .  -  .
   $email; }
   print '/p';
   }
   }
   //end member league table
   ?
  
  
  
  
  
  
  
  
   mysql
  
  
   CREATE TABLE `inf_league` (  `gid` int(11) NOT NULL auto_increment,
 
 `game`
 
   varchar(255) NOT NULL,  `type` varchar(255) NOT NULL,  `league`
   varchar(255) NOT NULL,  `season` varchar(255) NOT NULL,  PRIMARY KEY
   (`gid`))
   TYPE=MyISAM  AUTO_INCREMENT=4 ;-- -- Dumping data for table
 
 `inf_league`--
 
   INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`)
 
 VALUES
 
   (1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st Quarter');INSERT INTO
 
 `inf_league`
 
   (`gid`, `game`, `type`, `league`, `season`) VALUES (2, 'CoD2', 'CTF',
   'TWL', '2006 2nd QTR');INSERT INTO `inf_league` (`gid`, `game`, `type`,
   `league`, `season`) VALUES (3, 'CoD2', 'Search  Destroy', 'CAL', '2006
 
 4th
 
   QTR');-- -- --
   Table structure for table
   `inf_member`-- CREATE TABLE `inf_member` (  `user_id` int(11) NOT NULL
   auto_increment,  `user_level` int(2) NOT NULL default '0', 
   `list_order` int(3) NOT NULL default '0',  `user_name` varchar(100) NOT
   NULL default
 
 '',
 
   `password` varchar(25) NOT NULL default '',  `email` varchar(100) NOT
 
 NULL
 
   default '',  `country` text NOT NULL,  `game` text,  `rank` varchar(40)
   default NULL,  `qoute` longtext,  `config` int(1) default '0',  `map`
   varchar(100) default '',  `gun` varchar(100) default '',  `brand`
   varchar(100) default '',  `cpu` varchar(20) default '',  `ram`
 
 varchar(20)
 
   default '',  `video` varchar(100) default '',  `sound` varchar(100)
 
 default
 
   '',  `monitor` varchar(100) default '',  `mouse` varchar(100) default
 
 '',
 
   PRIMARY KEY  (`user_id`)) TYPE=MyISAM  AUTO_INCREMENT=3 ;--
   -- Dumping data for table `inf_member`-- INSERT INTO `inf_member`
   (`user_id`, `user_level`, `list_order`, `user_name`, `password`,
 
 `email`,
 
   `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`,
 
 `cpu`,
 
   `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (1, 1, 0, 'nitrox',
   'test', '[EMAIL PROTECTED]', 'United States', 'CoD2', 'Founder', NULL, 0,
 
 NULL,
 
   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);INSERT INTO
   `inf_member` (`user_id`, `user_level`, `list_order`, `user_name`,
   `password`,
 
 `email`,
 
   `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`,
 
 `cpu`,
 
   `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (2, 1, 

Re: [PHP] Extracting XMP text from Jpeg

2007-01-13 Thread Dotan Cohen

On 14/01/07, Bill Guion [EMAIL PROTECTED] wrote:

At 8:05 PM +0200 1/13/07, Dotan Cohen wrote:


Hehehe... Good thing that I didn't post a picture of Gush:
http://dotancohen.com/gallery/img-122.html


I presume Gush is an advanced computer mouse?

  -= Bill =-



First wireless model available!

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/464/stone_temple_pilots.html
http://easy-answers.org

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



Re: [PHP] Include file error, common one I think

2007-01-13 Thread Chris Carter

I am not sure about this but the requirement is that even the links
associated with the image changes with the image. Like an image of
restaurant links to restaurants page and image for pubs links to pubs page.
Is this achievable through this code. I could not test it coz it was not
working. Can you help!!!

Thanks,


Jochem Maas wrote:
 
 Chris Carter wrote:
 Hi,
 
 I have used this file in my index file. When I run this file separately
 it
 shows the random image but not when I include on my index.php.
 
 your image script shouldn't be included in your [index] page.
 instead it should be referenced by the src attribute of an img
 tag that your [index] page outputs e.g. in your [index] page
 have a line something like:
 
 echo ' /randomimage.php ';
 
 
 Thanks in advance,
 
 
 João Cândido de Souza Neto wrote:
 Is it the whole code of your file, or is there any other html code?

 Chris Carter [EMAIL PROTECTED] escreveu na mensagem 
 news:[EMAIL PROTECTED]
 Hi,

 Here is code that I got from the internet for random image. This file 
 works
 perfect if I try it independently but not on any existing file. I think 
 the
 error that I am getting is quite common on the net but its new for me.

 I am getting this error:

 Warning: Cannot modify header information - headers already sent by 
 (output
 started at /folder/test.php:12) in /folder/randomimage.php on line 19

 the code that I got from net:

 ?
 $folder = 'images/';
 $exts = 'jpg jpeg png gif';
 $files = array(); $i = -1;
 if ('' == $folder) $folder = './';
 $handle = opendir($folder);
 $exts = explode(' ', $exts);
 while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) {
if (preg_match('/\.'.$ext.'$/i', $file, $test)) {
$files[] = $file;
++$i;
}
}
}
 closedir($handle);
 mt_srand((double)microtime()*100);
 $rand = mt_rand(0, $i);


 Line 19 is below:

 header('Location: '.$folder.$files[$rand]);
 ?

 Thanks a bunch.
 Chris
 -- 
 View this message in context: 
 http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8316202
 Sent from the PHP - General mailing list archive at Nabble.com. 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



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

-- 
View this message in context: 
http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8331510
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] multidimensional array problems

2007-01-13 Thread Jim Lucas

Give this a go

?php
//begin member league table
$memroster = SELECT inf_league.game, inf_league.type, 
inf_member.user_name, inf_member.rank,  .

inf_member.country, inf_member.email  .
FROM inf_league  .
INNER JOIN inf_memberleague ON inf_league.gid = 
inf_memberleague.l_id  .
INNER JOIN inf_member ON inf_member.user_id = 
inf_memberleague.m_id;

$memrosterresults = mysql_query($memroster) or die(mysql_error());

$currentType = FALSE;
echo p\n;
while ( $row = mysql_fetch_assoc($memrosterresults) ) {
   if ( $row['type'] != $currentType ) {
   if ( $currentType !== FALSE ) {
   echo /p\n;
   echo p\n;
   }
   echo h3{$row['type']}/h3\n;
   $currentType = $row['type'];
   }
   echo {$row['user_name']} - {$row['rank']} - {$row['country']} - 
{$row['email']}br /\n;

}
echo /p\n;
//end member league table
?

This is untested, but it should give you the results you are looking for.

Jim Lucas

nitrox doe wrote:

hi all,
im very new to php but i think i jumped on the
toughest thing to learn. Im trying to create a
team roster that will show game, game type
and league and then show each member based
on the game type. Ive worked out alot of code
but just cant figure where im going wrong. so
here is my code. Any pointers would be greatly
appreciated.

this is an example of what im trying to do
http://www.chalkthree.com/exampleroster.html

php code
?php
//begin member league table
$memroster = SELECT inf_league.game, inf_league.type, 
inf_member.user_name, inf_member.rank,  .

inf_member.country, inf_member.email  .
FROM inf_league  .
INNER JOIN inf_memberleague ON inf_league.gid = 
inf_memberleague.l_id  .
INNER JOIN inf_member ON inf_member.user_id = 
inf_memberleague.m_id;

$memrosterresults = mysql_query($memroster)
 or die(mysql_error());
 while ($row = mysql_fetch_array($memrosterresults)) {

foreach ($row as $game = $type) {
echo p;
echo $type;
 foreach ($row as $type = $user_name) {
echo $user_name .  -  . $rank .  -  . $country .  -  . 
$email; }

print '/p';
}
}
//end member league table
?








mysql


CREATE TABLE `inf_league` (  `gid` int(11) NOT NULL auto_increment,  
`game` varchar(255) NOT NULL,  `type` varchar(255) NOT NULL,  `league` 
varchar(255) NOT NULL,  `season` varchar(255) NOT NULL,  PRIMARY KEY  
(`gid`)) TYPE=MyISAM  AUTO_INCREMENT=4 ;-- -- Dumping data for table 
`inf_league`-- INSERT INTO `inf_league` (`gid`, `game`, `type`, 
`league`, `season`) VALUES (1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st 
Quarter');INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, 
`season`) VALUES (2, 'CoD2', 'CTF', 'TWL', '2006 2nd QTR');INSERT INTO 
`inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (3, 
'CoD2', 'Search  Destroy', 'CAL', '2006 4th QTR');-- 
-- -- Table 
structure for table
`inf_member`-- CREATE TABLE `inf_member` (  `user_id` int(11) NOT NULL 
auto_increment,  `user_level` int(2) NOT NULL default '0',  
`list_order` int(3) NOT NULL default '0',  `user_name` varchar(100) 
NOT NULL default '',  `password` varchar(25) NOT NULL default '',  
`email` varchar(100) NOT NULL default '',  `country` text NOT NULL,  
`game` text,  `rank` varchar(40) default NULL,  `qoute` longtext,  
`config` int(1) default '0',  `map` varchar(100) default '',  `gun` 
varchar(100) default '',  `brand` varchar(100) default '',  `cpu` 
varchar(20) default '',  `ram` varchar(20) default '',  `video` 
varchar(100) default '',  `sound` varchar(100) default '',  `monitor` 
varchar(100) default '',  `mouse` varchar(100) default '',  PRIMARY 
KEY  (`user_id`)) TYPE=MyISAM  AUTO_INCREMENT=3 ;--
-- Dumping data for table `inf_member`-- INSERT INTO `inf_member` 
(`user_id`, `user_level`, `list_order`, `user_name`, `password`, 
`email`, `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, 
`brand`, `cpu`, `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES 
(1, 1, 0, 'nitrox', 'test', '[EMAIL PROTECTED]', 'United States', 'CoD2', 
'Founder', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
NULL);INSERT INTO `inf_member` (`user_id`, `user_level`, `list_order`, 
`user_name`, `password`, `email`, `country`, `game`, `rank`, `qoute`, 
`config`, `map`, `gun`, `brand`, `cpu`, `ram`, `video`, `sound`, 
`monitor`, `mouse`) VALUES (2, 1, 1, 'raze', 'itsme', 
'[EMAIL PROTECTED]', 'United States', NULL, 'Leader', NULL, 0, '', '', 
'', '', '', '', '', '', '');-- 
-- -- Table 
structure for table
`inf_memberleague`-- CREATE TABLE `inf_memberleague` (  `l_id` int(4) 
NOT NULL,  `m_id` int(4) NOT NULL) TYPE=MyISAM;-- -- Dumping data for 
table `inf_memberleague`-- INSERT INTO `inf_memberleague` (`l_id`, 
`m_id`) VALUES (1, 2);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) 
VALUES (1, 1);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES 
(2, 1);INSERT INTO 

Re: [PHP] Stripslashes

2007-01-13 Thread Jim Lucas

Beauford wrote:

Hi,

Anyone know how I can strip slashes from $_POST variables. I have tried
about a hundred different ways of doing this and nothing works.

i.e.

if(!empty($_POST)){
foreach($_POST as $x = $y){
$_POST[$x] = stripslashes($y);
}
}

This came about after someone tried to enter O'Toole in a form, and it
appeared as O\'Toole.

Thanks

  

This is what I use, and it has worked ever time.

if ( get_magic_quotes_gpc() ) {
 $_POST = array_map(stripslashes, $_POST);
}

Jim Lucas

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



Re: [PHP] Stripslashes

2007-01-13 Thread Larry Garfield
On Sunday 14 January 2007 12:01 am, Jim Lucas wrote:

 This is what I use, and it has worked ever time.

 if ( get_magic_quotes_gpc() ) {
   $_POST = array_map(stripslashes, $_POST);
 }

 Jim Lucas

That will break as soon as you submit an array back through a POST request, 
which I do rather often. :-)  You need to iterate over the array, and if an 
item is an array, iterate over it recursively.  array_walk() can be useful 
here.

Of course, the real answer is to disable magic quotes in the first place as 
they are spawn of Satan.  If you're using a web host that doesn't let you do 
so, get a real web host.  

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



Re: [PHP] Stripslashes

2007-01-13 Thread Jim Lucas

Larry Garfield wrote:

On Sunday 14 January 2007 12:01 am, Jim Lucas wrote:

  

This is what I use, and it has worked ever time.

if ( get_magic_quotes_gpc() ) {
  $_POST = array_map(stripslashes, $_POST);
}

Jim Lucas



That will break as soon as you submit an array back through a POST request, 
which I do rather often. :-)  You need to iterate over the array, and if an 
item is an array, iterate over it recursively.  array_walk() can be useful 
here.


Of course, the real answer is to disable magic quotes in the first place as 
they are spawn of Satan.  If you're using a web host that doesn't let you do 
so, get a real web host.  

  

Had to think about that one and test, but you are right.
Up until this point, I have not had a project that I had to submit 
arrays via POST.  Just happens that next week, I would have started my 
first project that does require me to submit via POST with arrays and I 
would have found it then, but anyways, it is fixed now.


on my dev server I have PHP 4.3.11 so I had to build my own work around 
for array_walk_recursive, since it is only in PHP5 and newer  :(


I am pretty sure that it does what the function does in PHP5

Try this

plaintext?PHP
//stripslashes test

function array_walk_recursive($a, $b, $c=null) {
   foreach ( $a AS $k = $v ) {
   if ( is_array($v) ) {
   array_walk_recursive($v, $b, $c);
   $a[$k] = $v;
   } else {
   $a[$k] = $b($v, $k, $c);
   }
   }
   return true;
}

function my_stripslashes($a, $b, $c='') {
   return stripslashes($a);
}

$data[] = addslashes(Jim's new list);
$data[] = addslashes(Tom's new list);
$data[] = array(addslashes(bill's), addslashes(Tracy's));

var_dump($data);

array_walk_recursive($data, my_stripslashes);

var_dump($data);

?


Jim Lucas

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