Re: [PHP] PHP 5.16 and Sihuson

2006-10-19 Thread Google Kreme

On 19 Oct 2006, at 02:30 , Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2006-10-18 10:57:52 -0600:

php -v
PHP 5.1.6 with Suhosin-Patch 0.9.5 (cli) (built: Oct 18 2006  
08:36:59)

Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies


The Suhosin patch only reports the double free() in PHP so if
anything it's PHP that's not ready for production. You can disable
the patch but that won't fix the bug in PHP.


I've been told the problem is the Zend Engine.


--
No one ever thinks of themselves as one of Them. We're always one of  
Us. It's Them that do the bad things.


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



Re: [PHP] What is the smallest, fastest web server to run PHP and SSL (on a soekris box)

2006-10-19 Thread Google Kreme

On 18 Oct 2006, at 17:25 , Daevid Vincent wrote:
I need to run a httpd server that can serve up PHP, SQL Lite, and  
SSL on a

little Soekris box (ie. a 486 with 32MB RAM and 32MB CF storage).


There's thttp which is really really small.  However, keep in mind,  
Apache has been around for long enugh that at one time a 486 with  
32MB of RAm was state of the art.



How small can Apache get?


Pretty darn small.  You might find SSL is larger, and certainly SQL  
Lite will have more of an impact.


I'd try it with apache with as much disabled as possible.  You're  
going to find better support tools for apache anyway.  However, the  
'throttling' aspect of thttp might be useful in a low-resource setting.



Related, does anyone know of a tutorial or something that will help to
reduce Apache to only the things really needed for PHP, mySQL, SSL?  
Right

now, our Apache memory footprint is an astounding 120MB !!


How are you counting that?  If you've only got 32MB it CAN'T be using  
120MB.  Unless you are counting VRAM, which is a mistake.



--
We will fight for Bovine Freedom and hold our large heads high
We will run free with the Buffalo or die

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



[PHP] Problems with open_basedir

2006-10-19 Thread Patrik Jansson

Hello,
I'm having some difficulties with open_basedir. If I include the prefix 
/home/web25637/ in open_basedir shouldn't it include every directory 
within this? We're getting this error:


Warning: file_exists() [function.file-exists]: open_basedir restriction 
in effect. 
File(/home/web25637/domains/abc.ssf.scout.se/public_html//components/com_sef/sef.php) 
is not within the allowed path(s): 
(/home/web25637/:/tmp/:/var/www/:/usr/local/lib/php/:/etc/virtual/:/var/uploads/:/var/squirrelmail) 
in /usr/home/web25637/domains/abc.ssf.scout.se/public_html/index.php on 
line 46


As you can se, the file is within the prefix which is listed in allowed 
paths. How could it be the case that we're experiencing open_basedir 
restriction here?


Cheers,
Patrik

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



Re: [PHP] Re: How to recognise url in a block of text

2006-10-19 Thread Robin Vickery

On 18/10/06, AYSERVE.NET <[EMAIL PROTECTED]> wrote:

Hello Guys,
I thought I was home and dry when the program worked fine on my windows
but when I ran from my Linus server, I keep getting a url like:
http://www.website.com/pdf/ED1.pdf%A0 instead of
http://www.website.com/pdf/ED1.pdf.


I'd look at the text that you're working on rather than the regexp. It
looks like some characterset conversion is going wrong - 0xA0 is the
latin-1 non-breaking space character. I'm expect that on your linux
machine that it's being converted to %0A at some point which is
perfectly valid in a URL.

But I'm just guessing.

-robin

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



Re: [PHP] Re: Creating thumbnails using Image Functions, then saving to folders

2006-10-19 Thread Al

Børge Holen wrote:

On Wednesday 18 October 2006 20:55, Al wrote:

Matthews, Chris wrote:

Good Morning:

I am looking to create a thumbnail from an uploaded image, and then save
it to a directory.

I don't have any problem with the image functions, and can successfully
create the thumbnail and push it to the browser or, as is currently set
up, store the data in a database.

What I want to do instead, however, is take that dynamically created
thumbnail and write it to a folder on the server.

If I simply write the file, however, it appears I need to have a folder
chmod'd world read/writable for the process to work.  My network guys do
not want this.

I tried the FTP functions, which work great for copying a file that
already exists somewhere into another folder, but I can't seem to get it
to recognize the buffer as a valid source file location...

Is there a way to use a php FTP function to FTP the file out of the
buffer to a directory on the server, or some other way to write a file to
a folder without making that folder 0777?

Chris Matthews
eGovernment Information Officer
Washoe County, Nevada
775.328.3719
http://www.washoecounty.us

Director, West Region
National Association of Government Webmasters
http://www.nagw.org

Have your program create the folder and assign it 754 or 755, don't create
it via Apache. Thus, the owner will be the famous "nobody".  The 754 means
nobody [your program] has full rights; but the world only has reading
rights.  You'll see all your standard folders created by the system are
755, which is safe also.


and how do apache create directories again?


With tomahawks and bows and arrows.

Some folks make dumb mistakes occasionally especially when in a hurry.

However, the approach of having the script create the folders with 755 or 754 
is correct. Is it not?

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



[PHP] regex

2006-10-19 Thread Bagus Nugroho
Hi All,

If we have variable like :

$var1 = 'abcde 12';
$var2 = 'abcdefghi 34';
$var3 = 'abc 20 def';

Then we want output like :
$var1 = 'abcde';
$var2 = 'abcdefghi';
$var3 = 'abc def';

How regex can help us?.

Thanks in advance.
bgs

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



Re: [PHP] regex

2006-10-19 Thread John Nichel

Bagus Nugroho wrote:

Hi All,

If we have variable like :

$var1 = 'abcde 12';
$var2 = 'abcdefghi 34';
$var3 = 'abc 20 def';

Then we want output like :
$var1 = 'abcde';
$var2 = 'abcdefghi';
$var3 = 'abc def';

How regex can help us?.



Use preg_replace to replace all numbers with nothing.

$var = preg_replace ( "/\d+/", "", $var );

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



[PHP] Creating Tree Structure from associative array

2006-10-19 Thread Angelo Zanetti

Hi all,

I have an associative array, which contains parent and child 
relationships. I've searched the web for creating a tree structure from 
this and found a few good sites but doesnt help 100% perhaps someone can 
point me in the correct direction? I've started to code it got to a 
point where I cant go any further, the code is pseudo code and dont want 
to reinvent the wheel.


any suggestions would be really appreciated.

Thanks in advance

--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] 

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



Re: [PHP] regex

2006-10-19 Thread Google Kreme

On 19 Oct 2006, at 07:49 , Bagus Nugroho wrote:


Hi All,

If we have variable like :

$var1 = 'abcde 12';
$var2 = 'abcdefghi 34';
$var3 = 'abc 20 def';

Then we want output like :
$var1 = 'abcde';
$var2 = 'abcdefghi';
$var3 = 'abc def';

How regex can help us?.


Well, stripping the digits is easy

s/ \d+//

(have that space before the number if there will ALWAYS be a space  
before the nu,bers you want to remove.



--
You try to shape the world to what you want the world to be. Carving  
your name a thousand times won't bring you back to me. Oh no, no I  
might as well go and tell it to the trees. Go and tell it to the  
trees, yeah.


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



Re: [PHP] regex

2006-10-19 Thread Google Kreme

On 19 Oct 2006, at 07:56 , John Nichel wrote:

$var3 = 'abc 20 def';
Then we want output like :
$var3 = 'abc def';
How regex can help us?.


Use preg_replace to replace all numbers with nothing.

$var = preg_replace ( "/\d+/", "", $var );


Nope, that will leave

$var3 = 'abc  def';

(note the double space)

it will also leave $var1 = 'abcdef ';


--
The trouble with being a god is that you've got no one to pray to.

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



Re: [PHP] regex

2006-10-19 Thread Stut

Bagus Nugroho wrote:

If we have variable like :

$var1 = 'abcde 12';
$var2 = 'abcdefghi 34';
$var3 = 'abc 20 def';

Then we want output like :
$var1 = 'abcde';
$var2 = 'abcdefghi';
$var3 = 'abc def';

How regex can help us?.


It's very difficult to get the right solution to a problem when all you 
provide is examples. If you want accurate help please provide an 
accurate description of the problem you're trying to solve rather than a 
few before and afters.


-Stut

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



[PHP] IMAP extension causing delays

2006-10-19 Thread Edward Kay
Hello,

I need PHP's IMAP extension for my web app but it is really slowing my 
server up.

My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP), 
PHP IMAP extension - all standard FC5 RPMs. The test page is simple - just a 
call to phpinfo().

Without the IMAP extension, the response time is almost immediate. With the 
IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4 
secs.

Watching with 'top', I can see php-cgi is called immediately when the 
request is received. With the IMAP extension installed, after php-cgi 
starts, it then drops to the end of the 'top' list, consuming 0% CPU and 
2.0% memory. It remains there for the 2-3 second delay before coming into 
play again an running the script quickly. Without the IMAP extension, it 
just ends quickly having finished the request.

>From this, it is clear to me there is some major delay being introduced by 
the loading of the IMAP extension. Any ideas on how to resolve this?

Thanks,
Edward 

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



Re: [PHP] IMAP extension causing delays

2006-10-19 Thread Jochem Maas
Edward Kay wrote:
> Hello,
> 
> I need PHP's IMAP extension for my web app but it is really slowing my 
> server up.
> 
> My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP), 
> PHP IMAP extension - all standard FC5 RPMs. The test page is simple - just a 
> call to phpinfo().
> 
> Without the IMAP extension, the response time is almost immediate. With the 
> IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4 
> secs.
> 
> Watching with 'top', I can see php-cgi is called immediately when the 
> request is received. With the IMAP extension installed, after php-cgi 
> starts, it then drops to the end of the 'top' list, consuming 0% CPU and 
> 2.0% memory. It remains there for the 2-3 second delay before coming into 
> play again an running the script quickly. Without the IMAP extension, it 
> just ends quickly having finished the request.
> 
> From this, it is clear to me there is some major delay being introduced by 
> the loading of the IMAP extension. Any ideas on how to resolve this?

use php as an apache module - thereby the startup delay is only noticed when
the webserver starts - this assumes that the problem is a startup problem ...

what you describe could be down to a dns configuration error - i.e. the imap 
extension
is trying to resolve some domainname and having a hard time of it I can't 
remember
the specifics of such issues but I know that the archives of this list will 
turn up more info
regarding dns config problems (that cause slow downs)

> 
> Thanks,
> Edward 
> 

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



Re: [PHP] IMAP extension causing delays

2006-10-19 Thread John Nichel

Edward Kay wrote:

Hello,

I need PHP's IMAP extension for my web app but it is really slowing my 
server up.


My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP), 
PHP IMAP extension - all standard FC5 RPMs. The test page is simple - just a 
call to phpinfo().


Without the IMAP extension, the response time is almost immediate. With the 
IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4 
secs.


Watching with 'top', I can see php-cgi is called immediately when the 
request is received. With the IMAP extension installed, after php-cgi 
starts, it then drops to the end of the 'top' list, consuming 0% CPU and 
2.0% memory. It remains there for the 2-3 second delay before coming into 
play again an running the script quickly. Without the IMAP extension, it 
just ends quickly having finished the request.


From this, it is clear to me there is some major delay being introduced by 

the loading of the IMAP extension. Any ideas on how to resolve this?



If you don't have to, don't run it as a cgi.

A /possible/ solution, and I don't even know if it's possible, is to 
compile two versions of the cgi; one with and one without.  While I know 
that part is at least possible, I don't know if you can make your 
webserver *choose* which version of the cgi to run depending on the need.


Can the cgi in PHP5 dynamically load modules?  dl() is available in 
PHP4, but I think they got rid of it in PHP5


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



RE: [PHP] IMAP extension causing delays

2006-10-19 Thread Edward Kay
> >
> > From this, it is clear to me there is some major delay being
> introduced by
> > the loading of the IMAP extension. Any ideas on how to resolve this?
>
> use php as an apache module - thereby the startup delay is only
> noticed when
> the webserver starts - this assumes that the problem is a startup
> problem ...

No can do. I need to run my PHP scripts as different users and to interact
with the file system.

> what you describe could be down to a dns configuration error -
> i.e. the imap extension
> is trying to resolve some domainname and having a hard time of
> it I can't remember
> the specifics of such issues but I know that the archives of this
> list will turn up more info
> regarding dns config problems (that cause slow downs)

This sounds very plausible. It certainly seems as if the delay is due to a
timeout or similar. I'll see what I can find on this in the archives.

Thanks!

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



Re: [PHP] IMAP extension causing delays

2006-10-19 Thread John Nichel

Edward Kay wrote:

From this, it is clear to me there is some major delay being

introduced by

the loading of the IMAP extension. Any ideas on how to resolve this?

use php as an apache module - thereby the startup delay is only
noticed when
the webserver starts - this assumes that the problem is a startup
problem ...


No can do. I need to run my PHP scripts as different users and to interact
with the file system.



You can still do this running php as a module.  Just enable suexec in 
Apache (and configure it safely of course).


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] regex

2006-10-19 Thread Robin Vickery

On 19/10/06, Bagus Nugroho <[EMAIL PROTECTED]> wrote:

Hi All,

If we have variable like :

$var1 = 'abcde 12';
$var2 = 'abcdefghi 34';
$var3 = 'abc 20 def';

Then we want output like :
$var1 = 'abcde';
$var2 = 'abcdefghi';
$var3 = 'abc def';



$re = '/^\s+|\d+\s*|\s*\d+\s*$/';

$var1 = preg_replace($re, '', $var1);

It may or may not be what you're after, but it handles all your examples.

-robin

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



[PHP] Re: Problems with open_basedir

2006-10-19 Thread Colin Guthrie
Patrik Jansson wrote:
> Hello,
> I'm having some difficulties with open_basedir. If I include the prefix
> /home/web25637/ in open_basedir shouldn't it include every directory
> within this? We're getting this error:
> 
> Warning: file_exists() [function.file-exists]: open_basedir restriction
> in effect.
> File(/home/web25637/domains/abc.ssf.scout.se/public_html//components/com_sef/sef.php)
> is not within the allowed path(s):
> (/home/web25637/:/tmp/:/var/www/:/usr/local/lib/php/:/etc/virtual/:/var/uploads/:/var/squirrelmail)
> in /usr/home/web25637/domains/abc.ssf.scout.se/public_html/index.php on
> line 46
> 
> As you can se, the file is within the prefix which is listed in allowed
> paths. How could it be the case that we're experiencing open_basedir
> restriction here?

I ran into problems with openbase_dir when using symlinks... They only
really reared their ugly head when I upgraded to 5.1.6 before that they
were OK (tho' if memory serves I had to add both the symlink location
and the directory it pointed to.

Anyway, are symlinks to blame here?

Other than that I don't really know.

Col.

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



Re: [PHP] Creating Tree Structure from associative array

2006-10-19 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-19 16:08:58 +0200:
> Hi all,
> 
> I have an associative array, which contains parent and child 
> relationships. I've searched the web for creating a tree structure from 
> this and found a few good sites but doesnt help 100% perhaps someone can 
> point me in the correct direction? I've started to code it got to a 
> point where I cant go any further, the code is pseudo code and dont want 
> to reinvent the wheel.
> 
> any suggestions would be really appreciated.

I don't think there's any graph-manipulation library for PHP
(there's a bit of addEdge(), addNode() stuff in Image_GraphViz[1]
but it doesn't seem useful). Until someone wraps Agraph or
Boost.Graph in a module: check out Iterator, Builder, and Composite
in Design Patterns[2].

[1] http://pear.php.net/package/Image_GraphViz
[2] http://www.amazon.com/dp/0201633612

-- 
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] IMAP extension causing delays

2006-10-19 Thread Edward Kay
Thanks for your suggestions John. At the moment, I do need to run it as a
CGI as I need different php.ini files for each virtual host.

I think there may well be some issues with DNS, as suggested by Jochem. My
configuration of DNS stuff locally is a bit patchy :) I'll investigate this
avenue first...

>
> If you don't have to, don't run it as a cgi.
>
> A /possible/ solution, and I don't even know if it's possible, is to
> compile two versions of the cgi; one with and one without.  While I know
> that part is at least possible, I don't know if you can make your
> webserver *choose* which version of the cgi to run depending on the need.
>
> Can the cgi in PHP5 dynamically load modules?  dl() is available in
> PHP4, but I think they got rid of it in PHP5
>
> --
> John C. Nichel IV
> Programmer/System Admin (ÜberGeek)
> Dot Com Holdings of Buffalo
> 716.856.9675
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

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



[PHP] worst sites / standard format

2006-10-19 Thread Chuck Stearns

hey, check out the bar on the side of the ones with main.html.

http://www.997thelake.com/main.html
http://www.cool929fm.com/main.html
http://www.star933.com/
http://www.wzzo.com/main.html
http://www.929nin.com/main.html

guess we have our work cut out for us, eh?  we need to find a distinct, 
unarguable value for this product, and i believe that it's the fact that 
the link redistributes to amazon, whereas there is a greater value if 
they can sell the songs themselves.


problem is, what agreement dot hey have with amazon?

anyway, that's what i found.

later

/cs

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



Re: [PHP] worst sites / standard format

2006-10-19 Thread Ed Lazor
Sorry, how does this relate to PHP?  It seems like you're just trying  
to get us to visit your sites to bump up traffic.



On Oct 19, 2006, at 8:44 AM, Chuck Stearns wrote:


hey, check out the bar on the side of the ones with main.html.

http://www.997thelake.com/main.html
http://www.cool929fm.com/main.html
http://www.star933.com/
http://www.wzzo.com/main.html
http://www.929nin.com/main.html

guess we have our work cut out for us, eh?  we need to find a  
distinct, unarguable value for this product, and i believe that  
it's the fact that the link redistributes to amazon, whereas there  
is a greater value if they can sell the songs themselves.


problem is, what agreement dot hey have with amazon?

anyway, that's what i found.

later

/cs

--
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] worst sites / standard format

2006-10-19 Thread Skip Evans
Me thinks Chuckie boy here is spamming our list 
and needs to get booted.


Sorry, Chuckie, only the best tasting tuna get to 
be Starkist.


Skip

Ed Lazor wrote:
Sorry, how does this relate to PHP?  It seems like you're just trying  
to get us to visit your sites to bump up traffic.



On Oct 19, 2006, at 8:44 AM, Chuck Stearns wrote:


hey, check out the bar on the side of the ones with main.html.

http://www.997thelake.com/main.html
http://www.cool929fm.com/main.html
http://www.star933.com/
http://www.wzzo.com/main.html
http://www.929nin.com/main.html

guess we have our work cut out for us, eh?  we need to find a  
distinct, unarguable value for this product, and i believe that  it's 
the fact that the link redistributes to amazon, whereas there  is a 
greater value if they can sell the songs themselves.


problem is, what agreement dot hey have with amazon?

anyway, that's what i found.

later

/cs

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





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

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



Re: [PHP] worst sites / standard format

2006-10-19 Thread Chuck Stearns
shoot, sorry guys, i was working on an email to a buddy, and didn't 
realize i was still on my newsgroup program til it was too late... 
won't happen again...


/cs

Skip Evans wrote:

Me thinks Chuckie boy here is spamming our list and needs to get booted.

Sorry, Chuckie, only the best tasting tuna get to be Starkist.

Skip

Ed Lazor wrote:
Sorry, how does this relate to PHP?  It seems like you're just trying  
to get us to visit your sites to bump up traffic.



On Oct 19, 2006, at 8:44 AM, Chuck Stearns wrote:


hey, check out the bar on the side of the ones with main.html.

http://www.997thelake.com/main.html
http://www.cool929fm.com/main.html
http://www.star933.com/
http://www.wzzo.com/main.html
http://www.929nin.com/main.html

guess we have our work cut out for us, eh?  we need to find a  
distinct, unarguable value for this product, and i believe that  it's 
the fact that the link redistributes to amazon, whereas there  is a 
greater value if they can sell the songs themselves.


problem is, what agreement dot hey have with amazon?

anyway, that's what i found.

later

/cs

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







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



[PHP] Creating new table from distinct entries

2006-10-19 Thread Alan Milnes

PHP 4.4.4
MySQL 4.1.21-community-nt

I have a table in my database that has a Primary key on 2 fields  (MyID 
and MyChange) and a field that indicates if there is a problem with the 
record (MyError)- I want to create a new table that only has unique 
MyIDs and where there is more than 1 I only want the record with the 
highest MyChange number.  The table has about 50 fields so I have the 
following code:-


$myquery="CREATE TABLE mystats SELECT  *, DISTINCT MyID FROM oldstats 
WHERE MyError IS NULL ORDER BY MyChange DESC ;";

$myresult = mysql_query($myquery);

but I am getting an MySQL error #1064.

Any ideas or suggestions as to where I am going wrong?

Alan

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



[PHP] Telemarketing Script/Tracking Application

2006-10-19 Thread Jay Blanchard
Is anyone aware of a PHP/MySQL app that would be used by telemarketing
staff to track calls, do follow-ups, allow scripting, etc.? We could
write something in house but we are pressed for time. I have been poking
around the web this morning, but have not found much.

TVMIA!

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



Re: [PHP] Re: Creating thumbnails using Image Functions, then saving to folders

2006-10-19 Thread Børge Holen
On Thursday 19 October 2006 14:47, Al wrote:
> Børge Holen wrote:
> > On Wednesday 18 October 2006 20:55, Al wrote:
> >> Matthews, Chris wrote:
> >>> Good Morning:
> >>>
> >>> I am looking to create a thumbnail from an uploaded image, and then
> >>> save it to a directory.
> >>>
> >>> I don't have any problem with the image functions, and can successfully
> >>> create the thumbnail and push it to the browser or, as is currently set
> >>> up, store the data in a database.
> >>>
> >>> What I want to do instead, however, is take that dynamically created
> >>> thumbnail and write it to a folder on the server.
> >>>
> >>> If I simply write the file, however, it appears I need to have a folder
> >>> chmod'd world read/writable for the process to work.  My network guys
> >>> do not want this.
> >>>
> >>> I tried the FTP functions, which work great for copying a file that
> >>> already exists somewhere into another folder, but I can't seem to get
> >>> it to recognize the buffer as a valid source file location...
> >>>
> >>> Is there a way to use a php FTP function to FTP the file out of the
> >>> buffer to a directory on the server, or some other way to write a file
> >>> to a folder without making that folder 0777?
> >>>
> >>> Chris Matthews
> >>> eGovernment Information Officer
> >>> Washoe County, Nevada
> >>> 775.328.3719
> >>> http://www.washoecounty.us
> >>>
> >>> Director, West Region
> >>> National Association of Government Webmasters
> >>> http://www.nagw.org
> >>
> >> Have your program create the folder and assign it 754 or 755, don't
> >> create it via Apache. Thus, the owner will be the famous "nobody".  The
> >> 754 means nobody [your program] has full rights; but the world only has
> >> reading rights.  You'll see all your standard folders created by the
> >> system are 755, which is safe also.
> >
> > and how do apache create directories again?
>
> With tomahawks and bows and arrows.
>
> Some folks make dumb mistakes occasionally especially when in a hurry.
>
> However, the approach of having the script create the folders with 755 or
> 754 is correct. Is it not?

Yes, "user" is then set as the "apache user" witch in my case works 
flawlessly. all rights to apache. 
These directories on the other hand is the only writable directories on my 
servers together with /tmp.

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

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



Re: [PHP] Telemarketing Script/Tracking Application

2006-10-19 Thread Curt Zirzow

On 10/19/06, Jay Blanchard <[EMAIL PROTECTED]> wrote:

Is anyone aware of a PHP/MySQL app that would be used by telemarketing
staff to track calls, do follow-ups, allow scripting, etc.? We could
write something in house but we are pressed for time. I have been poking
around the web this morning, but have not found much.

TVMIA!


Something like a CRM, the best ones cost some money like SugarCRM.

Curt.

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



Re: [PHP] Creating new table from distinct entries

2006-10-19 Thread Ed Lazor
This is definitely something you'll want to run by the MySQL mailing  
list.




On Oct 19, 2006, at 10:02 AM, Alan Milnes wrote:


PHP 4.4.4
MySQL 4.1.21-community-nt

I have a table in my database that has a Primary key on 2 fields   
(MyID and MyChange) and a field that indicates if there is a  
problem with the record (MyError)- I want to create a new table  
that only has unique MyIDs and where there is more than 1 I only  
want the record with the highest MyChange number.  The table has  
about 50 fields so I have the following code:-


$myquery="CREATE TABLE mystats SELECT  *, DISTINCT MyID FROM  
oldstats WHERE MyError IS NULL ORDER BY MyChange DESC ;";

$myresult = mysql_query($myquery);

but I am getting an MySQL error #1064.

Any ideas or suggestions as to where I am going wrong?

Alan

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



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



[PHP] User question for PHP

2006-10-19 Thread Tom Ray [Lists]
Is it possible to have a PHP script execute as the user of the domain 
instead of the webserver? So when I upload files through a PHP script 
they are owned by me and not "wwwrun" or "nobody"?


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



Re: [PHP] User question for PHP

2006-10-19 Thread Christian Heinrich

try suPHP :-)

Is it possible to have a PHP script execute as the user of the domain 
instead of the webserver? So when I upload files through a PHP script 
they are owned by me and not "wwwrun" or "nobody"?




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



Re: [PHP] User question for PHP

2006-10-19 Thread Al

Christian Heinrich wrote:

try suPHP :-)

Is it possible to have a PHP script execute as the user of the domain 
instead of the webserver? So when I upload files through a PHP script 
they are owned by me and not "wwwrun" or "nobody"?




Sounds like it could be a big security issue if not very carefully.

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



Re: [PHP] User question for PHP

2006-10-19 Thread Andy Hultgren

To whoever was asking this (sorry didn't see the original email):


Is it possible to have a PHP script execute as the user of the domain
instead of the webserver? So when I upload files through a PHP script
they are owned by me and not "wwwrun" or "nobody"?


I was recently exchanging on this list about that very topic.  It's in the
archives for this list.  Go to www.php.net and set the dropdown menu in the
upper right corner of the page to "general mailing list", then type "File
Upload Security and chmod" into the search field and hit enter.  The
conversation is within the first few hits on this search.
The server hosting my site runs with php executing as "me" (the owner of the
domain), and we covered some of the potential security pitfalls of such a
situation (mainly centered on the fact that this makes any php script far
too powerful).  In my situation I couldn't change how the server was set up;
however, the general consensus was that this situation created a number of
serious security concerns that had to be very carefully addressed.  I would
avoid this configuration if you have the choice, based purely on the advice
I received.

Hope that helps,

Andy


[PHP] Weird stack trace in error_log from PDOException

2006-10-19 Thread Russ Brown
Hi,

I have a pretty simple bit of code that looks like the following;

// Prepare a statement. This will actually call a stored procedure
$objStatement = $objDB->prepare($strInsert);

try
{
$objStatement->execute($arrParams);

error_log("ABOUT TO fetchColumn");

$intID = $objStatement->fetchColumn();

error_log("AFTER fetchColumn");

$objStatement->closeCursor();
}
catch (PDOException $objEx)
{
error_log(get_class($objEx));
// Actually handle the exception
}

The query runs a stored procedure which sometimes results in an
(expected) error condition which the catch block handles. It all works
perfectly, with one exception: Inbetween the call to fetchColumn and the
catch block being invoked, PHP dumps a stack trace to the error log
complaining about the exception, and I can't for the life of me figure
out why or how to stop it. I have the PDO connection configured to throw
exceptions when it encounters and error, and apart from this the code
works perfectly: the exception gets handled and the rest of the code
continues as it should without any other issues.

Does anybody have any thoughts on what might be the cause of the problem
or any pointers on how I could go about debugging it?

Thanks.

-- 

Russ.

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



[PHP] [ANNOUNCE] php|tek

2006-10-19 Thread Richard Lynch
As many of you know, I've been planning to host a PHP-General
Gathering in Spring 2007.

It's just been announced that php|architect is hosting a php|tek
Conference MAY 2007 in CHICAGO!

Now, I'm not dumb enough to butt heads with Marco :-)

So we decided to work together on his conference this year:
http://www.phparch.com/tek

I'm still up for the first couple kegs and a round of appetizers at an
"After Party" in conjunction with php|tek, so be sure not to miss
that!

And the Chicago PHP User Group is sponsoring php|tek -- Look for us at
the Conference!

This is going to be a GREAT Event, and I'm ecstatic that a PHP
Conference is being hosted in Chicago!

Go register now for the best deal -- And because last year's php|tek
SOLD OUT.  Don't put it off and be left outside in the cold :-)
http://www.phparch.com/tek

More details in this thread in a few weeks!

PS
In case you thought I was serious about butting heads with Marco, I
want to publicly THANK MARCO TABINI for taking the time to call me and
allowing me to help out to make this a "win-win" for all!

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

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



[PHP] ENV vars

2006-10-19 Thread jekillen

Hello again;
I'm wondering if it is possible to create an $_ENV var with a php
script running under a web server. I'm not sure where to look
in the manual or other documentations for this. Isn't there a
set_env() function or something like it? (would apply to php 4 0r 5x)
Thanks in advance.
JK

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



Re: [PHP] ENV vars

2006-10-19 Thread Ed Lazor
How are you running PHP?  What are you trying to accomplish with  
setting the env var?


On Oct 19, 2006, at 8:16 PM, jekillen wrote:


Hello again;
I'm wondering if it is possible to create an $_ENV var with a php
script running under a web server. I'm not sure where to look
in the manual or other documentations for this. Isn't there a
set_env() function or something like it? (would apply to php 4 0r 5x)
Thanks in advance.
JK

--
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] Creating Tree Structure from associative array

2006-10-19 Thread Larry Garfield
That depends on what your data structure is, exactly, and what sort of tree 
structure you want on the other side.  Please be more specific.

On Thursday 19 October 2006 09:08, Angelo Zanetti wrote:
> Hi all,
>
> I have an associative array, which contains parent and child
> relationships. I've searched the web for creating a tree structure from
> this and found a few good sites but doesnt help 100% perhaps someone can
> point me in the correct direction? I've started to code it got to a
> point where I cant go any further, the code is pseudo code and dont want
> to reinvent the wheel.
>
> any suggestions would be really appreciated.
>
> Thanks in advance
>
> --
> 
> Angelo Zanetti
> Systems developer
> 
>
> *Telephone:* +27 (021) 469 1052
> *Mobile:*   +27 (0) 72 441 3355
> *Fax:*+27 (0) 86 681 5885
> *
> Web:* http://www.zlogic.co.za
> *E-Mail:* [EMAIL PROTECTED] 

-- 
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] Problems with open_basedir

2006-10-19 Thread Chris

Patrik Jansson wrote:

Hello,
I'm having some difficulties with open_basedir. If I include the prefix 
/home/web25637/ in open_basedir shouldn't it include every directory 
within this? We're getting this error:


Warning: file_exists() [function.file-exists]: open_basedir restriction 
in effect. 
File(/home/web25637/domains/abc.ssf.scout.se/public_html//components/com_sef/sef.php) 


The // might cause a problem, if you fix that does it work?

--
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] User question for PHP

2006-10-19 Thread Chris

Andy Hultgren wrote:

To whoever was asking this (sorry didn't see the original email):


Is it possible to have a PHP script execute as the user of the domain
instead of the webserver? So when I upload files through a PHP script
they are owned by me and not "wwwrun" or "nobody"?


I was recently exchanging on this list about that very topic.  It's in the
archives for this list.  Go to www.php.net and set the dropdown menu in the
upper right corner of the page to "general mailing list", then type "File
Upload Security and chmod" into the search field and hit enter.  The
conversation is within the first few hits on this search.
The server hosting my site runs with php executing as "me" (the owner of 
the

domain), and we covered some of the potential security pitfalls of such a
situation (mainly centered on the fact that this makes any php script far
too powerful).  In my situation I couldn't change how the server was set 
up;

however, the general consensus was that this situation created a number of
serious security concerns that had to be very carefully addressed.  I would
avoid this configuration if you have the choice, based purely on the advice
I received.


Actually you have that the wrong way around.

If php is running as "www" or "nobody" then any files or directories 
that a php script creates will be done as the web server user.


That means (potentially) that if domain 'a' creates a file, domain 'b' 
can read and write to that file and even delete it.



If php is running as you instead, you can control this with appropriate 
chmod commands (at least removing the risk of deleting of files / 
updating of files).


A shared user (like "www" or "nobody") is a *much* bigger risk than 
separate users.


--
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] Creating Tree Structure from associative array

2006-10-19 Thread Robert Cummings
On Thu, 2006-10-19 at 23:58 -0500, Larry Garfield wrote:
> That depends on what your data structure is, exactly, and what sort of tree 
> structure you want on the other side.  Please be more specific.
> 
> On Thursday 19 October 2006 09:08, Angelo Zanetti wrote:
> > Hi all,
> >
> > I have an associative array, which contains parent and child
> > relationships. I've searched the web for creating a tree structure from
> > this and found a few good sites but doesnt help 100% perhaps someone can
> > point me in the correct direction? I've started to code it got to a
> > point where I cant go any further, the code is pseudo code and dont want
> > to reinvent the wheel.
> >
> > any suggestions would be really appreciated.

It's kinda simple...

 '1',
'pid'   => '2',
'value' => 'Value Foo 1',
),
array
(
'id'=> '2',
'pid'   => '6',
'value' => 'Value Foo 2',
),
array
(
'id'=> '3',
'pid'   => '5',
'value' => 'Value Foo 3',
),
array
(
'id'=> '4',
'pid'   => '2',
'value' => 'Value Foo 4',
),
array
(
'id'=> '5',
'pid'   => '0',
'value' => 'Value Foo 5',
),
array
(
'id'=> '6',
'pid'   => '0',
'value' => 'Value Foo 6',
),
array
(
'id'=> '7',
'pid'   => '6',
'value' => 'Value Foo 7',
),
array
(
'id'=> '8',
'pid'   => '2',
'value' => 'Value Foo 8',
),
array
(
'id'=> '9',
'pid'   => '5',
'value' => 'Value Foo 9',
),
);

//
// Set up indexing of the above list (in case it wasn't indexed).
//
$lookup = array();
foreach( $list as $item )
{
$item['children'] = array();
$lookup[$item['id']] = $item;
}

//
// Now build tree.
//
$tree = array();
foreach( $lookup as $id => $foo )
{
$item = &$lookup[$id];
if( $item['pid'] == 0 )
{
$tree[$id] = &$item;
}
else
if( isset( $lookup[$item['pid']] ) )
{
$lookup[$item['pid']]['children'][$id] = &$item;
}
else
{
$tree['_orphans_'][$id] = &$item;
}
}

//
// WooohoOO!
//
print_r( $tree );

?>

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

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



[PHP] Setting try and catch to use my own error handler

2006-10-19 Thread Dave M G

PHP List,

I have a system where the code parses the URL and creates objects based 
on the classes named in the link.


In order to prevent a user typing in a URL that contains an object that 
doesn't exist, and getting an error, I'm trying to set up an error 
handler class, called ErrorHandler, that will handle it.


I set the error handler to be my own, and then put a Try and Catch 
around the part of the code that


set_error_handler(ErrorHandler::handleError());
try
{
object = new $urlParts[0]();
if (!empty($urlParts[2]))
{
$object->$urlParts[1]($urlParts[2]);
}
else
{
$object->$urlParts[1]();
}
}
catch (Error $e)
{
echo "Sorry, the web page you are looking for can not be found.";
}


Inside my ErrorHandler, I have this:
public static function handleError($errno, $errstr, $errfile, $errline)
{
echo "Hey dude! Error! " . $errno . $errstr . $errfile . $errline ;
}

However, I get errors saying that the arguments for handleError don't exist.

Shouldn't they be automatically passed to my own error handler?

Thank you for any advise.

--
Dave M G
Ubuntu 6.06 LTS
Kernel 2.6.17.7
Pentium D Dual Core Processor
PHP 5, MySQL 5, Apache 2

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



Re: [PHP] Setting try and catch to use my own error handler

2006-10-19 Thread Paul Scott

On Fri, 2006-10-20 at 15:50 +0900, Dave M G wrote:
> I have a system where the code parses the URL and creates objects based 
> on the classes named in the link.
> 
> In order to prevent a user typing in a URL that contains an object that 
> doesn't exist, and getting an error, I'm trying to set up an error 
> handler class, called ErrorHandler, that will handle it.
> 
> I set the error handler to be my own, and then put a Try and Catch 
> around the part of the code that
> 

You are getting confused as to what an error handler is and what a
custom exception handler is.

You need to define a class that extends Exception to handle your
"errors" in that way.

class myExceptionHandler extends Exception {
...
...
public function handleError($args)
{
  //do something
}
}

Then when you try and instantiate your object:

throw new myException("Your object is whack");

try {
 $obj = new Object();
}
catch(myException $e)
{
myException::handleError();
}

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