php-general Digest 13 May 2004 08:26:03 -0000 Issue 2760
Topics (messages 186042 through 186076):
SuExec and PHP
186042 by: Travis Low
Re: include (or require) doesn't seem to work
186043 by: Torsten Roehr
Re: User/Group rights system?
186044 by: Torsten Roehr
mcrypt & pdflib configuration
186045 by: William Holroyd
Re: Memory usage
186046 by: Torsten Roehr
Breaking out of a loop...
186047 by: René Fournier
186049 by: Curt Zirzow
186054 by: René Fournier
186055 by: Curt Zirzow
186057 by: Tom Rogers
Re: HTTP_RAW_POST_DATA
186048 by: Chris Shiflett
186050 by: Michal Migurski
186056 by: Chris Shiflett
186063 by: raditha dissanayake
186064 by: raditha dissanayake
186066 by: Curt Zirzow
186068 by: Michal Migurski
mysql went away
186051 by: Bill Green
186061 by: raditha dissanayake
security and extended ascii characters
186052 by: Chris W
Re: PHP Session Handlers
186053 by: Paul Higgins
Re: Reshuffling an array
186058 by: Todd Cary
Re: Ordering alphabetical in secondary select string
186059 by: R.G. Vervoort
site search engine.. not dynamic
186060 by: Aaron Wolski
Zip-code Form Validation Scripts and Zipcode Program
186062 by: Ryan Munevar
186065 by: Manuel Lemos
a good user directory application...
186067 by: bruce
186069 by: Ryan A
186070 by: bruce
PHP5 - instanceof
186071 by: Martin Towell
186072 by: Travis Low
Multiple Socket's at one time
186073 by: Terence
Re: PHP5 - instanceof [SOLVED]
186074 by: Martin Towell
problem install pws and php
186075 by: lee 03
Saving and mailing remote file
186076 by: Sascha Meyer
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Greetings. We have a need for our PHP scripts to run as the user and group
associated with each Apache virtual domain on our Redhat server. Currently,
all PHP scripts run as nobody.nobody.
I know that the apache suexec module allows CGI scripts to run as the user and
group of the virtual host, but that doesn't seem to be the case for PHP scripts
run under the apache php module (mod_php).
So my questions are:
(1) Can we use suexec to force PHP scripts (running under mod_php) to run as
the user/group associated with the virtual host? If so, how? Are there any
special configuration tricks to make this happen?
(2) If we CAN'T use suexec with mod_php, I assume we can run PHP as CGI to
solve our problem. However, I'm worried about performance. Have any of you
done this on linux? Is it difficult to configure? Do you have to audit all of
your PHP scripts? Etc., etc.
I did read the pages http://www.php.net/security.cgi_bin and
http://www.php.net/manual/en/security.apache.php, but did not come away with
clear answers to my questions. There were also a lot of contradictory comments
at the bottom of those pages, and a whole mess of stuff on google, so I'm
getting more lost, not less. Please help!
cheers,
Travis
--
Travis Low
<mailto:[EMAIL PROTECTED]>
<http://www.dawnstar.com>
--- End Message ---
--- Begin Message ---
"Daniel Barbar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks Torsten! Using the file-system relative path made it work (I had
> tried only with the absolute path, which ddidn't work). However, I checked
> again and I did have 'allow_url_fopen = On' in /etc/php.ini. I'll take a
> closer look later and report the problem if I find it. Thanks again,
>
> Daniel
Using the absolute path works as well - but you have to use the full LOCAL
file path, e.g. /htdocs/www/your-domain etc.
You can get this value from $_SERVER['DOCUMENT_ROOT'].
Regards, Torsten
>
> "Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > > Try including it as a local file:
> > > require_once library.php'; // if it is in the same directory as the
file
> > you
> >
> > Forgot a quote here, sorry:
> > require_once 'library.php';
> >
> > Torsten
--- End Message ---
--- Begin Message ---
"David David" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> Does anyone know of an open source "user/group" based
> permission system built with php/MySQL?
>
> That is, the effective rights for any user on a
> specific secured object are computed from various
> permit/deny permissions assigned to the user or any of
> the groups he/she belongs to.
>
> PEAR::Auth seems only to support basic user
> authentication.
Take a look at PEAR's LiveUser:
http://pear.php.net/package/LiveUser
Regards, Torsten
--- End Message ---
--- Begin Message ---
I've already posted this question in comp.lang.php but no one seemed to have
an answer to it.
So I've got PHP to recognize mcrypt and pdflib in the phpinfo() output, but
trying to use any of the functions fail with "...undefined function
called..". There aren't any configurable files with either distro and
neither mention php.ini settings need to be made. Restarting the apache
server does not fix this and no errors are reported while starting.
The most recent stable releases Apache 2.0.49 and PHP 4.3.6 are being used
with mcrypt 2.4 (stable, but 2.6.4 is most recent) and pdflib 5.0.3p1 (most
recent stable release) libraries, running on Windows 2003 Server Enterprise
with all updates applied.
I picked up a copy of Visual Studio .NET Enterprise but am also stumped of
how to compile these functions from source which I would prefer to do at
this point.
Any help on either topic is much appreciated.
-William
--- End Message ---
--- Begin Message ---
"Oliver Hankeln" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi!
>
> I get memory exceded errors and want to find out why. So I am looking
> for a way to determine how much memory is currently beeing used by my
> script. Is this possible?
> getPID + reading from /proc dosent work because php is an apache module.
> (I can´t change this)
>
> Thanks!
Maybe this script will help you:
http://phpsysinfo.sourceforge.net/
Regards, Torsten
--- End Message ---
--- Begin Message ---
Hi,
I have this code (below) that waits for particular data to come over
the socket ("ENX"), at which point it breaks out of the loop and does
other things. Presently, it will loop forever, until it receives
"ENX"—a good start—but I also need it to break-out if the loop runs
longer than five seconds. This is where I'm having a problem. It seems
that it is only reading once data comes over the socket, so it is stuck
on that first 'while' line ("while(($buf =
socket_read($socket,128,PHP_BINARY_READ)) !== false) {").
$timer = time();
while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
$data .= $buf;
$elapsed = time() - $timer;
if(preg_match("/ENX/", $data)) {
break;
} elseif ($elapsed > 5) {
echo "TOO LONG!\n";
break;
}
}
Maybe set non-blocking / blocking socket is the answer? Only problem is
I can't find much [good] documentation describing what blocking and
non-blocking sockets are good for, etc. Any ideas? Thanks.
...Rene
--- End Message ---
--- Begin Message ---
* Thus wrote Ren Fournier ([EMAIL PROTECTED]):
> Hi,
>
> I have this code (below) that waits for particular data to come over
> the socket ("ENX"), at which point it breaks out of the loop and does
> other things. Presently, it will loop forever, until it receives
> "ENX"—a good start—but I also need it to break-out if the loop runs
> longer than five seconds. This is where I'm having a problem. It seems
> that it is only reading once data comes over the socket, so it is stuck
> on that first 'while' line ("while(($buf =
> socket_read($socket,128,PHP_BINARY_READ)) !== false) {").
>
> $timer = time();
> while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
> $data .= $buf;
> $elapsed = time() - $timer;
> if(preg_match("/ENX/", $data)) {
> break;
> } elseif ($elapsed > 5) {
> echo "TOO LONG!\n";
> break;
> }
> }
>
> Maybe set non-blocking / blocking socket is the answer? Only problem is
> I can't find much [good] documentation describing what blocking and
> non-blocking sockets are good for, etc. Any ideas? Thanks.
blocking - wait for response or till timeout
non-blocking - return right away
If you use blocking and then set the timeout for the read, you can
just check for socket_last_error() after the loop.
socket_set_block($socket);
socket_set_option($socket, SO_RCVTIMEO, 5000); // milliseconds iirc
while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
//...
}
if ($error = socket_last_error($socket) ) {
echo "socket error [$error]:" . socket_strerror($error);
}
or something like that.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
Thanks for the help, but.... I now get the error "PHP Warning:
socket_set_option() expects exactly 4 parameters, 3 given in
/Users/test/cr.php on line 51" when I run the script. Also, it still
seems to just wait on that "while" line, instead of skipping to the "}
elseif ($elapsed > 5) {" and breaking from the loop (which is what I
want it to do). (Is it just me, or is the PHP documentation on
socket_set_block and socket_set_option a bit too sparse? I mean, where
do you find the docs on those options and values?)
------------------------------------------------------------------------
---------------------------------
socket_set_block($socket);
socket_set_option($socket,SO_RCVTIMEO,5000); // milliseconds iirc
do {
$timer = time();
while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
$data .= $buf;
$elapsed = time() - $timer;
if(preg_match("/ENX/", $data)) {
break;
} elseif ($elapsed > 5) {
echo "TOO LONG!\n";
break;
}
if ($error = socket_last_error($socket)) {
echo "socket error [$error]:" . socket_strerror($error);
}
}
------------------------------------------------------------------------
---------------------------------
On Wednesday, May 12, 2004, at 03:41 PM, Curt Zirzow wrote:
* Thus wrote Ren Fournier ([EMAIL PROTECTED]):
Hi,
I have this code (below) that waits for particular data to come over
the socket ("ENX"), at which point it breaks out of the loop and does
other things. Presently, it will loop forever, until it receives
"ENX"—a good start—but I also need it to break-out if the loop runs
longer than five seconds. This is where I'm having a problem. It seems
that it is only reading once data comes over the socket, so it is
stuck
on that first 'while' line ("while(($buf =
socket_read($socket,128,PHP_BINARY_READ)) !== false) {").
$timer = time();
while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
$data .= $buf;
$elapsed = time() - $timer;
if(preg_match("/ENX/", $data)) {
break;
} elseif ($elapsed > 5) {
echo "TOO LONG!\n";
break;
}
}
Maybe set non-blocking / blocking socket is the answer? Only problem
is
I can't find much [good] documentation describing what blocking and
non-blocking sockets are good for, etc. Any ideas? Thanks.
blocking - wait for response or till timeout
non-blocking - return right away
If you use blocking and then set the timeout for the read, you can
just check for socket_last_error() after the loop.
socket_set_block($socket);
socket_set_option($socket, SO_RCVTIMEO, 5000); // milliseconds iirc
while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
//...
}
if ($error = socket_last_error($socket) ) {
echo "socket error [$error]:" . socket_strerror($error);
}
or something like that.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
* Thus wrote Ren Fournier ([EMAIL PROTECTED]):
> Thanks for the help, but.... I now get the error "PHP Warning:
> socket_set_option() expects exactly 4 parameters, 3 given in
> /Users/test/cr.php on line 51" when I run the script. Also, it still
> seems to just wait on that "while" line, instead of skipping to the "}
> elseif ($elapsed > 5) {" and breaking from the loop (which is what I
> want it to do). (Is it just me, or is the PHP documentation on
> socket_set_block and socket_set_option a bit too sparse? I mean, where
> do you find the docs on those options and values?)
yeah it is rather undocumentated, probably because of its current
EXPERIMENTAL status.
the actual call should be this:
$timeout = array('sec' => 5, 'usec' => 0);
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $timeout);
The idea of using the blocking method and letting the read() call
to handle the time, makes you're loop simplier and not have to
manage the time elapsed.
If you want to manage the elapsed time yourself (nonblocking),
you'll have to restructure your loop because the read() will fail
if no data is available. Not to mention it will be rather
unfriendly for your cpu since you're going to have a loop that
continue to run for 5 seconds.
Another option would be to use the fsockopen/fread tools.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
Hi,
Thursday, May 13, 2004, 6:57:14 AM, you wrote:
RF> Hi,
RF> I have this code (below) that waits for particular data to come over
RF> the socket ("ENX"), at which point it breaks out of the loop and does
RF> other things. Presently, it will loop forever, until it receives
RF> "ENX"—a good start—but I also need it to break-out if the loop runs
RF> longer than five seconds. This is where I'm having a problem. It seems
RF> that it is only reading once data comes over the socket, so it is stuck
RF> on that first 'while' line ("while(($buf =
RF> socket_read($socket,128,PHP_BINARY_READ)) !== false) {").
RF> $timer = time();
RF> while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
RF> $data .= $buf;
RF> $elapsed = time() - $timer;
RF> if(preg_match("/ENX/", $data)) {
RF> break;
RF> } elseif ($elapsed > 5) {
RF> echo "TOO LONG!\n";
RF> break;
RF> }
RF> }
RF> Maybe set non-blocking / blocking socket is the answer? Only problem is
RF> I can't find much [good] documentation describing what blocking and
RF> non-blocking sockets are good for, etc. Any ideas? Thanks.
RF> ...Rene
RF> --
RF> PHP General Mailing List (http://www.php.net/)
RF> To unsubscribe, visit: http://www.php.net/unsub.php
Try doing this at the error point
} elseif ($elapsed > 5) {
echo "TOO LONG!\n";
break 2; //kill both loops
}
--
regards,
Tom
--- End Message ---
--- Begin Message ---
--- Michal Migurski <[EMAIL PROTECTED]> wrote:
> Anyone have any clue why this is the case? Is there a performance
> reason that raw post data must be explicitly enabled, or is it more
> of a protective measure for overly permissive beginner scripts?
If it was always enabled, it sure would make a DoS attack easy. I'd just
send lots of huge POST requests to any PHP script on your server. Hope you
have "migs and megs of memories," as Strong Bad would say. :-)
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/
--- End Message ---
--- Begin Message ---
> > Anyone have any clue why this is the case? Is there a performance
> > reason that raw post data must be explicitly enabled, or is it more of
> > a protective measure for overly permissive beginner scripts?
>
> If it was always enabled, it sure would make a DoS attack easy. I'd just
> send lots of huge POST requests to any PHP script on your server. Hope
> you have "migs and megs of memories," as Strong Bad would say. :-)
Isn't this potentially a DoS attack vector anyway? I don't need a server
to accept or read my obscenely long POST requests to clog the pipes with
them. Would the proper way to handle this risk be to disallow POST at the
webserver level, or does turning always_populate_raw_post_data off cause
the connection to be automatically dropped after Connection: close?
-mike.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---
--- raditha dissanayake <[EMAIL PROTECTED]> wrote:
> NOw I am very curious, the raw_post_data doesn't always get
> populated even with that setting. If i have not been barking up
> the wrong tree all these years that variable only gets populated
> if the content type is not url-encoded or multipart/form-data. If
> you are indeed using one of these types please be so kind as to
> share more info about your set up, this is something i would like
> to reproduce.
This is what our tangential conversation touched on. Curt mentioned that
always_populate_raw_post_data is a funny name, and I mentioned how it was
also misleading (always should mean always).
I assume the original poster is using neither of the content types you
mention, since this was already working for him in one environment.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/
--- End Message ---
--- Begin Message ---
Chris Shiflett wrote:
--- raditha dissanayake <[EMAIL PROTECTED]> wrote:
NOw I am very curious, the raw_post_data doesn't always get
populated even with that setting. If i have not been barking up
the wrong tree all these years that variable only gets populated
if the content type is not url-encoded or multipart/form-data. If
you are indeed using one of these types please be so kind as to
share more info about your set up, this is something i would like
to reproduce.
This is what our tangential conversation touched on. Curt mentioned that
always_populate_raw_post_data is a funny name, and I mentioned how it was
also misleading (always should mean always).
I assume the original poster is using neither of the content types you
mention, since this was already working for him in one environment.
Hi,
Thants what I am also thinking, i was quite taken aback to read the original post.
shocked in fact.
Raditha Dissanayake.
---------------------------------------------
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions
--- End Message ---
--- Begin Message ---
Michal Migurski wrote:
Anyone have any clue why this is the case? Is there a performance
reason that raw post data must be explicitly enabled, or is it more of
a protective measure for overly permissive beginner scripts?
If it was always enabled, it sure would make a DoS attack easy. I'd just
send lots of huge POST requests to any PHP script on your server. Hope
you have "migs and megs of memories," as Strong Bad would say. :-)
Isn't this potentially a DoS attack vector anyway? I don't need a server
to accept or read my obscenely long POST requests to clog the pipes with
them. Would the proper way to handle this risk be to disallow POST at the
webserver level, or does turning always_populate_raw_post_data off cause
the connection to be automatically dropped after Connection: close?
Well if you disallow post, you will have to use get for things like
login in - insecure. And you will be limited to about 1024 bytes of data
on most systems and you can't use file uploads.
I guess you would know how to how to create malformed packets. Doing a
dos attack on a PHP script that accepts POST you only need about 10
lines of code, don't need to know how to create malformed packets, and
you don't waste your own bandwidth.
--
Raditha Dissanayake.
---------------------------------------------
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions
--- End Message ---
--- Begin Message ---
* Thus wrote Michal Migurski ([EMAIL PROTECTED]):
> > > Anyone have any clue why this is the case? Is there a performance
> > > reason that raw post data must be explicitly enabled, or is it more of
> > > a protective measure for overly permissive beginner scripts?
> >
> > If it was always enabled, it sure would make a DoS attack easy. I'd just
> > send lots of huge POST requests to any PHP script on your server. Hope
> > you have "migs and megs of memories," as Strong Bad would say. :-)
>
> Isn't this potentially a DoS attack vector anyway? I don't need a server
> to accept or read my obscenely long POST requests to clog the pipes with
> them. Would the proper way to handle this risk be to disallow POST at the
> webserver level, or does turning always_populate_raw_post_data off cause
> the connection to be automatically dropped after Connection: close?
The POST data basically sits in STDIN for the webserver, it will
just sit there unless somebody like php reads that data and does
something with it.
By default php streams the STDIN to a file so your just dealing
with buffer sized ~2K-4K. enabling this option makes php put the
contents into memory, thus leaving open the possiblity of someone
using up all your memory and bringing the machine to a standstill
till, then when swap space runs out.. watch out! :)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
> > Isn't this potentially a DoS attack vector anyway? I don't need a server
> > to accept or read my obscenely long POST requests to clog the pipes with
> > them. Would the proper way to handle this risk be to disallow POST at the
> > webserver level, or does turning always_populate_raw_post_data off cause
> > the connection to be automatically dropped after Connection: close?
>
> By default php streams the STDIN to a file so your just dealing with
> buffer sized ~2K-4K. enabling this option makes php put the contents
> into memory, thus leaving open the possiblity of someone using up all
> your memory and bringing the machine to a standstill till, then when
> swap space runs out.. watch out! :)
This makes sense, thanks.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---
HI. I've been using mySQL 4.0.13, php4.3.4, and phpMyAdmin2.5.5 on Mac
OS 10.3.3 as a learning/testing/development environment for a couple of
months now - no problems, works great.
I've created more than a few mySQL databases and tables, but yesterday
I created a database, a table, and LOAD DATA from within phpMyAdmin.
Successfully. I looked at the data and all was fine. Logged out and
went away for a while. Came back and phpMyAdmin would not show me my
databases in the left frame, and I could not launch a query window. I
could see runtime information, system vars, processes, and even
privileges.
I tried logging in to mySQL through the terminal Through the command
line client I can run simple commands, but no commands to view or
affect databases or tables.
I can run php scripts from a browser - connect to databases, retrieve
and even insert/update data, but I cannot view databases or tables, and
though I haven't tried I doubt I'll be able to create, delete, or
backup databases or tables.
Does anyone have a clue about what the problems may be or where I
should start?
---
Bill Green
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
This should be in a mysql newsgroup.
Bill Green wrote:
HI. I've been using mySQL 4.0.13, php4.3.4, and phpMyAdmin2.5.5 on Mac
OS 10.3.3 as a learning/testing/development environment for a couple
of months now - no problems, works great.
I've created more than a few mySQL databases and tables, but yesterday
I created a database, a table, and LOAD DATA from within phpMyAdmin.
Successfully. I looked at the data and all was fine. Logged out and
went away for a while. Came back and phpMyAdmin would not show me my
databases in the left frame, and I could not launch a query window. I
could see runtime information, system vars, processes, and even
privileges.
I tried logging in to mySQL through the terminal Through the command
line client I can run simple commands, but no commands to view or
affect databases or tables.
I can run php scripts from a browser - connect to databases, retrieve
and even insert/update data, but I cannot view databases or tables,
and though I haven't tried I doubt I'll be able to create, delete, or
backup databases or tables.
Does anyone have a clue about what the problems may be or where I
should start?
---
Bill Green
[EMAIL PROTECTED]
--
Raditha Dissanayake.
---------------------------------------------
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions
--- End Message ---
--- Begin Message ---
In an effort to make sure no binary data is maliciously submitted via a
form I have code the makes sure all characters in any input field are
with in the range of a space to a "~". However now that I am getting
some users of my site from Europe, that are having problems submitting
some extended characters. I don't have the time to localize this site
for every language but I would like to make it so European users can
enter the character that you don't find in the English alphabet. So I
was wondering what other ascii values I need to allow so users in Europe
won't have these problems?
Chris W
Bring Back the HP 15C
http://hp15c.org:8080
If you don't get the gifts you "really want", maybe The Wish Zone can help.
http://thewishzone.com:8086
--- End Message ---
--- Begin Message ---
Ok, thanks.
One other question. If I use the example I cited earlier, are the session
values still stored in a flat file? Or do I have to replace that with
database entries?
Thanks.
From: "John W. Holmes" <[EMAIL PROTECTED]>
Reply-To: "John W. Holmes" <[EMAIL PROTECTED]>
To: "Paul Higgins"
<[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>
Subject: Re: [PHP] PHP Session Handlers
Date: Wed, 12 May 2004 15:14:36 -0400
From: "Paul Higgins" <[EMAIL PROTECTED]>
> I just read this tutorial:
> http://www.phpbuilder.com/columns/ying20000602.php3
>
> I understand what each function does and what to do in each function.
> However, my question is this: If I write my own session handling
functions,
> do I have to explicity call them myself? If so, when do I call them?
No, you'll just use sessions as normal and these functions will be used by
PHP when needed. For instance, at the end of the script when PHP needs to
save the current session variables, it'll call your "write()" function. You
just use sessions as normal, though.
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Getting married? Find tips, tools and the latest trends at MSN Life Events.
http://lifeevents.msn.com/category.aspx?cid=married
--- End Message ---
--- Begin Message ---
Works as advertised. Made it a sort.
Todd
John W. Holmes wrote:
From: "Todd Cary" <[EMAIL PROTECTED]>
I do the following:
$eventList = array();
$eventList[] = "Any";
$dbh = db_open($host, $user, $password, $database);
if($dbh) {
$sthdl = db_get_event_data($dbh);
while ($row = mysql_fetch_object($sthdl)) {
$eventList[] = $row->EV_EVENT;
}
} else {
$eventList[] = "* None found *";
}
asort( $eventList );
Now I want to put "Any" as the first item. What is the best way to do
this? Often the sort puts it as an item down the list.
Remove the line adding 'Any' at the beginning of your code and use
array_unshift() to add it at the end.
$eventList = array();
$dbh = db_open($host, $user, $password, $database);
if($dbh) {
$sthdl = db_get_event_data($dbh);
while ($row = mysql_fetch_object($sthdl)) {
$eventList[] = $row->EV_EVENT;
}
} else {
$eventList[] = "* None found *";
}
asort( $eventList );
array_unshift($eventList,'Any');
do you really need to maintain the numeric keys to the array by using
asort() instead of just sort()? If so, this may not work. You may be able to
use array_splice($input, 0, 0, array('Any')) or array_merge().
---John Holmes...
--- End Message ---
--- Begin Message ---
it are different table and the first table does not contain names, onlu the
id form names.
Ordering ASC woll not work because it is not in the first query
thank for thinking with me anyway
"Dennis Biletsky" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
>
> "R.G. Vervoort" <[EMAIL PROTECTED]> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
> ÓÌÅÄÕÀÝÅÅ: news:[EMAIL PROTECTED]
> >
> >
> >
> >
> > Does anyone have a suggestion how I can order a list with names in a
> > secondary select string.
> >
> >
> >
> > The first string selects a number of locations where people work
> >
> >
> >
> > From this string I get several id's form people (in the location table
> there
> > are no names but id's form the people table) that work on those
locations
> >
> >
> >
> > No I make another select to get the name form the people table using the
> id
> > I got before.
> >
> >
> >
> > I would like to have the table ordered alphabetical by the name of the
> > people
> >
> >
> >
> > Since the number op people is very long is will be to slow working the
> other
> > way around (first selecting people and then looking for the location)
> >
> >
> >
> > Example:
> >
> >
> >
> > Location 1 Name A
> >
> > Name B
> >
> > Name C
> >
> > Location 3 Name D
> >
> > Name E
> >
> > Location 5 Name F
> >
> > Location 2 Name G
> >
> > Location 9 Name H
> >
> > Location 7 Name I
> >
> >
> >
> >
> >
> >
> >
> >
> ORDER BY name ASC
>
>
--- End Message ---
--- Begin Message ---
Hi all,
Can anyone point me in the direction of a site search engine that reads
files in a directory find relevant results for an search term that a
person might enter on a site?
I need to build a site search engine but the problem is. the site isn't
dynamic (yet) so I need to read actual files to pull things together.
Anything out there?
Thanks!
Aaron
--- End Message ---
--- Begin Message ---
Hey Guys,
Question 1: Does anyone have a really good php form validation script
for Zip-codes?
Question 2: Does anyone know of a great depository of form validation
scripts for all kinds of form inputs?
Question 3: Does anyone know (yea I know, getting tedious here) of a
way or program to check the real distance from one zip-code to another
zip-code like on yahoo maps?
Thank you.
Later,
Ryan
P.S. "Man only needs 3 things to survive... Water, food, and 37 lb.
of fluid resistant pornography. Everything else is just semantics."
--- End Message ---
--- Begin Message ---
Hello,
On 05/12/2004 09:22 PM, Ryan Munevar wrote:
Question 1: Does anyone have a really good php form validation script
for Zip-codes?
Question 2: Does anyone know of a great depository of form validation
scripts for all kinds of form inputs?
http://www.phpclasses.org/formsgeneration
Question 3: Does anyone know (yea I know, getting tedious here) of a
way or program to check the real distance from one zip-code to another
zip-code like on yahoo maps?
http://www.phpclasses.org/phpziplocator
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
hey...
hi. we're looking for a good/really good web based user directory
application. we'd like the app to be able to allow users to login, and add
information to their profile. we'd prefer an app that would provide the
ability to select/add additional information fields and not constrain us. we
would also like an app that allows the user to upload a picture for the
other users to be able to see...
we're looking for something that will allow our users to be able to search
through the profile information, to find other users with the skills that
they need. The goal is to be able to support a distributed team of users.
this would be a way of allowing them to kind of stay in touch.
we'd also prefer that the app have a good admin function.
if need be, we could always rip this function out of an existing app if you
know of one, and create a stand alone app....
Of course we'd also prefer that the app be "open source"...
Thanks,
bruce
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On 5/13/2004 4:29:52 AM, [EMAIL PROTECTED] wrote:
> hey...
>
> hi.
> we're looking for a good/really good web based user directory
> application. we'd
> like the app to be able to allow users to login, and add
> information to their profile.
> we'd prefer an app that would provide the
> ability to select/add additional information fields and not constrain us.
we
> would also like an app that allows the user to upload a picture for the
> other users to be able to see...
>
> we're
> looking for something that will allow our users to be able to search
> through the profile information, to find other users with the skills that
> they need. The goal is to be able to support a distributed team of users.
> this would be a way of allowing them to kind of stay in touch.
>
> we'd also prefer that the app have a good admin function.
>
> if need be, we could always rip this function out of an existing app if
you
> know of one, and create a stand alone app....
>
> Of course we'd
> also prefer that the app be "open source"...
Of course...why pay for something so useful??
Maybe you would also prefer for someone to make this for you...open source
and free of course :-)
Cheers,
-Ryan
--- End Message ---
--- Begin Message ---
ryan...
we've seen apps that have had some of the functions we're looking for... ie
dating apps, cms systems, etc... we're curious if anybody has seen/used
something that they've considered to be really good/solid...
-bruce
[EMAIL PROTECTED]
-----Original Message-----
From: Ryan A [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 12, 2004 8:59 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] a good user directory application...
On 5/13/2004 4:29:52 AM, [EMAIL PROTECTED] wrote:
> hey...
>
> hi.
> we're looking for a good/really good web based user directory
> application. we'd
> like the app to be able to allow users to login, and add
> information to their profile.
> we'd prefer an app that would provide the
> ability to select/add additional information fields and not constrain us.
we
> would also like an app that allows the user to upload a picture for the
> other users to be able to see...
>
> we're
> looking for something that will allow our users to be able to search
> through the profile information, to find other users with the skills that
> they need. The goal is to be able to support a distributed team of users.
> this would be a way of allowing them to kind of stay in touch.
>
> we'd also prefer that the app have a good admin function.
>
> if need be, we could always rip this function out of an existing app if
you
> know of one, and create a stand alone app....
>
> Of course we'd
> also prefer that the app be "open source"...
Of course...why pay for something so useful??
Maybe you would also prefer for someone to make this for you...open source
and free of course :-)
Cheers,
-Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I have been playing with PHP5 and am liking it more and more. But I have one
question about "instanceof"
If you have something like this:
<?
class A { }
class B extends A { }
$x = new B;
if ($x instanceof B) echo "B";
if ($x instanceof A) echo "A";
?>
This would echo "BA". That's good, I understand that.
Now the question: Is it possible to determine if B is an instance of A
without instantiating it?
Thanks
Martin
--- End Message ---
--- Begin Message ---
An instance only exists after it has been instantiated. So you can't know
anything about an instance (== an object) beforehand. It's like knowing a
person before they are born.
Maybe you mean you want to determine if class B is a subclass of class A.
That's the same problem again. Even if PHP5 had a Class object (a la Java),
you'd have to instantiate *it* in order to find the relationship between class
A and class B. Prior to that point, you only have text strings to work with.
I suppose you could search the text of the file for "extends FooBar" or something.
cheers,
Travis
Martin Towell wrote:
I have been playing with PHP5 and am liking it more and more. But I have one
question about "instanceof"
If you have something like this:
<?
class A { }
class B extends A { }
$x = new B;
if ($x instanceof B) echo "B";
if ($x instanceof A) echo "A";
?>
This would echo "BA". That's good, I understand that.
Now the question: Is it possible to determine if B is an instance of A
without instantiating it?
Thanks
Martin
--
Travis Low
<mailto:[EMAIL PROTECTED]>
<http://www.dawnstar.com>
--- End Message ---
--- Begin Message ---
Hi All,
A simple example I got from the manual:
$fp = @fsockopen ($address, $port, $errno, $errstr, 5);
if (!$fp) {
echo "Oops";
} else {
echo "Ok";
fclose ($fp);
}
Can someone point me in the direction of being able to probe multiple ports
at the same time? (multi-threading or forking concept) We are looking at
creating our own monitoring service to test if ports are open on our
servers. If we scan every minute, and each takes 5 seconds, that only allows
us 12 such ports before we overflow into the next minute. Unless someone
else has a better solution that we can implement?
Thanks!
Terence
--- End Message ---
--- Begin Message ---
ah yes, of course "instanceof" means you're working with an instance of an
class - <slaps forehead>
Pity there's no equivalent for classes :( oh well, I'll just have
instantiate the class first then do the checking.
Thanks
Martin
> -----Original Message-----
> From: Travis Low [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 13 May 2004 2:42 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] PHP5 - instanceof
>
>
> An instance only exists after it has been instantiated. So
> you can't know
> anything about an instance (== an object) beforehand. It's
> like knowing a
> person before they are born.
>
> Maybe you mean you want to determine if class B is a subclass
> of class A.
> That's the same problem again. Even if PHP5 had a Class
> object (a la Java),
> you'd have to instantiate *it* in order to find the
> relationship between class
> A and class B. Prior to that point, you only have text
> strings to work with.
> I suppose you could search the text of the file for "extends
> FooBar" or something.
>
> cheers,
>
> Travis
>
> Martin Towell wrote:
> > I have been playing with PHP5 and am liking it more and
> more. But I have one
> > question about "instanceof"
> >
> > If you have something like this:
> >
> > <?
> > class A { }
> > class B extends A { }
> > $x = new B;
> > if ($x instanceof B) echo "B";
> > if ($x instanceof A) echo "A";
> > ?>
> >
> > This would echo "BA". That's good, I understand that.
> >
> > Now the question: Is it possible to determine if B is an
> instance of A
> > without instantiating it?
> >
> > Thanks
> > Martin
> >
>
> --
> Travis Low
--- End Message ---
--- Begin Message ---
i am a beginner for php programming, my OS is win98 while my webserver is PWS, all is
in the same machine,when i try to run my internet explorer( type in
http://localhost/phpinfo.php), phpinfo.php cannot be display.
i try to reinstall pws and php follow the instrustruction but its still same problem.
i hope yours can help me to show whats wrong, thanks for your help
---------------------------------
Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download
Messenger Now
--- End Message ---
--- Begin Message ---
Hi there!
I need to email linked files (URLs are retrieved from a database) with PHP
but after I downloaded the remote file through my script the downloaded
file headers are always damaged ( I tried to download pdf and zip files).
Could one of you help me in saving the remote file to the local webserver?
The delivery of the mail with attachment already works fine ...
Thank you in advance!
Sascha
--- End Message ---