php-general Digest 21 Jul 2003 05:39:40 -0000 Issue 2188

Topics (messages 155983 through 156013):

Re: Forms and PHP
        155983 by: Curt Zirzow

Re: list server problem
        155984 by: Jason Wong
        155989 by: Andu

Re: mail function
        155985 by: Curt Zirzow
        155986 by: Jason Wong
        155996 by: Peda

Re: Jumping between HTTP and HTTPS
        155987 by: Jason Wong
        155988 by: John W. Holmes
        155991 by: Curt Zirzow
        155994 by: John Manko
        155995 by: John W. Holmes

Re: Mail From option in PHP.ini
        155990 by: Lowell Allen
        155992 by: Curt Zirzow

Serial Port and PHP Login
        155993 by: Dev

Re: Auto session timeout
        155997 by: Hardik Doshi
        156001 by: John W. Holmes

Re: redirecting to a url..
        155998 by: Louie Miranda
        156008 by: Ow Mun Heng

Re: Still problem with files
        155999 by: Beauford.2005

Error - when trying to connect to postgresql
        156000 by: Paul Tun

Howto list Mysql Table Headers using PHP
        156002 by: Ow Mun Heng
        156003 by: John W. Holmes
        156005 by: Ow Mun Heng

on preview, loosing data using post/session..
        156004 by: Louie Miranda

POSIX seteuid and similar
        156006 by: David Goodchild
        156007 by: David Goodchild
        156012 by: Curt Zirzow

Re: Something to watch look for when getting HEADER Warnings
        156009 by: Ow Mun Heng

computing 2 value and adding it..
        156010 by: Louie Miranda
        156011 by: Ralph Guzman

Re: running a php script in /cgi from /web
        156013 by: Tom Rogers

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
* Thus wrote Yasir Malik ([EMAIL PROTECTED]):
> I'm working with forms using PHP and HTML.  I've noticed that there is a
> limit of the length of a URL that can sent to browser (I'm passing many
> many things as arguments across pages).  Is there a way to get across the
> limit or am I doing something wrong?
> Yasir

using a form POST has virtually unlimited amount data that can be sent.

if you have to keep passing the data around, I would suggest to storing
the data in a session of some sort then just passing the session
variable around in the urls.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
On Monday 21 July 2003 00:39, Andu wrote:

> > The executive summary is that there is nothing to be fixed. If you're
> > using a  less than adequate mail client which does not understand the
> > mailing list  info contained in the headers then you should either change
> > clients or, even  easier, just add the mailing list address into your
> > address book.
>
> Nonsense, all clients understand reply-to if it's there and that is the
> obligation of the sender which in this case is the list server not my
> client.

Please read the archives.

The list is not the originator/sender of any particular message and hence 
should not be the subject of any reply or reply-to. Therefore it follows that 
it is not the list's responsibility to set a reply-to header pointing to 
itself.

It is the mail client's job (or the list subscriber to be more precise) to 
direct a reply to the appropriate place and not the list's responsibility to 
second-guess where a reply should be directed.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Delta: The kids will love our inflatable slides.    -- David Letterman
*/


--- End Message ---
--- Begin Message ---

--On Monday, July 21, 2003 01:34:11 +0800 Jason Wong <[EMAIL PROTECTED]> wrote:

On Monday 21 July 2003 00:39, Andu wrote:

> The executive summary is that there is nothing to be fixed. If you're
> using a  less than adequate mail client which does not understand the
> mailing list  info contained in the headers then you should either
> change clients or, even  easier, just add the mailing list address
> into your address book.

Nonsense, all clients understand reply-to if it's there and that is the
obligation of the sender which in this case is the list server not my
client.

Please read the archives.

There's several thousand emails in there, give me a subject or something. I already attempted to do that but the search only takes 2 words, it looks like and chances I use the relevant ones are low, just spent some time without any relevant success.



The list is not the originator/sender of any particular message and hence should not be the subject of any reply or reply-to. Therefore it follows that it is not the list's responsibility to set a reply-to header pointing to itself.

So what you're saying is that all the lists i've been on in the past 7-8 years were doing it wrong but this one doesn't. The list is not the originator of my message but an inteligent list server knows that the vast majority of the clients want to reply to the list not the originator of the message.



It is the mail client's job (or the list subscriber to be more precise) to direct a reply to the appropriate place and not the list's responsibility to second-guess where a reply should be directed.

So what do I do if I have one account only? Should I keep changing the Reply-To for each email I send so that replies to other unrelated mail don't end up on php list? The list should second-guess members of the list want to reply to the list 99% of the time without being wrong.



-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Delta: The kids will love our inflatable slides. -- David Letterman */


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







Regards, Andu Novac



--- End Message ---
--- Begin Message ---
* Thus wrote Peda ([EMAIL PROTECTED]):
> I put this PHP script on web server:
> 
> <?php if (mail("[EMAIL PROTECTED]", "brati", "peda", "From: Peda")==
> TRUE) print("U redu je"); else print("Greska"); ?>
> 
> But It seems that mail function doesn't work. I don't get any e-mail.
> 
> Can anyone tell me what is wrong.

What does your sendmail_path say in your config, and what OS are you
running.

Read:
http://us2.php.net/mail
and
http://php.net/function.mail

Oh, and your from should contain a valid email too, otherwise it prolly
get bounced to /dev/null

From: "Peda" <[EMAIL PROTECTED]>

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
On Sunday 20 July 2003 23:00, Peda wrote:
> I put this PHP script on web server:
>
> <?php
>  if (mail("[EMAIL PROTECTED]", "brati", "peda", "From: Peda")== TRUE)
> print("U redu je");
>  else
> print("Greska");
> ?>
>
> But It seems that mail function doesn't work. I don't get any e-mail.
>
> Can anyone tell me what is wrong.

Check your php error logs and your mailserver logs.

A good and quick way to check whether mail on your system is working correctly 
is to use error_log() with the mail option.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
What a misfortune to be a woman!  And yet, the worst misfortune is not to
understand what a misfortune it is.
                -- Kierkegaard, 1813-1855.
*/


--- End Message ---
--- Begin Message ---
sendmail_path = /usr/sbin/sendmail
OS is Linux




--- End Message ---
--- Begin Message ---
On Monday 21 July 2003 00:30, Curt Zirzow wrote:
> I'm curious as to why your email has these headers:
>
> References: <[EMAIL PROTECTED]>
> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
> In-Reply-To: <[EMAIL PROTECTED]>
>
> My email program thinks your discussing db sized and how you can get it
> into a variable in php.

That's because:

---------------
You have started a new thread by taking an existing posting and replying to
it while you changed the subject.

That is bad, because it breaks threading. Whenever you reply to a message,
your mail client generates a "References:" header that tells all recipients
which posting(s) your posting refers to. A mail client uses this information
to build a threaded view ("tree view") of the postings.

With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread it has nothing to do with.

Always do a fresh post when you want to start a new thread. To achieve this,
click on "New message" instead of "Reply" within your mail client, and enter
the list address as the recipient. You can save the list address in your
address book for convenience.
---------------

In the above, $you =='john'.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
30. Ooops.  Save your work, everyone.  FAST!

        --Top 100 things you don't want the sysadmin to say
*/


--- End Message ---
--- Begin Message --- Curt Zirzow wrote:

On and advanced note, there are ways to protect a users password on a
normal http connection.  The authentication program I helped developed
and use has the abilty to make a hash of the password on the client side
then send the hash value to the authentication script. The authenication
script never sees the password just verifies the hash.

So, I can't sniff the password, but I can sniff the hash and then send the same one when I want access. This doesn't protect much until the user changes their password and I have to get their new hash.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message ---
* Thus wrote John W. Holmes ([EMAIL PROTECTED]):
> Curt Zirzow wrote:
> 
> >On and advanced note, there are ways to protect a users password on a
> >normal http connection.  The authentication program I helped
> >developed and use has the abilty to make a hash of the password on
> >the client side then send the hash value to the authentication
> >script. The authenication script never sees the password just
> >verifies the hash.
> 
> So, I can't sniff the password, but I can sniff the hash and then send
> the same one when I want access. This doesn't protect much until the
> user changes their password and I have to get their new hash.

The method isn't fool proof.  There other things the authentication
checks for when building the hash. 

User Requests login form:
  1. when the user requests the login page the auth program generates a
     key which is something like md5(rand()).
  2. stores that key in session variable for the next request.

User Submits form:
  3. when the form is submitted a javascipt function takes the key and
     hashes the password with the key (and otherstuff)
  4. the auth program then  looks at the users session stuff finds the
     key that it generated, from when the user first requested the page.
  5. uses the session key and the users password from the database and
     hashes those together.
  6. if they match then the following was true.
            - user currently has the currect session (expires after time)
                        - user currently has the corrrect (psudo secret) key (expires 
after time)
                        - user is from the same ip (optional) 
                        - user had entered the correct password. 
        7. on fail or success, the key is marked as stale (expired). If it
                 failed a new key is generated, and we restart the login form
                 process.

So.. if you followed that and I explained it well enough... 

if you do sniff the hash, the key, and the session.  You will  have to
get your request in before the key becomes stale, otherwise that
information you have is bad.  In most cases the authentication is the
first thing done so we're dealing with micro seconds.

You can check the code out if you want its over on sourceforge
(called DiggerAuth).


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---


You dont need to touch any php code, just modify the html so the
properlinks point to https where needed.


I tried that. However, the session is different when going from 80 to 443.




--- End Message ---
--- Begin Message --- John Manko wrote:



You dont need to touch any php code, just modify the html so the
properlinks point to https where needed.


I tried that. However, the session is different when going from 80 to 443.

You'll have to pass the SID through the form or URL when switching from HTTP to HTTPS.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message ---
> From the php website, it appears that the [EMAIL PROTECTED] can be
> put in the fifth parameter of the mail() function:
> 
> Example 3. Sending mail with extra headers and setting an additional
> command line parameter.
> 
> mail("[EMAIL PROTECTED]", "the subject", $message,
>    "From: [EMAIL PROTECTED]", "[EMAIL PROTECTED]");
> 
> 
> Note: This fifth parameter was added in PHP 4.0.5. Since PHP 4.2.3
> this parameter is disabled in safe_mode and the mail() function will
> expose a warning message and return FALSE if you're trying to use it.

I followed this recent thread with some interest, because I'd like to be
able to set the return-path header for a script that emails to a large list,
which would in turn allow me to identify bounced emails. I'm using a shared
host server, with PHP running as the master account user name, so the
return-path for emails is something like "Return-Path:
<[EMAIL PROTECTED]>". I had accepted that I could not change
the return-path value with PHP, but reading about this fifth parameter
renewed my hope that I could.

I tried adding a fifth parameter to mail() in order to do this, like so:

// fifth mail() parameter to set envelope sender
$cmd_line_param = "[EMAIL PROTECTED]";
mail("$fullname<$email>", $subject, $message, $headers, $cmd_line_param);

This didn't change the return-path header. Perhaps the problem is that I
have no idea what the syntax of the command line parameter is (what the "-f"
does).

Can anyone advise? Is it possible to use this fifth parameter to set the
return-path header, and if so, what's the syntax?

TIA,

--
Lowell Allen


--- End Message ---
--- Begin Message ---
* Thus wrote Lowell Allen ([EMAIL PROTECTED]):
> return-path for emails is something like "Return-Path:
> <[EMAIL PROTECTED]>". I had accepted that I could not change
> the return-path value with PHP, but reading about this fifth parameter
> renewed my hope that I could.
> 
> I tried adding a fifth parameter to mail() in order to do this, like so:
> 
> // fifth mail() parameter to set envelope sender
> $cmd_line_param = "[EMAIL PROTECTED]";
> mail("$fullname<$email>", $subject, $message, $headers, $cmd_line_param);
> 
> This didn't change the return-path header. Perhaps the problem is that I
> have no idea what the syntax of the command line parameter is (what the "-f"
> does).

I believe its '-f [EMAIL PROTECTED]', could be different depending on wich
sendmail your using.

I'm curious though what if your sendmail already has a -f on it:
  php.ini: sendmail_path=sendmail [EMAIL PROTECTED]

thus a command
sendmail [EMAIL PROTECTED] [EMAIL PROTECTED]

> 
> Can anyone advise? Is it possible to use this fifth parameter to set the
> return-path header, and if so, what's the syntax?
> 

Also, the 5th paramater is disabled in safe_mode, check that also if the
above doesn't work.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message --- Hello All,

I have asked before about serial port programing with PHP and have gotten great advice and now I am stuck again.

Okay here is my problem.

I want to have a php app executed upon a modem connection. Currently the /sbin/login is what is executed.

Does anyone have any clues on this or where I may want to look. I am using mgetty as my modem connection control.

Thanks in advance!



--- End Message ---
--- Begin Message ---
Hi,

I have implemented the Auto session timeout after the
specific period of time. 

What i am doing is..At the time of login to the
system, my script is storing the current unix time
into the session and later on at every user click, It
(my script) is checking the stored unix time with the
current time. So, if you want to auto logout the user
after 30 minutes of inactivity then you need to store
auto session timeout interval to 30 min. 

Algorith is..If session stored time + auto session
timeout interval > current time then my script
automatically logout the user from the system
otherwise my script stores the current unix time in
the session.

My problem is.. If user is doing some work on the
particular page (Ex. user is writing some stuff on the
specific page) but my script is counting this thing to
inactive period.. so after 31 minutes if user is
completing the writing and hit submit button then he
is getting the session expired screen and he is
loosing all the contents on that particular page..
Please let me know if any one has solution for this.

Let me know if i am unclear at any point.

Thanks

Hardik


--- "John W. Holmes" <[EMAIL PROTECTED]> wrote:
> Tan Ai Leen wrote:
> > Hi,
> > Can someone confirm that php does not have a auto
> timeout feature? Meaning
> > something like session will auto expire
> irregardless of whether the browser
> > is close or not?
> 
> If you're using the default session handler and
> storing the session 
> files in the location specified in php.ini, then the
> files will be 
> deleted by the garbage collection process after so
> many minutes of not 
> being accessed. So, whether the browser window is
> open or not, the file 
> will be deleted if it hasn't been accessed, thus
> ending the session.
> 
> The time that this happens isn't exact, though,
> since garbage collection 
> is triggered based upon traffic to your site and a
> probability you set 
> in php.ini. It's close enough for government work,
> though. :)
> 
> -- 
> ---John Holmes...
> 
> Amazon Wishlist:
> www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> PHP|Architect: A magazine for PHP Professionals –
> www.phparch.com
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

--- End Message ---
--- Begin Message --- Hardik Doshi wrote:

Hi,

I have implemented the Auto session timeout after the
specific period of time.


What i am doing is..At the time of login to the
system, my script is storing the current unix time
into the session and later on at every user click, It
(my script) is checking the stored unix time with the
current time. So, if you want to auto logout the user
after 30 minutes of inactivity then you need to store
auto session timeout interval to 30 min.


Algorith is..If session stored time + auto session
timeout interval > current time then my script
automatically logout the user from the system
otherwise my script stores the current unix time in
the session.

My problem is.. If user is doing some work on the
particular page (Ex. user is writing some stuff on the
specific page) but my script is counting this thing to
inactive period.. so after 31 minutes if user is
completing the writing and hit submit button then he
is getting the session expired screen and he is
loosing all the contents on that particular page..
Please let me know if any one has solution for this.

What you could do, at the point you realize the session has times out, is save the contents of $_GET, $_POST, or $_REQUEST (depending upon your script) and the current URL of the page in the session. Have the user log in again. The "login validation" page then checks for the saved values, and if they are there, redirects back to that page. Then the user doesn't lose anything. It'll require a little work, but short of increasing your time-out limit, that's the best option. There's no way to tell if a user is working on filling out a page or has left the browser open.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message ---
yes, got it working. thanks a lot.. i did use header

--
Thank you,
Louie Miranda ([EMAIL PROTECTED])


----- Original Message ----- 
From: "Chris Shiflett" <[EMAIL PROTECTED]>
To: "Louie Miranda" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, July 18, 2003 11:45 PM
Subject: Re: [PHP] redirecting to a url..


> 
> --- Louie Miranda <[EMAIL PROTECTED]> wrote:
> > echo "<meta http-equiv=\"REFRESH\" CONTENT=\"0; URL=us/index.php\">";
> > 
> > Or you may have other more advance alternatives?
> 
> You can use a protocol redirect rather than relying on HTML:
> 
> header('Location: http://yoursite.org/us/index.php');
> 
> Chris
> 
> =====
> Become a better Web developer with the HTTP Developer's Handbook
> http://httphandbook.org/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Me, 

        I have 2 functions. 1 I call - immediate and other refresh.. the
difference is one as the name implies is immediate - (like chris pointed out
below ) -> 

header('Location: http://yoursite.org/us/index.php');

The other is more of a refresh kind, waits a default of 2 secs (for me so
that I can show a warning message before it redirects..

function header_refresh_html($l_refresh_url)
{
        // This is taken from php-manual
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  //
always modified
        header("Cache-Control: no-store, no-cache, must-revalidate");   //
HTTP/1.1
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");
// HTTP/1.0
        header( "Refresh:2;url=$l_refresh_url" );               // Wait
default of 2 seconds
}
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-----Original Message-----
From: Chris Shiflett [mailto:[EMAIL PROTECTED]
Sent: Friday, July 18, 2003 11:46 PM
To: Louie Miranda; [EMAIL PROTECTED]
Subject: Re: [PHP] redirecting to a url..


--- Louie Miranda <[EMAIL PROTECTED]> wrote:
> echo "<meta http-equiv=\"REFRESH\" CONTENT=\"0; URL=us/index.php\">";
> 
> Or you may have other more advance alternatives?

You can use a protocol redirect rather than relying on HTML:

header('Location: http://yoursite.org/us/index.php');

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

--- End Message ---
--- Begin Message ---
I've kept the code in a temp file so when I get some time I will delve
into it further. Certainly more of a pain than I expected.

-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: July 20, 2003 4:45 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Still problem with files


On Monday 21 July 2003 00:23, Beauford.2005 wrote:
> These files were already done from last year, so I figured I would 
> just carry on with them. Last year they did not have to be manipulated

> - so it wasn't a big deal. I have since changed the whole thing and am

> now using a database (took me a whole 45 minutes), which I was using 
> anyway to hold all my other info. I'd still be curious though as to 
> why the other way did not work.

If it's not obvious from examining the code then you have to get down to
some 
serious debugging. Most importantly you need to:

 - incorporate error checking into your code, examine the values
returned from 
all functions

 - var_dump() all your major variables and verify that they are what you

expect them to be

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
What's all this brouhaha?
*/


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


--- End Message ---
--- Begin Message ---
When I try to connect to postresql with my php script below I got hhis eror:
I can insert into the table from psql.  Please help
 
Thanks,
 
-----------------------------------------------------------------------------------------------------------
Warning: pg_exec() query failed: ERROR: invention: permission denied in 
/home/pptun/public_html/invention.php on line 9
-----------------------------------------------------------------------------------------------------------
Here is my PHP script:

<?PHP

$L_Invention = addslashes($Invention);

$L_Inventor = addslashes($Inventor);

$L_Year = addslashes($Year);

//note: Nation is a code with integer value

$L_Nation = addslashes($Nation);

$conn = pg_connect("dbname=pptun port=5432");

$result = pg_exec($conn, "insert into invention 
values('$L_Invention','$L_Inventor','$L_Year',$L_Nation);");

//header("Location:http://is3.usfca.edu/~pptun/invention.html";);

exit;

?>



---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

--- End Message ---
--- Begin Message ---
Hi,

        Got a quick question.. How do I get the table headers also
printed/retrieved by PHP for 'echo'??

        eg :
1       +--------------+--------------+---------+----------------+
2       | Drive SN     | HSA DCM      | Family  | Media Supplier |
3       +--------------+--------------+---------+----------------+
4       | WMACK0000001 | GD223213JHHS | PIONEER | KOMAG          |
5       | WMACK0000002 | GH37489284HH | PIONEER | FUJI           |
6       | WMACK0000003 | F023213JHHS  | XBOX    | KOMAG          |
7       | WMACK0000004 | FV23213JHHS  | XBOX    |                |
8       +--------------+--------------+---------+----------------+

The coding can get rows 4-7 printed out but I would like to get row2 printed
out as well. The table's all set up for it already.

        I'm using 

        $result = mysql_query($sql);
        $num_results = mysql_num_rows($result);
        for ($i = 0; $i < $num_results ; $i++)
        {
                echo "<tr>\n"  ;
                $row = mysql_fetch_row($result);
                for ($j = 0; $j < sizeof($row) ; $j++)
                {
                        echo "\t" . '<td>';     
                        echo  $row[$j] ;
                        echo "</td> \n";
                }
        echo "</tr>\n";
        }


Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


--- End Message ---
--- Begin Message --- Ow Mun Heng wrote:

Hi,

        Got a quick question.. How do I get the table headers also
printed/retrieved by PHP for 'echo'??

mysql_field_name()


Next time, check the manual. :)

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message ---
Whoops.. Missed that..

Thanks.. (& sorry..)

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-----Original Message-----
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Monday, July 21, 2003 9:45 AM
To: Ow Mun Heng
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Howto list Mysql Table Headers using PHP


Ow Mun Heng wrote:

> Hi,
> 
>       Got a quick question.. How do I get the table headers also
> printed/retrieved by PHP for 'echo'??

mysql_field_name()

Next time, check the manual. :)

-- 
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message ---
hello, im am making a business card preview program. im passing data using..
post and session. i did use a redir on my index because i use 2 diff layout.
when it redir it goes to a index site that dont have a post yet. after the
users enters the data when they preview the data is ok, but when they go
back to correct the fields. the entered data is being lost.

is there a way to store data that it wont be lost using it's session? or
post? what ever's easy will be good help.

--
Thank you,
Louie Miranda ([EMAIL PROTECTED])



--- End Message ---
--- Begin Message ---
Hi,

I am trying to create a small php program where I can control users
processes.  As far as I see I require Apache to run as root in order to do
this (Note: I wish to access it via a webpage run through a browser).  At
the moment all pages are executed as user 'apache' (UID #48 in this case).
Other than giving apache root access which i hear is a very bad thing to do,
what other ways can i use the posix_seteuid() functions and the like.

Any help at all will be really appreciated.

Thanks,

Dave



--- End Message ---
--- Begin Message ---
Hi,

I am trying to create a small php program where I can control users
processes.  As far as I see I require Apache to run as root in order to do
this (Note: I wish to access it via a webpage run through a browser).  At
the moment all pages are executed as user 'apache' (UID #48 in this case).
Other than giving apache root access which i hear is a very bad thing to do,
what other ways can i use the posix_seteuid() functions and the like.

Any help at all will be really appreciated.

Thanks,

Dave


--- End Message ---
--- Begin Message ---
* Thus wrote David Goodchild ([EMAIL PROTECTED]):
> Hi,
> 
> I am trying to create a small php program where I can control users
> processes.  As far as I see I require Apache to run as root in order to do
> this (Note: I wish to access it via a webpage run through a browser).  At
> the moment all pages are executed as user 'apache' (UID #48 in this case).
> Other than giving apache root access which i hear is a very bad thing to do,
> what other ways can i use the posix_seteuid() functions and the like.
> 
> Any help at all will be really appreciated.

There is an example in the contributed notes on the site under the
posix_setuid. Baically it is a perl script that is ran in cgi mode that
is setuid'd. then opens a php script that runs the setuid script.

I dont see why, if you choose this method is to just bypass the perl cgi
and just make your php cgi setuid.

I'm not sure of any security issues in doing that but it seems better
than running your whole apache server as root.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
Been There.. 

Was a REAL pain to figure that out one.. 

Have a look through PhpMyAdmin's (source) scripts, I see there's a bash
shell code that actually searches through some of it's php files for
sanitation for the exact same purpose. (Haven't played with it yet though)

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-----Original Message-----
From: John Manko [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 19, 2003 12:49 PM
Cc: [EMAIL PROTECTED]
Subject: Something to watch look for when getting HEADER Warnings


Recently, I ran into a problem where I continually got a "Header already 
sent" message.
I took me a while to figure out because the file that was "included" 
only contained function definitions, or so I thought.
After the closing php tag, I had a new line with a single space on it.  
This space was, in turn, sent to the browser.

---- file.php begin (blah, not working) -----
<?php
function seomthing()
{ //do something
}
?>[enter]
[space]
---- file.php end ------

It wasn't until I removed the single space and any additional newlines 
that all worked fine.
Any non-null lines outside of the php tags will results in voiding all
rights to send any header or cache information, and this includes
space or newline characters.
Just an FYI.

---- file.php begin (cool, it works now) -----
<?php
function seomthing()
{ //do something
}
?>[no newline]
---- file.php end ------

Actually, you can have a newline after the clsoing php tab, but if you 
have a
non-null string following that (this includes newline characters), bad 
bad stuff can happen.




--- End Message ---
--- Begin Message ---
I have a 2 form value on 500/pcs and 1000/pcs
And i was hoping how will i compute this when i comes to this code..

--- start --------------------
$final_price_usmail = ( $bcard_price + $usmail_price );
$final_price_courier = ( $bcard_price + $courier_price );

if ($v_sendvia === 'USMail') {
 echo '$' . $bcard_price . ' (Business Card) + ' . $usmail_price . ' (U.S.
Mail) = $' . $final_price_usmail . '.00';

} elseif ($v_sendvia === 'Courier') {
 echo '$' . $bcard_price . ' (Business Card) + ' . $courier_price . '
(Courier) = $' . $final_price_courier . '.00';
}
--- end --------------------

Im looking for a way that when the user click on the 1000/pcs it will
compute * 2.
But i couldt figure this out..

--
Thank you,
Louie Miranda ([EMAIL PROTECTED])



--- End Message ---
--- Begin Message ---

if($pcs_1000){
  $total = $amount * 2;
}

-----Original Message-----
From: Louie Miranda [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 20, 2003 7:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] computing 2 value and adding it..
Importance: High

I have a 2 form value on 500/pcs and 1000/pcs
And i was hoping how will i compute this when i comes to this code..

--- start --------------------
$final_price_usmail = ( $bcard_price + $usmail_price );
$final_price_courier = ( $bcard_price + $courier_price );

if ($v_sendvia === 'USMail') {
 echo '$' . $bcard_price . ' (Business Card) + ' . $usmail_price . '
(U.S.
Mail) = $' . $final_price_usmail . '.00';

} elseif ($v_sendvia === 'Courier') {
 echo '$' . $bcard_price . ' (Business Card) + ' . $courier_price . '
(Courier) = $' . $final_price_courier . '.00';
}
--- end --------------------

Im looking for a way that when the user click on the 1000/pcs it will
compute * 2.
But i couldt figure this out..

--
Thank you,
Louie Miranda ([EMAIL PROTECTED])



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




--- End Message ---
--- Begin Message ---
Hi,

Sunday, July 20, 2003, 12:30:30 AM, you wrote:

DW> Thanks for the response Tom.  Unfortunately, that won't work either.  A 
DW> little background....  I'm using Dreamweaver and their template feature. 
DW> for the site.  I want to read some info out of a text file and format it 
DW>   into the web page.  (the hosting company doesn't support any db 
DW> either...  I wish I COULD change companies, but...)  So, if I use your 
DW> idea, when the html file is included in my php script in /cgi, the 
DW> images in the html file will be relative, not absolute (../images/***).

DW> The only solution I can think of is to call the php script, have it 
DW> extract the info I need and deposit it (with html-formatting) into a 
DW> file, then have the html file include that file.  Course, this will blow 
DW> up if more than one person accesses the site at the same time.

DW> Anybody with any other thoughts?

DW> Thanks
DW> Dale

Can you set the path type to 'Site Root Relative' in Dreamveaver ?

-- 
regards,
Tom


--- End Message ---

Reply via email to