[PHP] CSS / PHP / Javascript

2006-11-14 Thread Ed Lazor
I'm reading a book on CSS and how you can define different style  
sheets for different visitors.  I'm wondering how you guys do it.   
The book recommends using Javascript functions for identifying the  
user's browser and matching them with the corresponding style  
sheets.  Anyone using PHP for this instead - specifically with  
defining style sheets for different target browsers and platforms?


-Ed

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



Re: [PHP] Protecting Streaming Audio

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



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


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

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

Sincerely,
Adam




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


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

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

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




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

 Dear List,

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

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

 Help, there must be a way..

 Thanks for any ideas..

 Sincerely,
 Adam




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



Re: [PHP] Frameworks

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



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

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

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

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

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

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

Your thoughts?

Thanks,
Ray

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



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



Re: [PHP] Protecting Streaming Audio

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


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


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




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


Dear List,

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

passworld again..

How does one protect an url - or do I have to copy the file to a  
temp dir

and then after a set time delete it?

Help, there must be a way..

Thanks for any ideas..

Sincerely,
Adam


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



Re: [PHP] ChangeLog PHP 5.2.0 - Fileupload

2006-11-04 Thread Ed Lazor

Very cool example.


Probably best explained with an example:

  http://progphp.com/upload.php

Try uploading a 200-300k file.

The source code is at:

  http://progphp.com/upload.phps

-Rasmus

--
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] Mac PHP MySQL

2006-11-03 Thread Ed Lazor
Thanks Johan, I appreciate the info.  I ended up going with MAMP as a  
quick solution.



On Nov 2, 2006, at 11:29 PM, Johan Martin wrote:



On 02 Nov 2006, at 5:11 PM, Ed Lazor wrote:

I'm trying to configure and compile PHP 5.  The configure is  
failing to find the MySQL UNIX socket.  Any ideas?


./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-zlib \
--with-mysql=/usr/local/mysql \
--with-mysql-socket=/tmp




I had a similar problem and downloaded the tar version of the Mac  
OS X Mysql Server. Pointed --with-mysql= to the libraries and that  
folder and it worked. Decided to compile my own because the  
packages always seem to lag behind the released versions of the  
software. Also need both postgresql and mysql support.


Johan Martin
Catenare LLC
534 Pacific Ave
San Francisco, CA. 94133

Phone: (415) 834-9802
Fax: (415) 294-4495
http://www.catenare.com

AOL: catenarellc
Yahoo: martin_johan
GTalk: [EMAIL PROTECTED]

FreeWorldDialup  :716798  - http://www.freeworlddialup.com/
Gizmo Project: 747-627-9132 - http://www.gizmoproject.com/

http://www.linkedin.com/in/catenare





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



Re: [PHP] Re: PHP 5.1.6 on Mac OSX 10.4.8 w/MySQL 5.0.27 support

2006-11-02 Thread Ed Lazor
Thanks Colin.  I'd seen that site and noticed in their forums that  
people were reporting problems with PHP 5.1.6.  I also noted that  
they use Apache 1.3 and I'm trying to use 2.2.


On Nov 2, 2006, at 6:02 AM, Colin Guthrie wrote:


Ed Lazor wrote:

Any ideas on how to get this PHP configure / compile to work?


My colleague recommends this site which he was able to consult to  
get a

similar setup working.

Hope it helps.

http://www.entropy.ch/software/macosx/php/

Col.

--
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] Mac PHP MySQL

2006-11-02 Thread Ed Lazor
I'm trying to configure and compile PHP 5.  The configure is failing  
to find the MySQL UNIX socket.  Any ideas?


./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-zlib \
--with-mysql=/usr/local/mysql \
--with-mysql-socket=/tmp

The mysql.sock file is physically located in /private/tmp.  The /tmp  
is a link to /private/tmp.  I also tried specifying the --with-mysql- 
socket=/private/tmp with no luck.


PHP 5.1.6
Apache 2.2.3
MySQL 5.0.27
Mac OS X 10.4.8

Thanks,

Ed

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



Re: [PHP] Closing a connection to browser without exiting the script

2006-11-02 Thread Ed Lazor

Here's another idea:

display your message in the original browser window, launch a new  
browser window for the processing script, have the window set behind  
the first with javascript.  When your script is finished, have it  
output javascript that closes the processing window.



On Nov 2, 2006, at 12:37 PM, [EMAIL PROTECTED] wrote:


 Original Message 
Subject: [PHP] Closing a connection to browser without exiting the
script
From: David Négrier [EMAIL PROTECTED]
Date: Wed, November 01, 2006 2:24 pm
To: php-general@lists.php.net

Hello there,

I'm having a somewhat unusual question here, and I cannot find any  
way

to solve it.

I have a PHP page that displays a message, and then, performs a very
long operation. Note that it displays the message first.
I do not intend to give some feedback to the user when the  
operation is

done.

I've seen I can use ignore_user_abort() to prevent the user from
stopping the ongoing operation, but that solves only part of my  
problem.
Because as long as the page is not fully loaded, the mouse cursor  
in the

user's browser is showing a watch.

So ideally, what I would like is to be able to close the  
connection from

the server-side, but without using the exit() function, so my script
keeps running afterwards.

I know I could use a system() call to launch another process to do  
the
processing, but I would like to avoid doing that, because there  
are many

variables in the context that I cannot easily pass in parameter.

I also tried to use the register_shutdown_function() to perform my
operation after the page is displayed but since PHP 4.1.0, the
connection is closed after the function is called

Would any of you have an idea on how I could close that connection?

Thanks a lot,
David
www.thecodingmachine.com


It's a bit different of an idea, but you could put your reqest to
perform the operation in a text file in some directory.  Then you have
a seperate PHP script that checks that directory for any files that
would tell it to operate.  Then you tell Cron to run that script every
minute, 10 minutes, whatever works best for you.

With this idea you can write out the file and then tell the person  
that
you have submitted a request.  Then the cron job checks for the  
request

and performs it.  You could use a database instead of a file as well
with the idea of a queue.  That would probably work better, because
then if you needed to you can keep track of which user's process was
run, and then update the user table.  Say the user table has a
column processing with three possible values.  0 (not processed), 1
(in processing), 2 (finished processing).  You could probably expand
upon that idea quite a bit more if you need to.

It's no single magic bullet function call, but that's how I'd probably
do it.

Ray

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



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



Re: [PHP] Mac PHP MySQL

2006-11-02 Thread Ed Lazor
Very very nice.  I'm impressed with how easy everything was to  
setup.  I keep wondering why nobody at PHP/MySQL/Apache ever sets up  
stuff like this.



On Nov 2, 2006, at 8:40 PM, Wee Keat Chin wrote:


Ed,

Ed Lazor wrote:
I'm trying to configure and compile PHP 5.  The configure is  
failing to find the MySQL UNIX socket.  Any ideas?


I can't tell you why because I have not a clue, but why don't you  
try using MAMP (http://www.living-e.de/en/products/The-MAMP/ 
download.php) and you can then switch between PHP4 AND 5?




--
Wee Keat Chin

--
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] Changing the Action attribute of Form

2006-11-01 Thread Ed Lazor

Javascript: Have the submit button call a JS function which would
check the state of the select and set the action appropriately
before submitting the form.

PHP: submit the result to a dispatcher script that'll redirect to
one of the targets based on what has arrived in the data (you'll
lose the ability to POST though).


I'd chose the javascript route personally.  You could use PHP's curl  
functions to rePOST the data, but that seems like more work than is  
necessary.


My .02 cents. :)

-Ed

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



Re: [PHP] php.ini ini_set

2006-11-01 Thread Ed Lazor
I think that's what he's trying, but he's missing the fact that he  
needs to include the actual From:  that you've specified.


In other words, I think he's doing:

mail([EMAIL PROTECTED], Subject, Body, [EMAIL PROTECTED]);

instead of:

mail([EMAIL PROTECTED], Subject, Body,  
From:[EMAIL PROTECTED]);




On Oct 31, 2006, at 10:55 PM, M.Sokolewicz wrote:


Why can't you just add a
From: Registrar [EMAIL PROTECTED]
header? =/

- tul

Chris wrote:

Beauford wrote:

That doesn't work.

Here is what I have.

mail($email,$subject,$body,$from);
Which is (senders address, the subject, the body of the message,  
and the

from address)

The from address is taken from this, and I added the -f in front  
of it.

define(regaddress, [EMAIL PROTECTED]);

It still says it comes from:
Nobody [EMAIL PROTECTED]; on behalf of; Registrar
[EMAIL PROTECTED]

That's something different entirely to what your original email said.
Your mail server is adding that, it's not a php setting you can  
change.
If you look at the mail source, it will have an extra header in  
there (can't remember what it is but check against this email -  
something like Sender or Sender-Address).


--
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] 301 redirect returning 302 instead

2006-11-01 Thread Ed Lazor

Have the lighttpd guys come up with any ideas?


On Nov 1, 2006, at 10:24 AM, [EMAIL PROTECTED] wrote:

Just a shot in the dark, but it's possible that providing a  
Location
header resets the status response. Try swapping your two header  
calls.


Stut:
Flipping the headers doesn't work, unfortunately, running wget  
still shows

a 302 being returned.

Kris:
You need both headers. Just giving the Location would give a 302,  
when a

301 is the goal.

Just to add more info: We're running php as fastcgi under lighttpd.  
Doing
a little searching I see that there is some weirdness with http  
headers
when PHP is run as a CGI, but I can't seem to see any solutions out  
there.
Obviously I can't be the ONLY person running this way, so there has  
to be

a solution out there.

--
Ian Evans
Chairman  Executive Producer
DigitalHit.com

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



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



Re: [PHP] Microsoft Partners With Zend

2006-11-01 Thread Ed Lazor

It's great to see Microsoft be so supportive of PHP.  Go Andi! :)

Personally I'm unsure. I would like to think that Zend is smart  
enough to
realize M$ tactics of embrace/extend and will not allow that to  
happen. But
everyone has a price, and you through enough money at something and  
you can

make things happen (as M$ knows all to well).
I also would NEVER (by choice) use M$ for a web server, not due to any
anti-M$ sentiment (I use XP as my desktop), but just b/c I feel  
LAMP is just
so integrated and works so well for this task, why fix what isn't  
broken. So

personally I could give a shit if PHP works well on IIS.


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



Re: [PHP] Microsoft Partners With Zend

2006-11-01 Thread Ed Lazor

ps...  I wonder if .NET will ever support PHP *GRIN*


On Nov 1, 2006, at 11:59 AM, Ed Lazor wrote:


It's great to see Microsoft be so supportive of PHP.  Go Andi! :)

Personally I'm unsure. I would like to think that Zend is smart  
enough to
realize M$ tactics of embrace/extend and will not allow that to  
happen. But
everyone has a price, and you through enough money at something  
and you can

make things happen (as M$ knows all to well).
I also would NEVER (by choice) use M$ for a web server, not due to  
any
anti-M$ sentiment (I use XP as my desktop), but just b/c I feel  
LAMP is just
so integrated and works so well for this task, why fix what isn't  
broken. So

personally I could give a shit if PHP works well on IIS.


--
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] Directory name

2006-11-01 Thread Ed Lazor
I don't think web browsers are going to send you the name of the  
directory the file comes from.



On Nov 1, 2006, at 10:50 AM, Sugrue, Sean wrote:

I'm trying retrieve a directory name and a filename with a form. I  
want
to use input type file so the user can browse for the file but keep  
the

whole directory name.
Any help
Sean

--
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] OO website/program doubt

2006-11-01 Thread Ed Lazor
No variable is part of session data, unless you specifically add it  
yourself.


Sorry, can't answer to AJAX, haven't had time to play with it.


On Nov 1, 2006, at 12:50 PM, Meghdad Azriel wrote:



Hello,

The objects in an OO website/program is always alive in the  
session, or they

die at  the end of the execution of each page?


and what about making something like this:
front-building-engine in javascript
AJAX tells to PHP the events
AJAX request and load data from PHP
PHP sends front-layout-specification


--
View this message in context: http://www.nabble.com/OO-website- 
program-doubt-tf2555845.html#a7122248

Sent from the PHP - General mailing list archive at Nabble.com.

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



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



Re: [PHP] Microsoft Partners With Zend

2006-11-01 Thread Ed Lazor


And writing windows native applications with php under Visual  
Studio may be

interesting...


I use RealBasic a lot for cross-platform development... it would be  
cool if PHP were the base language, instead of Basic *grin*


-Ed

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



Re: [PHP] How do I get ini_set('output_handler', '') to work?!

2006-11-01 Thread Ed Lazor

Unless you want to pre-parse set_ini() for constants differently than
set_ini() for variables. [shudder]


It sounds like we just need support for pre-parser commands.  You end  
up with one set of variables, but now you have the opportunity to  
change attributes of the environment before script processing  
begins.  Then again, there's probably problems related to doing  
something like this.  Any idea of what they would be?


-Ed

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



Re: [PHP] Closing a connection to browser without exiting the script

2006-11-01 Thread Ed Lazor

dejavu!

This thread was just on the mailing list recently... check the  
mailing list archives.


-Ed


On Nov 1, 2006, at 1:24 PM, David Négrier wrote:


Hello there,

I'm having a somewhat unusual question here, and I cannot find any  
way to solve it.


I have a PHP page that displays a message, and then, performs a  
very long operation. Note that it displays the message first.
I do not intend to give some feedback to the user when the  
operation is done.


I've seen I can use ignore_user_abort() to prevent the user from  
stopping the ongoing operation, but that solves only part of my  
problem. Because as long as the page is not fully loaded, the mouse  
cursor in the user's browser is showing a watch.


So ideally, what I would like is to be able to close the connection  
from the server-side, but without using the exit() function, so my  
script keeps running afterwards.


I know I could use a system() call to launch another process to do  
the processing, but I would like to avoid doing that, because there  
are many variables in the context that I cannot easily pass in  
parameter.


I also tried to use the register_shutdown_function() to perform my  
operation after the page is displayed but since PHP 4.1.0, the  
connection is closed after the function is called


Would any of you have an idea on how I could close that connection?

Thanks a lot,
David
www.thecodingmachine.com

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



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



Re: [PHP] OO website/program doubt

2006-11-01 Thread Ed Lazor
Yes.  Check the mailing list archive.  We just had a discussion about  
2 weeks ago that talked about this and gave a few examples.



On Nov 1, 2006, at 1:30 PM, bruce wrote:


yo rich (or others)...

does php provide the ability to store objects in a session var



-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 01, 2006 1:16 PM
To: Meghdad Azriel
Cc: php-general@lists.php.net
Subject: Re: [PHP] OO website/program doubt


On Wed, November 1, 2006 2:50 pm, Meghdad Azriel wrote:

The objects in an OO website/program is always alive in the session,
or they
die at  the end of the execution of each page?


They die and are resurrected like zombies on the next page.

The Resurrection is slightly more complicated than that described in
the Bible, however, requiring some serious gnarly timing issues in
your loading of the class definitions before you attempt to use the
objects...

Probably best to load all your class definitions before you do
session_start() from that perspective, though I don't know as I never
use OOP much in PHP.

You *could* write a daemon in PHP to have long-lived objects, however,
if you want to keep them around for a long shelf life.

--
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 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] PHP 5.1.6 on Mac OSX 10.4.8 w/MySQL 5.0.27 support

2006-11-01 Thread Ed Lazor

Any ideas on how to get this PHP configure / compile to work?

Apache 2.2.3 is installed and working from source.
MySQL 5.0.27 is installed and working from the Mac OSX package  
available on the MySQL site.
PHP 5.1.6 will configure and make if I don't worry about MySQL  
support.  The configure fails if I try to add MySQL support.


Here's the first configure attempt:

./configure \
--with-axps2=/usr/local/apache2/bin/axps \
--with-mysql=/usr/local/mysql



This will error out saying the zlib library is missing, so I add the  
zlib parameter:


./configure \
--with-axps2=/usr/local/apache2/bin/axps \
--with-mysql=/usr/local/mysql \
--with-zlib=/usr


This configure fails with the config.log output at the end of this  
email.  I have the Mac fully updated and the Developer package is  
installed.


I Googled for answers, found a few examples of others who've had  
success and tried to use the same configure as them, but I end up  
with the same error.  Well, I found some stuff on entropy.ch that I  
didn't try, mainly because they were using Apache 1.3 and I'm using  
Apache 2.2.3.


Thanks in advance for any ideas you have.

-Ed







configure:58552: gcc -o conftest -I/usr/include -g -O2  -no-cpp- 
precomp -L/usr/local/mysql/lib -L/usr/local/mysql/lib -liconv -L/usr/ 
lib  conftest.c -lmysqlclient  -liconv -lz -lm  -lxml2 -lz -liconv - 
lm -lxml2 -lz -liconv -lm 15

ld: Undefined symbols:
_fprintf$LDBLStub
_sprintf$LDBLStub
_printf$LDBLStub
configure: failed program was:
#line 58541 configure
#include confdefs.h
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply.  */
char mysql_close();

int main() {
mysql_close()
; return 0; }
configure:58773: checking for mysql_error in -lmysqlclient
configure:58792: gcc -o conftest -I/usr/include -g -O2  -no-cpp- 
precomp -L/usr/local/mysql/lib -L/usr/local/mysql/lib -liconv -L/usr/ 
lib  -L/usr -L/usr conftest.c -lmysqlclient  -lz -liconv -lz -lm  - 
lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm 15

ld: Undefined symbols:
_fprintf$LDBLStub
_sprintf$LDBLStub
_printf$LDBLStub
configure: failed program was:
#line 58781 configure
#include confdefs.h
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply.  */
char mysql_error();

int main() {
mysql_error()
; return 0; }

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



Re: [PHP] Stupid question of the day (Editing text file in $HOME via web)

2006-10-31 Thread Ed Lazor


On Oct 30, 2006, at 11:34 PM, Google Kreme wrote:
So, do I whack up something where I just load the file into a HTML  
Textarea and then write it back (simple enough, though possibly  
rather dangerous), or is there something straightforward I should  
go ahead and use that might find use elsewhere on the server?


Playing Devils Advocate here, but why not store the text in a database?

The text file should be somewhat secure if you're manually reading  
and writing to it in PHP, making sure that you're the one controlling  
the file name, the file extension (file type), the file permissions,  
and the file size.


-Ed

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



Re: [PHP] Run script every 30 seconds

2006-10-31 Thread Ed Lazor


On Oct 31, 2006, at 2:48 AM, Ahmad Al-Twaijiry wrote:


yes, I think you can call it ,semi-real-time monitoring

because we want the script when it run it should read some records in
database and update other records


That's kind of vague.  I'm not able to give better advice without  
more information, but it does sound like you'll eventually run into  
some bottlenecks as system usage increases ( and fairly quickly if  
you're collecting data every 30 seconds).


-Ed

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



Re: [PHP] Decide witch table within a union

2006-10-31 Thread Ed Lazor


On Oct 30, 2006, at 9:20 PM, Børge Holen wrote:


On Tuesday 31 October 2006 02:27, Ed Lazor wrote:

Someone asked what it was to be used for.
It's for combining 4 forums into one witch shows the latest
movement among
them. More like an introduction sort of...


Sounds cool.  Are you using a pre-made forum package?


No
Maby it'd been easier, I did that at first... But not much to learn  
using

other ppls tools.


True, a good challenge is always fun :)

-Ed

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



Re: [PHP] channels attribute value returns wrong

2006-10-31 Thread Ed Lazor

Just getting, but is there a 0, 1, 2, and 3 channel?


On Oct 31, 2006, at 3:10 AM, dhatri gmail wrote:


Hello,

using function getimagesize();

I am trying to get channels attribute value of image, it returns 3  
for cmyk image actually it should return 4, can you tell me why it  
happens so?


regds.
dmt

--
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] Is there such a thing?

2006-10-31 Thread Ed Lazor


On Oct 31, 2006, at 8:25 AM, Rory Browne wrote:
It would be helpful if people would read the link the OP provided,  
as opposed to just the URL to that link.


The page isn't about compiling PHP source into a binary.

It's about creating a method of using web applications ( php )  
without the help of a seperate web-server.


I could be wrong, because I haven't used them, but I do think that  
some of the links I sent do what you're looking for.  For example,  
one of the links had information about storing the executables on CD  
for distributing presentations.  Good news tho, if those don't work  
for you, odds are good that you're not going to find what you're  
looking for... mainly because PHP is designed to be an interpretive  
web language and there are other tools more suited for what you're  
trying to accomplish.


-Ed

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



Re: [PHP] only one at atime

2006-10-31 Thread Ed Lazor


On Oct 31, 2006, at 2:29 AM, Ahmad Al-Twaijiry wrote:


We have a virtual stock exchange site (for learning purpose) we put
all the bids and offers in  a table and every minute we run the php
script to make the exchange

but my customer want to make it less than 1 minute


I can tell there's something I'm missing here.  I suspect it has to  
do with the operation of how the bid/offer exchange process actually  
works.  I'm assuming that the bid is the asking price for the stock,  
one bid will receive multiple offers, and your script sells the  
stock to the highest bidder within a given time frame.  Is that right?


-Ed

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



Re: [PHP] Imagecopyresampled creates black pictures

2006-10-30 Thread Ed Lazor


On Oct 30, 2006, at 12:52 AM, Martin Hochreiter wrote:


Hi!

I'm using imagecopyresampled to create thumbnails of
various pictures.

That works well except some pictures that imagecopyresampled
converts to small black thumbnails (although it converts it correctly
to a bigger size)

What is wrong here?


No idea off-hand, but it would probably help if you you included more  
information like source code and details about the images that are  
not working.


-Ed

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



Re: [PHP] PHP Search Engine - Synonyms

2006-10-30 Thread Ed Lazor
Another idea from what I just sent:  try googling synonym  
database.  It looks like there are a few leads in there as well.


On Oct 30, 2006, at 6:26 AM, Kevin wrote:


Hi,

Is it possible to automatically search for synonyms related to a  
word in a search engine for example if I create a search engine and  
search for the word 'Horse', it would automatically search for  
other words such as 'Pony' etc?


Has anyone had any experience on how this would be implemented?


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



Re: [PHP] Encoding PC-850

2006-10-30 Thread Ed Lazor

Would this help?
http://us3.php.net/manual/en/function.mb-convert-encoding.php

On Oct 30, 2006, at 7:21 AM, [EMAIL PROTECTED] wrote:


Hi!

I need to be able to encode text to PC-850 but I have big trouble  
finding out info about this encoding. Does it even exist? I get a  
few google hits, but nothing useful. Any idea of how I can convert  
for example an UTF-8 string or an ISO-8859-1 to this PC-850 format?


Thanks for any input.

Regards Emil


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



Re: [PHP] str_replace on words with an array

2006-10-30 Thread Ed Lazor
It looks like you guys are coming up with some cool solutions, but I  
have a question.  Wasn't the original purpose of this thread to  
prevent sql injection attacks in input from user forms?  If so,  
wouldn't mysql_real_escape_string be an easier solution?




On Oct 30, 2006, at 8:17 AM, Jochem Maas wrote:


Dotan Cohen wrote:
I need to remove the noise words from a search string. I can't  
seem to

get str_replace to go through the array and remove the words, and I'd
rather avoid a redundant foreach it I can. According to TFM
str_replace should automatically go through the whole array, no? Does
anybody see anything wrong with this code:

$noiseArray = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
\, ', :, ;, |, \\, , , ,, ., ?, $, !,
@, #, $, %, ^, , *, (, ), -, _, +, =, [,
], {, }, about, after, all, also, an, and,
another, any, are, as, at, be, because, been,
before, being, between, both, but, by, came, can,
come, could, did, do, does, each, else, for, from,
get, got, has, had, he, have, her, here, him,
himself, his, how, if, in, into, is, it, its,
just, like, make, many, me, might, more, most,  
much,

must, my, never, now, of, on, only, or, other,
our, out, over, re, said, same, see, should, since,
so, some, still, such, take, than, that, the,  
their,

them, then, there, these, they, this, those, through,
to, too, under, up, use, very, want, was, way,  
we,

well, were, what, when, where, which, while, who,
will, with, would, you, your, a, b, c, d, e, f,
g, h, i, j, k, l, m, n, o, p, q, r, s, t,
u, v, w, x, y, z);

$searchQuery=str_replace( ^.$noiseArray.$,  , $searchQuery);


// another idea based on further reading of the thread:

function pregify($val) {
foreach ((array)$val $k as $v)
$val[$k] = '\b'.preg_quote($v).'\b';

return $val;
}

$searchQuery = preg_replace(pregify($noiseArray),  , $searchQuery);



Thanks in advance.

Dotan Cohen

http://essentialinux.com
http://what-is-what.com/what_is/sitepoint.html



--
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] Is there such a thing?

2006-10-30 Thread Ed Lazor


On Oct 29, 2006, at 9:22 PM, Richard Lynch wrote:


On Fri, October 27, 2006 5:46 pm, Integz wrote:

http://www.evilbitz.com/2006/10/27/local-php-standalone-binaries-2/


I responded in that forum.

Short Version:

No.

Check out:
http://gtk.php.net/


Do these qualify?

http://www.roadsend.com/home/index.php?SMC=1pageID=compiler
http://www.priadoblender.com

-Ed

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



Re: [PHP] PHP Search Engine - Synonyms

2006-10-30 Thread Ed Lazor


On Oct 30, 2006, at 6:26 AM, Kevin wrote:


Hi,

Is it possible to automatically search for synonyms related to a  
word in a search engine for example if I create a search engine and  
search for the word 'Horse', it would automatically search for  
other words such as 'Pony' etc?


It is possible:  http://www.google.com/help/refinesearch.html


Has anyone had any experience on how this would be implemented?


I haven't done it, but it seems straight forward.  Start with one  
word, query a database for it's synonyms, and then use the resulting  
words (including the original word) in the final search query.  It  
just seems like it would take a lot of work to create a database of  
words and their synonyms.  You'll also need to add weight and sort  
the results so that your initial keyword scores higher.  Honestly, if  
I were you, I'd run this question by the MySQL mailing list.  PHP  
just works with the results of the search, so you still end up having  
to figure out how to do this in MySQL (or whatever database you're  
using).  Another thing that might help is to Google keywords like  
synonym search programming technique.  I had to sort through the  
results, but it did look like there were a few interesting articles.   
Here's one of them:  http://developer.apple.com/documentation/ 
UserExperience/Conceptual/SearchKitConcepts/searchKit_basics/ 
chapter_2_section_2.html


-Ed

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



Re: [PHP] str_replace on words with an array

2006-10-30 Thread Ed Lazor


On Oct 30, 2006, at 9:19 AM, Stut wrote:


Ed Lazor wrote:
It looks like you guys are coming up with some cool solutions, but  
I have a question.  Wasn't the original purpose of this thread to  
prevent sql injection attacks in input from user forms?  If so,  
wouldn't mysql_real_escape_string be an easier solution?


Me thinkie nottie. From the OP...

I need to remove the noise words from a search string.


You sure?  This is what they said originally:

Nothing else is relevant, but $searchQuery will get passed to the  
database, so it should be protected from SQL injection. That's why I  
want to remove characters such as quotes, dashes, and the equals sign.


Maybe that doesn't account for all of the extra words they're trying  
to remove... dunno, thus my question.



However, until the OPer accepts that people are right when they say  
you can't append strings to an array it's never going to work.  
Every bit of sample code posted retains the following line of code  
rather than fixing it according to several other previous posts...


^.$noiseArray.$

Happy happy joy joy, oh look, the spring's broken. Doing!!


Persistence is a virtue? hehe



-Stut (slightly drunk, but feeling generally good about the world)


Hy.  That's not fair.  No bragging unless you plan on  
sharing :)


-Ed

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



Re: [PHP] Decide witch table within a union

2006-10-30 Thread Ed Lazor

Someone asked what it was to be used for.
It's for combining 4 forums into one witch shows the latest  
movement among

them. More like an introduction sort of...


Sounds cool.  Are you using a pre-made forum package?
-Ed

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



Re: [PHP] only one at atime

2006-10-30 Thread Ed Lazor


On Oct 30, 2006, at 10:14 AM, Ahmad Al-Twaijiry wrote:


Hi everyone,

I create a php script that will run every minute (by cronjob) and
update some database tables (php 5, database mysql 5, tables type
innodb)

the problem is that I want this script to run only one at atime (only
one process from this script can run )

for example, if the cronjob start the script and the script takes more
than one minute, then after this one minute the cronjob start another
process from this script, it should exit once it find there is an old
process of it running)

what I do now is that when the script start it will check for a tmp
file (/tmp/script.pid) and if it fine it it will exit.
if the file  (/tmp/script.pid) is not exists, it will create it and
start doing the database update
and when the script finish it will remove the file


any better idea ?


It sounds like how I'd approach it, but it depends somewhat on the  
type of updates your script is performing and how busy your website  
is.  Plus, I'm curious, what kind of updates are needing to occur  
every 30 seconds?  And, if your scripts are at risk of running for  
more than 30 seconds, does this mean that the volume of data you're  
working with end up building upon itself?  Just wondering, because it  
sounds like you could end up hammering your database server.


-Ed

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



Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Ed Lazor


On Oct 30, 2006, at 10:26 AM, Ahmad Al-Twaijiry wrote:

is it possible to link the script to my php interface (the one that
the users is using it) and if the php interface page will run the
script (IN background) if it didn't run for the last 30 seconds ? I
see  this is very hard and almost impossible , what do you think ?

PS: also I need to make sure no more than 1 process of the script  
is running :)


Hi Ahmad.  Could you describe what your script is doing?  What type  
of information are you wanting users to see?  Is this some sort of  
status page?  Is it some sort of semi-real-time monitoring?


-Ed

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



Re: [PHP] str_replace on words with an array

2006-10-30 Thread Ed Lazor


On Oct 30, 2006, at 1:10 PM, Dotan Cohen wrote:


On 30/10/06, Stut [EMAIL PROTECTED] wrote:

Ed Lazor wrote:
 It looks like you guys are coming up with some cool solutions,  
but I

 have a question.  Wasn't the original purpose of this thread to
 prevent sql injection attacks in input from user forms?  If so,
 wouldn't mysql_real_escape_string be an easier solution?

Me thinkie nottie. From the OP...

I need to remove the noise words from a search string.


Yes, that is also part of the aim.


How come?  Not trying to be facetious here.  I'm just wondering if  
you see a benefit that I don't.  For example, say the hacker injects  
some sql and you use mysql_real_escape_string.  You end up with  
something like this... actually, I'll do one step further and just  
use the quote_smart function described in the  
mysql_real_escape_string page of the php manual:


$query = sprintf(SELECT * FROM users WHERE user=%s AND password=%s,
quote_smart($_POST['username']),
quote_smart($_POST['password']) );

Say the user tried to inject sql in $_POST['username'] and it looked  
something like:   root';drop all;


Having used quote_smart, the value of $query ends up

SELECT * FROM users WHERE user='root\'\;drop all\;' AND  
password='something'


The sql injection fails.  The data is seen as a literal.  The  
database is going to think there's no user with that name.  That  
means that even if the user did include extra words, they're just  
part of the value that is checked against user names - rather than  
being see as potential commands.


I'm not sure if I'm describing this well, so let me know what you  
think and I'll go from there.


-Ed

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



Re: [PHP] How do I get ini_set('output_handler', '') to work?!

2006-10-30 Thread Ed Lazor


I suppose I could re-compile my command line version with a different
php.ini file, but that's kind of lame that I have to have two  
php.ini files

for what ini_set() SHOULD handle.


Would modifications via .htaccess work for you?
-Ed

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



Re: [PHP] Query question

2006-10-29 Thread Ed Lazor
You'd still benefit from converting your data into an actual date  
format in order to take full advantage of available features.  hehe  
You guys are going to start thinking of me as a performance freak,  
but I think MySQL's date functions might provide better performance  
than string manipulation.



On Oct 29, 2006, at 6:08 AM, Beauford wrote:

I don't see this as a particular problem as the data will always be  
the
same. Now under other circumstances in another database, I can see  
what you

are saying.

-Original Message-
From: Satyam [mailto:[EMAIL PROTECTED]
Sent: October 29, 2006 4:30 AM
To: Beauford; 'PHP'
Subject: Re: [PHP] Query question

I said that you have a problem,not that you caused it, and my  
observation

might (hopefully) help newbies in the list.

Satyam


- Original Message -
From: Beauford [EMAIL PROTECTED]
To: 'PHP' php-general@lists.php.net
Sent: Sunday, October 29, 2006 9:06 AM
Subject: RE: [PHP] Query question


This is how I get the data and I have no control over the actual  
layout of

the database. So I have to work with what I have.

Robert:

LOL, I don't know either. The format is - 01/01/2006. When I first  
did it

I
used 7, which should be right, but I ended up getting /2002 /2003,  
etc. So



I
went to 8 and all was well. Beats me.


B

-Original Message-
From: Satyam [mailto:[EMAIL PROTECTED]
Sent: October 29, 2006 2:14 AM
To: Beauford; 'PHP'
Subject: Re: [PHP] Query question

If that works then you have a problem:  you are storing dates as a  
plain

string ( varchar or whatever) instead of a native date/time datatype,
which
precludes the use of a large number of native SQL date/time  
functions,

such
as year() which should suit you nicely in this case.  Eventually,  
you will
bump into something more elaborate which you won't be able to do  
on the

SQL
side just with string functions and that will force you to bring  
whole

tables into PHP to do more extensive processing.

Satyam

- Original Message -
From: Beauford [EMAIL PROTECTED]
To: 'PHP' php-general@lists.php.net
Sent: Sunday, October 29, 2006 7:05 AM
Subject: RE: [PHP] Query question



This is what I finally figured out, which works just perfectly.

select count(date) as count, substring(date,8) as year from stats  
group

by
year;

Thanks to all for the input.

-Original Message-
From: Joe Wollard [mailto:[EMAIL PROTECTED]
Sent: October 29, 2006 12:15 AM
To: Beauford
Cc: PHP
Subject: Re: [PHP] Query question

Look into the MySQL YEAR() function to extract the year from a  
specific

date.
Start here:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html




On 10/28/06, Beauford [EMAIL PROTECTED] wrote:


I posted this here as I figured I would need to manipulate this  
using

PHP.
The code below doesn't quite work because the date is in the  
format of

05/05/2006. So I am getting totals for each date, not each year. I
need the totals for each year, regardless of the day or month.  
This is
why I figured I'd need to use PHP to maybe put it in an array  
first or

something.

Thanks

-Original Message-
From: Joe Wollard [mailto:[EMAIL PROTECTED]
Sent: October 28, 2006 10:30 PM
To: Ed Lazor
Cc: Beauford; PHP
Subject: Re: [PHP] Query question

Agreed, this should go to a MySQL list. But in the spirit of  
helping I

think the following should give you a good starting point.

SELECT `year`, COUNT(`year`) AS `count` FROM `tbl` GROUP BY  
`year` ASC



On 10/28/06, Ed Lazor [EMAIL PROTECTED] wrote:


Use the mysql list :)


On Oct 28, 2006, at 3:01 PM, Beauford wrote:


Hi,

I have a MySQL database with a date field and a bunch of other
fields. The date field is in the format - 01/01/2006. What I want
to do is query the database and create a table that shows just  
the

year and how many instances of the year there is. I have been
taxing my brain for a simple solution, but just not getting it.
Any suggestions?

Thanks

Example output.

Year  Count

2002  5
2003  8
2004  9
2005  15
2006  22

ps - I get this information sent to me and I can't change any of
the data. I just enter it in the db and then hopefully do the
query on it.




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

Re: [PHP] strange problem with count()

2006-10-29 Thread Ed Lazor

Side note, it sounds like

$this-result

is an object holding an array, not the array itself and print_r is  
automatically traversing the object.



On Oct 29, 2006, at 4:27 AM, Gunnar Beushausen wrote:


Hi!

I've a strange problem with count. I wrote a routine to jump to the  
last position of an array. The code ist this:


if(!$this-done) {
array_push($this-result, $this-stmt-fetchall_assoc());
}
$this-done = true;
$this-currIndex = $this-rowIndex = count($this-result)-1;
return $this;

If i do a print_r($this-result); i'm getting like thousand  
entries, so the array is actually filled with all values needed.  
But somehow a count($this-result) gives me a value of 1.


I wonder why count says there is only 1 entry in that array, when  
print_r gives out more than thousand entries. Does anybody have a  
clue? I'm using php 5.1.6


Thanks in advance,

Gunnar

--
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] forms usage in web pages

2006-10-29 Thread Ed Lazor

Is anyone else getting multiple copies of posts?


On Oct 29, 2006, at 9:52 AM, Larry Garfield wrote:

There's nothing wrong with multiple forms on a single page, as long  
as all id
attributes in all elements are unique on the entire page, not just  
within the
form.  Just make sure that each form is self-contained with its own  
submit
button and such.  Only the form whose submit button is clicked will  
get

submitted by the browser.

Whether or not you want to use multiple forms for a given set of  
tasks or
multiple submit buttons in a single form (which you can then test  
to see

which was clicked) will depend on what it is you're doing.  Both are
perfectly legitimate ways of doing things, depending on what things  
you're

doing.

On Sunday 29 October 2006 01:45, Karthi S wrote:

hi,

i am newbie to web programming. i have a basic doubt in using forms.

Is it advisable to use multiple forms performing various functions  
in a

single web page.
what are the pros and cons of using that.

Please forgive me if this is not the right mailing list to post this
question. But help me out in clarifying this basic doubt.

thanks in advance

Karthi


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



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



Re: [PHP] Decide witch table within a union

2006-10-29 Thread Ed Lazor

PHP can't tell what table the data came from.


On Oct 29, 2006, at 1:34 PM, Børge Holen wrote:


Hi.
I got this working (almost)
How do I decide (inside?) the whileloop the table_nr, 1 to 4 witch  
the link is

echo'ed from.

I could add another field in each table telling witch table it is.  
Easy

solution, but feels like polluting the db.

Also I could do another loop to check another of the printed fields  
up agains
witch table is used, but that adding to the slowness of this union  
stuff, it
would take forever, if the union in itself is slow or the fact that  
I'm

cutting the message field after 100 characters I dunno.

This is anyway the main code wherein the problem lies:

$sql=	(select * from table_1 WHERE pid='0' order by id desc limit  
10) union
		(select * from table_2 WHERE pid='0' order by id desc limit 10)  
union
		(select * from table_3 WHERE pid='0' order by id desc limit 10)  
union

(select * from table_4 WHERE pid='0' order by id desc limit 10)
order by date desc limit 10 ;

$result = mysql_query($sql) or die('Error, query failed');
while($myrow = mysql_fetch_array($result)){
$id = $myrow[id];
$pid = $myrow[pid];

echo a href=\index.php?table=$table_nrpage/a;
}

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

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



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



Re: [PHP] str_replace on words with an array

2006-10-29 Thread Ed Lazor

checkout the function mysql_real_escape_string()


On Oct 29, 2006, at 3:13 PM, Dotan Cohen wrote:


On 30/10/06, Paul Novitski [EMAIL PROTECTED] wrote:

Hi Dotan,

To get help with your problem, share more of your PHP code with the
list so we can look at what you're doing.

Also, give us a link to the PHP script on your server so we can  
see the output.


Regards,
Paul



Nothing else is relevant, but $searchQuery will get passed to the
database, so it should be protected from SQL injection. That's why I
want to remove characters such as quotes, dashes, and the equals sign.

I set up a test page:
http://what-is-what.com/test.php

with this code:
htmlbody

?php

// FOIL SQL INJECTION AND REMOVE NOISE

$noiseArray = array([:alnum:], [:punct:], |, \\, , ,
#, @,  \$, %, ^, , *, (, ), -, _, +, =,
[, ], {, }, about, after, all, also, an, and,
another, any, are, as, at, be, because, been,
before, being, between, both, but, by, came, can,
come, could, did, do, does, each, else, for, from,
get, got, has, had, he, have, her, here, him,
himself, his, how, if, in, into, is, it, its,
just, like, make, many, me, might, more, most, much,
must, my, never, now, of, on, only, or, other,
our, out, over, re, said, same, see, should, since,
so, some, still, such, take, than, that, the, their,
them, then, there, these, they, this, those, through,
to, too, under, up, use, very, want, was, way, we,
well, were, what, when, where, which, while, who,
will, with, would, you, your);

$searchQuery=preg_replace( /^.$noiseArray.$/,  , $_POST 
[query]);

$searchQuery=trim($searchQuery);

print p$searchQuery/p;

?

form action=/test.php method=post
  input type=text name=query /
  input type=submit /
/form

/body/html



Dotan Cohen

http://song-lirics.com
http://what-is-what.com/what_is/distribution.html

--
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] Decide witch table within a union

2006-10-29 Thread Ed Lazor
Definitely not.  Review your design.  If you need to know which table  
data comes from, then perform table specific queries.  If you need to  
combine data from more than one table, code your application to  
respond accordingly.  You may also need to review your database  
schema design in order that it best meet your needs.


On Oct 29, 2006, at 2:00 PM, Børge Holen wrote:

Would you suggest to use a extra field to hold the table name as  
default?



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



Re: [PHP] socket_recv

2006-10-29 Thread Ed Lazor
Depends on the volume and type of data that you're working with.  It  
also depends on the type of connection between the server and  
client.  Slower connections, unreliable connections, or general data,  
use smaller packets.  Reliable connection or higher volumes of data,  
use larger packets.  Think of it this way, the entire packet of data  
gets resent if there's an error and this could be costly time-wise if  
your packets are huge.




On Oct 29, 2006, at 4:41 PM, Eric wrote:

Is there a reccomended size of data to pull in with socket_recv  
(Such as 1024) or can I pull in 981132487 and it wont make a  
difference? Thanks in advance.


--
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] Decide witch table within a union

2006-10-29 Thread Ed Lazor



That seems unreasonably harsh.


I can see what you mean, but don't take it that way.  I was trying to  
help.



What in your view is wrong with a union query that preserves an  
indicator of which component table a particular record comes from?


Read earlier in the thread.  He's talking about adding a field to the  
table and that the value of this field in every single record will be  
the name of the table the record belongs to.  I said I would  
definitely not recommend doing that.


I can easily imagine a circumstance in which this could be  
valuable, say the union of several mailing lists that are in  
separate tables simply because they originate from different  
sources.  We union them to print a single alphabetical list, for  
example, but we want an indicator as to the source of each record.


I can imagine modifying the OP's query to read:

$sql=  (select '1' as tableId, * from table_1 WHERE pid='0' order  
by id desc limit 10) union
(select '2' as tableId, * from table_2 WHERE pid='0' order  
by id desc limit 10) union
(select '3' as tableId, * from table_3 WHERE pid='0' order  
by id desc limit 10) union
(select '4' as tableId, * from table_4 WHERE pid='0' order  
by id desc limit 10)

order by date desc limit 10 ;

Would this be so egregious? and if so why?


I think this is a great solution, wish I'd thought of it.  =)



You say,

If you need to combine data from more than one table,
code your application to respond accordingly.


What does this mean, exactly?


I'm just talking about intelligent programming.

Surely you're not suggesting that we code an application to somehow  
divine the source of a record in a union query when the query  
itself could simply supply that datum easily.


Of course not.   Honestly, I think you're just being critical of what  
I said, because you thought I was being harsh and unfair when I  
wasn't actually trying to be.


-Ed

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



Re: [PHP] Decide witch table within a union

2006-10-29 Thread Ed Lazor


Sorry, Ed, I had intended my reply to be friendly as well.  I'm  
allergic to smiley-face icons, but I should have tried harder to  
convey my tone.  Dang this poker-faced email!


No worries.  It's all good :)

-Ed

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



Re: [PHP] Shopping Cart

2006-10-28 Thread Ed Lazor


Be specific in stating what prior research has been done so that we  
may help, if possible. Point noted.


Helping out further, you'll find that this rule applies to almost all  
mailing lists.


2) We don't owe you anything. If you decide to go elsewhere for  
help don't expect us to feel guilty or upset or anything but  
mildly amused. I would point out that you're unlikely to find a  
better source of help than the 'official' PHP lists, but I really  
don't care enough about where you go for help.




My statement was meant as some behavioral/emotional modification,  
or an attempt at soliciting pity. So my lack of compassion is  
mutually returned.


Helping out even further with another general rule of etiquette on  
mailing lists, keep it cool and filter the crap.  For example, Chris'  
initial reply came across as offensive and you could have surprised  
him by filtering his attitude, focusing on the real issue, and  
responding with information about what you have researched up to this  
point.  Speaking of which, I think that's where this thread is.  Have  
you researched any of the options that come up from Googling php  
shopping cart?  Which options have you dismissed and why?


-Ed

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



Re: [PHP] Uploading files.

2006-10-28 Thread Ed Lazor
Side note on the PHP FTP... I'm sure there are PHP FTP classes out  
there for you to use... google php ftp class and you'll see a few  
options to explore.



On Oct 28, 2006, at 10:47 AM, João Cândido de Souza Neto wrote:


Hi everyone.

I´m in a big doubt about uploading files ins a safe way.

I wont give permission for the web server user to write in some  
folder of my
system and then use move_uploaded_file function in order to keep it  
secure.


I was using ftp functions to do it but a get a new trouble, in some  
servers
my ftp user has no permission to read in the upload temp folder of  
php.


I am determined to access by ftp funcions, give permission to web  
server
user, put the file by move_uploaded_file and take the permission  
previously

gave. I do not test but i think it will works.

Someone has another tip to do it without loss security?

Thanks in advance.

--
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] Re: PHP Sessions || Problems with AOL, Safari, etc.

2006-10-28 Thread Ed Lazor
Check php.ini session settings.  There are some options in there for  
you to use in your scripts.  Set up scripts to test whether session  
cookies are being saved and then route accordingly.



On Oct 28, 2006, at 12:41 PM, sit1way wrote:


Hey all.

I run a members-only hockey report that relies on Session variable 
(s) to

grant/deny access to members-only site content.

Generally members have no trouble accessing members-only content once
logged-in to the site; however, since we have a few thousand  
members, I

frequently receive tech support requests along the lines of My login
doesn't work, I keep getting returned to the login screen.   
Invariably it's

McAffee anti-virus, or other anti-virus program running on the user's
computer that disables session cookies, or the user disabled  
session cookies

in attempts to make their browser more secure.

Is there a way to get around this problem?  Not being able to set  
Session
variable(s) is a major annoyance; one that I'd like to resolve if  
possible.


Suggestions welcome...

Thanks,

--Noah



--
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] Re: A general UL script

2006-10-28 Thread Ed Lazor
Are you just trying to tell whether the form has been submitted?  Or  
are you just trying to validate form data?


-- verify form submitted -
if (isset($_POST)) {
// form submitted, process data
} else {
// display form
}

--
http://us2.php.net/manual/en/features.file-upload.php

Example 38-2.  Validating file uploads



On Oct 28, 2006, at 2:46 PM, Børge Holen wrote:


Ok. got that thanks.
But that leaves me a bit off to how to tell the script to leave it  
alone.

Is it possible to check it

or maby even better. Posible to not add an empty field in the submit.
The multifile submit I actually intended this script for, always  
send the
first field empty so later on I slice the array to cut out the  
first'n empty

field.

Witch ALSO would be very helpful, since I right this minute seems to
believe/found out that Safari actually seems to send the field in the
opposite order of Firefox??? Maby there is something else, but the  
script

stops when I check the array for actual images.

On Saturday 28 October 2006 23:33, M.Sokolewicz wrote:

Børge Holen wrote:
When I use a normal single file upload form; both of these  
statements

will continue wether my form is empty or not, why?

if(!empty($_FILES)){
do som checking if its a jpg.
if not exit;

if(isset($_FILES)){


because it IS set and NOT empty.
$_FILES['file_upload_field'] is set, it's got no data, but it IS set.
$_FILES is set because $_FILES['file_upload_field'] exists.
Submitting a blank form sends all variables though without actual
(non-default) content.

- tul


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

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



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



Re: [PHP] A general UL script

2006-10-28 Thread Ed Lazor
You posted this earlier and people, myself included, responded.  I  
don't know why you're reposting your original message rather than  
reply to what we went.  If  you're not happy with the answers we  
provided, please rephrase your question in order that have more luck  
in answering it.



On Oct 28, 2006, at 1:16 PM, Børge Holen wrote:

When I use a normal single file upload form; both of these  
statements will

continue wether my form is empty or not, why?

if(!empty($_FILES)){
do som checking if its a jpg.
if not exit;

if(isset($_FILES)){

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

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



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



Re: [PHP] Query question

2006-10-28 Thread Ed Lazor

Use the mysql list :)


On Oct 28, 2006, at 3:01 PM, Beauford wrote:


Hi,

I have a MySQL database with a date field and a bunch of other  
fields. The
date field is in the format - 01/01/2006. What I want to do is  
query the
database and create a table that shows just the year and how many  
instances
of the year there is. I have been taxing my brain for a simple  
solution, but

just not getting it. Any suggestions?

Thanks

Example output.

YearCount

20025
20038
20049
200515
200622

ps - I get this information sent to me and I can't change any of  
the data. I

just enter it in the db and then hopefully do the query on it.




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



Re: [PHP] PHP 5 Hosting

2006-10-25 Thread Ed Lazor

Hi,

I wanted to give some feedback on PHP 5 hosting in case it helps  
someone.  I signed up with DreamHost last Thursday.  I also signed up  
with OCS Solutions to compare the two services.  I also maintain a  
server with CalPop.


When I signed up with Dreamhost, I discovered that you have to fill  
out a form and fax it to them, along with a rubbing of your credit  
card.  Personally, I found that part rather annoying.  They say it's  
for added security, but I've never had to do that with any other  
online transactions that I've done.  OCS Solutions had me pay for a  
year up front, which always makes me nervous when checking out a new  
provider, but they do offer a money back guarantee.  Actually, both  
providers offered a money back guarantee.  DreamHost's is 97 days.   
That's pretty good.


Cost-wise, both companies were fairly inexpensive.  I ran a Google  
search for DreamHost Coupon and found a coupon that eliminated a  
majority of the up front cost.  Actually, I was pretty surprised.   
They give you a free domain registration that includes private whois  
for free.  After the coupon, I paid $9.90 and covered the start-up  
fee (normally $45), the first month of service, and the domain  
registration.  It feels like I paid for a domain registration and got  
free hosting for a month.


My account with DreamHost was created on Monday.  Technically, it  
took 5 days to get my account set up.  That's the longest set up  
delay I've ever experienced with any host provider.  OCS Solutions  
called me an hour after signing up and had my account setup shortly  
thereafter.


I also registered a domain when signing up with OCS Solutions.  The  
whois was wrong.  Somehow it ended up showing as registered to one of  
their employees, but I called and they quickly fixed it.  The account  
was set up under the wrong username, but they fixed that quickly,  
along with problems with cpanel when it doesn't handle the name  
change correctly.  Mistakes were made, but I was really pleased with  
how easy it was to get help and I was really happy with how much  
people obviously cared about helping out.


After signing up with DreamHost, the domain that I'd registered with  
them wasn't working.  I was exploring their control panel to figure  
out the problem when I came upon a DNS management page.  The page  
automatically identified and fixed the problem.  That was impressive.


Also, I started exploring the DreamHost forums after signing up,  
something I almost wish I'd done beforehand.  I found a lot of posts  
from very disgruntled customers.  It sounds as if they've been  
running into problems lately on their servers.  People complain A LOT  
about the lack of phone support from DreamHost... you have to submit  
a trouble ticket for everything.  If your account subscription is  
high enough, they offer a limited number of call backs.  The worst  
part was reading debates between the really happy and the really  
unhappy DreamHost clients.  A lot of the discussions boiled down to  
verbal attacks between customers.  I'm honestly surprised DreamHost  
didn't intervene.


One last thing with OCS, the plan I started on turned out to be  
insufficient for my needs.  I talked with them and they came up with  
a new plan that does everything I want and just charged me a little  
more to cover the difference.


End result so far...

CalPop: I've always had problems with the initial set up of servers  
at CalPop.  Talking with their tech support on the phone is a  
nightmare; there's something wrong with their phone lines (seems like  
a really bad voice over IP solution).  It usually takes way too many  
emails to resolve problems.  I've also experienced a lot of hardware  
failures, which makes me wonder about the quality of parts they  
purchase.  Once the server works though, everything seems to settle  
down until the next problem shows up.


DreamHost:  Best prices, low service.  It seems like DreamHost is run  
by and tailored toward experienced techies.  That's fine, I can work  
with that.  I'm willing to try working with limited phone support.   
I'm really only concerned with delays I might experience when a  
problem shows up in something that's mission critical.  Beyond that,  
there are a lot of features available here that aren't elsewhere.   
I'm getting great value for my money.


OCS Solutions:  Good prices, but you have to pay up front.  Best  
customer service I've experienced from an ISP so far.  I feel a lot  
more comfortable using them for anything mission critical.





On Oct 11, 2006, at 10:12 PM, Kyle wrote:


Hello,
I would suggest dreamhost at www.dreamhost.com.
Their prices look a bit hefty at first but there are referral codes  
all
over the internet and you can end up saving $97.  Their plans have  
tons

of bandwidth and space and I haven't had any trouble with it.  But I
would suggest them highly, their service is quite impressive.  And if
you don't like the PHP features 

Re: [PHP] [OFF] A note on replying to this list

2006-10-23 Thread Ed Lazor
You're asking everyone else to change their email client when the  
quickest solution would be for you to change yours.


On Oct 22, 2006, at 10:59 PM, theIggs wrote:


Hello all!

Sorry for the offtopic.
Please, when you reply to PHP mailing lists, put the Re: element right
in front of the subject:
Re: [PHP] Screen shots
not
[PHP] Re: Screen shots
When there are two different styles used simultaneously it's merely
impossible to sort messages in chains. At least my email client (The
Bat!) can't sort messages in chains with [PHP] Re-like subject. So I
believe for most of us two different styles at a time are not
convenient.

Thanks.
Please correct me if I'm wrong.

---
Regards,
theIggs.

--
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] [ANNOUNCEMENT] Sparse 1.1b released - create Ajax forms!

2006-10-23 Thread Ed Lazor

Has anyone checked this for security?


On Oct 23, 2006, at 11:26 AM, Daniel Orner wrote:

	A big new update for Sparse, the HTML-based framework for writing  
MySQL-backed CGI applications easily and quickly. Now, the  
generated forms output in fully degradable Ajax, meaning that if a  
user doesn't have Javascript available or if an error occurs, the  
regular functionality will still work. Documentation has also had a  
significant overhaul. If you haven't tried Sparse yet, now's the time!


--Daniel

--
Sparse - a new way to write MySQL-based programs with little to no  
actual programming. Save yourself time and effort!

http://sparse-php.sourceforge.net/

--
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] FTP - folders

2006-10-23 Thread Ed Lazor


On Oct 23, 2006, at 2:27 PM, Richard Lynch wrote:


On the Mac, I always dug Fetch personally.


Nice... I've been looking for something like Fetch.


PC, you got your CuteFTP and all that ilk.


SecureFTP by VanDyke rocks.


Now, on *nix, SCP is nice for that, if you have SSH shell access.  If
not, I dunno...  Never have stumbled across a good utility for that.
Never looked super hard either, as glob usually works in FTP shell,
and when it doesn't, well, I can ususally find some way around that
too.


ncftp for general stuff on Unix has always been my favorite.  I  
default to things like scp when I need secure transfers of data.


-Ed

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



Re: [PHP] Mapped Drive issue

2006-10-23 Thread Ed Lazor

Depends on your operating system.


On Oct 23, 2006, at 6:31 PM, Rob Kritzer wrote:


Yes, the directory on mapped drive Y does exist.

I do think that it might have something with how PHP and Apache is  
running.


How do I chanage how PHP is running under an account? Where do I  
tell PHP or

Apache to run under a different accunt?



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



Y: doesn't exist.

It may not exist because you haven't opened it lately and
authenticated it as valid.

Or it might not exist because PHP is not running as you, and PHP has
no access to it.

Or it might not exist because it's Windows, and you need to re-boot.



On Wed, October 18, 2006 2:14 pm, Rob Kritzer wrote:
 I have a script the use to work:

 $date = date(mdy);

 mkdir(Y:/Daily_DisplayAds/todays_ads-$date);

 But now I get this error:

 Warning: mkdir() [function.mkdir]: No such file or directory in
 C:\wamp\www\scripts\ad_finder\display_class.php on line 10

 If I change Y to C it works, can anyone please help me thanks.



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




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



Re: [PHP] Mapped Drive issue

2006-10-23 Thread Ed Lazor
If you're running Apache as an XP service, go to the services control  
panel, open the apache config, and you can change the user there.   
Otherwise, you'll have to edit the apache config and change the user  
there.


On Oct 23, 2006, at 7:21 PM, Rob Kritzer wrote:


For now I am on a PC XP Pro, wish they would give me back my Mac.


On 10/23/06, Ed Lazor [EMAIL PROTECTED] wrote:


Depends on your operating system.


On Oct 23, 2006, at 6:31 PM, Rob Kritzer wrote:

 Yes, the directory on mapped drive Y does exist.

 I do think that it might have something with how PHP and Apache is
 running.

 How do I chanage how PHP is running under an account? Where do I
 tell PHP or
 Apache to run under a different accunt?



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


 Y: doesn't exist.

 It may not exist because you haven't opened it lately and
 authenticated it as valid.

 Or it might not exist because PHP is not running as you, and  
PHP has

 no access to it.

 Or it might not exist because it's Windows, and you need to re- 
boot.




 On Wed, October 18, 2006 2:14 pm, Rob Kritzer wrote:
  I have a script the use to work:
 
  $date = date(mdy);
 
  mkdir(Y:/Daily_DisplayAds/todays_ads-$date);
 
  But now I get this error:
 
  Warning: mkdir() [function.mkdir]: No such file or directory in
  C:\wamp\www\scripts\ad_finder\display_class.php on line 10
 
  If I change Y to C it works, can anyone please help me  
thanks.

 


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






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



Re: [PHP] Screen Shots

2006-10-22 Thread Ed Lazor


On Oct 22, 2006, at 5:29 PM, Sancar Saran wrote:


On Sunday 22 October 2006 15:19, Mark McWhirter wrote:
Is there any way that I can get a script to take a screen shot  
every minute

of all the users using my php website?


Convert to pdf.


Are you logging the stats?  That would allow you to graph the usage  
whenever you want.

-Ed

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



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] Re: postback for php

2006-10-18 Thread Ed Lazor
Maybe he's talking about the ability to post data to a website, like  
using PHP to simulate a user submitting a webpage form.  If so, check  
out curl.


On Oct 18, 2006, at 8:00 AM, Miles Thompson wrote:


At 11:48 AM 10/18/2006, M.Sokolewicz wrote:


Ross wrote:
Looked on google and not found a satisfactory answer. Doies  
anyone have a funtion to do this?


R.
please explain, in details, what it is you're looking for.  
postback for php - a function to do this doesn't mean squat to  
most people. Please EXPLAIN.


- tul


Yes, not a helpful description. Maybe he means a callback function  
which would do something like

echo 'a href='. $_SERVER['PHP_SELF'] .'Please try again/a';
and he may have to pass a variable string.

M.


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



Re: [PHP] book on PHP security

2006-10-18 Thread Ed Lazor
essential PHP Security, by Chris Shiflett.  Pro PHP Security by Chris  
Snyder.



On Oct 18, 2006, at 9:04 AM, Angelo Zanetti wrote:


HI,

can anyone recommend a really good book on security with PHP?

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] mailto:[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



Re: [PHP] Re: postback for php

2006-10-18 Thread Ed Lazor


On Oct 18, 2006, at 8:43 AM, Justin Cook wrote:

I believe he is talking about the concept of postback in ASP.Net.  
PHP does not have anything built in for this.

  _


Is that where the same script displays a form and processes the data  
when the form is submitted?


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



Re: [PHP] A no brainer...

2006-10-17 Thread Ed Lazor
Hi Guys :)  I'm off today, so I'll follow-up with you tomorrow.   
Meanwhile, have a great day :)


-Ed


On Oct 17, 2006, at 2:20 AM, Roman Neuhauser wrote:


# [EMAIL PROTECTED] / 2006-10-16 16:40:34 -0700:


On Oct 16, 2006, at 6:20 PM, Roman Neuhauser wrote:

   Modern filesystems cope well with large directories (plus it's
   quite trivial to derive a directory hierarchy from the
   filenames).  Looking at the numbers produced by timing various
   operations in a directory with exactly 100,000 files on sw RAID 1
   (2 SATA disks) in my desktop i'd say this concern is completely
   baseless.


I knew that you could get PHP to use a directory structure for the
session data files, but hearing that you can have 100k files in a
single directory and not run into performance issues or problems is
news to me.  Which OS are you running?


FreeBSD. What do your tests show, on what OS/version/FS?


It still uses  files, but hopefully you don't hit them very often,
especially when  you're dealing with the same table records.


   A RDBMS is basically required to hit the disk with the data on
   commit. One of the defining features of a RDBMS, Durability, says
   that once you commit, the data is there no matter what. The
   host OS may crash right after the commit has been acked, the data
   must  stay.

   You can turn on query caching in MySQL, but this will give you
   *nothing* for purposes of session storage.


Unless session storage is used to save time in retrieving data,
right?  I'm seeing your point on the writing, but what about reading?

I think it would be kind of fun to run some actual tests.


Check out the query cache in the MySQL 5.0 manual, it clearly
says that any modification of a table (INSERT, UPDATE, ALTER
TABLE...) will invalidate all cache entries that use that table.
IOW, request from any visitor such that it starts or updates
a session invalidates query cache entries for all sessions.

Max cache hits for any single cache entry depend on the number
of requests a visitor can produce in sequence without updating the
session table, number of concurrent visitors, request frequency...

You're likely to max cache hits for any entry at 1, and all but
that one will be purged with 0 cache hits.


Also, having raw data is  always faster than having to process it
before you can use it.


   I don't know what that means.



   Bytes in files on disk are as raw
   as it gets, you get one roundtrip process - kernel - process;
   compare the communication protocol MySQL (or just any other DB)
   uses where data is marshalled by the client, and unmarshalled by
   the server, overhead of the database process(es) taking part in
   the write...



If you pull a record from the db, you can access the data.  Or you
can query the db, get the serialized data, de-serialize it, and now
access the data.


That's not really filesystem vs. database, that's to serialize or
not to serialize.


I tested this previously and found the database to be faster.
The references I gave supported this and listed additional benefits.


The article from Chris Shiflett contains zero quantifications  
of the

purported performance benefits.


Things change tho, especially with technology.  It seems like we
should be able to test this pretty easily.  I actually think it would
be fun to do as well.  Do you have a box we can test this on?
Meanwhile, I'll check one of my boxes to see if I can use it.  If
anything, it'll be interesting to see if two systems report the same.


Yes I can provide a testbed, just post a testing methodology
proposal.

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

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



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



Re: [PHP] A no brainer...

2006-10-16 Thread Ed Lazor

Almost ALL of this is moot for any but the hardest-hit sites -- So
choosing your session store based solely on performance for a boutique
store is just plain silly.


You don't have to be one of the hardest-hit sites to benefit.  I  
won't go so far as to say that all sites benefit, but even the  
boutique benefits, if you're running multiple sites on one server,  
which is common.  I agree with the other stuff you said about  
serialization :)


-Ed

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



Re: [PHP] A no brainer...

2006-10-16 Thread Ed Lazor


On Oct 16, 2006, at 1:03 PM, Richard Lynch wrote:

My thesis is that choosing SOLELY on raw performance without regard to
security, scalability is silly, and it's particularly silly on sites
that get so little traffic that raw performance tests and benchmarks
are rendered meaningless.


I that case, I agree with you whole heartedly.  Security and  
scalability are definitely important.



Yeah, sure, in a shared hosting environment, a really bad script can
be problematic -- I know, cuz I've gotten those emails from my webhost
:-)


So you're the one! ;) hehe

-Ed

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



Re: [PHP] A no brainer...

2006-10-16 Thread Ed Lazor


On Oct 16, 2006, at 6:20 PM, Roman Neuhauser wrote:
Modern filesystems cope well with large directories (plus it's  
quite

trivial to derive a directory hierarchy from the filenames).
Looking at the numbers produced by timing various operations in
a directory with exactly 100,000 files on sw RAID 1 (2 SATA disks)
in my desktop i'd say this concern is completely baseless.


I knew that you could get PHP to use a directory structure for the  
session data files, but hearing that you can have 100k files in a  
single directory and not run into performance issues or problems is  
news to me.  Which OS are you running?



It still uses  files, but hopefully you don't hit them very often,
especially when  you're dealing with the same table records.


A RDBMS is basically required to hit the disk with the data on
commit. One of the defining features of a RDBMS, Durability, says
that once you commit, the data is there no matter what. The  
host OS
may crash right after the commit has been acked, the data must  
stay.


You can turn on query caching in MySQL, but this will give you
*nothing* for purposes of session storage.


Unless session storage is used to save time in retrieving data,  
right?  I'm seeing your point on the writing, but what about reading?


I think it would be kind of fun to run some actual tests.




Also, having raw data is  always faster than having to process it
before you can use it.


I don't know what that means.


If you pull a record from the db, you can access the data.  Or you  
can query the db, get the serialized data, de-serialize it, and now  
access the data.




Bytes in files on disk are as raw
as it gets, you get one roundtrip process - kernel - process;
compare the communication protocol MySQL (or just any other DB)  
uses

where data is marshalled by the client, and unmarshalled by the
server, overhead of the database process(es) taking part in the
write...

So no, it makes no sense for a database to be faster than
filesystem.


I tested this previously and found the database to be faster.  The  
references I gave supported this and listed additional benefits.   
Things change tho, especially with technology.  It seems like we  
should be able to test this pretty easily.  I actually think it would  
be fun to do as well.  Do you have a box we can test this on?   
Meanwhile, I'll check one of my boxes to see if I can use it.  If  
anything, it'll be interesting to see if two systems report the same.


-Ed

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



Re: [PHP] Re: LAMP || Apache Cache PHP Source File...

2006-10-15 Thread Ed Lazor

I'd like to have Apache cache this file.
Mod_File_Cache doesn't look like it will do the trick as this  
module only
works with static content, and Mod_Cache seems to require a GET  
request,

among other requirements, in order to perform file caching.


Apache:  reverse proxy

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



Re: [PHP] Re: LAMP || Apache Cache PHP Source File...

2006-10-15 Thread Ed Lazor


H, does mod_proxy perform file caching?  It appears to just  
redirect

urls to and from a proxy server.


Yes.

http://httpd.apache.org/docs/1.3/mod/mod_proxy.html

Note the difference between forward and reverse proxy.

You can also use Squid http://www.squid-cache.org

Note Transparent Caching

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



Re: [PHP] A no brainer...

2006-10-15 Thread Ed Lazor


On Oct 15, 2006, at 3:27 PM, Tony Di Croce wrote:

Wow... well, I was certainly not speaking from direct experience,  
only from what seemed to make sense to me. This tells me that their  
is some serious room for improvement in PHP de-serialization code...


Well, kinda.  Hard disks are a lot slower than ram and that gives  
file storage a disadvantage.  You can setup disk caching to help, but  
the OS still starts to lag when you have a lot of files in one  
directory, which is what happens with session data files.  MySQL  
tries to cache data in memory as much as possible.  It still uses  
files, but hopefully you don't hit them very often, especially when  
you're dealing with the same table records.  Also, having raw data is  
always faster than having to process it before you can use it.  Make  
sense?


-Ed

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



Re: [PHP] A no brainer...

2006-10-14 Thread Ed Lazor


Of course, the cost of serialization and deserialization is non- 
trivial for
any data structure that is of interesting size, and you have to  
keep in mind
that if you aren't syncing to the database periodically then you  
will end up
with stale data objects.  (An issue in any case, but the longer the  
object

representing a view of your database exists, the more of a problem it
becomes.  YMMV depending on the data you're holding.)


Has anyone done tests on the difference between the value and  
performance of serializing data structures versus just pulling the  
data from the database?


PHP stores session data in files by default.  There's gotta be a  
performance hit for the file access.  If you store session data in  
MySQL, you're still making a DB query.  It seems to me that the  
performance is almost the same, which means grabbing the current  
record ends up better because you avoid stale data.  What do you think?


-Ed

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



Re: [PHP] Windows ENV['_'] equivalent

2006-10-14 Thread Ed Lazor


On Oct 14, 2006, at 2:09 AM, Stut wrote:

Unfortunately there's no guarantee that a) the working directory  
will be where the PHP binary is, or b) that the binary is called  
php.exe.


Richard: AFAIK there is no way to know this under windows without  
writing an extension to tell you.


-Stut


Wouldn't it be an easy task of PHP checking the results to see if  
file_exists?  That would resolve the first part, but it might  
indirectly tell you whether you're using php.exe.  If the file_exists  
fails, then you can probably assume you're using the dll.  I know...  
a hacked solution, but maybe it will work?


-Ed

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



Re: [PHP] PHP Denial of service

2006-10-14 Thread Ed Lazor


On Oct 14, 2006, at 4:05 AM, Ryan Barclay wrote:

It hasn't actually been attempted.  However, if a couple of a users  
were to hold the refresh, the page generation times would go up  
ridiculously and clients would be waiting over 20sec for pages.  As  
mentioned, it's a very heavy php-mysql script with lots of queries.


I see what you're talking about.  Does everyone need live data for  
each page request?  It seems like a great opportunity for data / page  
caching.  I'm trying to remember the name of the caching tool I used,  
but I ran into something similar on one of my websites a few years  
ago.  Each page was dynamic and the server load was high.  I  
installed caching and pages would only update occasionally... meaning  
that users received pages from the cache, instead of each page  
getting processed with each request.  You could also try a reverse  
proxy with apache to do something similar.  The limit IP stuff from  
Roman also looks interesting.


-Ed

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



Re: [PHP] Crossing over to the Darkside?

2006-10-14 Thread Ed Lazor
I agree with Roman and Rory's comments, but I figure I might be able  
to add something, so here goes...


On Oct 14, 2006, at 5:52 AM, Ross wrote:


I am very suprised how easy  things like user auhtentication and form
validation is. Literally in minutes. Even though I have written a  
similar

script many times for php there is always some tweeking or modifying
required before it fits the project.


Checkout :
- Zend Studio
- Zend Platform
- Zend Framework
- Dreamweaver

Google search:
- PHP Framework
- PHP library

Also checkout Ruby on Rails.  Last, but not least, search the PHP  
mailing list for other available PHP frameworks for leads.


Keep in mind that editors may save you some work, but they often use  
a generic approach - bloated code, less efficient code, code that  
doesn't meet the specific needs of your project, code that's  
difficult to change without fighting the editor, and code that's more  
difficult to troubleshoot when you run into problems.  Some people  
are actually faster when coding manually, but that applies to C# just  
as much as it does to PHP.



The asp object model is far superior,
something that PHP developers can't really argue against.


On what basis are you saying one is superior?  It sounds like you're  
still trying to learn the differences between your options in order  
to choose which one to focus on.  Please list individual reasons for  
the superiority that you're talking about and give people a chance to  
provide counter arguments or  counter examples.  Every language,  
development platform, and development library has strengths and  
weaknesses.


Now I know asp .net is not ideal for all projects but I am now  
thinking that
there are some projects that would be suited to the use of .net and  
the

development time would be greatly reduced.


Sure, but the same thing could be said for PHP and some of it's  
available development tools.



I would like to know


-What is planned for the next version of PHP?


In case you're not already checking, you'll have a more balanced  
comparison if you also find out what's planned for the next version  
of ASP or .NET.



-How many of  you use both of the technologies?


I do.  It's more expensive.  There's a lot more work in applying  
updates.  There's also a lot more work to stay current with changes  
in technology; Jack of all trades, master of none.



-What influences your decision when using either ASP, .NET, or PHP


The individual needs of each project.  It's usually best to stick  
with whatever the customer is using if they already have a large  
investment in a particular technology.  However, it is sometimes cost  
effective to switch if the customer can afford it - Google PHP  
versus ASP or PHP versus .NET for plenty of examples.  Google  
Linux versus Windows; this ties into the debate.  Compare the cost  
of hiring developers for each of the technologies.  Compare the cost  
of hosting on Linux versus hosting on Windows.  Compare the security  
of IIS versus Apache.  And, like someone else mentioned, compare your  
value in being able to develop on one platform versus your value in  
being able to develop for one server platform versus your value in  
being able to develop for all of the server platforms that Apache/PHP  
work under.  I've seen examples of .NET being implemented under UNIX;  
they didn't work all that well from what I saw, but researching this  
might also add to your pool of knowledge on which direction to go.


-Ed

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



Re: [PHP] A no brainer...

2006-10-14 Thread Ed Lazor


On Oct 14, 2006, at 10:00 AM, Tony Di Croce wrote:

I think that the cost of de-serializing a session stored in files  
should be significantly LESS than the cost of doing so through a  
database, for the following reasons:


1) The db will need to parse querys. Not an issue for files.
2) The session ID will tell PHP what file to open in O(1).
3) The entire session needs to be de-serialized, not just some  
portion of it. The database is optimized for returning subsets of  
all the data.


Sorry Tony, I should have been more clear.  I already know that  
storing session data in MySQL is faster than storing it in files.  I  
know that goes against what you're saying, but there are some  
examples if you Google PHP MySQL session performance.  One of the  
more interesting examples is http://shiflett.org/articles/guru-speak- 
jan2005.  PHP session management defaults to files because it's more  
portable and the performance difference doesn't matter for small  
sites with few concurrent users.  MySQL also provides better  
scaleability and security for session data.


On Oct 14, 2006, at 2:51 PM, Larry Garfield wrote:

It depends on what your data is.

Is your data basic (a few elements in a linear array) or complex (a  
deeply
nested multi-dimensional array or complex object?)  Deserializing a  
complex

data structure can get expensive.

Is your data built by a single simple query against the database, a  
single but
very complex query with lots of joins and subqueries, or a bunch of  
separate
queries over the course of the program?  A single SQL query for  
cached data

is likely faster than lots of little queries.

Is your data something that's going to change every few seconds,  
every few
minutes, or every few days?  Caching something that will change by  
your next

page request anyway is a waste of cycles.

Is your data needed on every page load?  Putting a complex data  
structure into
the session if you only need it occasionally is a waste of cycles.   
You're
better off rebuilding it each time or implementing your own caching  
mechanism

that only loads on demand.

There is no general answer here.


Good points Larry.  I have to look back, but I think we were  
originally talking about basic user data.  ie. the user logs into the  
site and we store their login information and access rights in a  
session.  That seems like basic enough information that it's better  
to just store the user id in session data and grab the rest of their  
information from the db - not much of a difference in performance,  
plus you end up avoiding stale data.  Anyway, I like your distinction  
between simple and complex objects.


-Ed

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



Re: [PHP] OOP slow -- am I an idiot?

2006-10-13 Thread Ed Lazor


On Oct 13, 2006, at 1:35 AM, Tony Marston wrote:
What a coincidence! That's exactly my approach, but I've taken it  
one step
further. I always start with a properly normalised database which I  
can then
import into my daa dictionary application. From there I can press a  
button

and create a class file for each database table, and I am ptting the
finishing touhes to a procedure whereby I can press another button to
generate the scripts which will maintain each table. This means I  
can get
basic transactions up and running without writing a single line of  
code. All

I have to do is edit these files to include business logic and any
customisations.


Is the Radicore framework still available?

-Ed

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



Re: [PHP] OOP slow -- am I an idiot?

2006-10-13 Thread Ed Lazor


On Oct 13, 2006, at 1:54 AM, Stut wrote:
Youch!! Your implementation seems to be focused on development  
efficiency rather than runtime efficience. In all but rare research  
projects this is backwards for a web-based system. This is exactly  
the practice I am trying to discourage. It's a well-known fact that  
code generators are a poor substitute for real developers.


I agree with Stut, but I'd also like to check out a copy of the  
framework.  It seems like a lot of people are using frameworks now  
days and I can't help but wonder if they provide similar performance  
as the OOP library that Stut uses.


-Ed

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



Re: [PHP] Send process to background

2006-10-13 Thread Ed Lazor


On Oct 13, 2006, at 12:12 PM, Richard Lynch wrote:


On Fri, October 13, 2006 11:05 am, André Medeiros wrote:

I am working on a backup system that needs to be called through a
webpage to start the process. I am trying to do this on a
one-file-only sollution.

The thing is, the first request to the site needs to start the  
backup,

but I didn't want to use any command-line tools, since some of our
servers rely on safe_mode. Is there any way to send output to the
browser on this first instance, finish the request, but keeping the
PHP running and making the backup.


Probably not, at least not in a portable way.

In *some* OS configurations this might work:

?php `backup_script_here.xyz `;?

No promises.


In unix, you can run something like this:

script  output.log 

You can call something like that using PHP system calls.

You might be stuck if safe_mode_exec_dir is locked down.  You're  
especially screwed when you remove the option of using command-line  
tools.


If you were to try to use PHP itself to manually get a directory  
listing, open each file, compress it, add it to an archive, etc.,  
you're definitely going the wrong route.


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



Re: [PHP] Windows ENV['_'] equivalent

2006-10-13 Thread Ed Lazor


On Oct 13, 2006, at 11:53 AM, Richard Lynch wrote:


So, I have this automated testing script I wrote, and I want to make
it work on more than just my computer.

In cygwin, and in Linux, EVN['_'] has the nice path to the binary CLI
which is running -- which I call again in a backticks for each test
script in turn, to provide a consistent starting point.

In windows...  There ain't nothing in phpinfo() that matches the
php.exe which I'm running...

How do you handle this?

Note that I'm not attempting to test specific versions of PHP -- just
the PHP scripts, so I really just want to run whatever PHP they are
already running in their test environment, whatever that might be.

It's not in $argv, it's not in ENV.

I've check the getmyinode() friends in PHP Options/Info page.

Surely Windows provides this info to PHP somewhere, and PHP exposes
it, right?...  Guess not, hunh.

Anybody got a solution?


Not a solution, but an idea...  the dos chdir comand.  Maybe you can  
run it from within your script. It tells you the current working  
directory and you end up indirectly knowing the location of the  
php.exe that you're using.


-Ed

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



Re: [PHP] PHP Denial of service

2006-10-13 Thread Ed Lazor


On Oct 13, 2006, at 2:16 PM, Ryan Barclay wrote:

A simple question I imagine, but I am wondering how I would combat  
DoS attacks by users holding the REFRESH key on their browsers?


I have reproduced this error on a PHP-MYSQL website and when I hold  
the REFRESH key on for a while, page gen times shoot up  
dramatically and hundreds of processes are created.


Is there a way I can stop this/limit the connections/processes in  
apache conf/php.ini?


Apache.conf ThreadsPerChild?


What can I do to combat this method of DoS?


How do you consider this a DoS attack?  Are you seeing servers  
crippled because a user or a couple of users keep hitting the refresh  
key?  Honestly, it seems extreme.  Your server should be able to  
handle much higher loads than that, especially when PHP starts  
caching pages, etc..  I would start double checking the server  
config, etc..


Also, if you're really worried about someone attacking a site like  
this, you could just take advantage of PHP's auto_prepend to  
automatically log the IP and a time stamp of each page request... and  
if the last page request is within N seconds of the current request,  
you just redirect the user to a page that says something like server  
busy, try again in a moment.


-Ed

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



Re: [PHP] PHP 5 Hosting

2006-10-12 Thread Ed Lazor
Thanks for the feedback Kyle, much appreciated.  DreamHost does look  
pretty good price-wise.  Two others I was referred to are  
HostBaby.com and OCSSolutions.com.


Have a good one :)

-Ed


On Oct 11, 2006, at 10:12 PM, Kyle wrote:


Hello,
I would suggest dreamhost at www.dreamhost.com.
Their prices look a bit hefty at first but there are referral codes  
all
over the internet and you can end up saving $97.  Their plans have  
tons

of bandwidth and space and I haven't had any trouble with it.  But I
would suggest them highly, their service is quite impressive.  And if
you don't like the PHP features they let you compile you own!

Good Luck with it!
Kyle



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



Re: [PHP] OOP slow -- am I an idiot?

2006-10-12 Thread Ed Lazor


On Oct 12, 2006, at 10:18 AM, Richard Lynch wrote:

I can't architect a good OOP solution to a problem that hasn't been
fully defined, any more than one can architect a house without knowing
all the rooms that are needed...


Sorry to jump into the middle of the conversation, but I thought this  
was a pretty interesting comment.  It serves as one of those  
occasional reminders that I need to go back and study OOP structure  
design a bit more.  I know you're right about the importance of a  
fully defined problem, but it also seems that the reverse is true if  
you're really good with OOP.  In other words, it seems like any high  
quality solution starts by defining least common denominators.  You  
start with basic building blocks and expand from there; I'm always  
amazed when I see space stations or other complex structures built  
out of Legos, for example.  My problem is that I usually look at OOP  
and think it'll take too long, so I go the non-OOP route, solve the  
problem, and move on.  I can't help but think I'm missing out.  I do  
have libraries of code that I reuse, but I've always heard that I'd  
benefit a lot more from them if I OOPed them.  Dunno...  that's my  
two cents worth anyway hehe


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



Re: [PHP] OOP slow -- am I an idiot?

2006-10-12 Thread Ed Lazor

Comments / Questions below.

On Oct 12, 2006, at 12:15 PM, Stut wrote:

Except that is the attitude that leads to painful OOP in PHP. PHP  
is not the same environment as C++.
The environment (classes, objects, etc) needs to be created and  
destroyed with each request.


I definitely agree that PHP is not the same as C++.   I agree with  
the need for high efficiency and performance with low overhead.   
Actually, it's funny you mention that, because I've argued those same  
points with C/C++ coders new to PHP.


As such you cannot start designing a solution unless you know how  
the data/entities are going to be used.


Doesn't this mean that your design breaks when the behavior or use of  
the data/entities changes?


OOP in PHP cannot start with basic building blocks, at least not if  
you want a system that performs reasonably well.


Right.  That makes sense with PHP being an interpreted language.   
I've tried to offset this somewhat by compiling libraries and having  
them cached before pages that rely on these libraries load.


I'm trying to get a better idea of how you leverage the advantage of  
OOP in PHP.  Do you use it?  If so, how?  Do you use any OOP  
methodologies?  If so, which ones? For that matter, how many of your  
projects start with a detailed description of all data/entities and  
how they are going to be used?


Does your experience differ a lot from mine?  My customers rarely  
have a complete understanding of what they'll be doing.  They usually  
only have a general idea.  Part of my challenge is to help them  
define that idea, especially when it comes to defining the scope of  
the initial project.  Yes, scope creep is to be avoided or managed in  
projects, but customers are always finding new and creative ways to  
apply their ideas.  Things have to be flexible enough to support  
current needs and future needs.  You're saying that you cannot start  
designing a solution unless you know how the data/entities are going  
to be used.  I'm saying that you have to start somewhere and that  
code has to be extensible enough to meet growing demands.  I'm sure  
that you try to come up with flexible designs, but I'm wondering.   
What is your approach?


Also, isn't OOP supposed to be about separating data from programming  
logic?  If that's the case, isn't how you use that data irrelevant?   
That seems like one of the greatest promises of OOP, but maybe that's  
just the hype?


On Oct 12, 2006, at 2:29 PM, Richard Lynch wrote:

Rapid prototyping in OOP, if you're willing to chuck the prototyping
if it turns out to be the wrong OOP model is do-able.


Do you end up throwing away a lot of code?


Even building the basic blocks first is fine -- but you've got to have
the whole structure in your mind if you expect those blocks to fit in
well.


It sounds like you (Both Stut and Richard) have done a lot of this,  
so I'm sure you know what you're talking about.  Like I mentioned in  
my original post, I think I need to spend time learning better object  
modeling in order to take better advantage of OOP.  I still can't  
help but wonder.  How do you know if you have the full structure?   
Don't you end up going back and changing things a lot?



This is probably not really specific to OOP, but I think it tends to
be more obvious with OOP when you start trying to work around the
short-sighted architecture.  By which I only mean that in procedural
programming, the work-arounds feel less like work-arounds, at least at
first, as they are not so obviously work-arounds, and just look like
more functions.


I'm honestly not sure if I understand what you're saying here, but I  
do know that I've always tended more toward linear / procedural  
programming with a lot of functions.  I have used OOP, but in very  
limited capacity - mainly to avoid the system overhead.  I think I've  
also avoided it because I usually run into problems with defining  
data in objects - similar to the original issue of creating a  
customer object only to run into the problem of how to handle objects  
that represent a collection of customers.  Again, me needing to get a  
better understanding of data modeling in OOP.  It seems like you  
still end up having to learn data modeling the PHP way; people are  
probably critical of PHP because of this, but it seems like there's a  
middle ground and I'm curious where you guys have found that to be.   
Should I take this off the mailing list and talk with you about it in  
separate email?



To get back to the ORIGINAL point -- OOP is not about raw performance.

It's about maintainability, code re-use, encapsulation, etc.

You can get acceptable performance from OOP if you know what you are
doing -- If you don't, it's super easy for a beginner to write a total
performance hog following all the best practices in the world.


Definitely agree with you there.

-Ed

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



Re: [PHP] OOP slow -- am I an idiot?

2006-10-12 Thread Ed Lazor


On Oct 12, 2006, at 4:36 PM, Stut wrote:

You may end up refactoring code if your application changes that  
much, but a good OO design should also mean that when changes of  
that magnitude occur the changes required are limited to relatively  
small sections of code.


Ok, I think we're using the same approach here.  I also noted the  
earlier comments about BUDF and I'm exploring those.  It would be  
nice if anyone else has more examples of standard methodologies  
applied to PHP.


My general approach to designing a system is data-centric. I tend  
to start by defining the database schema since getting that clear  
in my head tends to lead me to a decent design.


Same here, most of the time.  There are a few situations where I  
focus more on just giving the customer canned solutions and finding  
ways to integrate them as easily as possible.  This is usually when  
the customer wants all kinds of features, but they can't really  
afford them.  For example, one guy approached me the other day asking  
me to code forums, a community calendar, news, a rant section, a  
products database with inventory management, a shopping cart system,  
and coming up with a layout and design that integrates it all... then  
he said... he needs it in two weeks, it has to be priced under $400,  
and he needs to be able to easily update content on his own.  ugh.  I  
told him flat out that his price was way off and that he'd best go  
with pre-made solutions like PHPBB to get what he's after.


If I then go on to create an admin interface for the users, I would  
create another completely separate class called UserCollection to  
handle  more than one user. I may at that point choose to expose  
any data-massaging methods in User to UserCollection to avoid code  
duplication, but that would be the extent of the way UserCollection  
uses the User class since the User class is optimised to work on a  
single user at any one time.


We use a similar approach for the user class.  I haven't ever  
implemented something like the UserCollection class though.  I'm  
curious about that.  Does your UserCollection class extend the basic  
user class?  Or is it something else entirely; I dunno, maybe  
UserCollection has a property defined as an array of User class?  I  
think that's what people were saying earlier in the thread as being a  
very bad thing in terms of memory utilization, etc.


How to properly define the User class and UserCollection classes also  
seems to delve into issues of UML and CORBA, which I don't have a lot  
of experience with.  Is anyone applying those technologies to PHP?


This makes it perfect for an object-per-record implementation since  
there is only one record.


Yea, but I keep thinking back to how the implementation of data  
representation is separate from the implementation of how that data  
is used.  Going back to the users example, I created a User class.  I  
never bothered to create a UserCollection class because coding that  
does anything with a collection of users typically ends up being  
situational.  Say I want a list of customers.  I could create a  
UserCollection class with a method called list... and I could have it  
query the db and dump general fields.  That seems like a fairly  
generic approach, so it might work, but I usually want to do  
something with individual fields - like link to a specific webpage to  
view more information on the customer, edit the customer record,  
delete, etc..  I know I could code all of these features into the  
class... but it reaches the point where it seems like overkill.  It  
seems better to just create a webpage that has code to handle  
that which is what I end up doing.  Mind you, I once created a  
bunch of classes that did all of the cool pretty formatting, table  
layout, with customizable doohikies, but that's where the classes  
started getting bloated, the system started bogging down, and there  
were very small, but very noticeable, delays in loading pages.  I  
guess that leads me back to wondering how you implemented the  
UserCollection class or, at least, what features you built into it in  
order for it to be of benefit.  I'm also assuming (uhoh hehe) that  
the same thing applies to other object hierarchies - for example, one  
class that defines a product and another class that defines a  
collection of products wondering how the two would be implemented  
to maintain efficiency...  and I'm guessing your answer is that how  
you implement it depends on the situation... whether the site focuses  
on using individual products the most or ends up working with  
collections of products most... but it seems like it wouldn't  
matter... ie. again, the separation of data from implementation.


All requirements change - fact of life. Customers never know what  
they really want. OOP will not shield you from the effects of  
having the system specification pulled from under your feet.  
However, it can be used to 

Re: [PHP] canon jpegs

2006-10-12 Thread Ed Lazor
Until someone has more specific information, my first thought was to  
wonder which version of PHP and GD you're using in case they aren't  
the latest and greatest.  If you're aren't, then I'd upgrade, retest,  
and go from there.  I'd also check to see if you run into the problem  
with images from your camera saved with different resolution and  
image quality settings.  Finally, you can also go to http:// 
www.boutell.com/gd/ for more information on GD or to contact them for  
help.


On Oct 12, 2006, at 5:35 PM, Emil Edeholt wrote:


Hi!

I'm trying to make thumbnails of uploaded jpegs via GD. It works  
fine on most jpegs but doesn't seem to work on canon jpegs (tried  
both a consumer canon and one of the finer DSLRs). When I resaved  
the canon jpeg in my imaging application GD could handle it.


Any ideas of how to solve this? I'm in a bit of a panic.

Emil

--
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] PHP 5 Hosting

2006-10-11 Thread Ed Lazor
Anyone ever use A2Hosting.com?  Or better yet, any recommendations on  
a PHP 5 web hosting company that you're happy with - measured in  
terms of quality support, they know what they're doing, and they have  
good prices?  Bonus points for good drive space, bandwidth, and SSH  
access.


I ran a Google search and came up with several options.   
A2Hosting.com seems the best so far.  My only reservation is that  
they offer 24/7 support through a message service who will page a  
tech who in turn will call you back - seems sketchy and I can imagine  
trying to talk someone into going to the server room at 2am.  I also  
checked out many of the other options, but some of them seemed even  
more sketchy... like VisualWebHosting.com...  you click on their link  
for a BBB review and it brings up another company entirely... and you  
call their number and all the greeting says is Please leave a  
message... bep... pretty scary if you ask me.


Anyway, thanks in advance for any recommendations you have.

-Ed

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



Re: [PHP] Re: Can the URL be controlled for more user-friendly readability?

2005-12-23 Thread Ed Lazor
Make sure to parse the input, instead of using $_GET... it's too easy for 
hackers to embed stuff...
   
  

Shawn McKenzie [EMAIL PROTECTED] wrote:
$result = yoursqlfunc(SELECT person FROM sometable WHERE
firstname='$_GET[fn]' AND lastname='$_GET[ln]');

   


[PHP] PHP 5 Hosting

2005-09-29 Thread Ed Lazor
Any recommendations on good host providers for PHP 5?  Bonus points if they 
support SSH access and a PHP compiler like Zend.
 
Thanks,
 
Ed


[PHP] launch app

2005-09-13 Thread Ed Lazor
What's the best way to send an executable to a client desktop in PHP?
 
I'm doing a project where we need to check and see which files need to be 
updated on a client-desktop.  The idea is for a user to visit the website, an 
executable launches, checks the files on the drive, and then sends the data 
back to the website.
 
It's all on the up and up - I'm not trying to do anything bad to the user.  The 
site is designed to maintain a product that they're purchasing from us.  
Screens will explain what's going on.  I also believe the browser will display 
something - not completely sure how to trigger this, but I think it's something 
to do with having executables signed - I'd appreciate if you have any advice 
on how to do this also.
 
Thanks,
 
Ed
 


Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Ed Lazor

It seems that PHP 5 is not that much compelling to most people to 
justify the change.

 

I'm sure you're right, but I also think it's a question of work load for the 
ISP.  Many server upgrades don't occur unless it's urgent and even then they 
sometimes get missed.

Plus... the last time I went to lease a server, the ISP told me that RedHat 
didn't come with PHP 5.  Installing PHP 5 was at my own risk.  Maybe PHP 5 is 
now bundled with the latest version of PHP, but I know it wasn't for a while 
and I also know that this hampered PHP 5 getting out there.

Is it possible to install both PHP 4 and PHP 5 on a single web server, have 
scripts all use the php extension, and somehow specify in the script itself 
which version of PHP should be used?

-Ed

 


RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Ed Lazor
 The most strange thing is, that the problem appeared at a 
 time, when no
 changes to the program was made.
 
 ANYBODY RAN INTO SOME SIMILAR THING?

I haven't run into this, but it'll be easier to help troubleshoot this if
you could post sample code.

Ed Lazor, President
http://RPGStore.com
Up to 50% off.  Over 20,000 items in stock 

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



RE: [PHP] 'Intelligently' truncate string?

2004-10-19 Thread Ed Lazor
 -Original Message-
 I'm wondering if anyone else on the list has worked out a way of
 intelligently truncating a string to take these kinds of 
 occurrences into
 account? I don't mind, in these situations if the truncation 
 takes place
 before or after the entity, since when displayed it will only 
 equate to one
 character more or less.

Check out the user contributed notes in manual for substr.  There's an
example there of how to keep words intact and it sounds like it might apply
to your situation.

Ed Lazor, President
http://RPGStore.com
Up to 50% off.  Over 20,000 items in stock 

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Ed Lazor
 How any rows are you pulling from the database?  
 aprrox. 12.000 but there are only around 50-100 new rows at a maximum
 within a day, and there were almost as many before the 
 problem appeared.

You're creating a form with over 12,000 options in a select statement?


 
 What's the very last part of the code:  .$_OR? 
 
 There is a switch, some echoes and a db_close;

Maybe the ._OR at the end of your echo is just a copy / paste issue.

 Have you tried this code in a separate script to test it's 
 performance
 individually?
 Yes, then it performs good.
 This seems to be strange and irrelevant to me, because placing a 
 $tmpsting .= microtime().br\n; into each loop and then echoing it
 shows, that there are randomly processing gaps between two cycles when
 running as a part of the whole.

Have you tried to increase the amount of memory available to this script?

-Ed

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



RE: [PHP] intenger

2004-10-14 Thread Ed Lazor
Do you mean an integer?  As in

$i = 5;

Print $i;

?

 

 -Original Message-
 From: Juan Pablo Herrera [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 14, 2004 10:19 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] intenger
 
 Please, i need output a intenger, what function can i use for this?.
 Print?, echo?
 
 Thank you.
 JP
 
 -- 
 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] User Defined Forms

2004-10-14 Thread Ed Lazor
 I have interviewed a few users and it has become instantly 
 apparent that
 they all work differently and record slightly different 
 information about
 their clients making it impossible to produce a general set 
 of forms that
 would encompass all users. I haven't done any other forms of 
 modelling as
 yet.

Create a global list of information that your users want to record about
their clients.  Review it and generalize information as much as possible.
Divide the information into groups based on who uses it.  Hopefully you'll
end up with sets of information that are common to all with only a few sets
that are user specific.  Work with your customers a lot here, because it
sounds like they are generally confused on how to organize their
information.  Ie. They are relying on your help for that.  Also keep in mind
that, in many cases, there is general information that everyone wants to
record about their clients and that anything else is usually considered
notes.  So, for example, if you create a table for the client's name,
address, phone, etc. and then create a notes section, you've captured a
majority of the information that your users want to track for their clients.

Ultimately, after all of that and if someone's willing to pay for the
development time, you could theoretically setup a series of forms where the
first form prompts for general detail and then, based on who's logged in,
you could present additional forms.  You could even design the logic behind
forms to respond based on information that's entered.  For example, if the
first form asks for the client's city, follow-up forms may prompt for data
specific to that city.

Hope this helps,

-Ed

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



  1   2   3   >