php-general Digest 24 Nov 2004 01:57:17 -0000 Issue 3130

Topics (messages 202722 through 202739):

Re: if($var) vs. if(isset($var))
        202722 by: Vincent Jansen
        202723 by: John Nichel

Re: Is there a shorthand way to...?
        202724 by: Gryffyn, Trevor

Re: IE title bug
        202725 by: Gryffyn, Trevor
        202726 by: Giles

mcrypt: generic_init failed
        202727 by: Adelaide Yip
        202728 by: Adelaide Yip

Lost Variables
        202729 by: Monique Verrier
        202731 by: abrea
        202732 by: M. Sokolewicz
        202733 by: Monique Verrier

solaris 10 and php5
        202730 by: Jonel Rienton

submitting two forms on one page
        202734 by: Adil
        202735 by: Greg Donald

Capturing phpinfo()
        202736 by: Ashley M. Kirchner
        202738 by: John Holmes
        202739 by: Michael Sims

Re: Upload is still not working
        202737 by: Michael Leung

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 ---
$var = false;

Then the first returns false
While the second is true

> -----Original Message-----
> From: Sam Smith [mailto:[EMAIL PROTECTED] 
> Sent: dinsdag 23 november 2004 14:23
> To: PHP
> Subject: [PHP] if($var) vs. if(isset($var))
> 
> 
> 
> What's the difference between:
> 
> if($var)
> 
> and
> 
> if(isset($var))
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

--- End Message ---
--- Begin Message --- Sam Smith wrote:
What's the difference between:

if($var)

and

if(isset($var))


First is checking if $var is true (1, true, has value) or false (0, false, null, not set, etc.). Second is checking if $var has been defined, regardless of value. Depending on your error reporting level, the first one will throw a notice if $var has not been defined.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I didn't see this in any of the responses, and truthfully it's not the
best way or most secure.. .basically it has a lot of flaws that you
should watch out for (probably creates security issues more than any
other thing) but another option for mass setting variables that are
possible set or not is to use extract()

Extract() will take all the array items and assign the values to the
keys:

$_POST['courses_list'] = 'Used';

Extract($_POST);

Becomes...

$courses_list == 'Used'


But if $_POST['courses_list'] isn't set, then you get no $courses_set
variable.


If you do end up using this, pay attention to variables that you havn't
used yet that might be used later on.  If a variable isn't set, in this
case, if $courses_list isn't set, then extract() will put the value of
$_POST['courses_list'] into $courses_list.   If it IS set, and you use
one of the extract() parameters, you can make it NOT overwrite the
current $courses_list.  Which may be a good idea to prevent someone from
over-writing one of your security related variables.

I only mention this because I think it can be very useful.   I wouldn't
be as concerned with $_POST variables as I would with $_GET variables.
You don't want to make it so someone can go:

Yourscript.php?userauthneticated=1

Then do:

Extract($_GET);

Then you have...

$userauthenticated == 1


If you then have something like:

If ($userauthenticated) {
        # Some code that allows user to edit or view personal stuff,
demographics, passwords
      # etc...   Or even make changes to a database or other security
related stuff
}


That would be bad.


You may still end up having to do a isset($courses_list) to decide what
to do with the info later, but if you end up with 100 $_POST variables,
then extract() might help break those out for ya.

-TG

> -----Original Message-----
> From: Al [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 22, 2004 9:01 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Is there a shorthand way to...?
> 
> 
> When handling $_POST[] values that may or may not be 
> assigned, I am forever using:
> 
> if((isset($_POST['courses_list']) AND 
> $_POST['courses_list']== 'Used'))
> 
> Is there a shorthand way of doing this without causing notice errors?
> 
> Thanks.....

--- End Message ---
--- Begin Message ---
This is probably more of a straight HTML/JS/something question.

Do you happen to be using any kind of javascript or vbscript in your
source that does any kind of "application.caption" or "window.title" or
anything like that?

I've used "Application.Caption" in VBA within Excel to update the title
of a window so I could get a quick and dirty status of something being
processed and I've seen odd things happen with that.


If your <title></title> HTML tag looks ok, I'd try to look into any
application. Or window. Stuff in Javascript or VBScript or some other
browser based scripting stuff.

Good luck!

-TG


> -----Original Message-----
> From: Giles [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 22, 2004 6:10 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] IE title bug
> 
> 
> Hello people
> 
>  
> 
> I am making a movie browsing site. On one page I have a list 
> of movies as
> links. When you click on the movie it goes to another page 
> with the movie ID
> as an anchor in the page so that the browser scrolls to that movie. 
> 
>  
> 
> The title of the page is made up of the movie category name 
> and the movie
> name. This all works fine in mozilla but in IE the title 
> appears like this:
> 
>  
> 
> Site Name - Category Name#3037#3037#3037#3037#3037#3037#3037#3037
> 
>  
> 
> Where #3037 is the ID of the movie and obviously appears at 
> the end of the
> url. Looking at the source of the page the <title> tag is 
> fine and does not
> contain any id's (or it would appear in mozilla as well).
> 
> Also the title appears ok to begin with - the page has flash 
> thumbnails of
> the movies in and as each of these swf's load into the page 
> another  #3037
> appears in the title. We are using the satay method of flash 
> embedding as
> this is required by the client. Possibly it is something to 
> do with that?
> 
>  
> 
> Anyone seen anything like this before or have any suggestions?
> 
>  
> 
> Thanks
> 
>  
> 
>  
> 
> Giles Roadnight
> 
http://giles.roadnight.name

 

--- End Message ---
--- Begin Message ---
It is actually a known bug in Flash with IE

If you go here:

http://www.macromedia.com/software/flash/about/#globalnav

you'll get #globalnav in the title 3 times as there are 3 flash players in
the page!

We are actually now not using anchors (I wasn't too happy about them anyway)
so no longer have the problem.

Thanks for the reply though.

Giles Roadnight
http://giles.roadnight.name


-----Original Message-----
From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] 
Sent: 23 November 2004 16:17
To: [EMAIL PROTECTED]
Cc: Giles
Subject: RE: [PHP] IE title bug

This is probably more of a straight HTML/JS/something question.

Do you happen to be using any kind of javascript or vbscript in your
source that does any kind of "application.caption" or "window.title" or
anything like that?

I've used "Application.Caption" in VBA within Excel to update the title
of a window so I could get a quick and dirty status of something being
processed and I've seen odd things happen with that.


If your <title></title> HTML tag looks ok, I'd try to look into any
application. Or window. Stuff in Javascript or VBScript or some other
browser based scripting stuff.

Good luck!

-TG


> -----Original Message-----
> From: Giles [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 22, 2004 6:10 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] IE title bug
> 
> 
> Hello people
> 
>  
> 
> I am making a movie browsing site. On one page I have a list 
> of movies as
> links. When you click on the movie it goes to another page 
> with the movie ID
> as an anchor in the page so that the browser scrolls to that movie. 
> 
>  
> 
> The title of the page is made up of the movie category name 
> and the movie
> name. This all works fine in mozilla but in IE the title 
> appears like this:
> 
>  
> 
> Site Name - Category Name#3037#3037#3037#3037#3037#3037#3037#3037
> 
>  
> 
> Where #3037 is the ID of the movie and obviously appears at 
> the end of the
> url. Looking at the source of the page the <title> tag is 
> fine and does not
> contain any id's (or it would appear in mozilla as well).
> 
> Also the title appears ok to begin with - the page has flash 
> thumbnails of
> the movies in and as each of these swf's load into the page 
> another  #3037
> appears in the title. We are using the satay method of flash 
> embedding as
> this is required by the client. Possibly it is something to 
> do with that?
> 
>  
> 
> Anyone seen anything like this before or have any suggestions?
> 
>  
> 
> Thanks
> 
>  
> 
>  
> 
> Giles Roadnight
> 
http://giles.roadnight.name

 

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

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

Our website uses mcrypt functions to encrypt and decrypt passwords
stored in the PostgreSQL database.  The website encrypted/decrypted
passwords flawlessly under PHP 4.0.4, however, we recently upgraded the
server that the website is stored on to PHP 4.2.3.

Since then, each time a password is encrypted/decrypted using any of the
mcrypt-functions, the following error displays even though the code was
untouched:

Fatal error: generic_init failed in
/home/httpd/html/domainsunderdevelop/include/class.databaseconnection.php on 
line 498

Line 498 on class.databaseconnection.php is:
$NewString = mcrypt_cbc( $this->CIPHER, $this->KEY, $RawString, $Mode,
$iv );

We installed libmcrypt 2.4.9 after upgrading PHP to 4.2.3.

If you have any suggestions or ideas, please let me know.


Thanks in advance,
Adelaide

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

I forgot to mention that the website is running on RedHat kernel-2.4.20.

-- Adelaide

--- End Message ---
--- Begin Message ---
First -- thank you for reading my post.

I am using the general strategy suggested by Jay (thanks, Jay) to process my
form in another procedure.  It's listed below.  In my processStuff.php
program, I use the following code:

$attributes = array();
$attributes = array_merge($attributes,$HTTP_POST_VARS, $HTTP_GET_VARS);
extract($attributes, EXTR_PREFIX_SAME, "this");

I want to load my numerous post variables into regular memory variables (or
whatever the php nomenclature is) -- e.g. $_POST['action'] becomes $action.
It doesn't seem to working according to the manual.  I list my
$HTTP_SESSION_VARS, there are none.

I would appreciate anyone taking the time to explain to me how this works.
Either it's stupid or I'm stupid.  I'm figuring it's me.

Monique.




<form method="post" name="form1" action="processStuff.php">
<input type="submit" name="action" value="Add Record">
<input type="submit" name="action" value="Delete Record">

In processStuff.php

<?php
switch ($_POST['action']){
case "Add Record":
...do stuff...
..redirect back to original page...
break;

case "Delete Record":
...do stuff...
..redirect back to original page...
break;

}
?>

--- End Message ---
--- Begin Message ---
To turn $_POST["var1"], $_POST["var2"], $_POST["var3"] into $var1, $var2, 
$var3:

if(isset($_POST))
 { foreach($_POST as $key=>$value)
 { $$key= $value; print("$$key= $value; <br />"); }}

This should do it. The print statement is just to check the result.
Regards

Alberto Brea


-----Original Message-----
From: "Monique Verrier" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Tue, 23 Nov 2004 12:52:29 -0800
Subject: [PHP] Lost Variables

> First -- thank you for reading my post.
> 
> I am using the general strategy suggested by Jay (thanks, Jay) to
> process my
> form in another procedure.  It's listed below.  In my processStuff.php
> program, I use the following code:
> 
> $attributes = array();
> $attributes = array_merge($attributes,$HTTP_POST_VARS, $HTTP_GET_VARS);
> extract($attributes, EXTR_PREFIX_SAME, "this");
> 
> I want to load my numerous post variables into regular memory variables
> (or
> whatever the php nomenclature is) -- e.g. $_POST['action'] becomes
> $action.
> It doesn't seem to working according to the manual.  I list my
> $HTTP_SESSION_VARS, there are none.
> 
> I would appreciate anyone taking the time to explain to me how this
> works.
> Either it's stupid or I'm stupid.  I'm figuring it's me.
> 
> Monique.
> 
> 
> 
> 
> <form method="post" name="form1" action="processStuff.php">
> <input type="submit" name="action" value="Add Record">
> <input type="submit" name="action" value="Delete Record">
> 
> In processStuff.php
> 
> <?php
> switch ($_POST['action']){
> case "Add Record":
> ...do stuff...
> ..redirect back to original page...
> break;
> 
> case "Delete Record":
> ...do stuff...
> ..redirect back to original page...
> break;
> 
> }
> ?>
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message --- Monique Verrier wrote:
First -- thank you for reading my post.

I am using the general strategy suggested by Jay (thanks, Jay) to process my
form in another procedure.  It's listed below.  In my processStuff.php
program, I use the following code:

$attributes = array();
$attributes = array_merge($attributes,$HTTP_POST_VARS, $HTTP_GET_VARS);
extract($attributes, EXTR_PREFIX_SAME, "this");

I want to load my numerous post variables into regular memory variables (or
whatever the php nomenclature is) -- e.g. $_POST['action'] becomes $action.
It doesn't seem to working according to the manual.  I list my
$HTTP_SESSION_VARS, there are none.

I would appreciate anyone taking the time to explain to me how this works.
Either it's stupid or I'm stupid.  I'm figuring it's me.

Monique.




<form method="post" name="form1" action="processStuff.php"> <input type="submit" name="action" value="Add Record"> <input type="submit" name="action" value="Delete Record">

In processStuff.php

<?php
switch ($_POST['action']){
case "Add Record":
...do stuff...
..redirect back to original page...
break;

case "Delete Record":
...do stuff...
..redirect back to original page...
break;

}
?>
don't use HTTP_POST_VARS, and the likes, instead use $_POST, $_GET, etc.
To do what you want, the easiest way would be to turn On the register_globals setting.

--- End Message ---
--- Begin Message ---
Thank you, Alberto.  Do you know -- does the extract() function not work?

Monique.


"Abrea" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> To turn $_POST["var1"], $_POST["var2"], $_POST["var3"] into $var1, $var2,
> $var3:
>
> if(isset($_POST))
>  { foreach($_POST as $key=>$value)
>  { $$key= $value; print("$$key= $value; <br />"); }}
>
> This should do it. The print statement is just to check the result.
> Regards
>
> Alberto Brea
>
>
> -----Original Message-----
> From: "Monique Verrier" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Date: Tue, 23 Nov 2004 12:52:29 -0800
> Subject: [PHP] Lost Variables
>
> > First -- thank you for reading my post.
> >
> > I am using the general strategy suggested by Jay (thanks, Jay) to
> > process my
> > form in another procedure.  It's listed below.  In my processStuff.php
> > program, I use the following code:
> >
> > $attributes = array();
> > $attributes = array_merge($attributes,$HTTP_POST_VARS, $HTTP_GET_VARS);
> > extract($attributes, EXTR_PREFIX_SAME, "this");
> >
> > I want to load my numerous post variables into regular memory variables
> > (or
> > whatever the php nomenclature is) -- e.g. $_POST['action'] becomes
> > $action.
> > It doesn't seem to working according to the manual.  I list my
> > $HTTP_SESSION_VARS, there are none.
> >
> > I would appreciate anyone taking the time to explain to me how this
> > works.
> > Either it's stupid or I'm stupid.  I'm figuring it's me.
> >
> > Monique.
> >
> >
> >
> >
> > <form method="post" name="form1" action="processStuff.php">
> > <input type="submit" name="action" value="Add Record">
> > <input type="submit" name="action" value="Delete Record">
> >
> > In processStuff.php
> >
> > <?php
> > switch ($_POST['action']){
> > case "Add Record":
> > ...do stuff...
> > ..redirect back to original page...
> > break;
> >
> > case "Delete Record":
> > ...do stuff...
> > ..redirect back to original page...
> > break;
> >
> > }
> > ?>
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

--- End Message ---
--- Begin Message --- Hi, i was trying to build php5 in a solaris 10 i386 box and I got stuck with the following error message:


In file included from /usr/include/sys/wait.h:24,
from /export/home/jonel/Downloads/php-5.0.2/ext/standard/exec.c:33:
/usr/include/sys/siginfo.h:259: error: parse error before "ctid_t"
/usr/include/sys/siginfo.h:292: error: parse error before '}' token
/usr/include/sys/siginfo.h:294: error: parse error before '}' token
/usr/include/sys/siginfo.h:390: error: parse error before "ctid_t"
/usr/include/sys/siginfo.h:392: error: conflicting types for `__proc'
/usr/include/sys/siginfo.h:261: error: previous declaration of `__proc'
/usr/include/sys/siginfo.h:398: error: conflicting types for `__fault'
/usr/include/sys/siginfo.h:267: error: previous declaration of `__fault'
/usr/include/sys/siginfo.h:404: error: conflicting types for `__file'
/usr/include/sys/siginfo.h:273: error: previous declaration of `__file'
/usr/include/sys/siginfo.h:420: error: conflicting types for `__prof'
/usr/include/sys/siginfo.h:287: error: previous declaration of `__prof'
/usr/include/sys/siginfo.h:424: error: conflicting types for `__rctl'
/usr/include/sys/siginfo.h:291: error: previous declaration of `__rctl'
/usr/include/sys/siginfo.h:426: error: parse error before '}' token
/usr/include/sys/siginfo.h:428: error: parse error before '}' token
/usr/include/sys/siginfo.h:432: error: parse error before "k_siginfo_t"
/usr/include/sys/siginfo.h:437: error: parse error before '}' token
In file included from /usr/include/sys/procset.h:24,
from /usr/include/sys/wait.h:25,
from /export/home/jonel/Downloads/php-5.0.2/ext/standard/exec.c:33:
/usr/include/sys/signal.h:85: error: parse error before "siginfo_t"
In file included from /export/home/jonel/Downloads/php-5.0.2/ext/standard/exec.c:33:
/usr/include/sys/wait.h:86: error: parse error before "siginfo_t"
In file included from /export/home/jonel/Downloads/php-5.0.2/ext/standard/exec.c:36:
/usr/include/signal.h:111: error: parse error before "siginfo_t"
/usr/include/signal.h:113: error: parse error before "siginfo_t"
make: *** [ext/standard/exec.lo] Error 1


I have installed the necessary packages from sunfreeware as required and google it and I seem to hit a wall. anyone have successfully build php5 in a solaris 10?

thanks and regards,
Jonel

--- End Message ---
--- Begin Message ---
Hey everyone,  I'm having issues with a couple of forms that exist on one
page.  Basically what I'm trying to do is the following:

Select a client from a dropdown select box(submit inner form). Based on
that, another select menu appears that retrieves a list of projects based on
the client selected.  Then you choose a file and upload it(submit the outer
form) which uploads the file and adds the file entry under the client
project table selected in the 2nd dropdown.

The problem is that the outer form works fine, but the inner form that
dynamically retrieves the client project list doesn't refresh the page or
post so the project list never shows up.  I've listed some code below.

Thanks in advance for any help on this.
Adil.


<?php
echo "<form name=\"mainform\" enctype=\"multipart/form-data\"
method=\"post\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"
width=\"100%\">       \\  The outer form starts here
<tr>
 <td valign=\"top\">
  <form name=\"client_picker\" action=\"{$_SERVER['PHP_SELF']}\"
method=\"post\">        \\ The inner form starts here
  <select name=\"client_list[]\"
onClick=\"document.client_picker.submit()\">
   <option selected value=\"0\">Select Client</option>
   <option value=\"1\">Bank of America</option>
   <option value=\"2\">Verizon</option>
   <option value=\"3\">Verizon Wireless</option>
   <option value=\"4\">AARP</option>
  </select><br><br>
  </form>
\\ The inner form ends here
 </td>
</tr>
<tr>
 <td valign=\"top\">";
  if ($_POST['client_list']) {
   getProjects();
  }
echo "</td>
</tr>
<tr>
 <td valign=\"top\">
  <input name=\"hidden\" type=\"hidden\">
  <font class=\"fieldTextDark\">Fill out the form to upload a
file:</font><br><br>
  <p class=\"fieldTextDark\">File: <input type=\"file\" name=\"upload\"
/></p>
  <p class=\"fieldTextDark\">Description: <textarea name=\"description\"
cols=\"40\" rows=\"5\"></textarea></p>
  <div align=\"center\">
   <input type =\"submit\" name=\"submit\" value=\"Submit\" /><br><br>
   <textarea name=\"message\" cols=\"40\" rows=\"4\"></textarea><br>
   <input type=\"submit\" name=\"Post\" value=\"Post\">
  </div>
 <!--End of form-->
 </td>
</tr>
</table>
</form>";
\\ The outer form ends here
?>

--- End Message ---
--- Begin Message ---
On Tue, 23 Nov 2004 17:43:22 -0500, Adil <[EMAIL PROTECTED]> wrote:
> The problem is that the outer form works fine, but the inner form that
> dynamically retrieves the client project list doesn't refresh the page or
> post so the project list never shows up.  I've listed some code below.

Looks like your javascript is messed up somehow, is that all of it?

> <?php
> echo "<form name=\"mainform\" enctype=\"multipart/form-data\"
> method=\"post\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"
> width=\"100%\">       \\  The outer form starts here
> <tr>
>  <td valign=\"top\">
>   <form name=\"client_picker\" action=\"{$_SERVER['PHP_SELF']}\"
> method=\"post\">        \\ The inner form starts here
>   <select name=\"client_list[]\"
> onClick=\"document.client_picker.submit()\">
>    <option selected value=\"0\">Select Client</option>
>    <option value=\"1\">Bank of America</option>
>    <option value=\"2\">Verizon</option>
>    <option value=\"3\">Verizon Wireless</option>
>    <option value=\"4\">AARP</option>
>   </select><br><br>
>   </form>
> \\ The inner form ends here
>  </td>
> </tr>
> <tr>
>  <td valign=\"top\">";

You might check out PHP's heredoc syntax of you plan to echo all your
html like that.

<?php

echo <<<EOF
<form method="post" action="$_SERVER[PHP_SELF]">
<input type="text" name="field">
<input type="button" name="submit">
</form>
EOF;

?>

Nice and clean, no escaping required, variables parse, all that..


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
How can I stick phpinfo() at the bottom of a page in such a way that it doesn't display the data in the page, but instead creates a log file and dumps everything in there) The log file should either be appended to every time, or if not, a unique one created every time (one per transaction.) Is this even possible?


--
W | I haven't lost my mind; it's backed up on tape somewhere.
 +--------------------------------------------------------------------
 Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
 IT Director / SysAdmin / Websmith             .     800.441.3873 x130
 Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave. #6
 http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.

--- End Message ---
--- Begin Message ---
> From: "Ashley M. Kirchner" <[EMAIL PROTECTED]>
>     How can I stick phpinfo() at the bottom of a page in such a way that 
> it doesn't display the data in the page, but instead creates a log file 
> and dumps everything in there)  The log file should either be appended 
> to every time, or if not, a unique one created every time (one per 
> transaction.)  Is this even possible?

Of course it's possible. Just fopen() a file at the end of the script, capture 
phpinfo() output with an output buffer (ob_start(), etc) and write it to the 
file. I can imagine the file getting very large very quick, though.

Alternatively, you could put

echo '<!-- ' . phpinfo() . '-->';

or

ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
echo "<!-- $phpinfo -->";

(from memory, so functions might be slightly different)...

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

--- End Message ---
--- Begin Message ---
John Holmes wrote:
>> From: "Ashley M. Kirchner" <[EMAIL PROTECTED]>
>>     How can I stick phpinfo() at the bottom of a page in such a way
>> that it doesn't display the data in the page, but instead creates a
>> log file and dumps everything in there)  The log file should either
>> be appended to every time, or if not, a unique one created every
>> time (one per transaction.)  Is this even possible?
>
> Of course it's possible. Just fopen() a file at the end of the
> script, capture phpinfo() output with an output buffer (ob_start(),
> etc) and write it to the file. I can imagine the file getting very
> large very quick, though.

Yup...on my test server here the HTML output of phpinfo() is 40Kb.  The text
version is 15Kb.  Depending on how many hits per day a site gets that can
add up fast.

Not only that, but also assuming a web server is involved there could easily
be many concurrent slave processes active.  Therefore if the file's
integrity is to be maintained (assuming a single file) then flock() should
be used.

Alternatively, assuming Apache, one file per request could be created.  If
mod_unique_id is installed/active then $_SERVER['UNIQUE_ID'] will be
available and could be used as the filename, or the basis for the filename.

Of course I'm not sure I see the point of saving phpinfo() for each
request...a large portion of it will be identical for every request.  Those
portions that differ from request to request can be logged more efficiently
in other ways...for example, dumping the contents of $_SERVER.  Of course,
much of that information can be gleaned from the Apache logs...

--- End Message ---
--- Begin Message ---
Hi,
   I have tested this with file no space on its filename


yours,
Michael

--- End Message ---

Reply via email to