OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Subject: php3 Digest 4 Mar 2000 18:00:02 -0000 Issue 1517
From: php3-digest-helplists.php.net
Date: Sat Mar 04 2000 - 12:00:02 CST


php3 Digest 4 Mar 2000 18:00:02 -0000 Issue 1517

Topics (messages 79788 through 79815):

Problem running PHP with MS IIS3
        79788 by: Joanhuangaol.com

forms with drop down menu list ?
        79789 by: bijan bel <bijanbelexcite.com>

putting PHP scripts in a box :)
        79790 by: Kristian Koehntopp <kknetuse.de>
        79794 by: Alex Belits <abelitsphobos.illtel.denver.co.us>

Passwords in clear text
        79791 by: "Greg Brunet" <GBrunetSemperSoft.com>

forms with menus
        79792 by: bijan bel <bijanbelexcite.com>

prevent multiple inserts/updates on post
        79793 by: "Manuel Lemos" <mlemosacm.org>
        79796 by: Ben Johnson <benblarg.net>
        79812 by: Bob Strouper <bobw123mail.com>

Perl question: sorry. really need help
        79795 by: Dean James <sacramonemediaone.net>
        79806 by: "Henry F. Marquardt" <hankyerpso.net>

powerfull templates using php
        79797 by: Auke van Slooten <aukemuze.nl>

PWS
        79798 by: "Jonathon Marshall" <jonmarshloxinfo.co.th>

Group Scheduling/Calendars?
        79799 by: Auke van Slooten <aukemuze.nl>

PWS Problems
        79800 by: "Jonathon Marshall" <jonmarshloxinfo.co.th>
        79815 by: "Greg Brunet" <GBrunetSemperSoft.com>

does flock prevent file truncation due to fopen("file",'w') ?
        79801 by: "Danny Heijl" <danny.heijlpandora.be>
        79813 by: <chagenbuwso.williams.edu>

PWS / PHP Cant get this Shi**ty thing to work
        79802 by: "Jon Marshall" <jonmarshallexecutivecatering.co.uk>

which way to count is more efficient?
        79803 by: Tom <tomhenrydirect-connection.com>

forms and php3
        79804 by: bijan bel <bijanbelexcite.com>

forms and menus
        79805 by: bijan bel <bijanbelexcite.com>

xml files usage
        79807 by: Maarten Stolte <M.StolteSamhoud.nl>

Query the database one time
        79808 by: Alaiddin Tayeh <atayehp-i-s.com>

Oracle 8 ROWID object. How do I use it?
        79809 by: Stewart Taylor <Stewart.Taylorrdel.co.uk>
        79810 by: Stewart Taylor <Stewart.Taylorrdel.co.uk>

Postgresql releses beta 7.0 with referential integrity
        79811 by: "SANIsoft" <tariquenagpur.dot.net.in>

Image functions
        79814 by: Andre Rieder <ariederfee.unicamp.br>

Administrivia:

To subscribe to the digest, e-mail:
        php3-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php3-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php3lists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi there,

I have downloaded PHP 3.0.15 Win32 binary file then installed it onto my
Window NT 4.0 server, I followed the instruction to rename php.ini-dist to
php3.ini, copied it to my d:\winnt directory, set extension_dir = c:\php3 in
php3.ini, installed php_iis_reg, inspected registry, seems everything is OK.

I use MS IIS3 as web server, then I wrote a simple test file test.php3, put
it onto d:\inetpub\wwwroot, then try to load from browser by
http://localhost/test.php3, I saw browser is trying to load the file, but
eventually came out error message:

Internet Explorer cannot open the internet site http://localhost/test.php3
The operation time out.

I moved it to a virtual directory with execute enable, still got the same
error message (my .asp page runs fine).

Could anyone who knows the reason help me to fingure it out?

Thanks!

Joan

attached mail follows:


Hi everyone,

First I'd like to thank the nice people who helped
me with me previous question. You know who you are :)

Now another question :
I have a form with drop menu (<SELECT><OPTION>...</OPTION></SELECT>)
With this form, some data is submitted. Now I want to be able to
read back that data into the form so that it could be modified.
Now everything is going into its place when its read back but the
drop menus are left unchanged.
The way I'm doing it is reading the information into an array
and then using the array to display the data.
Is there a special way of doing this ?
How can I get this to work ? Please help, I'm really stuck and on a
deadline.
Thank you in advance,
Bijan

_______________________________________________________
Get 100% FREE Internet Access powered by Excite
Visit http://freeworld.excite.com

attached mail follows:


Walter Cruz wrote:
> How can I chroot a PHP script?? Is it possible??

This is quite easy if you are using Apache and the CGI version
of PHP. You could use a modified suexec or a suexec replacement
such as sbox to do it. This will run all your CGI in a chrooted,
quotaed, and rlimited environment, which is exactly what you
want.

If you are in for the module version of PHP on Apache, this
cannot be done without a minor modification to the Unix kernel,
and a major modification of the PHP module. The benefit (apart
from using mod_php chrooted) would be that you could finally
abandon safe_mode, which is an ugly concept in itself.

The mod_php version could run chrooted and suexeced, if you were
to start Apache as root (have to anyway, because of Port 80) and
Apache would not give up its saved uid of 0. Apache would then
be able to seteuid() to the saved UID of root, and then down to
the uid of the script owner on script start, and back to root
and then down again to the saved UID of the wwwrun user at
script end. The only thing to control is that no Apache module
is able to give the user access to the seteuid() system call
(drop the Posix module, drop mod_perl). Upon exec(), the saved
uid is being dropped and the exec'ed program will run without
the opportunity to seteuid() up to root.

chroot() is a different matter, because unfortunately there is
no saved root in the general, analogous to a saved uid. That is,
chroot(NULL) will not return your current root back to the saved
root. Once you make that change to your kernel, you can chroot()
down into the document root on mod_php script start and
chroot(NULL) back to the saved root on script end. You'd also
have to modify the exec() system call, so that the saved root is
being dropped on exec.

After that you'd no longer need safe_mode, because the resulting
concept should be much more secure and easier to prove secure
than safe_mode. Also, you'd have the same security as in a
sboxed environment, only 10 times faster because you do not fork
yourself dead. And if you had the jail() system call instead of
chroot(), as in *BSD, you'd also control which IP the chrooted
client could bind to, which is another virtualization bonus.

What do you people think?

Kristian

-- 
Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH
Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00
Using PHP3? See our web development library at
http://phplib.netuse.de/ (We have moved! Update your bookmarks!)

attached mail follows:


On Sat, 4 Mar 2000, Kristian Koehntopp wrote:

> root. Once you make that change to your kernel, you can chroot() > down into the document root on mod_php script start and > chroot(NULL) back to the saved root on script end. You'd also > have to modify the exec() system call, so that the saved root is > being dropped on exec.

Except that php module doesn't do execve() (the syscall in question is execve()), and everything is happening within the same process anyway. The only way to run php module in chroot'ed environment with Apache is running the whole Apache in chrooted environment -- with or without kernel modification.

With fhttpd it's possible by running php module process in chroot'ed environment -- fhttpd will pass client's fd to it (in -s mode) or will relay client's connection over a pipe (-p mode) even if php executable will be already running chroot'ed when request will arrive.

This can be done by modifying "php" application configuration by changing php user to "root" and replacing php executable by a script that performs chroot and su to php user, then runs real php executable (under new root and userid), or equivalent program that calls chroot(), setgid(), initgroups(), setuid() and execve(). Of course, URLs will be mapped to the directories and files under new root -- if URL was http://myhost/mydir/myfile.php3 , and HTTP root is /home/http-root , php interpreter will still look for /home/http-root/mydir/myfile.php3 under new root (say, /home/chrooted-php ), so it will find something /home/chrooted-php/home/http-root/mydir/myfile.php3 , unless some additional rule applies in the server.

After starting php module process HTTP server will remain under real root, but php module process will be under chroot'ed environment, still communicating with HTTP server through sockets or pipes depending on the mode (-p or -s), and every new php module process will be started the same way, using the wrapper.

> After that you'd no longer need safe_mode, because the resulting > concept should be much more secure and easier to prove secure > than safe_mode. Also, you'd have the same security as in a > sboxed environment, only 10 times faster because you do not fork > yourself dead. And if you had the jail() system call instead of > chroot(), as in *BSD, you'd also control which IP the chrooted > client could bind to, which is another virtualization bonus. > > What do you people think?

I think that even though various kinds of restricted environment are useful, none of them will be of any use for Apache modules model because after the module code is executed, it simply returns to the main loop and has to be able to process any request (because of Apache symmetric model). If at that moment any restrictions will remain, subsequent requests processing won't work, and if by some kernel magic it will be possible to revert back after executing code that should be restricted, chroot() protection will be mostly lost -- chroot() and non-root userid protect against compromise if the code can be somehow tricked into executing malicious code (for example, through buffer overflow bugs), and malicious code can just call whatever brings the original root if it runs in the module's context. OTOH, situation with "saved root" protects only against running other executables that may be compromised -- what is not a protection at all if they are setuid -- once any malicious code is running as root, it can easily get out of chroot'ed environment (unless system of securelevels is extremely paranoid), so setuid executables under chroot'ed environment are a big no-no anyway.

-- 
Alex

---------------------------------------------------------------------- Excellent.. now give users the option to cut your hair you hippie! -- Anonymous Coward

attached mail follows:


Aidan:

Who generates the random number - the server or the client? And how can you ensure that the random number is different each time? It seems that you might be able to make sure that the random number isn't the same as the last one or two numbers used, but at a certain point in time there's a possibility that they'd repeat. If that's the case, then couldn't Eve just snarf a few random number / H3 pairs and rotate between them? Admittedly it'd be more work than intercepting a single transaction, but don't you think that they could still break through?

-- Greg

(Aidan - sorry - I omitted the mailing list the first time - so you'll get 2 copies of this)

attached mail follows:


Hi again , I found something related to this in the F.A.Qs ( the use of "var[]" ) but it is not clear how it exactly works. I tried something like below but it is not working. By the way I can't get the TEXT AREA or RADIO button to display either.

printf("Year: <SELECT NAME=\"start_year[]\"> <OPTION VALUE=\"2000\">2000</OPTION> <OPTION VALUE=\"2001\">2001</OPTION> <OPTION VALUE=\"N/A\">N/A</OPTION> </SELECT>\n", ($formValues) ? $formValues["start_year[]"] : "");

Any suggestions will be appreciated, Bijan

_______________________________________________________ Get 100% FREE Internet Access powered by Excite Visit http://freeworld.excite.com

attached mail follows:


Hello Bob,

On 04-Mar-00 03:32:13, you wrote:

>Well I thought it would be a breeze to use phplib >to prevent multiple posts to a form resulting in >screwy database inserts/updates when the user clicks >the submit button several times in an attempt to get >a response from the server.

Usually, multiple submissions are accidental (nervous clicks). A partial solution that I use to minimize those situations is PHP forms generation and validation class that may generate Javascript code to put up an alert message telling the user that he is attempting to submit the same form more than once and asking for confirmation. This way the form is not submitted twice unless the user really means it. You may find this class here:

http://phpclasses.UpperDesign.com/browse.html/package/1

>Yes I know I should possibly be focusing more >on the SQL and DB design and gracefully handle >duplicate entries, but it is more than that, as I >do a bunch of directory and file manipulation also >in the scripts ( move copy unlink rename etc. ), >so just preventing the insert/update part of the >scripts ( that come from a post ) from being >executed more than once is the ticket for me >right now.

I also avoid duplicate entries by either checking their existance and making at least table fields unique so even if it happens that two accesses (two clicks) occur, one will get an database access error which is better than duplicated or inconsistent data.

>So the solution I came up with was based on the same >principle as my phplib one, but instead of a registered >variable I used a file instead.

>At the beginning of this script, the first ( and only first) >time it is called, I create a zero length file:

>$fp = fopen( "/usr/local/stop_post_file" . $sess->id, "w" ); >fclose( $fp );

>Now, after the final POST ( after all the data has been validated >and the script is just about to insert/update to the database ) >I use the following check:

>if (!file_exists( "/usr/local/stop_post_file" . $sess->id )) >{ >//redirect or echo or whatever >exit; >} >else >unlink("/usr/local/stop_post_file" . $sess->id);

>// script may or may not proceed to update/insert

>Well this simple approach appears to work just fine. >Disabling the script in this way from processing the final >post more than once also works to prevent against refreshes >and back button reposts and I think that the creation of the >zero length "stop_post_file" is negligible with regards to >the slowing the server down.

>What do you think?

You always have a concorrency problem with eventual race conditions as your locks are not atomic, as they are divisible. When it comes with database operations, the right solution is to use transactions which turn several queries as if they were a single indivisible access.

If your database does not support transactions (MySQL doesn't but others do) maybe you'd better for implicit consistency checks with unique fields or some other constraint which lead to database errors but as I said they are better than duplicate or inconsistent data in the database.

Regards, Manuel Lemos

Web Programming Components using PHP Classes. Look at: acm.org">http://phpclasses.UpperDesign.com/?user=mlemosacm.org

--
E-mail: mlemosacm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--

attached mail follows:


Instead of using the existence of a file where a race condition could occur it might work better to use a mysql table which supports a form of locking and can force atomic transactions. One table with a single indexed (primary key) column that holds large randomly generate keys to transactions would replace the possibly many files. The table should be locked before inserting or deleting a key.

I have some functions that do exactly this. I'll share them if you want though I don't have them available currently.

I have not tested the functions extensively. I worry that they could cause transactions to move too slowly during heavy usage or may even create dead-locks. They need testing. I think they're reasonably well constructed though.

What do you think?

- Ben

On Sat, Mar 04, 2000 at 04:28:44AM -0200, Manuel Lemos wrote: > Hello Bob, > > On 04-Mar-00 03:32:13, you wrote: > > >Well I thought it would be a breeze to use phplib > >to prevent multiple posts to a form resulting in > >screwy database inserts/updates when the user clicks > >the submit button several times in an attempt to get > >a response from the server. > > Usually, multiple submissions are accidental (nervous clicks). A partial > solution that I use to minimize those situations is PHP forms generation > and validation class that may generate Javascript code to put up an alert > message telling the user that he is attempting to submit the same form more > than once and asking for confirmation. This way the form is not submitted > twice unless the user really means it. You may find this class here: > > http://phpclasses.UpperDesign.com/browse.html/package/1 > > > >Yes I know I should possibly be focusing more > >on the SQL and DB design and gracefully handle > >duplicate entries, but it is more than that, as I > >do a bunch of directory and file manipulation also > >in the scripts ( move copy unlink rename etc. ), > >so just preventing the insert/update part of the > >scripts ( that come from a post ) from being > >executed more than once is the ticket for me > >right now. > > I also avoid duplicate entries by either checking their existance and > making at least table fields unique so even if it happens that two accesses > (two clicks) occur, one will get an database access error which is better > than duplicated or inconsistent data. > > > > >So the solution I came up with was based on the same > >principle as my phplib one, but instead of a registered > >variable I used a file instead. > > >At the beginning of this script, the first ( and only first) > >time it is called, I create a zero length file: > > >$fp = fopen( "/usr/local/stop_post_file" . $sess->id, "w" ); > >fclose( $fp ); > > >Now, after the final POST ( after all the data has been validated > >and the script is just about to insert/update to the database ) > >I use the following check: > > >if (!file_exists( "/usr/local/stop_post_file" . $sess->id )) > >{ > >//redirect or echo or whatever > >exit; > >} > >else > >unlink("/usr/local/stop_post_file" . $sess->id); > > >// script may or may not proceed to update/insert > > > >Well this simple approach appears to work just fine. > >Disabling the script in this way from processing the final > >post more than once also works to prevent against refreshes > >and back button reposts and I think that the creation of the > >zero length "stop_post_file" is negligible with regards to > >the slowing the server down. > > >What do you think? > > You always have a concorrency problem with eventual race conditions as your > locks are not atomic, as they are divisible. When it comes with database > operations, the right solution is to use transactions which turn several > queries as if they were a single indivisible access. > > If your database does not support transactions (MySQL doesn't but others > do) maybe you'd better for implicit consistency checks with unique fields > or some other constraint which lead to database errors but as I said they > are better than duplicate or inconsistent data in the database. > > > Regards, > Manuel Lemos > > Web Programming Components using PHP Classes. > Look at: acm.org">http://phpclasses.UpperDesign.com/?user=mlemosacm.org > -- > E-mail: mlemosacm.org > URL: http://www.mlemos.e-na.net/ > PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp > -- > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net

-- 

attached mail follows:


Hello,

Thanks very much for your responce.

"Manuel Lemos" wrote: >You always have a concorrency problem with >eventual race conditions as your locks are >not atomic, as they are divisible.

Ben Johnson wrote: >Instead of using the existence of a file >where a race condition could occur

Ben, yes if you could get a hold of the scripts you mentioned i would very mutch like to see them and Manuel thanks I'll rejoin UpperDesign :-)

I'm not sure why there would be file locking / race condition problems with my method, as each file is created on on a per user/session basis and is unigue only to that users session and it is randomly named as is the session... so the file would look like:

stop_file3f068be7d61ef6534db5cb4c6caa12b6

So therefore only this user is working with this file...his session is creating it, and checking for its existence and non existance... and after he has finished his db transaction this file is unlinked, and when he starts a new db transaction this same file is then created again.

With this clarification do you guys still see race problems... locking issues?

Thanks, Bob

______________________________________________ FREE Personalized Email at Mail.com Sign up at http://www.mail.com?sr=mc.mk.mcm.tag001

attached mail follows:


Hello, I have a whole file of data listed like below. How can I take the data and format it so that each block entry will be one line with a Pipe before each description?? I need this in perl and I can't get any help from the perl lists so far. I know some PHP users are experience Perl programmers.

---------------------------------- sendme:1: e-mail only greeting:Mr firstname:dean lastname:james telephone:333333 emailaddress:deanthe.com address:33 somewhere lane unit: city:venice state:ca zip:90291

---------------------------------- sendme:e-mail only greeting:None firstname:test lastname:test telephone:33333333 emailaddress:testtest.com address: 33 somewhere lane unit:4 city: los angeles state:ca zip:44543

SO,,, I would I put each of these seperate entries pipe deliminated on its own line ie...

sendme: email only|firstname: dean |lastname: James |telephone: 444444 | etc...etc..etc.

any help would be greatly appreciated dean

attached mail follows:


Here goes ... I'm typing extempereaneously to I gaurantee no typos, but if know a 'little' perl, you'll get the gist.

#!/wheretheheckisperl/perl # $/="\n\n\n"; $infile="yourinputfilehere"; $outfile="youroutfilehere"; open INFILE, "<$infile"; open OUTFILE, ">$outfile"; while(<INFILE>) {

($dashes,$sendme,$greeting,$fname,$lname,$tele,$email,$addr,$unit,$city,$sta te,$zip)=split /\n/; $_=join '|',$dashes,$sendme,$greeting,$fname,$lname,$tele,$email,$addr,$unit,$city,$ state,$zip,'\n'; print OUTFILE; } close INFILE; close OUTFILE;

Just for the record ... you could do this in php just as easily assuming you have a cgi install laying around;)

Hank

-----Original Message----- From: Dean James [mailto:sacramonemediaone.net] Sent: Saturday, March 04, 2000 2:48 AM To: php3lists.php.net Subject: [PHP3] Perl question: sorry. really need help

Hello, I have a whole file of data listed like below. How can I take the data and format it so that each block entry will be one line with a Pipe before each description?? I need this in perl and I can't get any help from the perl lists so far. I know some PHP users are experience Perl programmers.

---------------------------------- sendme:1: e-mail only greeting:Mr firstname:dean lastname:james telephone:333333 emailaddress:deanthe.com address:33 somewhere lane unit: city:venice state:ca zip:90291

---------------------------------- sendme:e-mail only greeting:None firstname:test lastname:test telephone:33333333 emailaddress:testtest.com address: 33 somewhere lane unit:4 city: los angeles state:ca zip:44543

SO,,, I would I put each of these seperate entries pipe deliminated on its own line ie...

sendme: email only|firstname: dean |lastname: James |telephone: 444444 | etc...etc..etc.

any help would be greatly appreciated dean

--
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribelists.php.net
To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net
To search the mailing list archive, go to:
http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-adminlists.php.net

attached mail follows:


On Fri, 3 Mar 2000, Ben Johnson wrote:

> I don't know why I would use this instead of using my regular home grown > set of functions and classes. What do you mean exactly by "template"? > > - Ben >

Well, usually a template means that you seperate the content from the layout (and the code). Then you have some simple syntax to place the content in the right place in the layout. But if you want to do difficult layouting, conditional layout, e.g. 'only display this part if the content equals this', your template syntax starts to get complex pretty fast. So what I decided to try was to simply use PHP as the template language.

So just as in php you can do "<h1><pinp> echo $title; </pinp></h1>" which gets translated to something like "<h1><?php echo $data->title; ?></h1>" This way someone editting the layout template can use complex scripts, if he/she wants too, but cannot access any of your global variables which you don't want changed or otherwise messed with.

Now the same goes for functions. In the 'compiler' I listed a range of harmless functions, all other function get translated too. e.g. "<ul><pinp> ls("show.html"); </pinp></ul>" gets translated to "<ul><?php $code->ls("show.html"); ?></ul>". But something like "<pinp> echo strftime("%Y",time()); </pinp>" would stay "<?php echo strftime("%Y",time()); ?>" because these functions are harmless. By that I mean that you can't get access to the disk or the network or a database etc. through them.

I'm using this right now as a way for a user to completely program his own layout in Ariadne, a web application framework I made, without having to worry that he/she is trying to read my password file, or messing up the database or even reading parts of the database for which he/she doesn't have access rights.

So instead of just a simple way for a designer to change the layout once in a while, you could give users the power to change the layout on their own without them being able to really mess things up :)

I hope this makes a bit of sense :)

regards, Auke van Slooten aukemuze.nl http://www.muze.nl/

attached mail follows:


Hi all,

I have been using PHP3 with my ISP and no probs,

figured I'd download and try it locally.

I installed the files and they work as far as parsing goes in a dos box. My problem occurs only in the browser, indicatin a prob with PWS / PHP3

In the installation docs, it mentions browscap.ini, however no such file exists on my HDD, my guess is that PWS doesnt know to implement PHP3 but I am unsure. I did all of the stuff in the previous thread for PWS but no change Any ideas ?

Regards

jon marshall

attached mail follows:


On Fri, 3 Mar 2000 moebiusip-solutions.net wrote:

> Hey Auke, > That is a great program. It's easy to look at, easy to navigate and > pretty robust. Will you be posting update releases, or maybe sourceforge?

Thanks, and yes, I will clean up the code this weekend and post a new version on monday, I'll look after getting a sourceforge account sometime next week.

regards, Auke van Slooten aukemuze.nl http://www.muze.nl/

attached mail follows:


Hi all,

I have been using PHP3 with my ISP and no probs,

figured I'd download and try it locally.

I installed the files and they work as far as parsing goes in a dos box. My problem occurs only in the browser, indicatin a prob with PWS / PHP3

In the installation docs, it mentions browscap.ini, however no such file exists on my HDD, my guess is that PWS doesnt know to implement PHP3 but I am unsure. I did all of the stuff in the previous thread for PWS but no change Any ideas ?

Regards

jon marshall

attached mail follows:


Jon:

Installing with PWS doesn't have the best instructions - this is what worked for me:

I installed PWS 4.0 (from the NT4 option pack), and made sure it was successfully serving up HTML, ASP, and Cold Fusion pages. (Good instructions are available at http://msdn.microsoft.com/library/partbook/vb6/howtosetuppwsonyourmachine.ht m and the download wizard file can be downloaded from http://www.microsoft.com/msdownload/ntoptionpack/askwiz.asp (at least for today!) - I stopped trying to use the PWS setup that's on the Win98 CD because it didn't seem to support Cold Fusion).

I installed PHP3 (php-3.0.15-win32) and I followed the instructions provided at http://www.php.net/manual/install-windows95-nt.php3 with the following COMMENTS/CHANGES:

- You're right - browscap.ini is not in the distribution - it's not needed to run PHP. - Place the PHP3 files in the desired directory (e.g. C:\PHP3). - Make sure to update the PHP3.INI-DIST file appropriately, rename it to PHP3, and copy it into your Windows directory. - Uncommented the desired extensions (e.g., for mySQL & ODBC as the instructions specify) & set the extension_dir to the proper directory (e.g., c:\php3). - Update the php_iis_reg.inf as needed (setting the correct paths), then install it (right click it, then select Install). ** This automates the registry steps described in the on-line manual installation instructions. - Make any directories that had PHP scripts in them "Executable" (either through the Advanced Options page in the PWS Manager, or through the Web Sharing tab of the Sharing screen in Windows Explorer (right click on the directory folder). - Test out PHP & verify the version you're running by using a simple test script: ===== <?php phpinfo(); ?>

With these steps, I can run scripts from the command line as well as from PWS. Scripts using internal functions (such as phpinfo) work just fine. Even after all this, I had another problem that even though the INF file was run, only 2 of the 3 file associations seem to be working (PHP3 and PHTM3 work properly, PHP files don't get parsed - though all three get parsed from the command line, or by clicking on them from an explorer window - so it seems that there is still a problem with PWS. I do have all three entered in the registry under: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\parameters\Script Map)

NOTE: to run mySQL, you'll need to download & install (and start) mySQL. Test that it is running properly by running mysql.exe from the command line and running queries against the test databases.

-- Greg Semper Software, Inc. www.SemperSoft.com GBrunetSemperSoft.com

----- Original Message ----- From: ""Jonathon Marshall"" <jonmarshloxinfo.co.th> Newsgroups: php3.general Sent: Saturday, March 04, 2000 6:49 AM Subject: [PHP3] PWS Problems

> Hi all, > > I have been using PHP3 with my ISP and no probs, > > figured I'd download and try it locally. > > I installed the files and they work as far as parsing goes in a dos box. My > problem occurs only in the > browser, indicatin a prob with PWS / PHP3 > > In the installation docs, it mentions browscap.ini, however no such file > exists on my HDD, my guess is > that PWS doesnt know to implement PHP3 but I am unsure. I did all > of the stuff in the previous thread for PWS but no change > Any ideas ? > > Regards > > jon marshall

attached mail follows:


This does the trick for me (but every writer has to use this method) :

if (file_exists($session->sfile)) { $fp = fopen($session->sfile, "r+"); // file exists } else

$fp = fopen($session->sfile, "w"); // new file } flock($fp, 2); // exclusive lock and wait

... write to the file here ....

fclose($fp); // close and unlock

Danny

---

----- Original Message ----- From: ""Manuel Lemos"" <mlemosacm.org> Newsgroups: php3.general Sent: Saturday, March 04, 2000 5:20 AM Subject: Re: [PHP3] does flock prevent file truncation due to fopen("file",'w') ?

> Hello Ben, > > On 02-Mar-00 22:57:18, you wrote: > > >the file is truncated when a second process opens the file with the 'w' > >mode. > > >Anyone have an idea of how to get around this? I can't think of one. > >flock appears to be useless in this context. ??? > > Indeed. This concerns me too. Have you tried you tried opening the file > for reading first and lock it as shared and the without closing it, open > truncating the file and only then lock exclusively? I don't know if this > works or if it is any portable, but if it works just let me know. > > > >On Thu, Mar 02, 2000 at 03:49:42PM -0800, Ben Johnson wrote: > >> Hi. New list user. I didn't find an answer in the docs or the faq or > >> anywhere else so far. > >> > >> I want to overwrite a file on my server with new data during a cgi > >> request and I don't want requests to step on each other's toes. So... > >> I'm using flock($fp,2) for an exclusive (writer) file lock and > >> fopen("file",'w') for a replace-this-file kind of writing. The problem > >> is flock requires a file pointer to an open file, and my method of > >> opening the file truncates the file length to zero. It seems like my > >> flock will be for not if it fails because the file has already been > >> whacked. Is that true? I don't know how to test it other than forcing > >> multiple concurrent connections and finding out if it breaks. I'm > >> hoping to avoid that. > >> > >> tia. > >> > >> - Ben Johnson > >> > >> PS > >> > >> Here's my code: > >> > >> function _updatehtpasswd($dbc){ file://pass a database connection. > >> $filename = ".htpasswd"; file://in the current dir. > >> if( ! $result = mysql_db_query("BIGDB","SELECT name, password FROM > >> user",$dbc) ){ > >> echo "<p><b>Couldn't update passwords!</b></p>"; > >> } else { > >> > >> if( ! ($fp = fopen($filename,'w')) ){ > >> > >> echo "<p><b>Couldn't update passwords!</b></p>"; > >> > >> } else { > >> > >> if( ! flock($fp,2) ){ > >> > >> echo "<p><b>Couldn't update passwords! ", > >> "(and passwords likely deleted. sorry.)</b></p>"; > >> > >> } else { // write file. > >> rewind($fp); file://just in case someone else had it. > >> while($row = mysql_fetch_array($result)){ > >> fwrite($fp,$row[0].":".$row[1]."\n"); > >> } > >> } > >> fclose($fp); > >> } > >> } > >> } > >> > >> -- > >> PHP 3 Mailing List <http://www.php.net/> > >> To unsubscribe, send an empty message to php3-unsubscribelists.php.net > >> To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > >> To search the mailing list archive, go to: > >> http://www.php.net/mailsearch.php3 To contact the list administrators, > >> e-mail: php-list-adminlists.php.net > > >-- > > > >-- > >PHP 3 Mailing List <http://www.php.net/> > >To unsubscribe, send an empty message to php3-unsubscribelists.php.net > >To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > >To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > >To contact the list administrators, e-mail: php-list-adminlists.php.net > > > > Regards, > Manuel Lemos > > Web Programming Components using PHP Classes. > Look at: acm.org">http://phpclasses.UpperDesign.com/?user=mlemosacm.org > -- > E-mail: mlemosacm.org > URL: http://www.mlemos.e-na.net/ > PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp > -- > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net >

attached mail follows:


Quoting Danny Heijl <danny.heijlpandora.be>:

> if (file_exists($session->sfile)) { > $fp = fopen($session->sfile, "r+"); // file exists > } else > $fp = fopen($session->sfile, "w"); // new file > } > flock($fp, 2); // exclusive lock and wait

Unfortunately, this won't work. It might stand up to low or even reasonable loads, but it can't guarantee exclusive access. You can be interrupted right after the if() clause, move to another process executing the same script, get the _same_ result from the if(). At that point, one process could continue, finish writing, and release the flock, and the other would immediately truncate it.

You could theoretically have an arbitrary number of processes pass the if and then get interrupted, each finishing in turn and then truncating the work of the one that executed beforehand.

Mmm, concurrency issues.

-chuck

attached mail follows:


Hi all,

I have been using PHP3 with my ISP and no probs,

figured I'd download and try it locally.

I installed the files and they work as far as parsing goes in a dos box. My problem occurs only in the browser, indicatin a prob with PWS / PHP3

Also how the hell do I tell what version of PWS I am runninhg ?

In the installation docs, it mentions browscap.ini, however no such file exists on my HDD, my guess is that PWS doesnt know to implement PHP3 but I am unsure. I did all of the stuff in the previous thread for PWS but no change Any ideas ?

Also with regards to the php_iis_reg.inf, what actually happens with this ? where do I put it ?

Regards

jon marshall

attached mail follows:


AFA I can recollect, the MySQL docs specifically state that the fastest way to only count rows is to "count" a/the primary key field

$result = mysql_db_query($dbase,"select count(primarykey) from sometable");

HTH

At 07:38 PM 3/3/00 -0800, Daevid Vincent wrote: >//add up the number of rows in the Player_Table database >$countresult = mysql_db_query("xxxx", "select count(*) from Player_Table"); >$countrow = mysql_fetch_array($countresult); >$totalDrivers = $countrow[0]; > > >or > > >//add up the number of rows in the Player_Table database >$countresult = mysql_db_query("xxxx", "select * from Player_Table"); >$totalDrivers = mysql_num_rows($countresult); > > > > >-- >PHP 3 Mailing List <http://www.php.net/> >To unsubscribe, send an empty message to php3-unsubscribelists.php.net >To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net >To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 >To contact the list administrators, e-mail: php-list-adminlists.php.net

-------------------------------------------------------------------- Work :-( http://BusinessWebs.com/ Home :-) http://MultihullBoatbuilder.com --------------------------------------------------------------------

attached mail follows:


Hi everyone,

First I'd like to thank the nice people who helped me with me previous question. You know who you are :)

Now another question : I have a form with drop menu (<SELECT><OPTION>...</OPTION></SELECT>) With this form, some data is submitted. Now I want to be able to read back that data into the form so that it could be modified. Now everything is going into its place when its read back but the menus are left unchanged. The way I'm doing it is reading the information into an array and then using the array to display the data. Is there a special way of doing this ? How can I get this to work ? Please help, I'm really stuck and on a deadline. Thank you in advance, Bijan

_______________________________________________________ Get 100% FREE Internet Access powered by Excite Visit http://freeworld.excite.com

attached mail follows:


Hi again , I found something related to this in the F.A.Qs ( the use of "var[]" ) but it is not clear how it exactly works. I tried something like below but it is not working. By the way I can't get the TEXT AREA or RADIO button to display either.

printf("Year: <SELECT NAME=\"start_year[]\"> <OPTION VALUE=\"2000\">2000</OPTION> <OPTION VALUE=\"2001\">2001</OPTION> <OPTION VALUE=\"N/A\">N/A</OPTION> </SELECT>\n", ($formValues) ? $formValues["start_year[]"] : "");

Any suggestions will be appreciated, -Bijan

_______________________________________________________ Get 100% FREE Internet Access powered by Excite Visit http://freeworld.excite.com

attached mail follows:


Hi,

I'd like to experiment with XML files in PHP, but can't find too many examples. What i want is a webpage which makes a framework(graphics, tables etc.) and reads the values from the XML file as they are needed (like I do with databases most of the time). I can find some examples of xml usage in php, but not with this kind of stuff..

can someone point me to some docs or example code?

thanks alot,

Maarten

attached mail follows:


hello, I have a database and need to make web based search,I will use a combo box to show data for users to select from as a parameter , and I do not need to query the database to fill that combo box every time the user come to my .php page, is there any way to query that database one time and store that recordset into the memory and just fill that combo box when the user come to my .php page.

any help will be apreciated. thanks

attached mail follows:


Hello, I'm trying to access the ROWID field from an Oracle 8 query. See code below. But, the ROWID variable returned is an object. What are the properties and methods this object encapsulates? How to I find out the 'block.row.file' hex string I expect it to contain? Thanks, Stewart Taylor. $conn = OCILogin...... $sql = "select rowid ". "from part ". "where part='TEST'"; $part = OCIParse($conn,$sql); $rowid=OCINewDescriptor($conn,OCI_D_ROW_ID); OCIDefineByName($part,"ROWID",&$rowid); OCIExecute($part); OCIFetch($part); $rowid // ROWID object or OCIExecute($part); OCIFetchInto($part,&$data,OCI_ASSOC); $data["ROWID"] // ROWID object

attached mail follows:


Hello, I'm trying to access the ROWID field from an Oracle 8 query. See code below. But, the ROWID variable returned is an object. What are the properties and methods this object encapsulates? How to I find out the 'block.row.file' hex string I expect it to contain? Thanks, Stewart Taylor. $conn = OCILogin...... $sql = "select rowid ". "from part ". "where part='TEST'"; $part = OCIParse($conn,$sql); $rowid=OCINewDescriptor($conn,OCI_D_ROW_ID); OCIDefineByName($part,"ROWID",&$rowid); OCIExecute($part); OCIFetch($part); $rowid // ROWID object or OCIExecute($part); OCIFetchInto($part,&$data,OCI_ASSOC); $data["ROWID"] // ROWID object

attached mail follows:


Sorry for the OT post - but you might be interested to know

Postgresql released a beta of ver 7.0. The good news is that the SQL in this version now supports refential integrity and foreign keys. With this step taking it closer to ANSI/ISO compliance, PostgreSQL is (probably?) the first _open source_ database to support Referential integrity. The full version is expected to be released next month.

Tarique

======================================= Creating not just Web Sites but Web Applications http://www.sanisoft-india.com

Search Engine for Nagpur http://nagpurcity.net =======================================

attached mail follows:


I have the following configuration:

-Win95 -PHP3.0.14 -PWS

The php extension files are all in place, but the image functions do not work.

I loaded the php3_gd.dll extension file on my php3.ini and when I used the image functions no error was generated. But no image is output by the script.

How can I get those incredible image functions to work with my configurations?

Andre Rieder ":^)