php-general Digest 27 Mar 2001 19:05:15 -0000 Issue 592

Topics (messages 45701 through 45761):

File upload and database optimization questions
        45701 by: Vikram Vaswani
        45702 by: Jason Murray
        45708 by: Jason Lotito

submit form witout clilck submit button
        45703 by: Jacky
        45704 by: Ankur Verma

Re: equivalent to PERL's qq
        45705 by: Carsten Gehling
        45706 by: Nuno Silva

Re: examine inner workings of functions
        45707 by: David Robley

Sendmail
        45709 by: Daniel B I

PHP as a general scripting language?
        45710 by: Gildas Quiniou

session expiretime
        45711 by: Søren Boll Overgaard
        45745 by: Johnson, Kirk

GD problem
        45712 by: Daniel B I
        45713 by: Daniel B I

Connect local->remote
        45714 by: Jochen Kaechelin

Re: [PHP-DB] Re: How to print last row in an array using WHILE?
        45715 by: andreas \(.work\)

Question on manually instantiating a file download
        45716 by: Vikram Vaswani

We need PHP developers - Urgently in the UK
        45717 by: Paul Tweedy

GZip + NS + Print = Trouble
        45718 by: Renze Munnik

Re: escape sequences not recognized inside an .html
        45719 by: Jason Stechschulte
        45725 by: Mauricio Junqueira

PostgreSQL and PHP - some Great Bridge news
        45720 by: Ned Lilly

Dynamic constant names
        45721 by: Geoff Caplan
        45723 by: Neil Kimber
        45739 by: CC Zona

A ToDo/ task list
        45722 by: Harshdeep S Jawanda
        45724 by: techzeus.pacific.net.sg
        45729 by: A.T.Z.

Re[PHP] Dynamic constant names -SOLVED
        45726 by: Geoff Caplan

free webspace supporting PHP/MySQL
        45727 by: Alaiddin Tayeh
        45728 by: Rosen

Re: How do you get rid of these warnings for undefined variable s?
        45730 by: Anyangwe, Tanwani
        45737 by: Philip Olson

search safe URLs
        45731 by: Joe Sheble aka Wizaerd
        45740 by: CC Zona
        45743 by: Philip Olson
        45749 by: Joe Sheble (Wizaerd)

Looking for a file editor written in php
        45732 by: Chris Moewes-Bystrom

Environment extract
        45733 by: Costas
        45735 by: Matt Friedman
        45736 by: Costas

Re: reading microsoft word, excel, pdf document text
        45734 by: ~~~i LeoNid ~~

POP mail delete
        45738 by: Miguel Carvalho

password
        45741 by: Marisol Díaz E.
        45742 by: Nathan Cassano

Again and again problem installing under Solaris
        45744 by: Emiliano Marmonti

"DF" output
        45746 by: Steven Shepherd
        45748 by: Joe Brown
        45751 by: Steven Shepherd
        45759 by: Joe Brown

form and php
        45747 by: Augusto Cesar Castoldi
        45750 by: Johannes Janson
        45758 by: Philip Olson

Interbase error code = -504 Cursor unknow
        45752 by: Mauricio Junqueira
        45756 by: Mauricio Junqueira

Simple If-else statement
        45753 by: Louis Brooks
        45754 by: Johnson, Kirk
        45755 by: Johannes Janson

About Dbase
        45757 by: Odd Rune Heggestad

PHP and Apachecon
        45760 by: Brian Moon

Statistical Functions
        45761 by: robert_youdale.yahoo.co.uk

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]


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


Hello all,

I'm in the process of building a document-storage system for my firm with
PHP. The goal is this is essentially to allow users to upload documents to
our server (central repository) and allow other users to view/modify these
files.

I have a number of questions, most of them related to optimization of the
code. Any assistance on these from more experienced developers would be
much appreciated.

1. I will be allowing users to upload files of specific types only (DOC,
HTML, TXT, images). My original belief (maybe incorrect) was that allowing
users to upload scripts (.php, .cgi) was dangerous and should be disallowed. 

I am now considering whether files, once uploaded, should be renamed - for
example, "abc.txt" gets renamed to "01.03.dat", with a reference in the
mySQL database containing the real name. 

First, which of these two approaches is better, performance-wise (or is the
difference insignificant)?

Second, is it correct to say that if I adopt this "rename-after-upload"
approach, I can allow users to upload scripts also (since the file
extensions will be changed and no longer recognized as scripts).

2. Once the file is received by the upload script, I am using the followign
code to INSERT a record. I then use the insert_id() function to set the new
filename as well. Is this approach correct?

$query = "INSERT INTO data (category, owner, realname, created,
description, comment, view, modify) VALUES('$category', '$SESSION_UID',
'$file_name', NOW(), '$desc', '$comment', '$viewStr', '$modifyStr')";

$result = mysql_db_query($database, $query, $connection) or die ("Error in
query: $query. " . mysql_error());

$fileId = mysql_insert_id($connection);

$newFileName = $category . "." . $fileId . ".dat";

3. At the time of upload, it is possible to specify a list of users who can
"view" and "modify" the file. Currently I am storing this list as a
whitespace-separated list in a mySQL TEXT column.

Column "view" data: 3 11 1 

At the time of displaying the list, I first SELECT * the entire list of
files, and then use explode() in combination with a "for" loop to split up
the "view" field and match each element againt the current user's ID. Only
if a match is found will I display the filename.

I suspect this approach is not optimal. Can anyone suggest a better approach?

Any insight into these issues will be much appreciated. Please CC a copy of
your response to 

[EMAIL PROTECTED] 

as well as the list (as I will be working on this @ home also and do not
have access to the full digest there)

TIA,

Vikram Vaswani
--
Sex is like air. It's only a big deal if you can't get any.




> 1. 
> 2. 

Both seem fine to me.

> 3. At the time of upload, it is possible to specify a list of 
> users who can "view" and "modify" the file. Currently I am storing 
> this list as a whitespace-separated list in a mySQL TEXT column.
> 
> Column "view" data: 3 11 1 
> 
> At the time of displaying the list, I first SELECT * the entire list 
> of files, and then use explode() in combination with a "for" loop to 
> split up the "view" field and match each element againt the current 
> user's ID. Only if a match is found will I display the filename.
> 
> I suspect this approach is not optimal. Can anyone suggest a 
> better approach?

Rather than a whitespace-separated list, store one ID as a "|ID|". So
your field might look like:

Column "view" data:  '|3||11||1|'

That way, knowing the user's ID who is viewing docs, you can select
<<blah blah>> WHERE view LIKE '|$thisusersidnumber|' ... no longer 
any need to step through and explode the array.

Jason





> > 3. At the time of upload, it is possible to specify a list of
> > users who can "view" and "modify" the file. Currently I am storing
> > this list as a whitespace-separated list in a mySQL TEXT column.
> >
> > Column "view" data: 3 11 1
> >
> > At the time of displaying the list, I first SELECT * the entire list
> > of files, and then use explode() in combination with a "for" loop to
> > split up the "view" field and match each element againt the current
> > user's ID. Only if a match is found will I display the filename.
> >
> > I suspect this approach is not optimal. Can anyone suggest a
> > better approach?
>
> Rather than a whitespace-separated list, store one ID as a "|ID|". So
> your field might look like:
>
> Column "view" data:  '|3||11||1|'
>
> That way, knowing the user's ID who is viewing docs, you can select
> <<blah blah>> WHERE view LIKE '|$thisusersidnumber|' ... no longer
> any need to step through and explode the array.
>
> Jason

No.. very bad.  Not good.  I suggest that you read this article on database
optimization (not to sound rude, but I honestly think you might learn
something, heck, I did when I was writing it =)):
http://www.newbienetwork.net/sections.php?op=viewarticle&artid=17

Using what you described above with the ||, you have already broken the
first normal form.  Serious problems can develop from that implementation.
Rathers, use this format:

document_id             users_allowed
-----------             -------------
001                     1
002                     2
003                     1
003                     2
003                     3

Basically the primary key is in fact both the docid and users_allowed
columns.  This was is the proper way of displaying the above information.

Jason Lotito
www.NewbieNetwork.net
Where those who can, teach;
and those who can, learn.





Hi all
I have to submit username, domain name and password values to the cgi file, It starts 
from the login page and submit values to a php page to tie up username and domain name 
value together before submit it to the cgi file as two values ( "username+domainname" 
, "password") . 
The thing is that at php file, how do I submit those values without user click on the 
submit button,  say make the form submit right away as soon as the page is read?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for yourself"




you can do this using Javascript

place this in your HTML code

<HTML>
|
|
        Head title and the other stuff
|
|
<BODY OnLoad="javascript:document.forms[0].submit();">
|
|

Continue with the HTML Code

|
|

</Body>
</Html>

This will cause the form to be sumitted as soon as the page completes up
loading

hope that helps

regards

Ankur Verma
NetCentric Division
HCL Technologies
Noida, Uttar Pradesh
India



-----Original Message-----
From: Jacky [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 1:56 AM
To: [EMAIL PROTECTED]
Subject: [PHP] submit form witout clilck submit button


Hi all
I have to submit username, domain name and password values to the cgi file,
It starts from the login page and submit values to a php page to tie up
username and domain name value together before submit it to the cgi file as
two values ( "username+domainname" , "password") .
The thing is that at php file, how do I submit those values without user
click on the submit button,  say make the form submit right away as soon as
the page is read?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"





From: "Michael Hall" <[EMAIL PROTECTED]>
Sent: Monday, March 26, 2001 9:36 PM


> Hi.  I'm a converted Perl guy.  While I generally like PHP better than
Perl,
> I do severely miss the Perl operator qq, which allowed statements (in my
> case, lengthy SQL statements) to be written on multiple lines.
>
> $this = qq|Select *
> From xsdfs
> Group by date
> Order by id
> |;
>
> Is there anything similar to this in PHP?  I've been unable to find it if
> there is.

Check out this page:

http://php.net/manual/en/language.types.string.php

and read the paragraphs about the "here doc"´syntax. It might be what you're
looking for.

- Carsten






hi,

try:

<?php
$this = "
        select *
                from xcxcxc
                where var='111'";

echo $this;
?>

i'd say it's even better than qq ;)

regards,
nuno



Carsten Gehling wrote:

> From: "Michael Hall" <[EMAIL PROTECTED]>
> Sent: Monday, March 26, 2001 9:36 PM
> 
> 
> 
>> Hi.  I'm a converted Perl guy.  While I generally like PHP better than
> 
> Perl,
> 
>> I do severely miss the Perl operator qq, which allowed statements (in my
>> case, lengthy SQL statements) to be written on multiple lines.
>> 
>> $this = qq|Select *
>> From xsdfs
>> Group by date
>> Order by id
>> |;
>> 
>> Is there anything similar to this in PHP?  I've been unable to find it if
>> there is.
> 
> 
> Check out this page:
> 
> http://php.net/manual/en/language.types.string.php
> 
> and read the paragraphs about the "here doc"´syntax. It might be what you're
> looking for.
> 
> - Carsten





On Tue, 27 Mar 2001 12:59, Jack Dempsey wrote:
> hi all,
>
> I was thinking about some of the built-in functsions (like array_sort)
> and was wondering how I could find out what the code is behind them.
> ie, is it an insertion sort? quicksort? etc...do i have to look into
> CVS for that? thanks!
>
> -jack

Try your luck in ext/standard/array.c in the distribution tarball - 
search on sort.

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




Yep, I had the same problem yesterday with the mail.
Try to just put a semicolon ";" in front of the sendmail path
directive :). It worked with mine! It seems that it wants to find the
path itself.

Daniel BI

>Hi ,
>I'm at a loss....I've searched throught the knowledgebase, archives, docs,
>etc but I can't figure out what's going on.  The problem is when using the
>mail() function nothing gets send and I don't get any error messages
either.
>It's like the message gets eaten by a black hole.
>I already put "-t -i" in the path, but still doesn't work ..
>Anybody can help me ?
>Regards,
>Atet Sugiharto





Hi,

What are the pros and cons to using PHP as a scripting language like Perl or
Python?

After a couple of years using this excellent language for dynamic web pages
(its first purpose), I'm currently starting to program shell scripts with
PHP. Doing so I encountered some minor problems I turned around like the
need to have 2 .ini files, one for web programming and another for shell
scripting: for instance I don't want error messages cluttered with HTML tags
on shell scripts but I need them for web PHP scripts and so on. Some
behaviors are also missing like the ability to fork() a process for
instance.

Before going too far, I would like to know what other PHP users/gurus think
about using PHP as a general scripting language, what should be avoided and
what are the drawbacks I should take care of. Before someone ask me why not
use Perl or Python: I don't like Perl, I prefer Python, I use it too but I'm
not as easy with it as I am with PHP and I'd prefer put all my efforts in a
single language if it can bring me all I expect...

Thanks for any suggestion, idea, comments.

--Gildas.

--
/-----------------------------*-----------------------------\
| Systèmes & Technologies     | Tél:     +33 2 96438787     |
| Informatiques du Ponant     | Fax:     +33 2 96438788     |
| 27, rue Auguste Brizeux     | email:   [EMAIL PROTECTED]     |
| 22200 Guingamp - France     | web:     http://www.stip.fr |
\-----------------------------*-----------------------------/






Hello

I am trying to figure out how long a session survives, if the user does
nothing in his or her browser, to update the session. I'm creating a rather
comprehensive signup-process, and I need to know how much time a user can
spend on each page, before the session expires.

Looking through php.ini left me somewhat confused, as I can't determine
which of the following parameters control sessiontimeouts.

session.cookie_lifetime   = 0       ; lifetime in seconds of cookie
                                    ; or if 0, until browser is restarted

Apparantly this just controls the cookies lifetime, however, if the
GC-process cleans up the sessions before the cookie times out, obviously the 
session will be destroyed.

As far as I can see, the gc-process is controlled by this directive:

session.gc_maxlifetime    = 1440    ; after this number of seconds, stored
                                    ; data will be seen as 'garbage' and
                                    ; cleaned up by the gc process


So, does this mean that the session will persist for 1440 seconds, with the
above directives inserted in php.ini?

Thanks in advance.

-- 
Søren O.




Yes and no. session.gc_maxlifetime is the right setting, and this means the
session will last *at least* this long. The setting in
session.gc_probability also has an effect. This gives the percentage of page
hits on which gc is launched. For example, if session.gc_probability = 1,
then on one out of every 100 page requests the gc routine gets launched. So,
on a really slow day where the server isn't getting many requests (or late
at night?), then the session can actually last much longer, since the gc
routine isn't getting launched.

Kirk

> -----Original Message-----
> From: Søren Boll Overgaard [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 27, 2001 2:09 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] session expiretime
> 
> 
> Hello
> 
> I am trying to figure out how long a session survives, if the 
> user does
> nothing in his or her browser, to update the session.
> 
> As far as I can see, the gc-process is controlled by this directive:
> 
> session.gc_maxlifetime    = 1440    ; after this number of 
> seconds, stored
>                                     ; data will be seen as 
> 'garbage' and
>                                     ; cleaned up by the gc process
> 
> 
> So, does this mean that the session will persist for 1440 
> seconds, with the
> above directives inserted in php.ini?
 




You need the jpeg support. Shortly, do this:
(I will use my version names, so you can easyly
find something, if you find newer ones, it's your bussiness)

1. search the internet for: 
jpegsrc.v6b.tar.gz 
gd-1.8.3.tar.gz
apache_1.3.14.tar.gz
php-4.0.4.tar.gz

2. unzip all files in a tmp directory (let's say /tmp ):
tar zxvf jpegsrc.v6b.tar.gz 
the same for gd, php, apache...

3. modify the 'Makefile' of the jpeg kit, to meet your requirements
(only the paths to be correct, as your are)
then issue: 
 ./configure --enable-shared --enable-static
then
 make 
 make install

4. modify the gd Makefile:
out there the your paths and uncomment the 'CFLAGS' line that 
enables the jpeg support (something like CFLAGS -DHAVE ljpeg)
then issue:
 make
 make install

5. now configure php and apache and compile them. it should work.
it took me alot these days to discover all of this..

I hope it helps.

Daniel BI







It.s me, again :)
There is trick to find out if php will be compiled well
(I mean with jpeg support):

when issuing the ./configure command in php,
after putting all the options, put something like this:
./configure ... > cf.log

(this is a redirection comand to write all output info
to the file named cf.log so that you could review it
afterwards. excuse me if you knew it :)

in this way you can examine after the configuration
process what was done (it does it so quickly that I
cannot see all it does, so this way I can).
If all is ok, you should see in that log something like:

.....ImageCreateFromJpeg:  yes

If it says no, don't bother yourself by issuing the make
and make install commands. review the previous jpeg
and gd installations and try again.

Daniel BI





how can I connect to a remote-database from
my local dos-window?

I use the following without success:

mysql -u XXXXXXX -h mysql-XXXXXXX -p -D XXXX


Jochen Kaechelin




hi,

$myrow = mysql_fetch_array($result); // erase this line

while ($myrow = mysql_fetch_array($result)) { 


greetings 

andreas








----- Original Message ----- 
From: "Jon Valvatne" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 1:28 PM
Subject: [PHP-DB] Re: How to print last row in an array using WHILE?


What you are missing is the first row, not the last row.

To explain:

mysql_fetch_row() operates with an internal pointer which moves one step
down the result set with each call to the function. The first time it is
called, it returns the first row, and moves its pointer to the second row.
The second time it is called, it returns the second row, and moves its
pointer to the third row. And so on. When it gets to the end, it returns
false.

Your while() structure is exactly what's needed to iterate through the
result set. But because you call mysql_fetch_row() once before starting
the while loop, the first row disappears. When the while loop starts, the
internal pointer points to the second row.

So just remove the first mysql_fetch_row() call, and it should work fine.


Jon Valvatne


On Mon, 26 Mar 2001, Bob Stone wrote:

> Dear PHP Helpers,
>
> I have an array created by an mysql select statement.
>
> I have the code to display the "rows" from the select
> statement.
>
> Everything works fine except that only n-1 rows from
> the array will display.
>
> For example if the array contains four rows only three
> will display. If the array contains one row, nothing
> displays on the screen.
>
> I understand that a WHILE loop will count down to zero
> and then since it becomes false will quit, but how do
> I get the last (or first) row to print?
>
> Here is the code:
>
> <HTML>
>
> <HEAD>
>
> <TITLE></TITLE>
>
> </HEAD>
>
> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF"
> VLINK="#800080">
>
> <?php
>
> $db = mysql_connect("localhost" , "phpuser" ,
> "phpuser");
>
> mysql_select_db("SVT",$db);
>
> // display individual record
>
> if ($user_name) {
>
>    $result = mysql_query("SELECT * FROM svt_members
> WHERE user_name='$user_name'",$db);
>
>    $myrow = mysql_fetch_array($result);
>
>   while ($myrow = mysql_fetch_array($result)) {
>
> printf("Full Name: <b><font color=\"green\"
> size=\"5\">%s %s %s %s\n<br></b></font>",
> $myrow["salutation"], $myrow["first_name"],
> $myrow["mid_name"], $myrow["user_name"]);
>
> printf("Credentials and Degrees: <b><font
> color=\"blue\" size=\3\">%s</font></b>   Job Title:
> <b><font color=\"blue\"
> size=\3\">%s</font></b><br>Company/Institution:
> <b><font color=\"blue\"
> size=\3\">%s<br></font></b>Address: <b><font
> color=\"blue\" size=\3\">%s %s<br></font></b>City:
> <b><font color=\"blue\" size=\3\">%s</font></b>
> State/Provence: <b><font color=\"blue\"
> size=\3\">%s<br></font></b>Country: <b><font
> color=\"blue\" size=\3\">%s</font></b>   Postal Code:
> <b><font color=\"blue\"
> size=\3\">%s<br></font></b>Voice: <b><font
> color=\"blue\" size=\3\">%s</font></b>   Fax: <b><font
> color=\"blue\" size=\3\">%s<br></font></b>E-mail:
> <b><font color=\"blue\" size=\3\">%s\n<P></b></font>",
> $myrow["cert_deg"], $myrow["job_title"],
> $myrow["institution"], $myrow["address_1"],
> $myrow["address_2"], $myrow["geo_loc"],
> $myrow["state"], $myrow["country"], $myrow["zip"],
> $myrow["phone"], $myrow["fax"], $myrow["e_mail"]);
>
> }
>
> }
> ?>
>
> <form method="post" action="<?php echo $PHP_SELF ?>">
>
> Enter Last Name To Search:  <input type="Text"
> name="user_name"><p>
>
> <input type="Submit" name="submit" value="Click To
> Search">
>
> </form>
>
> </BODY>
>
> </HTML>
>
> Thank you very much for your help.
>
> Best regards,
>
> Bob Stone
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/?.refer=text
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Hello all,

I am working on a script which locates a file on the system and then tells
the browser to pop open the "Save As" dialog box for download. In order to
do this, I am using the following code:

$filename = $dataDir . $id . ".dat";
header ("Content-Type: application/octet-stream"); 
header ("Content-Disposition: attachment; filename=$filename"); 
readfile($filename); 

This works fine - however, I would like to redirect the browser to another
page once the download is complete (or once it starts). I have tried adding a 

header("Location:next.php")

line to the end of the script above, but it has no effect whatsoever (after
the download is complete, the browser displays an hourglass as though
waiting for something). Do I need to send some kind of "end-of-download"
header...or something else?

Can anyone suggest some possible solutions to this problem?

Please CC a copy of your response to 

[EMAIL PROTECTED] 

as well as the list (as I will be working on this @ home also and do not
have access to the full digest there)

Any help will be much appreciated. TIA,

Vikram Vaswani
--
Sex is like air. It's only a big deal if you can't get any.





Sorry for the repeat posting, but this was send a few weeks ago and we had
no response from the list - perhaps new subscribers to the list will be
interested.

We are a successful web agency based in the UK and are looking for talented
UK-based html and technical developers.

Our company 5e, has progressed from two to almost twenty people over the
last couple of years, working with an excellent client list with well known
brands. We utilise a variety of platforms for development, including an
increasing emphasis on Linux/PHP/MySQL to deliver high-profile web
applications.

Due to continued expansion, we are now looking for in-house permanent
html-ers and technical developers (sorry freelance not possible). We have
excellent facilities, the latest kit and have eventful after-hours socials.
You may even get the opportunity to write for internet magazines when they
ask us to review web sites!

Your core skills will include PHP/Perl, MySQL (or a similar RDBMS), Apache
configuration, and a general enthusiasm for Linux and open-source software.
Knowledge of other languages and platforms (Lasso, Win2K, MacOSX) is also an
advantage.

Take a look at our site <http://www.5emedia.net> to see what we're up to. If
you think you fit the bill, we'd love to hear from you - email us at
<[EMAIL PROTECTED]>.

Best regards,

Paul Tweedy
5emedia Limited

The web development team that walked away with two (count 'em, TWO) BT
eBusiness Innovation Awards!
__________________________________________________
Bedford Heights - Manton Lane - Bedford - MK40 7PA

Tel: 01234 402500 (International: +44 1234 402500)
Fax: 01234 244541

Email: [EMAIL PROTECTED]
www: http://www.5emedia.net
_______________________________________________________
internet sites -  ecommerce - screensavers - multimedia

DISCLAIMER

The opinions expressed in this email are not necessarily the opinion of
5emedia Limited.

The content of this e-mail contains proprietary information which is
confidential and may be legally privileged. It is for the intended recipient
only. If an addressing or transmission error has misdirected this email,
please notify the author by replying to this email and informing them of
this matter as soon as possible. If you are not the intended recipient you
must not use, disclose, distribute, copy, print or rely in any way on the
information in this email. In addition, you must erase all of the
information contained in this email immediately after notifying the author.





Okay....

ob_start ("ob_gzhandler") is a very cool thing to use. At least when
you write _to much_ code like I do. And it works perfectly....

....most of the time, i.e.

I've got this problem:

My pages start with the gzhandler (see above) to decrease the amount
of data that should be transferred. Nicest thing is that if your
browser doesn't support any compression, the data will be sent
uncompressed. Very cool. But then Netscape... It understand gzip.
Yes it does but they forgot something. At the point that you want to
print out the page your looking at in your browser, Netscape forgets
to unzip the data. Guess what... a whole lot of crap on the paper.
Well not very much ofcourse _BECAUSE IT'S COMPRESSED!!!_

I don't realy like this bug and I'm wondering if someone maybe has
some solution for this....


RenzE




On Sat, Mar 24, 2001 at 09:06:36PM -0500, Mauricio Junqueira wrote:
> Hi,
> I believe I am missing some configuration regarding my apache becouse 
> I can only get php to work inside a file .php. 
> If my page extension is .html, nothing happend with the php script; but 
> just changing from .html to .php everthing works fine.
> Anyone? Anyhelp?

If you ar using a *nix system, you probably need to add:

AddType application/x-httpd-php .html

to you httpd.conf

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
/* we have tried to make this normal case as abnormal as possible */
             -- Larry Wall in cmd.c from the perl source code




I've check the other articles and came up with the following:
1- take out the extension, html or php, inside the links in way
that I can change from .html to .php and vice-versa without worrie
to change all links.
2- and to add the .html to httpd.conf in order to all files to be parsed.

Not too beatifull but so far, I'm a litte too short in html/php and this is
going to help me to finish the job.

At first, I though that the apache it itself called php and it finds the 
escape sequence, not that the entirely file has to be parsed by php.

Thanks for your replays

Mauricio Junqueira 


wrote:

> Hi,
> I believe I am missing some configuration regarding my apache becouse
> I can only get php to work inside a file .php.
> If my page extension is .html, nothing happend with the php script; but
> just changing from .html to .php everthing works fine.
> Anyone? Anyhelp?
> 
> I'm new over php. I usually do stuff with Delphi/Builder and now I'm
> moving to web oriented programs.
> 
> Thanks for looking!
> 
> Mauricio Junqueira
> Mautec Corp.
> 





All,

I'm pleased to announce two initiatives at Great Bridge aimed at
improving the integration of PostgreSQL and PHP, and some exciting
stuff that we're doing as a company to get behind PHP more fully.

First, Great Bridge is partnering with Zend Technologies to include
a fully-integrated installation of PHP in an upcoming Web
developer's edition of Great Bridge PostgreSQL.  In addition to
professionally-supported PHP (and other open source Web
technologies), we'll also give our customers the chance to purchase
Zend's value-added PHP tools (IDE, cache, encoder, and more...)
Zend  is a major contributor to the open source PHP effort, and
we're very happy to be working with them.

Secondly, we're pleased to announce that three PHP core developers
have joined the Great Bridge advisory committee- Rasmus Lerdorf, the
creator of PHP; Thies Arntzen, an expert in PHP-database
connectivity; and Sascha Schumann, PHP author and provider of
high-performance webchat solutions.  Rasmus, Thies, and Sascha will
work with us to help craft our Web developer products and services,
including (of course) a fully optimized free download package.
We'll be putting some development energy into the PHP-Postgres
interface, and look for other ways the two open source projects can
help each other.

We're also very interested in hacker feedback as to what you'd like
to see in a software and service package that revolves around the
Web development "stack."  What kind of tools, building blocks, and
applications would you like to see commercially supported?  Don't be
shy - please email me at [EMAIL PROTECTED] with any suggestions.
I'll also be at ApacheCon in a few weeks if you'd like to get
together in person.

Thanks,
Ned

--
----------------------------------------------------
Ned Lilly                     e: [EMAIL PROTECTED]
Vice President                w: www.greatbridge.com
Evangelism / Hacker Relations        v: 757.233.5523
Great Bridge, LLC                    f: 757.233.5555





Hi folks

I am trying to create a constant name dynamically and then get at the
value.

// We set up the constant
define( CONSTANT_1 , "Some value" ) ;

// Later we try to use it dynamically ...
$constant_number = 1 ;
$constant_name = ( "CONSTANT_" . $constant_number ) ;

// We try to assign the constant value to a variable...
$constant_value = $constant_name ;

But we find that $constant value still contains the NAME of the
constant, and not the VALUE.

Am I misunderstanding something? Is there any way that this can be done?

Thanks

Geoff Caplan
Caplan Associates






You need another level of indirection. Try:

$constant_value = $$constant_name ;


-----Original Message-----
From: Geoff Caplan [mailto:[EMAIL PROTECTED]]
Sent: 27 March 2001 14:19
To: PHP General List
Subject: [PHP] Dynamic constant names


Hi folks

I am trying to create a constant name dynamically and then get at the
value.

// We set up the constant
define( CONSTANT_1 , "Some value" ) ;

// Later we try to use it dynamically ...
$constant_number = 1 ;
$constant_name = ( "CONSTANT_" . $constant_number ) ;

// We try to assign the constant value to a variable...
$constant_value = $constant_name ;

But we find that $constant value still contains the NAME of the
constant, and not the VALUE.

Am I misunderstanding something? Is there any way that this can be done?

Thanks

Geoff Caplan
Caplan Associates



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]







In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Geoff Caplan) wrote:

> I am trying to create a constant name dynamically and then get at the
> value.
> 
> // We set up the constant
> define( CONSTANT_1 , "Some value" ) ;
> 
> // Later we try to use it dynamically ...
> $constant_number = 1 ;
> $constant_name = ( "CONSTANT_" . $constant_number ) ;
> 
> // We try to assign the constant value to a variable...
> $constant_value = $constant_name ;
> 
> But we find that $constant value still contains the NAME of the
> constant, and not the VALUE.
> 
> Am I misunderstanding something? Is there any way that this can be done?

Your error_reporting level must not be all the way up to E_ALL, because 
when I tried your code PHP reported errors that might have helped you solve 
the problem.  Try this:

// We set up the constant
define("CONSTANT_1", "Some value" ) ; //constant name must be in quotes

// Later we try to use it dynamically ...
$constant_number = 1 ;
eval( "echo CONSTANT_$constant_number;" ) ;//tell PHP to treat the name as 
code not as a text string

-- 
CC




Hi ppl,

I have been thinking of using PHP to make a ToDo/task list type of
application. I am looking for something different from the usual
Personal Information Managers (PIMs) - they are oriented more towards
appointments than tasks.

Does anybody know of any ongoing (preferably open source) projects in
PHP of a similar nature?

I would like to be able to open/create a task, maybe assign it to
somebody, be able to add comments to it, have user authentication and
the most desired (though uncommon) feature is: a change log. Through a
change log, I want to be able to trace the who and when of comments
added to a task etc.

Any help/pointers will be highly appreciated. Thanks,

--
Regards,
Harshdeep Singh Jawanda.






I think Sourceforge uses something like what you are talking about.

Check it out :

http://www.sourceforge.net 

----- Original Message ----- 
From: "Harshdeep S Jawanda" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 9:29 PM
Subject: [PHP] A ToDo/ task list


> Hi ppl,
> 
> I have been thinking of using PHP to make a ToDo/task list type of
> application. I am looking for something different from the usual
> Personal Information Managers (PIMs) - they are oriented more towards
> appointments than tasks.
> 
> Does anybody know of any ongoing (preferably open source) projects in
> PHP of a similar nature?
> 
> I would like to be able to open/create a task, maybe assign it to
> somebody, be able to add comments to it, have user authentication and
> the most desired (though uncommon) feature is: a change log. Through a
> change log, I want to be able to trace the who and when of comments
> added to a task etc.
> 
> Any help/pointers will be highly appreciated. Thanks,
> 
> --
> Regards,
> Harshdeep Singh Jawanda.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 






>Does anybody know of any ongoing (preferably open source) projects in
>PHP of a similar nature?

Seen something on www.php.net just click links and projects.

Bye,



B.





Hi folks

I had 2 suggestions from the list:

1) indirection - $constant_value = $$constant_name ;

I had already tried this, but couldn't get it to work. Unless I am
missing something it just gives an "Undefined Variable" error.

2) eval("\$constant_value = $constant_name;") ;

This does work. Thanks Paul!

Geoff Caplan






Hi,
is there any comapany (like freeservers.com and geocities.com)give a
free web space and supporting PHP/MySQL.
Thanks
--
Best Regards
Alaiddin Tayeh;
Webmaster
Palestinian Internet Services
WWW.P-I-S.COM
Tel: +97272843197
Fax: +97272843377






Hi,
The adress is:
www.f2s.com

Rosen Marinov


"Alaiddin Tayeh" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
> is there any comapany (like freeservers.com and geocities.com)give a
> free web space and supporting PHP/MySQL.
> Thanks
> --
> Best Regards
> Alaiddin Tayeh;
> Webmaster
> Palestinian Internet Services
> WWW.P-I-S.COM
> Tel: +97272843197
> Fax: +97272843377
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Warning: Undefined index: make in C:\PHP\Test_Scripts\testdb3.php on line 16

Warning: Undefined variable: user in C:\PHP\Test_Scripts\testdb3.php on line
5
etc.




hi anyangwe,

either define the variables or do what most people do and turn down error
reporting.  see :

  Reporting Errors                                            :
  -------------------------------------------------------------
  http://www.php.net/manual/en/phpdevel-errors.php

pay special attention to E_NOTICE.  for example, the following should give
a similar errors with E_NOTICE on :

  print $array[index]  // Always use quotes, looks for static variable
                       // named 'index' first.  'make' in your case.
                       // sidenote: something like $array[4] is good.

  if ($user == '')     // Use isset or empty or something similar.

  print $notset;       // ""

  if ($sumbit)         // "" or don't depend on submit buttons.

messing with empty variables is okay but use quotes around array index.
always.  except when index is a number (not associative).  it works
without but having php look for static variables first wastes energy and
will cause unexpected results if it happens to exist.

this is set in php.ini through error_reporting setting and also the
following function has useful information within it :

  error_reporting -- set which PHP errors are reported        :
  -------------------------------------------------------------  
  http://www.php.net/manual/en/function.error-reporting.php

anyone have more information to share?  please do.

warm regards,

philip



On Tue, 27 Mar 2001, Anyangwe, Tanwani wrote:

> Warning: Undefined index: make in C:\PHP\Test_Scripts\testdb3.php on line 16
> 
> Warning: Undefined variable: user in C:\PHP\Test_Scripts\testdb3.php on line
> 5
> etc.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





In order to use URLs without ? and &, there has to be some re-configuration 
in Apache, correct?  So somebody who didn't have access to httpd.conf 
couldn't use this methodology?  Or if this is completely incorrect, where 
can I find more info on implementing it strictly in PHP?

Joseph E. Sheble
[EMAIL PROTECTED]
========================
Wizaerd's Realm
http://www.wizaerd.com





In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Joe Sheble aka Wizaerd) wrote:

> In order to use URLs without ? and &, there has to be some re-configuration 
> in Apache, correct?  So somebody who didn't have access to httpd.conf 
> couldn't use this methodology?  Or if this is completely incorrect, where 
> can I find more info on implementing it strictly in PHP?

Apache allows use of urls without "?" and "&" right out of the box.  That's 
just a URI without an optional query string: <http://www.php.net>, for 
example.   I'm guessing you want to use URLs that *do have a query string 
and transform them into ones that don't: 
<http://www.php.net/find_stuff.php?query=foo&method=bar> becoming 
<http://www.php.net/find_stuff/foo/bar/>, right?

You can use an .htaccess file to direct Apache to rewrite URLs as long as 
mod_rewrite is installed.  See 
<http://httpd.apache.org/docs/misc/rewriteguide.html> for a detailed 
tutorial.

For a how-to on implementing this in PHP, check out some of the tutorial 
sites like phpbuilder.com,weberdev.com, webmonkey.com, etc.

-- 
CC




Check out this post :

  http://marc.theaimsgroup.com/?l=php-general&m=98555149708325

The first two tutorials should help.  Btw, no reconfigurations are 
required.

Regards,

Philip

On Tue, 27 Mar 2001, Joe Sheble aka Wizaerd wrote:

> In order to use URLs without ? and &, there has to be some re-configuration 
> in Apache, correct?  So somebody who didn't have access to httpd.conf 
> couldn't use this methodology?  Or if this is completely incorrect, where 
> can I find more info on implementing it strictly in PHP?
> 
> Joseph E. Sheble
> [EMAIL PROTECTED]
> ========================
> Wizaerd's Realm
> http://www.wizaerd.com
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





thanx, I'll be looking these over vigarously...

At 05:11 PM 3/27/01 +0000, Philip Olson wrote:
>Check out this post :
>
>   http://marc.theaimsgroup.com/?l=php-general&m=98555149708325
>
>The first two tutorials should help.  Btw, no reconfigurations are
>required.
>
>Regards,
>
>Philip
>
>On Tue, 27 Mar 2001, Joe Sheble aka Wizaerd wrote:
>
> > In order to use URLs without ? and &, there has to be some 
> re-configuration
> > in Apache, correct?  So somebody who didn't have access to httpd.conf
> > couldn't use this methodology?  Or if this is completely incorrect, where
> > can I find more info on implementing it strictly in PHP?
> >
> > Joseph E. Sheble
> > [EMAIL PROTECTED]
> > ========================
> > Wizaerd's Realm
> > http://www.wizaerd.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]





I am trying to find a file editor / file management tool written in php 
something like the file manager used by the old geocities now yahoo public 
web servers. ANyone seen something like this, or done something like this??


Chris Moewes
http://phpusergroups.com




In perl the code to extract browser info is:
$length = $ENV{'HTTP_USER_AGENT'};

What is the equivalent code in PHP.

Thanks








print $HTTP_USER_AGENT; // the variable is already in the global scope.

also $ua = getenv('HTTP_USER_AGENT');

Most variables are automatically made a part of the environment in a PHP
script. It's one of the ways PHP makes scripting easier.

The online manual is invaluable for this type of info. http://www.php.net/

Also, write a short script and run it as so:
<? phpinfo(); ?>
You'll see a myriad of variables and their values. It's also handy for
debugging. You can include phpinfo() anywhere to see the output values of
your script.

Matt Friedman



----- Original Message -----
From: "Costas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 8:01 AM
Subject: [PHP] Environment extract


> In perl the code to extract browser info is:
> $length = $ENV{'HTTP_USER_AGENT'};
>
> What is the equivalent code in PHP.
>
> Thanks
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>





when i try printing

print $HTTP_USER_AGENT;

I get the error message  Undefined variable: HTTP_USER_AGENT

have i missed a declaration of some sort or something else?

thanks

""Matt Friedman"" <[EMAIL PROTECTED]> wrote in message
002701c0b6d8$88abb740$03284d18@mattq3h8budilr">news:002701c0b6d8$88abb740$03284d18@mattq3h8budilr...
> print $HTTP_USER_AGENT; // the variable is already in the global scope.
>
> also $ua = getenv('HTTP_USER_AGENT');
>
> Most variables are automatically made a part of the environment in a PHP
> script. It's one of the ways PHP makes scripting easier.
>
> The online manual is invaluable for this type of info. http://www.php.net/
>
> Also, write a short script and run it as so:
> <? phpinfo(); ?>
> You'll see a myriad of variables and their values. It's also handy for
> debugging. You can include phpinfo() anywhere to see the output values of
> your script.
>
> Matt Friedman
>
>
>
> ----- Original Message -----
> From: "Costas" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, March 27, 2001 8:01 AM
> Subject: [PHP] Environment extract
>
>
> > In perl the code to extract browser info is:
> > $length = $ENV{'HTTP_USER_AGENT'};
> >
> > What is the equivalent code in PHP.
> >
> > Thanks
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






On 25 Mar 2001 20:25:47 -0800 impersonator of
[EMAIL PROTECTED] (David Robley) planted &I saw in
php.general:

>On Mon, 26 Mar 2001 13:20, Erick Papadakis wrote:
>> hi david,
>>
>> thanks for the note. ok, here is what i want to do. i
>> want my users to upload WORD, XLS, PPT and PDF files.
>> when they upload, i store these files in the temp
>> directory, grab the text from them, and then put it
>> into my database for later searching. i dont care
>> about the formatting, i only care about the text
>> because i need the keywords later for searching.
>>
>> can i run some sort of a parser on the server side
>> like the wvware.com's word parser and just call it
>> through php? i have not been able to figure out how to
>> do this using php.
>>
>> i would really appreciate any ideas and suggestions!
>>
>> thanks/erick
>
>OK - do you have the relevant parsers? There are specific (Unix) tools 
>available for PDF (pdftotext or acrobat reader) and Word; I mentioned 
>some of that in an earlier mail. For Excel you could probably use (Unix 
>again) just the Unix command strings to get the text - same might work 
>for Powerpoint but if some dipstick has created a graphics-only 
>presentation you won't get much that's useful.
>
>As I mentioned previously, you'll probably want to run the parser[s] from 
>PHP using one of the Program execution functions; exec, system or the 
>backtick operator should do what you want. How you capture the output 
>will of course depend on how the output is delivered - see the docs for 
>the particular parser.
>
>None of the above is probably relevant if your server is Windows.
>
Excuse me for entering, but I just successfully run pdftotext (the latest
binary) from php exec() on my personal Windows95. The only inconvinience
is that the capture of output, looks like, is not designed for this tool.
Have to put up with output in the file:-(

Regards,
--
LeoN     to  e-mail: cut  "auto_no." if present. 
(.±.)  ` to think - is to speak quietly,  to speak - is to think aloud`
 \~/     
My posted articles archive: http://leo.portland.co.uk/doc00.htm





I, i'm a little new to PHP.

I'm sorry if this question has already be answerd, but i have i have
searched the list, and i have not found any arcticle about it.

My question is:
    How do i delete a message from a POP server, using  PHP functions?

I have tried, imap_setflag_full, imap_delete, but no luck.

Can any one point me to some solution?

If possible, i dont want to dig into the POP protocol.

Thanks.
Miguel Carvalho





Hi

I need the code, for protecting the dir by password.


Thanks


Marisol Díaz E.





Don't you mean..

http://httpd.apache.org/docs/mod/mod_auth.html

or do you want to do this with php headers?

-----Original Message-----
From: Marisol Díaz E. [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 27, 2001 9:03 AM
To: PHP General
Subject: [PHP] password


Hi

I need the code, for protecting the dir by password.


Thanks


Marisol Díaz E.






Dear Friends

Before all, Thank you Joe, the ar package was the solution and was located
at the same place that you told me.
Now ,after making and installing all, PHP doesn´t work. I followed this
process:

./configure --with-mysql --with-apxs=/usr/apache/bin/apxs
make
make install

I have had a little problem with make install because it doesn´t find
httpd.conf. I have posted it in a folder that could find and locate the
change in the folder that originally was. Now the httpd.conf loads the
module of PHP, the module is located where httpd.conf says, there is a
PHP.INI where should be, but a simple test page doesn´t work. I have looked
at httpd.conf and found some sections that define Directories where could
follow a script secuence. I must generate a section for my PHP test folder?
Is there another special configuration? I´m using Apache 1.3.9

Thank you all.
Emiliano.






I am writing a script, actually modifying PhPSysInfo to include the top
processes used on a machine.  So far, no matter what I do, I can only get
it to work via the command line.  I get a blank screen when trying it via
the browser:

Tried this:

<?php
$data = `ps auxwww`; echo nl2br($data);      
?>

------------------------------------------------
and this:

<TT> 
<PRE> 
<?php 
exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top); 
while (list(,$line) = each($top)){ 
 echo $line, "<BR>\n"; 
  } 
 ?> 
</PRE> 
</TT>

I used sed to remove control characters..etc.  Again, both examples above
work via the command line, but not via a browser.  User "www" is able to
run this command as well, so it's not permissions.  Help?!  :)





nobody has execute permission on ps?

Probably quite the opposite, your webserver user doesn't have execute
permission on ps, so there is no execution or return value.

"Steven Shepherd" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am writing a script, actually modifying PhPSysInfo to include the top
> processes used on a machine.  So far, no matter what I do, I can only get
> it to work via the command line.  I get a blank screen when trying it via
> the browser:
>
> Tried this:
>
> <?php
> $data = `ps auxwww`; echo nl2br($data);
> ?>
>
> ------------------------------------------------
> and this:
>
> <TT>
> <PRE>
> <?php
> exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top);
> while (list(,$line) = each($top)){
>  echo $line, "<BR>\n";
>   }
>  ?>
> </PRE>
> </TT>
>
> I used sed to remove control characters..etc.  Again, both examples above
> work via the command line, but not via a browser.  User "www" is able to
> run this command as well, so it's not permissions.  Help?!  :)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Bad example (changed to ps and it works actually..but i dont want 'ps', I
want 'top').  Ran top using su to the user 'www' from the command line and
was able to run it fine.

On Tue, 27 Mar 2001, Joe Brown wrote:

> Date: Tue, 27 Mar 2001 12:35:08 -0500
> From: Joe Brown <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] "DF" output
> 
> nobody has execute permission on ps?
> 
> Probably quite the opposite, your webserver user doesn't have execute
> permission on ps, so there is no execution or return value.
> 
> "Steven Shepherd" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I am writing a script, actually modifying PhPSysInfo to include the top
> > processes used on a machine.  So far, no matter what I do, I can only get
> > it to work via the command line.  I get a blank screen when trying it via
> > the browser:
> >
> > Tried this:
> >
> > <?php
> > $data = `ps auxwww`; echo nl2br($data);
> > ?>
> >
> > ------------------------------------------------
> > and this:
> >
> > <TT>
> > <PRE>
> > <?php
> > exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top);
> > while (list(,$line) = each($top)){
> >  echo $line, "<BR>\n";
> >   }
> >  ?>
> > </PRE>
> > </TT>
> >
> > I used sed to remove control characters..etc.  Again, both examples above
> > work via the command line, but not via a browser.  User "www" is able to
> > run this command as well, so it's not permissions.  Help?!  :)
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 





Well, that's a whole different ballpark.

do man top see if it has a batch mode option

With the top on my linux box:
$ top -b

"Steven Shepherd" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Bad example (changed to ps and it works actually..but i dont want 'ps', I
> want 'top').  Ran top using su to the user 'www' from the command line and
> was able to run it fine.
>
> On Tue, 27 Mar 2001, Joe Brown wrote:
>
> > Date: Tue, 27 Mar 2001 12:35:08 -0500
> > From: Joe Brown <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] "DF" output
> >
> > nobody has execute permission on ps?
> >
> > Probably quite the opposite, your webserver user doesn't have execute
> > permission on ps, so there is no execution or return value.
> >
> > "Steven Shepherd" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I am writing a script, actually modifying PhPSysInfo to include the
top
> > > processes used on a machine.  So far, no matter what I do, I can only
get
> > > it to work via the command line.  I get a blank screen when trying it
via
> > > the browser:
> > >
> > > Tried this:
> > >
> > > <?php
> > > $data = `ps auxwww`; echo nl2br($data);
> > > ?>
> > >
> > > ------------------------------------------------
> > > and this:
> > >
> > > <TT>
> > > <PRE>
> > > <?php
> > > exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top);
> > > while (list(,$line) = each($top)){
> > >  echo $line, "<BR>\n";
> > >   }
> > >  ?>
> > > </PRE>
> > > </TT>
> > >
> > > I used sed to remove control characters..etc.  Again, both examples
above
> > > work via the command line, but not via a browser.  User "www" is able
to
> > > run this command as well, so it's not permissions.  Help?!  :)
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






I had a form with just with one button, the action is a PHP file. And when
I hit "enter" the button (submit) form action was done.


Then I put other button (change)  on this form, and now when I hit enter,
beside the
"pressed" button is the second one (I want that when I hit "enter" the
submit button is pressed), the PHP stops and the screen of the IE5 stays
blank.

What I should do to solve this problem?

thanks.

Augusto





Hi,

i'm sorry but I don't quite get what you mean. Which button is
pressed. or post the code.

Johannes

"Augusto Cesar Castoldi" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
Pine.GSO.4.10.10103271417160.12546-100000@venus">news:Pine.GSO.4.10.10103271417160.12546-100000@venus...
> I had a form with just with one button, the action is a PHP file. And when
> I hit "enter" the button (submit) form action was done.
>
>
> Then I put other button (change)  on this form, and now when I hit enter,
> beside the
> "pressed" button is the second one (I want that when I hit "enter" the
> submit button is pressed), the PHP stops and the screen of the IE5 stays
> blank.
>
> What I should do to solve this problem?
>
> thanks.
>
> Augusto
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi Augusto,

Submit buttons aren't that special, they just send a name=value pair.     
Doing something like this :

If the following is pressed, if ($action == 'edit') will return true.    
  
  <input type="submit" name="action" value="edit">
  
If the following is pressed, if ($action == 'new')  will return true.     
  
  <input type="submit" name="action" value="new">

See?  Regarding what gets sent while pressing the enter key, not exactly  
sure on that, you can use javascript to help determine.  Check out :

  http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html

And do some google searches for terms such as "enter, key, form, submit,
javascript, html" and some others.

And here's a thread that will help, some ideas within are better then
others :
  
  [PHP] multiple submit buttons                                     :
  -------------------------------------------------------------------
  http://marc.theaimsgroup.com/?l=php-general&m=97513765915454&w=2

It's a very lengthy thread :-)


regards,

Philip Olson
http://www.cornado.com/


On Tue, 27 Mar 2001, Augusto Cesar Castoldi wrote:

> I had a form with just with one button, the action is a PHP file. And when
> I hit "enter" the button (submit) form action was done.
> 
> 
> Then I put other button (change)  on this form, and now when I hit enter,
> beside the
> "pressed" button is the second one (I want that when I hit "enter" the
> submit button is pressed), the PHP stops and the screen of the IE5 stays
> blank.
> 
> What I should do to solve this problem?
> 
> thanks.
> 
> Augusto
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 






Hello, this is my first attempt to query and print a result coming from a 
database, in this case interbase6.

I got the following error: InterBase: Dynamic SQL Error SQL error code = 
-504 Cursor unknown in maingeral.htm on line 8

Here's the code: 
<? include("php/header.php");
 
 ibase_pconnect(BANCO,DBUSER,DBPASSWD)
    or die ("<script language='javaScript'> alert('" . ibase_errmsg() . 
"'); </script>");
 
  $stmt     = "select count(*) from soldcars";
  $query    = ibase_query($stmt) or die ("<script 
language='javaScript'>alert('" . ibase_errmsg() . "'); </script>");
  $result   = ibase_fetch_row($query);    // THIS IS LINE 8
  $TOTSOLD  = $result;
  ibase_free_result($query);
 
  $stmt    ="select Total from monthsold";
  $query   = ibase_query($stmt) or die ("<script 
language='javaScript'>alert('" . ibase_errmsg() . "'); </script>");
  $result  = ibase_fetch_row($query);
  $TOTMONTH = $result[0];
  ibase_free_result($query);
 
  $stmt    = "select count(*) from deal where available = 1";
  $query   = ibase_query($stmt) or die ("<script 
language='javaScript'>alert('" . ibase_errmsg() . "'); </script>");
  $result  = ibase_fetch_row($query);
  $TOTAVAIL= $result[0];
  ibase_free_result($query);
 
  ibase_commit();
  ibase_close();
?>

I have 3 query blocks. the result shows the contents of 2nd and 3rd block 
variable:TOTMONH and TOTAVAIL but nothing from the first block, TOTSOLD.
If I comment the first block entirely, I got the same error 
(ibase_fetch_row line) on the 2nd block and the only result that appear is 
from the 3rd block.

What I am doing wrong?


I've put this statement before the first block to see if $query was empty 
but the statement return true and the same error occured in the 
ibase_fetch_row line and the echo $query shows everytime Resource id#4

 if (isset($query)) {
  echo($query);
  $result   = ibase_fetch_row($query);
  $TOTSOLD  = $result;
  ibase_free_result($query);
  } else echo "query not set";

If just comment the following lines, everything works.... Please help... 
I'm getting nut !!

<? include("php/header.php");
 
 ibase_pconnect(BANCO,DBUSER,DBPASSWD)
    or die ("<script language='javaScript'> alert('" . ibase_errmsg() . 
"'); </script>");
 
  $stmt     = "select count(*) from soldcars";
  $query    = ibase_query($stmt) or die ("<script 
language='javaScript'>alert('" . ibase_errmsg() . "'); </script>");
//  $result   = ibase_fetch_row($query);
//  $TOTSOLD  = $result[0];
//  ibase_free_result($query);
$TOTSOLD ="COMMENTED";
 
  $stmt    ="select Total from monthsold";
  $query   = ibase_query($stmt) or die ("<script 
language='javaScript'>alert('" . ibase_errmsg() . "'); </script>");
  $TOTMONTH = $result[0];
  ibase_free_result($query);
 
  $stmt    = "select count(*) from deal where available = 1";
  $query   = ibase_query($stmt) or die ("<script 
language='javaScript'>alert('" . ibase_errmsg() . "'); </script>");
  $result  = ibase_fetch_row($query);
  $TOTAVAIL= $result[0];
  ibase_free_result($query);
 
  ibase_close();
?>






Since ibase_query returns true if the query succeeds I've tried this, but 
with the same problem with ibase_fetch_row:

  $stmt     = "select count(*) from soldcars";
  if ($query    = ibase_query($stmt) or die ("<script 
language='javaScript'>alert('" . ibase_errmsg() . "'); </script>")){
    $result   = ibase_fetch_row($query);
    $TOTSOLD  = $result[0];
    ibase_free_result($query);}




Hi:

I am trying to set up a simple script that will verify that all the blanks 
in a form have been filled out and then submit that to mySQL. If the form 
has not been completely filled out I want it to redirect them back to the 
original form. I know that the mySQL part of the script works, but I am 
unable to get the part of the script that checks the form input to see if 
everything was filled out to work. It seems to bypass this part of the 
script and enter the info into mySQL . Here is what I have so far:


If (($fname == " ") || ($lname == " "))
         {
                 header("Location: http://callook.org/member_joinform.html");
}else{
         $db = mysql_connect("localhost", "name", "password");
         mysql_select_db("dBase",$db);
         $sql = "INSERT INTO 
members 
(fname,lname,address,city,state,zip,country,email,username,password) 
VALUES 
('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user 
name','$password')";
         $result = mysql_query($sql);
}

I hope the formatting comes out right. I am sure it is something simple I 
have missed but I have tried the script several different ways and nothing 
seems to work. Thank you for any help.

Sincerely,

Louis Brooks

BTW: Is there a faq for this list before I go asking anymore questions?




This code is checking if $fname and $lname are equal to a single blank
character. Is this what you want? My guess is you really want

        if(($fname == "") || ($lname == ""))

Another way to write this is

        if( (!$fname) || (!$lname) )

Kirk


> -----Original Message-----
> From: Louis Brooks [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 27, 2001 11:34 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Simple If-else statement
> 
> 
> Hi:
> 
> I am trying to set up a simple script that will verify that 
> all the blanks 
> in a form have been filled out and then submit that to mySQL. 
> If the form 
> has not been completely filled out I want it to redirect them 
> back to the 
> original form. I know that the mySQL part of the script 
> works, but I am 
> unable to get the part of the script that checks the form 
> input to see if 
> everything was filled out to work. It seems to bypass this 
> part of the 
> script and enter the info into mySQL . Here is what I have so far:
> 
> 
> If (($fname == " ") || ($lname == " "))
>          {
>                  header("Location: 
http://callook.org/member_joinform.html");
}else{
         $db = mysql_connect("localhost", "name", "password");
         mysql_select_db("dBase",$db);
         $sql = "INSERT INTO 




Hi,

if ($name == " ") { .... checks for a space in $name.
"empty" is either if (§name == "") without a free space
between "" or you could do it with empty($mane)
if (empty($name)) is true if it is empty (who would
have thought this?)

Johannes

"Louis Brooks" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi:
>
> I am trying to set up a simple script that will verify that all the blanks
> in a form have been filled out and then submit that to mySQL. If the form
> has not been completely filled out I want it to redirect them back to the
> original form. I know that the mySQL part of the script works, but I am
> unable to get the part of the script that checks the form input to see if
> everything was filled out to work. It seems to bypass this part of the
> script and enter the info into mySQL . Here is what I have so far:
>
>
> If (($fname == " ") || ($lname == " "))
>          {
>                  header("Location:
http://callook.org/member_joinform.html");
> }else{
>          $db = mysql_connect("localhost", "name", "password");
>          mysql_select_db("dBase",$db);
>          $sql = "INSERT INTO
> members
> (fname,lname,address,city,state,zip,country,email,username,password)
> VALUES
>
('$fname','$lname','$address','$city','$state','$zip','$country','$email','$
user
> name','$password')";
>          $result = mysql_query($sql);
> }
>
> I hope the formatting comes out right. I am sure it is something simple I
> have missed but I have tried the script several different ways and nothing
> seems to work. Thank you for any help.
>
> Sincerely,
>
> Louis Brooks
>
> BTW: Is there a faq for this list before I go asking anymore questions?
>






Heyzz Dude!
I've got a problem with dbase, do you think you can help me?
http://www.ripwares.com/~np2k/norway-warez/admin/create.php
here's the script:
-------------------------
<?
$dbname = "tedst.dbf";
$def =
    array(
        array("date",     "D"),
        array("name",     "C",  50),
        array("age",      "N",   3, 0),
        array("email",    "C", 128),
        array("ismember", "L")
    );
if (!dbase_create ($dbname, $def))
    print "<strong>Error!</strong>";
?>
-----------------------
try this, you'll get:
Fatal error: Call to undefined function: dbase_create() in 
/home/sites/site1/users/np2k/web/norway-warez/admin/create.php on line 16

Do you know the problem, I also saw your ad on php.net about dbase
"./configure --enable-dbase". 
Where to put this?

Thanks in acvance
{KiKk0}





Hello All,

Apachecon is next week and I am preparing to request a BOF (Birds Of A
Feather) for the PHP community.  It will be an hour long session that is
basically an open forum for users of PHP to meet and talk about PHP.

What I would like from all you out there is a list of possible topics to be
used as a starting point for discussion.

Please just email them back to me as I am not on this list.

Brian Moon
------------------------------------------
dealnews.com, Inc.
Makers of dealnews & dealmac
http://dealnews.com/ | http://dealmac.com/

Look for my presentation at ApacheCon 2001.
"Caching Dynamic Web Content to Increase Dependability and Performance"
http://www.apachecon.com/






Just a note to say that I have written a couple of functions, to calculate to the 
standard deviation of a given Integer array and to calculate a 'Weighted Mean'.

If anybody is interested just let me know,

Thanks

Robert


Reply via email to