[PHP] imagecreatefromgif fails for a valid image

2007-09-24 Thread thushw

I get a failure in creating a gif. php error log shows this:

Sep 24 00:25:47 thushw-laptop apache2: PHP Warning:  imagecreatefromgif() [
function.imagecreatefromgif function.imagecreatefromgif ]:
'/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif'
is not a valid GIF file in
/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/button.php on
line 30

the gif can be viewed by gthumb. it seems ok.

the problem is only for some gifs. Most gifs, all pngs, jpegs that i've
tested so far work.

i'm running php5 on ubuntu (uname -a : Linux thushw-laptop 2.6.20.3-ubuntu1
#2 SMP Sun Apr 15 11:26:58 PDT 2007 i686 GNU/Linux)

phpinfo shows:

gd
GD Support  enabled
GD Version  2.0 or higher
FreeType Supportenabled
FreeType Linkagewith freetype
FreeType Version2.2.1
T1Lib Support   enabled
GIF Read Supportenabled
GIF Create Support  enabled
JPG Support enabled
PNG Support enabled
WBMP Supportenabled

from what i've read so far, seems like i need gd lib >=2.0.28. from phpinfo
output it is not clear if i have the right version. i use: apt-get install
php5-gd to install gd

these are the files i think are of importance:

/usr/lib/libgd.so.2.0.34
/usr/lib/libgd.so.2

[the second is a symlink to the first]

>> ls -l /usr/lib/libgd.so.2
lrwxrwxrwx 1 root root 15 2007-09-24 00:25 /usr/lib/libgd.so.2 ->
libgd.so.2.0.34

how do i debug this further?  any help greatly appreciated. this problem
doesn't appear with the gd we have installed on our centos servers. seems to
happen only on my ubuntu install.

thushara
-- 
View this message in context: 
http://www.nabble.com/imagecreatefromgif-fails-for-a-valid-image-tf4507593.html#a12855355
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] Players Table

2007-09-24 Thread Christoph

Players

NFL_Team ( varchar32 )
Fantasy_team ( varchar32 )


I player can definitely be part of only 1 NFL Team.  But how are you 
handling your league?  Is this just for a single small group of people?  Or 
is this database to be set up for lots of leagues?  If the latter, you 
should move Fantasy_team out to another table.


Also, do you want to be able to track a player historically?  If so, you 
might want to move NFL_Team to another table as well since a player can get 
traded.



Salary cap (int )6


Why do you need this?  For the fantasy league?  If so, is the cap different 
for each league?  If so, you might want to break this out.



Another thought.
I am not sure on what to do with the players stats.
Should that be in the same table as his profile info?
Like Passing Yards, touchdowns, etc.


If you want to track this as part of historical data, put it into another 
table.  Otherwise it should do fine in the player table.


thnx,
Chris 


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



Re: [PHP] Limiting connection to mysql using old mysql module (not mysqli)

2007-09-24 Thread Chris



The number of connections is presumably only important if we speak
about the number of concurrent connections.  If each query can be
dealt with faster due to caching, the number of concurrent
connections  should drop.

Err no - it still has to connect to the database (thus use a
connection slot) to even get to the cache.


Err yes - a query replied to out of cache will take less time to
complete, therefore the connection will be given up faster, therefore
less _concurrent_ connections.  


I guess my idea of concurrency is different to yours.

100 people come to your website - that's still going to be 100 
connections to the database, regardless of where the results come from.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Limiting connection to mysql using old mysql module (not mysqli)

2007-09-24 Thread Per Jessen
Chris wrote:

>> Err yes - a query replied to out of cache will take less time to
>> complete, therefore the connection will be given up faster, therefore
>> less _concurrent_ connections.
> 
> I guess my idea of concurrency is different to yours.

http://en.wiktionary.org/wiki/concurrent

"Happening at the same time; simultaneous."

> 100 people come to your website - that's still going to be 100
> connections to the database, regardless of where the results come
> from.

But if that is one every hour for a hundred hours, your max concurrency
is 1.  


/Per Jessen, Zürich

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



Re: [PHP] Limiting connection to mysql using old mysql module (not mysqli)

2007-09-24 Thread Chris

Per Jessen wrote:

Chris wrote:


Err yes - a query replied to out of cache will take less time to
complete, therefore the connection will be given up faster, therefore
less _concurrent_ connections.

I guess my idea of concurrency is different to yours.


http://en.wiktionary.org/wiki/concurrent

"Happening at the same time; simultaneous."


100 people come to your website - that's still going to be 100
connections to the database, regardless of where the results come
from.


But if that is one every hour for a hundred hours, your max concurrency
is 1.  


I'm talking about "now" - not over any time span. 100 connections at the 
same time. If you get 100 people to your website at exactly the same 
time, the query cache may be used - but you're still going to have 100 
connections to your database.


The OP wanted to cut that down. In which case the answer is to cache 
things server side using something like memcache or even one of the pear 
modules.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Limiting connection to mysql using old mysql module (not mysqli)

2007-09-24 Thread Per Jessen
Chris wrote:

>> "Happening at the same time; simultaneous."
>> 
>>> 100 people come to your website - that's still going to be 100
>>> connections to the database, regardless of where the results come
>>> from.
>> 
>> But if that is one every hour for a hundred hours, your max
>> concurrency is 1.
> 
> I'm talking about "now" - not over any time span. 100 connections at
> the same time. If you get 100 people to your website at exactly the 
> same time, the query cache may be used - but you're still going to
> have 100 connections to your database.

For a while, yes.  I don't believe there is any sense in talking about
server load, number of connections, caching and concurrency without
talking about over how long. 

When you think length("now")==0, you can have an infinite number of
connections. 


/Per Jessen, Zürich

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



[PHP] Merging PDF Documents

2007-09-24 Thread Tom Chubb
Please can someone tell me if this is easy to do or whether I should
use a package already available...

I want to upload a pdf file to a folder then for each subsequent
upload, I want it to be appended to the original file. Each pdf is a
timesheet, so I want to end up with one file for all timesheets
instead of different files every week.

What I'd like to know is which function I can use on PHP4?
Is it PDF_begin_page_ext?
Any help appreciated.

Thanks,

Tom

-- 
Tom Chubb
[EMAIL PROTECTED]

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



RE: [PHP] Merging PDF Documents

2007-09-24 Thread Edward Kay
>
> Please can someone tell me if this is easy to do or whether I should
> use a package already available...
>
> I want to upload a pdf file to a folder then for each subsequent
> upload, I want it to be appended to the original file. Each pdf is a
> timesheet, so I want to end up with one file for all timesheets
> instead of different files every week.
>
> What I'd like to know is which function I can use on PHP4?
> Is it PDF_begin_page_ext?
> Any help appreciated.
>
> Thanks,
>
> Tom

I haven't used the PDF functions in PHP, but I think they're primarily
designed for creating new PDF files.

I think http://www.linux.com/articles/36815 will be helpful to you though.

Edward

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



[PHP] Data request

2007-09-24 Thread Christian Hänsel

Good afternoon folks,

as this is not directly related to PHP, I put "OT" into the subject line...
Just trying to stop them watchdogs from biting me ;o)

Anyhow, I am looking for data, preferrably in CSV format, concerning
aircraft. I do have a list of all aircraft which are currently crossing our
sky, but what I am looking for is a dataset with as much information as
possible, i.e. seating capacity, which airline is flying this aircraft,
range... all that kind of stuff.

If anybody has a good resource for stuff like that, please let me know. It
would be highly appreciated.

All the best!

Chris

--
-
My baby's first words will be
"Hello World"



--
-
My baby's first words will be
"Hello World"

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



Re: [PHP] Data request

2007-09-24 Thread Stut

Christian Hänsel wrote:

as this is not directly related to PHP, I put "OT" into the subject line...
Just trying to stop them watchdogs from biting me ;o)


No you didn't. Chomp!


Anyhow, I am looking for data, preferrably in CSV format, concerning
aircraft. I do have a list of all aircraft which are currently crossing our
sky, but what I am looking for is a dataset with as much information as
possible, i.e. seating capacity, which airline is flying this aircraft,
range... all that kind of stuff.


Ok... I don't think "OT" would have covered it anyway.


If anybody has a good resource for stuff like that, please let me know. It
would be highly appreciated.


Have you tried Google? It knows a lot about most things and a little 
about the rest.


-Stut

--
http://stut.net/

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



Re: [PHP] Data request

2007-09-24 Thread Paul Scott

On Mon, 2007-09-24 at 14:14 +0100, Stut wrote:
> Have you tried Google? It knows a lot about most things and a little 
> about the rest.

Also try have a look at the models used in flightgear -
http://www.flightgear.org 

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] Access name of variable in $_POST array

2007-09-24 Thread Eric Lommatsch
Hello Dan,

First off I am sorry for not getting back to you sooner, I had a weekend and
was not checking my work email

The reason that I want both the name of the variable and the value of the
variable is because what I need to do is create a text file that another
program I am integrating with is already designed to work with. If I am not
putting the field names in the file along with the data this other program
ignores the file I am creating. What I need as an output is something that
looks similar to:

FirstName   :   Eric
LastName:   Lommatsch

The point of the script that I am writing is that I want it to be capable of
handling several different PDF forms.

Thank you
 
Eric H. Lommatsch
Programmer
360 Business 
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939
Fax 303-778-0378
 
[EMAIL PROTECTED]

-Original Message-
From: Dan Parry [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 6:26 PM
To: 'Daniel Brown'; 'Stut'
Cc: Eric Lommatsch; php-general@lists.php.net
Subject: RE: [PHP] Access name of variable in $_POST array

> -Original Message-
> From: Daniel Brown [mailto:[EMAIL PROTECTED]
> Sent: 21 September 2007 23:27
> To: Stut
> Cc: Eric Lommatsch; php-general@lists.php.net
> Subject: Re: [PHP] Access name of variable in $_POST array
> 
> On 9/21/07, Stut <[EMAIL PROTECTED]> wrote:
> > Please include the list when replying.
> >
> > Eric Lommatsch wrote:
> > > -Original Message-
> > > From: Stut [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, September 21, 2007 3:09 PM
> > > To: Eric Lommatsch
> > > Cc: php-general@lists.php.net
> > > Subject: Re: [PHP] Access name of variable in $_POST array
> > >
> > > Eric Lommatsch wrote:
> > >> I am writing a PHP script that is going to accept variables that
> are
> > >> passed from a PDF form and should write both the name of the
> variable
> > >> and its value to a text file.
> > >>
> > >>
> > >> I can get the value that I want to retrieve with out problem.
> However,
> > >> even though I have searched through the PHP.net site and googled
> this
> > >> as well I have not yet been able to find the syntax that I need 
> > >> to
> get
> > >> the names of the variables in the $_Post array.
> > >>
> > >> Can someone point me to the place in the PHP manual where I can
> find
> > >> the syntax to get the name of a variable in the $_POST array?
> > >
> > > http://php.net/array_keys
> > >
> > > As in...
> > >
> > > $varnames = array_keys($_POST);
> > >
> > > -Stut
> > >
> > > --
> > > http://stut.net/
> > >
> > > Hello Stut,
> > >
> > > That is not exactly what I am looking for. If I try using that in
> My PHP
> > > script what I get as a result of that is repeatedly the Phrase
> "Post Array"
> > > when I check the values there. The PDF form that is posting to the
> PHP script
> > > is passing variable names like "Employer_name" or "Employee_Name".
> I am
> > > hoping to get those variable names.
> >
> > Put this line at the top of the script that the form posts to...
> >
> > print ''.print_r($_POST, true).''; exit;
> >
> > That will display the contents of the $_POST array and you should be 
> > able to figure out where everything is.
> >
> > By the sounds of it the posted values are actually in $_POST['Post 
> > Array'] but use the above line to be sure.
> >
> > -Stut
> >
> > --
> > http://stut.net/
> >
> > --
> > PHP General Mailing List (http://www.php.net/) To unsubscribe, 
> > visit: http://www.php.net/unsub.php
> >
> >
> 
> Maybe this will get you started and give you some ideas.
> 
>  foreach($_POST as $p => $v) {
> $$p = $v;
> echo $p." = ".$v."\n";
> }
> ?>

I might be missing something but I fail to see the point of the variable
variable assignation (which is best to be avoided :) )

Dan

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



RE: [PHP] Access name of variable in $_POST array

2007-09-24 Thread Eric Lommatsch
-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 21, 2007 4:12 PM
To: Eric Lommatsch
Cc: php-general@lists.php.net
Subject: Re: [PHP] Access name of variable in $_POST array

Please include the list when replying.

Eric Lommatsch wrote:
> -Original Message-
> From: Stut [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 21, 2007 3:09 PM
> To: Eric Lommatsch
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Access name of variable in $_POST array
> 
> Eric Lommatsch wrote:
>> I am writing a PHP script that is going to accept variables that are 
>> passed from a PDF form and should write both the name of the variable 
>> and its value to a text file.
>>  
>>  
>> I can get the value that I want to retrieve with out problem. 
>> However, even though I have searched through the PHP.net site and 
>> googled this as well I have not yet been able to find the syntax that 
>> I need to get the names of the variables in the $_Post array.
>>  
>> Can someone point me to the place in the PHP manual where I can find 
>> the syntax to get the name of a variable in the $_POST array?
> 
> http://php.net/array_keys
> 
> As in...
> 
> $varnames = array_keys($_POST);
> 
> -Stut
> 
> --
> http://stut.net/
> 
> Hello Stut,
> 
> That is not exactly what I am looking for. If I try using that in My 
> PHP script what I get as a result of that is repeatedly the Phrase "Post
Array"
> when I check the values there. The PDF form that is posting to the PHP 
> script is passing variable names like "Employer_name" or "Employee_Name". I
am
> hoping to get those variable names.   

Put this line at the top of the script that the form posts to...

print ''.print_r($_POST, true).''; exit;

That will display the contents of the $_POST array and you should be able to
figure out where everything is.

By the sounds of it the posted values are actually in $_POST['Post Array']
but use the above line to be sure.

-Stut

--
http://stut.net/

Sorry, I thought that I had hit reply to all. Apparently I didn't. 

Thanks that appears to actually be what I was looking for.

Thank you
 
Eric H. Lommatsch
Programmer
360 Business 
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939
Fax 303-778-0378
 
[EMAIL PROTECTED]

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



Re: [PHP] Merging PDF Documents

2007-09-24 Thread Tom Chubb
Unfortunately I can't use shell or install anything on my shared box.
Any other suggestions?

On 24/09/2007, George Pitcher <[EMAIL PROTECTED]> wrote:
> Tom,
>
> I use a Java app called itext to merge PDFs. In my case, it's to add a PDF
> cover created in PHP to a file produced in a wp/ocr package. You need to be
> able to run exec() or shell() to use itext, but its free and quick. Let me
> know if you want more info.
>
> George in Edinburgh
>
> > -Original Message-
> > From: Tom Chubb [mailto:[EMAIL PROTECTED]
> > Sent: 24 September 2007 1:24 pm
> > To: PHP General List
> > Subject: [PHP] Merging PDF Documents
> >
> >
> > Please can someone tell me if this is easy to do or whether I should
> > use a package already available...
> >
> > I want to upload a pdf file to a folder then for each subsequent
> > upload, I want it to be appended to the original file. Each pdf is a
> > timesheet, so I want to end up with one file for all timesheets
> > instead of different files every week.
> >
> > What I'd like to know is which function I can use on PHP4?
> > Is it PDF_begin_page_ext?
> > Any help appreciated.
> >
> > Thanks,
> >
> > Tom
> >
> > --
> > Tom Chubb
> > [EMAIL PROTECTED]
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>


-- 
Tom Chubb
[EMAIL PROTECTED]
07912 202846

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



[PHP] Re: Merging PDF Documents

2007-09-24 Thread Colin Guthrie
Tom Chubb wrote:
> Unfortunately I can't use shell or install anything on my shared box.
> Any other suggestions?

I can't remember the syntax but I'm sure there is an easy way to get one
PDF to reference another and distil it into one... I remember this from
way back when (and using Adobe tools which is why the phrase distil was
used...) and it could be completely irrelevant from the context of PHP
functions which I'm not familiar with personally so in short, I
can't help :/

Col

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



[PHP] Re: Data request

2007-09-24 Thread Colin Guthrie
Stut wrote:
> Have you tried Google? It knows a lot about most things and a little
> about the rest.

Failing that you could try asking Henry's cat. You must know Henry's
cat? He knows everything about nothing and not to much about that. So if
you know someone who know what he knows then you must know Henry's cat


I'll get my coat

Col

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



Re: [PHP] imagecreatefromgif fails for a valid image

2007-09-24 Thread Tijnema
On 9/24/07, thushw <[EMAIL PROTECTED]> wrote:
>
> I get a failure in creating a gif. php error log shows this:
>
> Sep 24 00:25:47 thushw-laptop apache2: PHP Warning:  imagecreatefromgif() [
> function.imagecreatefromgif function.imagecreatefromgif ]:
> '/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif'
> is not a valid GIF file in
> /home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/button.php on
> line 30
>
> the gif can be viewed by gthumb. it seems ok.
>
> the problem is only for some gifs. Most gifs, all pngs, jpegs that i've
> tested so far work.
>
> i'm running php5 on ubuntu (uname -a : Linux thushw-laptop 2.6.20.3-ubuntu1
> #2 SMP Sun Apr 15 11:26:58 PDT 2007 i686 GNU/Linux)
>
> phpinfo shows:
>
> gd
> GD Support  enabled
> GD Version  2.0 or higher
> FreeType Supportenabled
> FreeType Linkagewith freetype
> FreeType Version2.2.1
> T1Lib Support   enabled
> GIF Read Supportenabled
> GIF Create Support  enabled
> JPG Support enabled
> PNG Support enabled
> WBMP Supportenabled
>
> from what i've read so far, seems like i need gd lib >=2.0.28. from phpinfo
> output it is not clear if i have the right version. i use: apt-get install
> php5-gd to install gd
>
> these are the files i think are of importance:
>
> /usr/lib/libgd.so.2.0.34
> /usr/lib/libgd.so.2
>
> [the second is a symlink to the first]
>
> >> ls -l /usr/lib/libgd.so.2
> lrwxrwxrwx 1 root root 15 2007-09-24 00:25 /usr/lib/libgd.so.2 ->
> libgd.so.2.0.34
>
> how do i debug this further?  any help greatly appreciated. this problem
> doesn't appear with the gd we have installed on our centos servers. seems to
> happen only on my ubuntu install.
>
> thushara
>

Hello Thushara:

My guess is that your .gif file isn't actually a GIF image (but jpeg, bmp,...).

If you have access to SSH/command line try running
file 
/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif
and see if it's really a gif, if you don't have access to above, open
the image with any text editor, and see what the first 3 letters say..
If it's an GIF image, it says GIF (GIF89 probably)
if it's an JPEG image, it says something like ÿØÿà
if it's an BMP image, it says BM (BM6)
and if it's an PNG image, it says ‰PNG

I hope this helps you..

Tijnema

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



Re: [PHP] imagecreatefromgif fails for a valid image

2007-09-24 Thread Thushara Wijeratna
Hi Tijnema
It does appear to be a GIF. See output from file command below:
for now, to get by I have copied over a libgd.so verion from a working
centos installation over /usr/lib/libgd.so
thanks,
thushara

>> file 
>> /home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif
/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif:
GIF image data, version 89a, 1 x 28

On 9/24/07, Tijnema <[EMAIL PROTECTED]> wrote:
> On 9/24/07, thushw <[EMAIL PROTECTED]> wrote:
> >
> > I get a failure in creating a gif. php error log shows this:
> >
> > Sep 24 00:25:47 thushw-laptop apache2: PHP Warning:  imagecreatefromgif() [
> > function.imagecreatefromgif function.imagecreatefromgif ]:
> > '/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif'
> > is not a valid GIF file in
> > /home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/button.php on
> > line 30
> >
> > the gif can be viewed by gthumb. it seems ok.
> >
> > the problem is only for some gifs. Most gifs, all pngs, jpegs that i've
> > tested so far work.
> >
> > i'm running php5 on ubuntu (uname -a : Linux thushw-laptop 2.6.20.3-ubuntu1
> > #2 SMP Sun Apr 15 11:26:58 PDT 2007 i686 GNU/Linux)
> >
> > phpinfo shows:
> >
> > gd
> > GD Support  enabled
> > GD Version  2.0 or higher
> > FreeType Supportenabled
> > FreeType Linkagewith freetype
> > FreeType Version2.2.1
> > T1Lib Support   enabled
> > GIF Read Supportenabled
> > GIF Create Support  enabled
> > JPG Support enabled
> > PNG Support enabled
> > WBMP Supportenabled
> >
> > from what i've read so far, seems like i need gd lib >=2.0.28. from phpinfo
> > output it is not clear if i have the right version. i use: apt-get install
> > php5-gd to install gd
> >
> > these are the files i think are of importance:
> >
> > /usr/lib/libgd.so.2.0.34
> > /usr/lib/libgd.so.2
> >
> > [the second is a symlink to the first]
> >
> > >> ls -l /usr/lib/libgd.so.2
> > lrwxrwxrwx 1 root root 15 2007-09-24 00:25 /usr/lib/libgd.so.2 ->
> > libgd.so.2.0.34
> >
> > how do i debug this further?  any help greatly appreciated. this problem
> > doesn't appear with the gd we have installed on our centos servers. seems to
> > happen only on my ubuntu install.
> >
> > thushara
> >
>
> Hello Thushara:
>
> My guess is that your .gif file isn't actually a GIF image (but jpeg, 
> bmp,...).
>
> If you have access to SSH/command line try running
> file 
> /home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif
> and see if it's really a gif, if you don't have access to above, open
> the image with any text editor, and see what the first 3 letters say..
> If it's an GIF image, it says GIF (GIF89 probably)
> if it's an JPEG image, it says something like ÿØÿà
> if it's an BMP image, it says BM (BM6)
> and if it's an PNG image, it says ‰PNG
>
> I hope this helps you..
>
> Tijnema
>

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



[PHP] trouble trying to connect to gmail server.

2007-09-24 Thread Fábio Generoso
Thanks for offer your help.
I will try to explain in details what I did.

First of all, on file php.ini I removed the comments for the line below:

extension=php_imap.dll

After that, I have followed the Gmail instructions to enable POP in my Gmail
account as below:

1. Log in to your Gmail account.
2. Click Settings at the top of any Gmail page.
3. Click Forwarding and POP.
4. Select Enable POP for all mail.
5. Choose "Keep Gmail's copy in the inbox" when messages are accessed with
POP.

When I run the simple code below:

http://pop3.gmail.com:995/pop3%7DINBOX>',
'@ gmail.com', '');
print_r(imap_alerts());
print_r(imap_errors());
$num_mens_not_read = imap_num_recent($mbox);
imap_close($mbox);
?>

I get these errors:

Warning: imap_open(): Couldn't open stream
{pop3.gmail.com:995/pop3}INBOXin
c:\arquivos de programas\easyphp1-8\www\index.php on line 2
Array ( [0] => Host not found (#11001): pop3.gmail.com )
Warning: imap_num_recent(): supplied argument is not a valid imap resource
in c:\arquivos de programas\easyphp1-8\www\index.php on line 5
Warning: imap_close(): supplied argument is not a valid imap resource in
c:\arquivos de programas\easyphp1-8\www\index.php on line 6

And, when I run the simple code below:

http://pop.gmail.com:995/pop3%7DINBOX>',
'@gmail.com', ');
print_r(imap_alerts());
print_r(imap_errors());
$num_mens_not_read = imap_num_recent($mbox);
imap_close($mbox);
?>

I get these errors:

Warning: imap_open(): Couldn't open stream {
pop.gmail.com:995/pop3}INBOXin
c:\arquivos de programas\easyphp1-8\www\index.php on line 4
Fatal error: Maximum execution time of 30 seconds exceeded in c:\arquivos de
programas\easyphp1-8\www\index.php on line 4
Notice: (null)(): POP3 connection broken in response (errflg=2) in Unknown
on line 0


This second code looks like ok for me, but for some reason I get this time
out. Do you have any idea what's going on? Did I miss some configuration?


Thanks in advance.



On 9/19/07, Chris < [EMAIL PROTECTED]> wrote:
> Fábio Generoso wrote:
> > I have a little trouble while trying to connect to gmail server.
> > I already enabled POP on gmail.
> > After experience a lots of errors with the command below, now I'm
> > seeing no more errors, but it still doesn't working, the page stay
> > processing and just is broke after this command.
> >
> > $mbox = imap_open('{ 
> > pop.gmail.com:995/pop3}INBOX
',
> > '[EMAIL PROTECTED]', 'my_pass');
>
> What is $mbox at this point? A resource or false?
>
> print_r(imap_alerts());
> print_r(imap_errors());
>
> anything in those?
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>


[PHP] article: 7 reasons I switched back to PHP after 2 years on Rails

2007-09-24 Thread XIMvad

hohoho .. maaanya :D
http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html
--

Cordialmente

Victor Anaya / Analista Programador

*
Apisdev S.A.C. - Integral Solutions
http://www.apisdev.com
[EMAIL PROTECTED]
Tel: (511) 271-7154
Av. Caminos del Inca 1064 Of 4 - Surco

*
Aviso de Confidencialidad
El presente correo electrónico y/o material adjunto es para uso 
exclusivo de la persona o entidad a la que expresamente se le ha 
enviado, puede contener información confidencial o material 
privilegiado.  Si usted no es el destinatario legítimo del mismo, por 
favor repórtelo inmediatamente al remitente del correo y bórrelo. 
Cualquier revisión, retransmisión, difusión o cualquier otro uso de este 
correo, por personas o entidades distintas a las del destinatario 
legítimo, queda expresamente prohibido.


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



Re: [PHP] article: 7 reasons I switched back to PHP after 2 years on Rails

2007-09-24 Thread Robert Cummings
On Mon, 2007-09-24 at 12:52 -0500, XIMvad wrote:
> hohoho .. maaanya :D
> http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html


DUPE!!!

Posted yesterday! :)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



[PHP] Regex æøå email validation?

2007-09-24 Thread Søren Neigaard

Hi guys

Im helping a friend with hes internet site, and I have found this  
regex email validation regex on the internet:


var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a- 
z]{2,6}(?:\.[a-z]{2})?)$/i;

if(!filter.test(email)) {
return false;
}

It works fine, but my friend strangely enough has users with special  
danish letters (æøåÆØÅ) in their email address, and that it does not  
accept. Regex is black magic to me, I have tried to modify it in  
different ways, but with no luck.


I know its not PHP specific (its JavaScript), but maybe one of you  
can help me anyways?


Best regards
Søren

smime.p7s
Description: S/MIME cryptographic signature


[PHP] Strategy for Secure File Storage

2007-09-24 Thread Kevin Murphy
I'm working on a intranet site that uses an LDAP server to  
authenticate users and then a integrated CMS (kind of like a wiki  
with security features so only certain people can post things or  
upload files) runs the whole thing. (The CMS is custom built with PHP).


I've got a need to make certain files secured so that if someone  
uploads a file they can specify that no one except certain people can  
view the file. I've got all the security features set up, what I need  
to do is come up with the best way of securing those files. Obviously  
the link won't show to those files if the user doesn't have access to  
it, but I'm worried that someone might know the link and be able to  
access the file that they are not supposed be able to see.


This doesn't need to be NSA level security, but I do need to protect  
against some computer savvy users. So, I'm pondering the following  
ideas for hiding those files. Any insight on the best method would be  
appreciated:


1) Write secure files to MySQL as a blob (only secure files would be  
written there)


2) Write secure files to the level below the web root and come up  
with a way of copying the files over to a temporary directory for  
access, then delete the files as soon as they are accessed.


3) Use Unix passwords to protect a folder in the web level and then  
the CMS knows the password and can pass the password for access (so  
that the user doesn't know this password, but the CMS does).


4) Some various forms of link obfuscation, where the CMS goes through  
all the secure files once an hour or so and rewrites the file name  
with a random string.


5) Or  I'm open to suggestions.
Thanks.

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada College
www.wnc.edu
775-445-3326

P.S. Please note that my e-mail and website address have changed from  
wncc.edu to wnc.edu. 

Re: [PHP] Strategy for Secure File Storage

2007-09-24 Thread Jon Anderson

Kevin Murphy wrote:
I'm working on a intranet site that uses an LDAP server to 
authenticate users and then a integrated CMS (kind of like a wiki with 
security features so only certain people can post things or upload 
files) runs the whole thing. (The CMS is custom built with PHP).


I've got a need to make certain files secured so that if someone 
uploads a file they can specify that no one except certain people can 
view the file. I've got all the security features set up, what I need 
to do is come up with the best way of securing those files. Obviously 
the link won't show to those files if the user doesn't have access to 
it, but I'm worried that someone might know the link and be able to 
access the file that they are not supposed be able to see.


This doesn't need to be NSA level security, but I do need to protect 
against some computer savvy users. So, I'm pondering the following 
ideas for hiding those files. Any insight on the best method would be 
appreciated:


1) Write secure files to MySQL as a blob (only secure files would be 
written there)


2) Write secure files to the level below the web root and come up with 
a way of copying the files over to a temporary directory for access, 
then delete the files as soon as they are accessed.


3) Use Unix passwords to protect a folder in the web level and then 
the CMS knows the password and can pass the password for access (so 
that the user doesn't know this password, but the CMS does).


4) Some various forms of link obfuscation, where the CMS goes through 
all the secure files once an hour or so and rewrites the file name 
with a random string.


5) Or  I'm open to suggestions. 



You can easily force all file access to pass through a PHP script -> 
just do this kind of thing:


- Fetch file information from a get variable, like file.php?fileid=12345 
(or even file.php?filename=somefile.bin)
- Check if the user is allowed access to that file (yes: continue, no: 
display an error)


header("Content-Type: " . $file->getContentType());
readfile("/path/to/secure/" . $file->getFileName());

Then just make sure that the "/path/to/secure/" (as in the example 
above) is not readable by web users by some means.


jon

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



[PHP] Re: Strategy for Secure File Storage

2007-09-24 Thread Colin Guthrie
Kevin Murphy wrote:
> 1) Write secure files to MySQL as a blob (only secure files would be
> written there)

Personally I don't like this strategy but it is always a hot topic on
this list. I don't mind storing a few small images in the db but when
you start to store >200-300Megs it just complicates your database backup
strategy. If you use snapshot-based filesystem level backups (e.g. using
LVM) then this is mitigated but still has many downsides IMO.

> 3) Use Unix passwords to protect a folder in the web level and then the
> CMS knows the password and can pass the password for access (so that the
> user doesn't know this password, but the CMS does).

Nah... seems to complex.

> 4) Some various forms of link obfuscation, where the CMS goes through
> all the secure files once an hour or so and rewrites the file name with
> a random string.

Still not 100% secure and overly complex IMO.

> 2) Write secure files to the level below the web root and come up with a
> way of copying the files over to a temporary directory for access, then
> delete the files as soon as they are accessed.

> 5) Or  I'm open to suggestions.

I think you are kind of on the right track with 2 but there is no need
to do this copying.

Simply put all requests for your file through a PHP script. This can be
done with PATH_INFO or mod-rewrite in Apache (just google this for examples.

You PHP script will then check the access credentials of the user (e.g.
a logged in Session) and then output relevent cache headers (again
google) before issuing a Content-Type header with the correct mime type
for the file in question along with the Content-Length header with the
physical size of the file (not strictly speaking necessary but nicer for
the client) before simply calling
"include('/path/to/file/not/in/webroot.ext') to push the content to the
user.

Hope this helps.

Col

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



[PHP] Re: article: 7 reasons I switched back to PHP after 2 years on Rails

2007-09-24 Thread Colin Guthrie
Robert Cummings wrote:
> On Mon, 2007-09-24 at 12:52 -0500, XIMvad wrote:
>> hohoho .. maaanya :D
>> http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html
> 
> 
> DUPE!!!
> 
> Posted yesterday! :)

This is why everyone accuses us PHPites of rewriting everything :p

Col

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



Re: [PHP] Regex æøå email validation?

2007-09-24 Thread Per Jessen
Søren Neigaard wrote:

> Hi guys
> 
> Im helping a friend with hes internet site, and I have found this
> regex email validation regex on the internet:
> 
> var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-
> z]{2,6}(?:\.[a-z]{2})?)$/i;
> if(!filter.test(email)) {
> return false;
> }
> 
> It works fine, but my friend strangely enough has users with special
> danish letters (æøåÆØÅ) in their email address, and that it does not
> accept. Regex is black magic to me, I have tried to modify it in
> different ways, but with no luck.
> 
> I know its not PHP specific (its JavaScript), but maybe one of you
> can help me anyways?

Hej Søren

to get it to work, you need to be in the Danish locale, otherwise "æøå"
won't be recognised as being word-characters. In javascript, I'm not
sure, but maybe you have to use UTF-8?


/Per Jessen, Zürich

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



Re: [PHP] Regex æøå email validation?

2007-09-24 Thread mike
On 9/24/07, Per Jessen <[EMAIL PROTECTED]> wrote:
> > Hi guys
> >
> > Im helping a friend with hes internet site, and I have found this
> > regex email validation regex on the internet:
> >
> > var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-
> > z]{2,6}(?:\.[a-z]{2})?)$/i;
> > if(!filter.test(email)) {
> > return false;
> > }
> >
> > It works fine, but my friend strangely enough has users with special
> > danish letters (æøåÆØÅ) in their email address, and that it does not
> > accept. Regex is black magic to me, I have tried to modify it in
> > different ways, but with no luck.
> >
> > I know its not PHP specific (its JavaScript), but maybe one of you
> > can help me anyways?

have you looked into http://php.net/filter functions?

not sure if those are locale-friendly or not. if(filter_var($foo,
FILTER_VALIDATE_EMAIL)) {} has worked for me. i don't use any extended
characters though. but changing your locale in PHP might allow it to
work.


Re: [PHP] Re: Strategy for Secure File Storage

2007-09-24 Thread Kevin Murphy
Ok, I'm almost there. I took what everyone said (and a few Google  
searches later) and built this, which works great on Firefox and  
Safari (both mac and PC). The $path leads to a directory outside the  
web root, and there is also an array with all the mime types in it  
($mimetype).



$file_path = $path."/".$file;

$ext = explode(".",$file);

$filesize = filesize($file_path);

$extension = $mimetypes["$ext[1]"];

header("Content-type: $extension");
header("Content-length: $filesize");
header("Content-Disposition: attachment; filename=\"$file\"");
header("Pragma: no-cache");
$file = file_get_contents($file_path);
echo ($file);

The problem is IE7. All browsers work with this code as is but IE  
says "Internet Explorer cannot download test.pdf from XXX"


Any suggestions?

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada College
www.wnc.edu
775-445-3326

P.S. Please note that my e-mail and website address have changed from  
wncc.edu to wnc.edu. 

Re: [PHP] Questions about overloading and visibility in PHP5

2007-09-24 Thread Larry Garfield
On Tuesday 18 September 2007, Andrew Ballard wrote:

> > I'm guessing that the answer to all of my questions is some how
> > wrapped up in visibility and overloading.  Unfortunately I cannot find
> > any resource that documents the interactions.  TIA.
>
> As I understand it, the __get and __set do not ignore visibility;
> rather, they only work for accessing private members. If a property is
> declared public, it does not need the __get and __set, so they aren't
> used. Likewise, $bar->y is public since it was added dynamically
> outside the class.
>
> Andrew

Untrue.  If a property exists, then it is used as-is and 
__get()/__set()/__isset()/__unset() are never called.  The property behaves 
normally, as if those methods were not defined.  If they're not defined, the 
magic methods do whatever they do, which can include adding more properties 
to the object if appropriate (thus bypassing the magic methods in the 
future).

-- 
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] trouble trying to connect to gmail server.

2007-09-24 Thread Chris



Array ( [0] => Host not found (#11001): pop3.gmail.com )


So pop3.gmail.com doesn't exist.


http://pop.gmail.com:995/pop3%7DINBOX>',
'@gmail.com', ');
print_r(imap_alerts());
print_r(imap_errors());
$num_mens_not_read = imap_num_recent($mbox);
imap_close($mbox);
?>

I get these errors:

Warning: imap_open(): Couldn't open stream {
pop.gmail.com:995/pop3}INBOXin
c:\arquivos de programas\easyphp1-8\www\index.php on line 4
Fatal error: Maximum execution time of 30 seconds exceeded in c:\arquivos de
programas\easyphp1-8\www\index.php on line 4
Notice: (null)(): POP3 connection broken in response (errflg=2) in Unknown
on line 0


This second code looks like ok for me, but for some reason I get this time
out. Do you have any idea what's going on? Did I miss some configuration?


Line 4 is

$num_mens_not_read = imap_num_recent($mbox);

so it's taking too long to work out how many are recent.

How many unread messages are there in your account? How many messages in 
total?


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Re: Strategy for Secure File Storage

2007-09-24 Thread brian

Kevin Murphy wrote:
Ok, I'm almost there. I took what everyone said (and a few Google  
searches later) and built this, which works great on Firefox and  Safari 
(both mac and PC). The $path leads to a directory outside the  web root, 
and there is also an array with all the mime types in it  ($mimetype).



$file_path = $path."/".$file;

$ext = explode(".",$file);

$filesize = filesize($file_path);

$extension = $mimetypes["$ext[1]"];

header("Content-type: $extension");
header("Content-length: $filesize");
header("Content-Disposition: attachment; filename=\"$file\"");
header("Pragma: no-cache");
$file = file_get_contents($file_path);
echo ($file);

The problem is IE7. All browsers work with this code as is but IE  says 
"Internet Explorer cannot download test.pdf from XXX"


Any suggestions?



echo 'Your software provider sucks eggs. Get a better browser.';

heh ...

I just did precisely this (the script, not the "sucks eggs" comment) for 
a project i'm working on. There's a file store above document root and a 
script that does user validation, then reads the top dir of the file 
store and display links for each directory or file in there (of course, 
they're not direct links), letting the user drill down as far as it goes.



What exactly is in the var $extension?
header("Content-type: $extension");


Don't do this:
$file = file_get_contents($file_path);
echo ($file);

Do this instead:
readfile($file_path);
exit;


Here's the business end of my script:

-- snip --
header ('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header ('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: Binary');
header('Content-length: ' . filesize($filepath));
header('Content-disposition: attachment; filename="' . 
basename($filepath) .'"');

readfile($filepath);
exit;
-- snip --

Note that i'm not trying to give the option for the browser to hand off 
the file to a "helper application" or plugin. This script is for 
downloading only, hence no MIME type and the "octet-stream' & 'attachment'.


I just checked another project where i did pass the MIMIE to allow for 
the file to open in Adobe Reader, MSExcel, etc. You also might want to 
add these two with your no-cache header:


header ('Expires: Mon, 1 Apr 1974 05:00:00 GMT');
header ('Last-Modified: ' . gmdate('D,d M YH:i:s') . ' GMT');

I seem to remember that it was IE that wanted these in order to play nice.

brian

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



[PHP] PHP build exits @ "bad magic number (not a Mach-O file)". Ideas?

2007-09-24 Thread Aliya Harbouri
Hi everybody!

I'm working on building a few "similar" Dev machines on different OSs.

I've finished a source build of PHP_5_2 branch cvs on a FreeBSD box.
Went smoothly!

I've tried the same on an OSX box.  It's got mostly the same
built-from-source prereqs in place as the FreeBSD box.

But, building PHP_5_2 on OSX keels over at,

...
gcc -bundle -bundle_loader /usr/local/apache2/sbin/httpd
-L/usr/local/bdb46/lib -L/usr/local/sqlite/lib -L/usr/local/lib
-L/usr/local/apache2/lib -laprutil -ldb-4.6 -lsqlite3
/usr/local/mysql/lib/mysql/libmysqlclient_r.la -lexpat -liconv
-L/usr/local/apache2/lib -lapr -lpthread -g -O2 -DZTS
-L/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/bdb46/lib
ext/libxml/libxml.o ext/openssl/openssl.o ext/openssl/xp_ssl.o
ext/pcre/php_pcre.o ext/zlib/zlib.o ext/zlib/zlib_fopen_wrapper.o
ext/zlib/zlib_filter.o ext/date/php_date.o
...
Zend/zend_exceptions.o Zend/zend_strtod.o Zend/zend_objects.o
Zend/zend_object_handlers.o Zend/zend_objects_API.o
Zend/zend_default_classes.o Zend/zend_execute.o
sapi/apache2handler/mod_php5.o sapi/apache2handler/sapi_apache2.o
sapi/apache2handler/apache_config.o
sapi/apache2handler/php_functions.o main/internal_functions.o
-ldb-4.5 -lz -lpcre -lssl -lcrypto -lm -lxml2 -lz -liconv -lm
-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lxml2 -lz -liconv -lm  -o
libs/libphp5.bundle && cp libs/libphp5.bundle libs/libphp5.so
/usr/bin/ld: /usr/local/mysql/lib/mysql/libmysqlclient_r.la bad magic
number (not a Mach-O file)
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1


I don't know exactly why MySql libs are involved here.  I'm NOT
configuring the build for any MySQL-related modules to be built; I'll
do those separately as extensions, later.  During ./configure output,
I make sure I see

...
checking for MSSQL support via FreeTDS... no
checking for MySQL support... no
...
checking for MySQLi support... no
checking whether to enable embedded MySQLi support... no
...
checking for MySQL support for PDO... no
...

The only source I've been able to find for the -lmysqlclient_r references is,

apu-1-config --libs
 -ldb-4.6   -lsqlite3  /usr/local/mysql/lib/mysql/libmysqlclient_r.la
 -lexpat -liconv

Which probably gets picked up from PHP's ./configure,

./configure --with-apxs2=/usr/local/apache2/sbin/apxs ...

I'm guessing here, but I figure this 'bad magic number' biz is an
OSX-only thing.  About which I don't know a bunch :-(

Any suggestions as to what to do here?

Thanks a lot! :-)

Ali

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