php-general Digest 25 Jul 2004 08:17:24 -0000 Issue 2897
Topics (messages 191774 through 191806):
Re: Trouble with Apache, PHP, pear
191774 by: Marek Kilimajer
191787 by: Ron King
Re: Unexpected T_ENCAPSED...
191775 by: John W. Holmes
191777 by: Philip Olson
HTML Table display based upon field contents
191776 by: Robb Kerr
191778 by: Tularis
191779 by: Kevin
191784 by: Robb Kerr
191785 by: Robb Kerr
191786 by: Tularis
Re: PHP5, XPath and count()
191780 by: Christian Stocker
Creation of MySQL Database Using PHP
191781 by: Harlequin
191782 by: Marek Kilimajer
191783 by: Dennis Seavers
exec works with some, but not all commands
191788 by: Jonathan Villa
191789 by: Matthew Sims
191791 by: Chris Martin
191795 by: bruce
Re: How to get all links from a webpage?
191790 by: Jason Wong
191803 by: Wudi
Re: Disk serial number
191792 by: Jason Wong
Re: IMPORTANT: Please Verify Your Message
191793 by: Mark
191794 by: Jason Wong
191796 by: John W. Holmes
191800 by: Jason Wong
Re: Weeeeee! ;)))
191797 by: Jason Barnett
Learning Regex
191798 by: PHP Gen
191802 by: Jason Barnett
include_path ???
191799 by: D_Angle
191801 by: Jason Barnett
191804 by: D_Angle
191806 by: Lester Caine
Re: PHP editor that doesn't require installation
191805 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 ---
Ron King wrote:
At 06:28 AM 7/23/2004, you wrote:
You need php-cli rpm, it's not an extension, it's command line binary.
And it won't hurt anything to have both cli and extension installed?
-- Ron
No
--- End Message ---
--- Begin Message ---
Matthew (and Marek),
>>Sounds like you've done everything correctly, just PHP wasn't installed
>> as a
>>CLI. Just to be sure, do a $ find / -name php
>
> Is it ok to have PHP installed as both CLI and as a module?
>
It is perfectly okay to have both. I'm using both on a server I have.
I installed the CLI rpm, and was then able to install pear. Now I just need
to get the path situation straightened out.
Thanks for the help,
-- Ron
--- End Message ---
--- Begin Message ---
Philip Olson wrote:
And quoting integers is not a problem, I even prefer it. IMHO we should
tell people to quote all values so if someone "forgets" to do any sort of
input validation (i.e. make sure it's actually an integer) there won't be
a major problem otherwise problems (including SQL injection) may arise.
I wouldn't recommend that you recommend that to everyone. Not all
databases will allow you to enter a STRING into an numeric field. MySQL
may be lenient on it, but that doesn't mean you should get in the habit
of using it that way. Properly validate your data and none of this is an
issue. :)
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
> > And quoting integers is not a problem, I even prefer it. IMHO we should
> > tell people to quote all values so if someone "forgets" to do any sort of
> > input validation (i.e. make sure it's actually an integer) there won't be
> > a major problem otherwise problems (including SQL injection) may arise.
>
> I wouldn't recommend that you recommend that to everyone. Not all
> databases will allow you to enter a STRING into an numeric field. MySQL
> may be lenient on it, but that doesn't mean you should get in the habit
> of using it that way. Properly validate your data and none of this is an
> issue. :)
Yeah, we all know you want magic_quotes_gpc off by default too but can
PHP coders really be that trusted? ;) I was only referring to MySQL, will
look into the string/int index issue a bit later. Yes it would be nice if
people validated data but having to write about that everytime gets old.
My advice wasn't ideal, I'll admit that.
Regards,
Philip
--- End Message ---
--- Begin Message ---
I have a complicated table that needs to be altered depending upon the
contents of a field in one of my recordsets. I've tried several approaches
and need to know what you recommend.
I've created three totally different tables and put the HTML code for each
into a database. Then I used PHP to insert the relevant code into the page
depending upon the contents of a field in a different database. Result -
the appropriate code is inserted properly into the HTML. Problem - the HTML
table I'm trying to insert contains PHP code which is not executed after
being inserted.
Because sometimes the HTML table needs 4 rows and other times only 2, I
tried enclosing the appropriate <tr>s in a PHP IF statement (see below).
Problem - PHP IF wasn't executed, both <tr>s embedded appeared on page
anyway. And, sometimes, the relevant <tr>s will include PHP code so this
embedding technique won't work.
<?php
if ($row_RS_PageContent['PageType'] != "2") {
?>
<tr>
<td width="200" height="0" bgcolor="99CCCC"> </td>
<td width="20" height="0"> </td>
<td height="0" align="left" valign="top"> </td>
<td height="0" align="right" valign="top"> </td>
<td width="20" height="0"> </td>
<td width="5" height="0" bgcolor="333366"> </td>
</tr>
<tr>
<td width="200" height="0" bgcolor="99CCCC"> </td>
<td width="20" height="0"> </td>
<td height="0" align="left" valign="top"> </td>
<td height="0" align="right" valign="top"> </td>
<td width="20" height="0"> </td>
<td width="5" height="0" bgcolor="333366"> </td>
</tr>
<?php
}
?>
Should I simply describe the entire relevant <tr>s on one line,
appropriately escape them, assign the to a variable and then use an ECHO to
put them on the page? Or does someone have a simpler more elegant solution?
Thanx
--
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
----------------------------------------------------
http://www.digitaliguana.com
http://www.cancerreallysucks.org
--- End Message ---
--- Begin Message ---
Robb Kerr wrote:
I have a complicated table that needs to be altered depending upon the
contents of a field in one of my recordsets. I've tried several approaches
and need to know what you recommend.
I've created three totally different tables and put the HTML code for each
into a database. Then I used PHP to insert the relevant code into the page
depending upon the contents of a field in a different database. Result -
the appropriate code is inserted properly into the HTML. Problem - the HTML
table I'm trying to insert contains PHP code which is not executed after
being inserted.
Because sometimes the HTML table needs 4 rows and other times only 2, I
tried enclosing the appropriate <tr>s in a PHP IF statement (see below).
Problem - PHP IF wasn't executed, both <tr>s embedded appeared on page
anyway. And, sometimes, the relevant <tr>s will include PHP code so this
embedding technique won't work.
<?php
if ($row_RS_PageContent['PageType'] != "2") {
?>
<tr>
<td width="200" height="0" bgcolor="99CCCC"> </td>
<td width="20" height="0"> </td>
<td height="0" align="left" valign="top"> </td>
<td height="0" align="right" valign="top"> </td>
<td width="20" height="0"> </td>
<td width="5" height="0" bgcolor="333366"> </td>
</tr>
<tr>
<td width="200" height="0" bgcolor="99CCCC"> </td>
<td width="20" height="0"> </td>
<td height="0" align="left" valign="top"> </td>
<td height="0" align="right" valign="top"> </td>
<td width="20" height="0"> </td>
<td width="5" height="0" bgcolor="333366"> </td>
</tr>
<?php
}
?>
Should I simply describe the entire relevant <tr>s on one line,
appropriately escape them, assign the to a variable and then use an ECHO to
put them on the page? Or does someone have a simpler more elegant solution?
Thanx
just use eval() on that string, it's not elegant, nor is it really
secure, but it'll work fine.
--- End Message ---
--- Begin Message ---
Hi Robb,
I am a newbie so I wanted to ask a stupid question. In your code below if
the first if statement is true it ends the php processing and then you
reopen with a new <?php before the closing }. What would happen if you took
out the ?> before the first <tr> tag and the </php before the }. Would that
work?
Sorry if this is just dumb. Trying to learn. :)
Kevin
-----Original Message-----
From: Robb Kerr [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 24, 2004 4:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] HTML Table display based upon field contents
I have a complicated table that needs to be altered depending upon the
contents of a field in one of my recordsets. I've tried several approaches
and need to know what you recommend.
I've created three totally different tables and put the HTML code for each
into a database. Then I used PHP to insert the relevant code into the page
depending upon the contents of a field in a different database. Result -
the appropriate code is inserted properly into the HTML. Problem - the HTML
table I'm trying to insert contains PHP code which is not executed after
being inserted.
Because sometimes the HTML table needs 4 rows and other times only 2, I
tried enclosing the appropriate <tr>s in a PHP IF statement (see below).
Problem - PHP IF wasn't executed, both <tr>s embedded appeared on page
anyway. And, sometimes, the relevant <tr>s will include PHP code so this
embedding technique won't work.
<?php
if ($row_RS_PageContent['PageType'] != "2") {
?>
<tr>
<td width="200" height="0" bgcolor="99CCCC"> </td>
<td width="20" height="0"> </td>
<td height="0" align="left" valign="top"> </td>
<td height="0" align="right" valign="top"> </td>
<td width="20" height="0"> </td>
<td width="5" height="0" bgcolor="333366"> </td>
</tr>
<tr>
<td width="200" height="0" bgcolor="99CCCC"> </td>
<td width="20" height="0"> </td>
<td height="0" align="left" valign="top"> </td>
<td height="0" align="right" valign="top"> </td>
<td width="20" height="0"> </td>
<td width="5" height="0" bgcolor="333366"> </td>
</tr>
<?php
}
?>
Should I simply describe the entire relevant <tr>s on one line,
appropriately escape them, assign the to a variable and then use an ECHO to
put them on the page? Or does someone have a simpler more elegant solution?
Thanx
--
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
----------------------------------------------------
http://www.digitaliguana.com
http://www.cancerreallysucks.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Sat, 24 Jul 2004 17:47:48 -0400, Kevin wrote:
> Hi Robb,
>
> I am a newbie so I wanted to ask a stupid question. In your code below if
> the first if statement is true it ends the php processing and then you
> reopen with a new <?php before the closing }. What would happen if you took
> out the ?> before the first <tr> tag and the </php before the }. Would that
> work?
>
> Sorry if this is just dumb. Trying to learn. :)
>
> Kevin
>
> -----Original Message-----
> From: Robb Kerr [mailto:[EMAIL PROTECTED]
> Sent: Saturday, July 24, 2004 4:47 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] HTML Table display based upon field contents
>
> I have a complicated table that needs to be altered depending upon the
> contents of a field in one of my recordsets. I've tried several approaches
> and need to know what you recommend.
>
> I've created three totally different tables and put the HTML code for each
> into a database. Then I used PHP to insert the relevant code into the page
> depending upon the contents of a field in a different database. Result -
> the appropriate code is inserted properly into the HTML. Problem - the HTML
> table I'm trying to insert contains PHP code which is not executed after
> being inserted.
>
> Because sometimes the HTML table needs 4 rows and other times only 2, I
> tried enclosing the appropriate <tr>s in a PHP IF statement (see below).
> Problem - PHP IF wasn't executed, both <tr>s embedded appeared on page
> anyway. And, sometimes, the relevant <tr>s will include PHP code so this
> embedding technique won't work.
>
> <?php
> if ($row_RS_PageContent['PageType'] != "2") {
> ?>
> <tr>
> <td width="200" height="0" bgcolor="99CCCC"> </td>
> <td width="20" height="0"> </td>
> <td height="0" align="left" valign="top"> </td>
> <td height="0" align="right" valign="top"> </td>
> <td width="20" height="0"> </td>
> <td width="5" height="0" bgcolor="333366"> </td>
> </tr>
> <tr>
> <td width="200" height="0" bgcolor="99CCCC"> </td>
> <td width="20" height="0"> </td>
> <td height="0" align="left" valign="top"> </td>
> <td height="0" align="right" valign="top"> </td>
> <td width="20" height="0"> </td>
> <td width="5" height="0" bgcolor="333366"> </td>
> </tr>
> <?php
> }
> ?>
>
> Should I simply describe the entire relevant <tr>s on one line,
> appropriately escape them, assign the to a variable and then use an ECHO to
> put them on the page? Or does someone have a simpler more elegant solution?
>
> Thanx
> --
> Robb Kerr
> Digital IGUANA
> Helping Digital Artists Achieve their Dreams
> ----------------------------------------------------
> http://www.digitaliguana.com
> http://www.cancerreallysucks.org
To do what you're suggesting, you'd have to put each line of HTML in
separate ECHO statements (see below). The problem with this approach is
that the table will eventually contain very complex code in each cell. I'd
have to do extensive escaping to make sure the code is correctly
interpreted.
I used a shortcut syntax that allows you to embed several lines of HTML in
an IF statement without having to escape everything. The short PHP
statement after the embedded lines tells PHP that the embedded code is
embedded as if it was ECHOed line by line. This works most of the time.
Just not in this instance.
To use your suggestion, the code would have to look like this...
<?php
if ($row_RS_PageContent['PageType'] != "2") {
echo '<tr>';
echo '<td width=\"200\" height=\"0\" bgcolor=\"99CCCC\"> </td>';
echo '<td width=\"20\" height=\"0\"> </td>';
echo '<td height=\"0\" align=\"left\" valign=\"top\"> </td>';
etc.
}
?>
Note all of the escaping required to simply define the table. You'd have
tons more to do when images, links, JavaScript calls, etc. are placed in
the table.
--
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
----------------------------------------------------
http://www.digitaliguana.com
http://www.cancerreallysucks.org
--- End Message ---
--- Begin Message ---
On Sat, 24 Jul 2004 23:23:49 +0200, Tularis wrote:
> Robb Kerr wrote:
>
>> I have a complicated table that needs to be altered depending upon the
>> contents of a field in one of my recordsets. I've tried several approaches
>> and need to know what you recommend.
>>
>> I've created three totally different tables and put the HTML code for each
>> into a database. Then I used PHP to insert the relevant code into the page
>> depending upon the contents of a field in a different database. Result -
>> the appropriate code is inserted properly into the HTML. Problem - the HTML
>> table I'm trying to insert contains PHP code which is not executed after
>> being inserted.
>>
>> Because sometimes the HTML table needs 4 rows and other times only 2, I
>> tried enclosing the appropriate <tr>s in a PHP IF statement (see below).
>> Problem - PHP IF wasn't executed, both <tr>s embedded appeared on page
>> anyway. And, sometimes, the relevant <tr>s will include PHP code so this
>> embedding technique won't work.
>>
>> <?php
>> if ($row_RS_PageContent['PageType'] != "2") {
>> ?>
>> <tr>
>> <td width="200" height="0" bgcolor="99CCCC"> </td>
>> <td width="20" height="0"> </td>
>> <td height="0" align="left" valign="top"> </td>
>> <td height="0" align="right" valign="top"> </td>
>> <td width="20" height="0"> </td>
>> <td width="5" height="0" bgcolor="333366"> </td>
>> </tr>
>> <tr>
>> <td width="200" height="0" bgcolor="99CCCC"> </td>
>> <td width="20" height="0"> </td>
>> <td height="0" align="left" valign="top"> </td>
>> <td height="0" align="right" valign="top"> </td>
>> <td width="20" height="0"> </td>
>> <td width="5" height="0" bgcolor="333366"> </td>
>> </tr>
>> <?php
>> }
>> ?>
>>
>> Should I simply describe the entire relevant <tr>s on one line,
>> appropriately escape them, assign the to a variable and then use an ECHO to
>> put them on the page? Or does someone have a simpler more elegant solution?
>>
>> Thanx
> just use eval() on that string, it's not elegant, nor is it really
> secure, but it'll work fine.
This sounds like exactly what I need. But, can you help me with the synatx?
I've read the entry in the PHP documentation and I don't completely
understand. Let's assume all of the code to define the HTML table
(including appropriate PHP) is stored in a database table called
FooterTable. The field containing the code is called FooterField.
Do I first need to assign the field to a variable via the eval()...
$vFooterText = eval(FooterTable['FooterField']);
echo $vFooterText;
or does the eval statement automatically include the ECHO...
eval(FooterTable['FooterField']);
or do I have to read the contents into a variable first, then eval(), then
echo...
$vFooterText = FooterTable['FooterField'];
eval($vFooterText);
echo $vFooterText;
--
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
----------------------------------------------------
http://www.digitaliguana.com
http://www.cancerreallysucks.org
--- End Message ---
--- Begin Message ---
Robb Kerr wrote:
On Sat, 24 Jul 2004 23:23:49 +0200, Tularis wrote:
Robb Kerr wrote:
I have a complicated table that needs to be altered depending upon the
contents of a field in one of my recordsets. I've tried several approaches
and need to know what you recommend.
I've created three totally different tables and put the HTML code for each
into a database. Then I used PHP to insert the relevant code into the page
depending upon the contents of a field in a different database. Result -
the appropriate code is inserted properly into the HTML. Problem - the HTML
table I'm trying to insert contains PHP code which is not executed after
being inserted.
Because sometimes the HTML table needs 4 rows and other times only 2, I
tried enclosing the appropriate <tr>s in a PHP IF statement (see below).
Problem - PHP IF wasn't executed, both <tr>s embedded appeared on page
anyway. And, sometimes, the relevant <tr>s will include PHP code so this
embedding technique won't work.
<?php
if ($row_RS_PageContent['PageType'] != "2") {
?>
<tr>
<td width="200" height="0" bgcolor="99CCCC"> </td>
<td width="20" height="0"> </td>
<td height="0" align="left" valign="top"> </td>
<td height="0" align="right" valign="top"> </td>
<td width="20" height="0"> </td>
<td width="5" height="0" bgcolor="333366"> </td>
</tr>
<tr>
<td width="200" height="0" bgcolor="99CCCC"> </td>
<td width="20" height="0"> </td>
<td height="0" align="left" valign="top"> </td>
<td height="0" align="right" valign="top"> </td>
<td width="20" height="0"> </td>
<td width="5" height="0" bgcolor="333366"> </td>
</tr>
<?php
}
?>
Should I simply describe the entire relevant <tr>s on one line,
appropriately escape them, assign the to a variable and then use an ECHO to
put them on the page? Or does someone have a simpler more elegant solution?
Thanx
just use eval() on that string, it's not elegant, nor is it really
secure, but it'll work fine.
This sounds like exactly what I need. But, can you help me with the synatx?
I've read the entry in the PHP documentation and I don't completely
understand. Let's assume all of the code to define the HTML table
(including appropriate PHP) is stored in a database table called
FooterTable. The field containing the code is called FooterField.
Do I first need to assign the field to a variable via the eval()...
$vFooterText = eval(FooterTable['FooterField']);
echo $vFooterText;
or does the eval statement automatically include the ECHO...
eval(FooterTable['FooterField']);
or do I have to read the contents into a variable first, then eval(), then
echo...
$vFooterText = FooterTable['FooterField'];
eval($vFooterText);
echo $vFooterText;
once you get the code you posted a few lines up out of the database it
usually already resides in a variable. eg. $footertable['FooterField'].
What eval() does is take a string and just "imagine" it is actually an
included piece of PHP. If this helps you, you could imagine the eval
string as follows:
---------
// write the string contents to a new php file
$stream = fopen('tmpfile.php', 'w+');
fwrite($stream, $string, strlen($string));
fclose($stream)
include 'tmpfile.php'; // include it, seems obvious...
unlink('tmpfile.php'); // remove the file again
--------
This means that if you pass a string like eg:
<?php
if($a == $b) {
?>A is B!<br /><?php
} else {
?>A is not B!<br /><?php
}
?>
it would parse that as-if it were a piece of php-code, which it is in
this case. Remember though that everything you tell php to do in that
string is done at the time the eval() is called. That means that if you
use that string, eg. called $string (how obvious :P) in such an expression:
<?php
$string = '...'; // that php code but then as a string, or gotten from
the database
$a = 1;
$b = 2;
echo 'starting...<br />';
eval($string);
echo 'stopping';
?>
it would output:
starting...
A is not B!
stopping
Hope that helps :)
- Tul
--- End Message ---
--- Begin Message ---
On Sat, 24 Jul 2004 17:35:59 +0200, Victor Boivie <[EMAIL PROTECTED]> wrote:
> Christian Stocker wrote:
>
> >>var_dump($xpath->query("count(/catalog/cd")->item(0));
> >
> >
> > this doesn't work yet in DOM. The returned value has to be a nodeset.
> > Will be fixed some day ;)
> >
>
> Thanks, both Jason and Christian
>
> I found something else that I think is strange.
>
> $dom = new DOMDocument();
>
> $root = $dom->createElement("test");
> $dom->appendChild($root);
>
> $node = $dom->createElement("foo", "which entities <i>does</i> it
> escape & which doesn't it?");
> $root->appendChild($node);
>
> echo $dom->saveXML();
Yep, that looks like a bug... Can you please file a bug at bugs.php.net?
The workaround is the write the following:
$node = $dom->createElement("foo");
$text = $dom->createTextNode( "which entities <i>does</i> it
escape & which doesn't it?");
$node->appendChild($text);
$root->appendChild($node);
While a little more to type, it's at least the official W3C way ;)
chregu
>
> The result will be:
>
> <?xml version="1.0"?>
> <test><foo>which entities <i>does</i> it escape </foo></test>
>
> It stops at the &, which I think is strange. It escapes the < to <
> and > to >, but not & to &. It would be better if it escaped none
> or all entites that "can do harm".
>
> Or what do you think?
> regards,
> Victor
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
--- End Message ---
--- Begin Message ---
Hello.
I have a friend who knows less than me about PHP and MySQL (which I know is
hard to believe) but she needs a login facility for her site.
I've passed over some script I use but she doesn't know how to create the
database. I can write some commands that create the tables OK - but can I do
the same for the database or does that have to be done through the UI...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
--- End Message ---
--- Begin Message ---
Harlequin wrote:
Hello.
I have a friend who knows less than me about PHP and MySQL (which I know is
hard to believe) but she needs a login facility for her site.
I've passed over some script I use but she doesn't know how to create the
database. I can write some commands that create the tables OK - but can I do
the same for the database or does that have to be done through the UI...?
Do you know phpMyAdmin?
http://www.phpmyadmin.net/
--- End Message ---
--- Begin Message ---
mysql_query ('CREATE DATABASE name_of_database');
> [Original Message]
> From: Harlequin <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Date: 07/24/2004 3:08:47 PM
> Subject: [PHP] Creation of MySQL Database Using PHP
>
> Hello.
>
> I have a friend who knows less than me about PHP and MySQL (which I know
is
> hard to believe) but she needs a login facility for her site.
>
> I've passed over some script I use but she doesn't know how to create the
> database. I can write some commands that create the tables OK - but can I
do
> the same for the database or does that have to be done through the UI...?
>
> --
> -----------------------------
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -----------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
why would exec("touch /var/www/testfile.txt") work but not
exec("/usr/bin/gpg --homedir /home/testuser/.gnupg blah blah blah")
the dir used in homedir has mode 777 just for testing
this is the actual command I'm trying to run...
exec("/usr/bin/gpg --homedir /home/testdir/.gnupg --armor --output e.gpg
-e -r uid_someuser sf.txt");
if I run it from the command line, it works fine...
In summary, I'm trying to get a working gpg script going...
--- End Message ---
--- Begin Message ---
>
> why would exec("touch /var/www/testfile.txt") work but not
>
> exec("/usr/bin/gpg --homedir /home/testuser/.gnupg blah blah blah")
>
> the dir used in homedir has mode 777 just for testing
>
>
> this is the actual command I'm trying to run...
> exec("/usr/bin/gpg --homedir /home/testdir/.gnupg --armor --output e.gpg
> -e -r uid_someuser sf.txt");
>
> if I run it from the command line, it works fine...
>
I'm not sure but what if you defined an absolute path for your output
files (e.gpg and sf.txt).
--
--Matthew Sims
--<http://killermookie.org>
--- End Message ---
--- Begin Message ---
Matthew Sims wrote:
why would exec("touch /var/www/testfile.txt") work but not
exec("/usr/bin/gpg --homedir /home/testuser/.gnupg blah blah blah")
the dir used in homedir has mode 777 just for testing
this is the actual command I'm trying to run...
exec("/usr/bin/gpg --homedir /home/testdir/.gnupg --armor --output e.gpg
-e -r uid_someuser sf.txt");
if I run it from the command line, it works fine...
I'm not sure but what if you defined an absolute path for your output
files (e.gpg and sf.txt).
I'm not sure either, but I was thinking absolute too.
Also you might try system(), shell_exec(), or passthru() if you're
trying to get output back.
--
Chris Martin
Web Developer
Open Source & Web Standards Advocate
http://www.chriscodes.com/
--- End Message ---
--- Begin Message ---
when running shell commands form php/web apps... it's a good idea to check
the ownership/privs/permissions of both the exe being run, as well as any
output/input files for the exe app.
you should also check the web/apache/iis error/log files to determine if
everything is correct...
regards,
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] Behalf Of Chris Martin
Sent: Saturday, July 24, 2004 6:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: exec works with some, but not all commands
Matthew Sims wrote:
>>why would exec("touch /var/www/testfile.txt") work but not
>>
>>exec("/usr/bin/gpg --homedir /home/testuser/.gnupg blah blah blah")
>>
>>the dir used in homedir has mode 777 just for testing
>>
>>
>>this is the actual command I'm trying to run...
>>exec("/usr/bin/gpg --homedir /home/testdir/.gnupg --armor --output e.gpg
>>-e -r uid_someuser sf.txt");
>>
>>if I run it from the command line, it works fine...
>>
>
>
> I'm not sure but what if you defined an absolute path for your output
> files (e.gpg and sf.txt).
>
I'm not sure either, but I was thinking absolute too.
Also you might try system(), shell_exec(), or passthru() if you're
trying to get output back.
--
Chris Martin
Web Developer
Open Source & Web Standards Advocate
http://www.chriscodes.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Saturday 24 July 2004 16:08, Wudi wrote:
> Hm, Perl is OK. Could you send that program to me?
> I have searched the class in phpclasses.org, but not found.
> The classes I searched only can replace the link, can't get links.
Hmmm it needs to be able to *find* the links before it can replace them. Just
borrow the code that finds the links.
--
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
------------------------------------------
/*
Calling you stupid is an insult to stupid people!
-- Wanda, "A Fish Called Wanda"
*/
--- End Message ---
--- Begin Message ---
This script can replace links:
$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a
href=\"\\0\">\\0</a>", $text);
But it cannot get the links.
On Sun, 25 Jul 2004 09:18:28 +0800
Jason Wong <[EMAIL PROTECTED]> wrote:
> On Saturday 24 July 2004 16:08, Wudi wrote:
> > Hm, Perl is OK. Could you send that program to me?
> > I have searched the class in phpclasses.org, but not found.
> > The classes I searched only can replace the link, can't get links.
>
> Hmmm it needs to be able to *find* the links before it can replace them. Just
> borrow the code that finds the links.
>
> --
> 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
> ------------------------------------------
> /*
> Calling you stupid is an insult to stupid people!
> -- Wanda, "A Fish Called Wanda"
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--------------------------------------------------
Comment: English is not my first language.
Wudi <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---
On Saturday 24 July 2004 19:15, Rosen wrote:
Please do not top post.
> But how I can parse this output ?
> > c:\>dir c:\test.txt
> > Volume in drive C is Primary
> > Volume Serial Number is 003E-6CEA
There are many ways to go about this, I'll outline one of them. First you need
to grab the output so:
exec('dir c:\', $output);
Then you can use something like substr() on $output[1] (the second line) to
grab the serial number.
--
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
------------------------------------------
/*
A fanatic is a person who can't change his mind and won't change the subject.
- Winston Churchill
*/
--- End Message ---
--- Begin Message ---
Am I the only one who gets annoyed at these?
--- [EMAIL PROTECTED], [EMAIL PROTECTED] wrote:
> Date: Sat, 24 Jul 2004 04:22:16 -0400
> To: [EMAIL PROTECTED]
> Subject: IMPORTANT: Please Verify Your Message
> From: <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>
---------------------------------
Verify Email
Hello [EMAIL PROTECTED] ,
[EMAIL PROTECTED], [EMAIL PROTECTED] is currently
protecting themselves from receiving junk mail using SpamceaseJust
this once, click the link below so I can receive your emails.
You won't have to do this again.
http://www.tgpwizards.com/spamcease2/verify.php?id=1334886
�
=====
Mark Weinstock
[EMAIL PROTECTED]
***************************************
You can't demand something as a "right" unless you are willing to fight to death to
defend everyone else's right to the same thing.
***************************************
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
On Sunday 25 July 2004 09:42, Mark wrote:
> Am I the only one who gets annoyed at these?
No you're not. Look in the past week's archives.
> [EMAIL PROTECTED], [EMAIL PROTECTED] is currently
You've got the culprit here. Either lambast him publically (since he doesn't
want to receive your private mail). Or do what this says:
> http://www.tgpwizards.com/spamcease2/verify.php?id=1334886
Or set a filter to trash these messages.
--
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
------------------------------------------
/*
A is for Apple.
-- Hester Pryne
*/
--- End Message ---
--- Begin Message ---
Jason Wong wrote:
> On Sunday 25 July 2004 09:42, Mark wrote:
>>[EMAIL PROTECTED], [EMAIL PROTECTED] is currently
>
> You've got the culprit here. Either lambast him publically (since he
doesn't
> want to receive your private mail). Or do what this says:
The thing is, though, none of these people have actually signed up for
this service as far as I can tell. It's like there's a spamcease bot
signed up to the list and is sending out these "notices" to people that
post to the list saying that some random address has signed up for it.
It's saying the list is signed up and people are receiving messages
saying themselves are signed up when they know they haven't.
I really wish we could get an active admin on the list that would react
to these sorts of things. I'd volunteer, but I don't think anyone cares
besides the people actually on the list.
All that being said, I just trash these, anyhow. :)
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
On Sunday 25 July 2004 10:30, John W. Holmes wrote:
> The thing is, though, none of these people have actually signed up for
> this service as far as I can tell.
Some previous posts imply that some people *did* use spamcease, my anti-spam
measures protects me from seeing these "Please Verify Your Message" messages.
> It's like there's a spamcease bot
> signed up to the list and is sending out these "notices" to people that
> post to the list saying that some random address has signed up for it.
> It's saying the list is signed up and people are receiving messages
> saying themselves are signed up when they know they haven't.
If it's an email harvesting scam then I think it's rather over elaborate.
> I really wish we could get an active admin on the list that would react
> to these sorts of things. I'd volunteer, but I don't think anyone cares
> besides the people actually on the list.
If individuals are using spamcease then there's very little a list admin can
do short of chucking them off the list. BUt if it's a bot that's subscribed
to the list then yes throw it off.
> All that being said, I just trash these, anyhow. :)
Exactly.
--
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
------------------------------------------
/*
All this time I've been VIEWING a RUSSIAN MIDGET SODOMIZE a HOUSECAT!
*/
--- End Message ---
--- Begin Message ---
Comex wrote:
but there isn't any archive..
Let's see I shake my magic 8-ball and it says... PEAR?
--- End Message ---
--- Begin Message ---
Hi,
Does anybody know of a good place to learn how to work
with regex?
Google has quite a few links for "learn pattern
matching" or "learn php regex" but none that start you
on "baby steps".
Any recommendations?
Thnx,
Mag
=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
This helped me get started with Perl-compatible regular expressions:
http://www.weitz.de/regex-coach/
--- End Message ---
--- Begin Message ---
Hi.
I am a bit confused about the include_path in php.ini, I am using PHP
5.0.0 on IIS
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
include_path = ".;/php/includes"
When I run "phpinfo()" the include_path points to ".;c:\php\PEAR" but that
is incorrect the correct path is "c:\inetpub\php5\PEAR".
My question is, is it correct to set the include_path to
"c:\inetpub\php5\PEAR" or just leave it as is???
Thanks in advanced :)
D_Angle
--- End Message ---
--- Begin Message ---
When I run "phpinfo()" the include_path points to ".;c:\php\PEAR" but that
is incorrect the correct path is "c:\inetpub\php5\PEAR".
Are you *certain* you're looking at the correct ini file? phpinfo() should show
the settings currently in use for your server (assuming you're calling the
phpinfo in a page served by IIS instead of for example the CLI version of PHP).
Magic 8-ball says: you have an old php.ini from PHP4 and it is in your
system32 folder.
My question is, is it correct to set the include_path to
"c:\inetpub\php5\PEAR" or just leave it as is???
If this is the path to your PEAR files then you'll need to change your include_path.
--- End Message ---
--- Begin Message ---
This is taken right out of the download of PHP 5 zip file
"php-5.0.0-Win32.zip". Opening the "php.ini-recommended" it states the
following configuration
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
But phpinfo() shows this
include_path = .;C:\php5\pear
the correct windows path is
c:\inetpub\php5\pear
Do I change the path include_path to "c:\inetpub\php5\pear" ?
Why is it writen as ".;c:\php\includes" in recommended php.ini ?
Wy not call it pear_path = ".;C:\php5\pear" instead?
"Jason Barnett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > When I run "phpinfo()" the include_path points to ".;c:\php\PEAR" but
that
> > is incorrect the correct path is "c:\inetpub\php5\PEAR".
Sorry it was ment to be ".;c:\php5\PEAR" :p
>
> Are you *certain* you're looking at the correct ini file? phpinfo()
should show
> the settings currently in use for your server (assuming you're calling the
> phpinfo in a page served by IIS instead of for example the CLI version of
PHP).
> Magic 8-ball says: you have an old php.ini from PHP4 and it is in your
> system32 folder.
>
> >
> > My question is, is it correct to set the include_path to
> > "c:\inetpub\php5\PEAR" or just leave it as is???
>
> If this is the path to your PEAR files then you'll need to change your
include_path.
--- End Message ---
--- Begin Message ---
D_angle wrote:
This is taken right out of the download of PHP 5 zip file
"php-5.0.0-Win32.zip". Opening the "php.ini-recommended" it states the
following configuration
What is in the php.ini in your windows directory?
THAT is the copy that PHP is using.
( Is there something missing in the install notes - this is the second
time I've had to mention where the php.ini is located ;) )
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
--- End Message ---
--- Begin Message ---
Hi,
Sunday, July 25, 2004, 5:18:44 AM, you wrote:
JWH> Scite is perfect. You rock. A single 364KB file with PHP source code
JWH> highlighting, brace matching, (regex) search and replace and more. It's
JWH> so perfect I won't even make fun of you for mentioning TemplateTamer
JWH> again! ;) Thanks, though, seriously.
JWH> --
JWH> ---John Holmes...
JWH> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
JWH> php|architect: The Magazine for PHP Professionals � www.phparch.com
I have a modified lexer dll which has slightly better colouring
for php (basically it means php functions can be coloured differently
from the keywords) which I find useful. Your quite welcome to try it
out. Warning: it will add 3K to the dll size :)
--
regards,
Tom
--- End Message ---