OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 13 Oct 2005 15:37:13 -0000 Issue 3735

php-general-digest-helplists.php.net
Date: Thu Oct 13 2005 - 10:37:13 CDT


php-general Digest 13 Oct 2005 15:37:13 -0000 Issue 3735

Topics (messages 224012 through 224052):

Re: Small regex help?
        224012 by: Philip Hallstrom
        224013 by: Ethilien
        224024 by: Guy Brom

Is DOM the right thing for the job?
        224014 by: Chris

Problem with Javascript:...submit()
        224015 by: Johan Grobler
        224016 by: Jasper Bryant-Greene
        224018 by: Minuk Choi

Re: ampersand in dom with utf-8
        224017 by: cc
        224022 by: Marcus Bointon
        224032 by: cc

Re: Removing Items from an Array
        224019 by: cc

Connecting to MySQL Sever using PHP5
        224020 by: Jacques
        224021 by: Mark Rees
        224025 by: Mark Rees
        224026 by: Andreja Simovic
        224033 by: Jay Blanchard

404 ErrorDocument in safe mode
        224023 by: Petr Kodytek

Re: Trouble moving directory
        224027 by: Robin Vickery

Re: include file to global scope
        224028 by: Jochem Maas
        224034 by: cc

Guide for C programmer
        224029 by: Turgut Hakkı ÖZDEMİR
        224030 by: Jochem Maas
        224031 by: Paul Waring

PHP & Mysql Developer needed in South Africa
        224035 by: Paul

Re: array_slice and for loop problem
        224036 by: Rodney Green
        224037 by: Rodney Green

Re: actually the è not the ampersand
        224038 by: John Nichel

Re: Store a variable name in a database field.
        224039 by: Al
        224041 by: Liam Delahunty

function to compare ip addr to a ip range>
        224040 by: Bosky, Dave
        224043 by: Greg Donald

Re: Removing Items from an Array - My Solution
        224042 by: Alan Lord

Re: Any good free easy converting tool?
        224044 by: Leif Gregory

What's the safest way to destory/wipe out the arrays within the associative arrays?
        224045 by: Scott Fletcher
        224052 by: Paul Waring

Re: chown function
        224046 by: Scott Fletcher
        224048 by: John Nichel

Re: How to automate php with crontab?
        224047 by: Scott Fletcher
        224049 by: Greg Donald
        224050 by: John Nichel
        224051 by: John Nichel

Administrivia:

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

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

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

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

attached mail follows:


> Can anyone suggest the correct regex to replace col1,col2... with count(*)
> and strip out everything just before ORDER BY?
>
> so for this:
> SELECT col1,col2... FROM tbl WHERE filter1 filter2 ORDER BY order1,order2
>
> I would get this:
> SELECT count(*) FROM tbl WHERE filter1 filter2

$str = "SELECT col1,col2... FROM tbl WHERE filter1 filter2 ORDER BY order1,order2";

$str = ereg_replace("^SELECT .* FROM (.*) ORDER BY .*",
                         "SELECT COUNT(*) FROM \\1", $str);

attached mail follows:


Hmmm,
"/SELECT .* FROM (.*) WHERE (.*) ORDER BY .*/Ui", "SELECT count(*) FROM
\$1 WHERE \$2"

Might work, but haven't tried it...

Guy Brom wrote:
> Can anyone suggest the correct regex to replace col1,col2... with count(*)
> and strip out everything just before ORDER BY?
>
> so for this:
> SELECT col1,col2... FROM tbl WHERE filter1 filter2 ORDER BY order1,order2
>
> I would get this:
> SELECT count(*) FROM tbl WHERE filter1 filter2
>
> Thanks!

attached mail follows:


I ended up using the rewriteCountQuery from PEAR::DB_Pager (attached).
Thanks all!

function rewriteCountQuery($sql)
{
    if (preg_match('/^\s*SELECT\s+\bDISTINCT\b/is', $sql) ||
preg_match('/\s+GROUP\s+BY\s+/is', $sql)) {
        return false;
    }
    $queryCount = preg_replace('/(?:.*)\bFROM\b\s+/Uims', 'SELECT COUNT(*)
FROM ', $sql, 1);
    list($queryCount, ) = preg_split('/\s+ORDER\s+BY\s+/is', $queryCount);
    list($queryCount, ) = preg_split('/\bLIMIT\b/is', $queryCount);
    return trim($queryCount);
}

"Philip Hallstrom" <phpphilip.pjkh.com> wrote in message
news:20051012210050.R79050wolf.pjkh.com...
>> Can anyone suggest the correct regex to replace col1,col2... with
>> count(*)
>> and strip out everything just before ORDER BY?
>>
>> so for this:
>> SELECT col1,col2... FROM tbl WHERE filter1 filter2 ORDER BY order1,order2
>>
>> I would get this:
>> SELECT count(*) FROM tbl WHERE filter1 filter2
>
> $str = "SELECT col1,col2... FROM tbl WHERE filter1 filter2 ORDER BY
> order1,order2";
>
> $str = ereg_replace("^SELECT .* FROM (.*) ORDER BY .*",
> "SELECT COUNT(*) FROM \\1", $str);

attached mail follows:


Hey,

I've got a set of classes which represent an HTML form. Right now the
Elements return their string representation to the parent, which wraps
those in the form tag and supplementary formatting HTML. This method
works, but it creates an internal limit as to the design of the form.

I'm hoping to use the DOM to allow each element to return a DOMElement,
which the form object can put into it's own DOMElement that represents
the form.

I've run into a few snags, and was hoping someone could help, or maybe
point at a viable solution which I haven't considered yet.

Snag #1)
The DOMDocument seems to represent an entire page, all I'd like to do is
represent a Form tag and it's internal HTML. I can actually get it to
work that way, but it seems like it's the wrong way to go about things.

Snag #2)
The creation of a DOMElement object is very limited without being
associated with a DOMDocument, I'd like to create an independent
DOMElement inside the Element class, including possible sub-DOMElements,
without having to create the DOMDocument in the Form object..

I realize after writing this that these don't seem like very serious
snags, but I jsut dont' have a fuzzy feeling about the way this would
work if I implemented it knowing what I've stated here. Any assistance
would be greatly appreciated.

Thanks!
Chris

attached mail follows:


while ($row = mysql_fetch_array($sql_result))
{
echo"<Form name=\"".$row['LITERATURE_title']."\" action=\"searchlit.php\" method=\"post\">
<font face=\"arial\" size=\"2\">
<a href=\"javascript:".$row['LITERATURE_title'].".submit();\" >".$row['LITERATURE_title']." - ".$row['res_fname']." ".$row['res_lname']."</a>
...

Everything works as long as $row['LITERATURE_title'] is one word, see this variable contains the names of books, and if the books name is "Heaven" for instance it works fine but as soon as the title is something like "PHP for Dummies" it doesnt work and i get a error on page message, I tried using numbers as the form name but then the same thing happens.

Any ways around this?

thanx
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

attached mail follows:


Johan Grobler wrote:
> while ($row = mysql_fetch_array($sql_result)) { echo"<Form
> name=\"".$row['LITERATURE_title']."\" action=\"searchlit.php\"
> method=\"post\"> <font face=\"arial\" size=\"2\"> <a
> href=\"javascript:".$row['LITERATURE_title'].".submit();\"
> >".$row['LITERATURE_title']." - ".$row['res_fname']."
> ".$row['res_lname']."</a> ...
>
> Everything works as long as $row['LITERATURE_title'] is one word, see
> this variable contains the names of books, and if the books name is
> "Heaven" for instance it works fine but as soon as the title is
> something like "PHP for Dummies" it doesnt work and i get a error on
> page message, I tried using numbers as the form name but then the
> same thing happens.

If you've got a row ID number or something, just call the form "lit[id]"
(replacing [id] with the ID number), because I don't think a form name
can start with a number. Otherwise you could sha1() the title and use
that as the identifier, or simply remove all spaces...

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

attached mail follows:


I'm just taking a wild guess...

but I'm guessing that if you set a name with spaces, it'll be replaced
with "_"(underscore).

A couple of ways around this is to
    1) figure out a way to assign a one-word name for all your
books(e.g. Code, ID number, etc.)
    2) generate a hash code(e.g. md5($row['LITERATURE_title'])) will
generate a one word(no spaces).

If this is going to be a library application, you can always use
"ISBNXXXXXXXXX"(no spaces, no dashes), since the idea is that every book
has a unique ISBN number....

Johan Grobler wrote:

>while ($row = mysql_fetch_array($sql_result))
>{
>echo"<Form name=\"".$row['LITERATURE_title']."\" action=\"searchlit.php\" method=\"post\">
><font face=\"arial\" size=\"2\">
><a href=\"javascript:".$row['LITERATURE_title'].".submit();\" >".$row['LITERATURE_title']." - ".$row['res_fname']." ".$row['res_lname']."</a>
>...
>
>Everything works as long as $row['LITERATURE_title'] is one word, see this variable contains the names of books, and if the books name is "Heaven" for instance it works fine but as soon as the title is something like "PHP for Dummies" it doesnt work and i get a error on page message, I tried using numbers as the form name but then the same thing happens.
>
>Any ways around this?
>
>thanx
>--------------------------------------------------------------------
>Disclaimer
>This e-mail transmission contains confidential information,
>which is the property of the sender.
>The information in this e-mail or attachments thereto is
>intended for the attention and use only of the addressee.
>Should you have received this e-mail in error, please delete
>and destroy it and any attachments thereto immediately.
>Under no circumstances will the Cape Peninsula University of
>Technology or the sender of this e-mail be liable to any party for
>any direct, indirect, special or other consequential damages for any
>use of this e-mail.
>For the detailed e-mail disclaimer please refer to
>http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
>
>
>

attached mail follows:


both `&egrave;' and `&icirc;' are not entities in charset utf-8, use
`&amp;egrave;' and `&amp;icirc;' instead.

On 10/13/05, jonathan <news_phparclocal.com> wrote:
> I'm now getting this error:
>
> XML Parsing Error: undefined entity
>
> with the following entity at the first ampersand:
> <item_name>farm lettuces with reed avocado, cr&egrave;me
> fra&icirc;che, radish and cilantro</item_name>
>
> Why is an ampersand considered an undefined entity? The xml version
> is: <?xml version="1.0"?>
>
> Any thoughts please?
>
> -jonathan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On 13 Oct 2005, at 07:24, cc wrote:

> both `&egrave;' and `&icirc;' are not entities in charset utf-8, use
> `&amp;egrave;' and `&amp;icirc;' instead.

I would expect that to result in unconverted entities in the output.
If you're intending to send that content as HTML, then I guess that
would be OK. However, if you're using UTF-8 anyway, why not just use
the real characters?

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcussynchromedia.co.uk | http://www.synchromedia.co.uk

attached mail follows:


maybe i should have said: &egrave; is not an _xml_ entity.
i m not very sure.
sorry.

`&egrave;' is an html entity,
represents the letter `è' in iso-8859-1 charset,
which have ascii value of 0xe8 .

to have it recognized by libxml, there are 3 ways to do this:
1, <?xml version="1.0"><item_name>&#e8;</item_name>
2, <?xml version="1.0" encoding="iso-8859-1"><item_name>è</item_name>
3, <?xml version="1.0"><item_name>è</item_name>

1 can be saved using either utf-8 encoding or iso-8859-1 encoding;
2 must be saved using iso-8859-1 encoding
3 must be saved using utf-8 encoding ( to have `è' be converted properly)

in php, we can do this:

   $html = html_entity_decode('<item_name>farm lettuces with reed
avocado, cr&egrave;me
fra&icirc;che, radish and cilantro</item_name>');
   $dom = DomDocument::loadXML("<?xml version=\"1.0\"
encoding=\"iso-8859-1\">$html");

On 10/13/05, Marcus Bointon <marcussynchromedia.co.uk> wrote:
> On 13 Oct 2005, at 07:24, cc wrote:
>
> > both `&egrave;' and `&icirc;' are not entities in charset utf-8, use
> > `&amp;egrave;' and `&amp;icirc;' instead.
>
> I would expect that to result in unconverted entities in the output.
> If you're intending to send that content as HTML, then I guess that
> would be OK. However, if you're using UTF-8 anyway, why not just use
> the real characters?
>
> Marcus
> --
> Marcus Bointon
> Synchromedia Limited: Putting you in the picture
> marcussynchromedia.co.uk | http://www.synchromedia.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


could Alan give samples about the input and expected output of the black box?
then we can consider implement it.

On 10/13/05, Alan Lord <lord_alanhotmail.com> wrote:
> Thanks for the replies gents.
>
> I have cludged together something from your solutions but it isn't yet
> working. I've been staring at multi-dim arrays all day and am getting
> tired, so I'll carry on tomorrow.
>
> Thanks again,
>
> Alan
>
> > -----Original Message-----
> > From: Jochem Maas [mailto:jochemiamjochem.com]
> > Sent: 12 October 2005 19:18
> > To: tg-phpgryffyndevelopment.com
> > Cc: php-generallists.php.net; lord_alanhotmail.com
> > Subject: Re: [PHP] Removing Items from an Array
> >
> > Id like to continue where TG left off ...
> >
> > hth.
> >
> > tg-phpgryffyndevelopment.com wrote:
> > > If I understand what you're asking, then maybe this will help:
> > >
> > > $arrset1 = array("Apples" => 3, "Oranges" => 5, "Apricots" => 1);
> > > $arrset2 = array("Couches" => 6, "Chairs" => 2, "Benches" => 5);
> > >
> > > $alldataarr["Fruits"] = $arrset1;
> > > $alldataarr["Furniture"] = $arrset2;
> > >
> > > Say we want to remove "Chairs", and let's do it the hard way:
> > >
> > > foreach ($alldataarr as $key => $data) {
> > > foreach ($data as $subkey => $subdata) {
> > > if ($subkey == "Chairs) {
> > > unset($alldataarr[$key][$subkey]);
> > > }
> > > }
> > > }
> > >
> > > using foreach $arr as $key => $data you can get the
> > key/index name as well as the actual value stored in that
> > part of your array. Then all you have to do is refer back up
> > to the main array using the current $key/$subkey values as
> > your indexes.
> > >
> >
> > $filter = array(
> > 'Fruits' => array('Apples' => 1, 'Oranges' => 1),
> > 'Furniture' => array('Couches' => 1, 'Chairs' => 1), );
> >
> > $alldataarr = array();
> > $alldataarr["Fruits"] = array("Apples" => 3, "Oranges" => 5,
> > "Apricots" => 1); $alldataarr["Furniture"] = array("Couches"
> > => 6, "Chairs" => 2, "Benches" => 5);
> >
> > foreach ($alldataarr as $key => $data) {
> > if (!isset($filter[$key]) {
> > // we want it all;.
> > continue;
> > }
> > $alldataarr[$key]= array_intersect_keys($data, $filter[$key]); }
> >
> >
> > // heres one I prepared earlier:
> >
> >
> > /**
> > * array_intersect_keys()
> > * ^--- the internal function (php5.x+?)
> > has no 's'
> > *
> > * returns the all the items in the 1st array whose keys are
> > found in any of the other arrays
> > *
> > * return array()
> > */
> > function array_intersect_keys()
> > {
> > $args = func_get_args();
> > $originalArray = $args[0];
> > $res = array();
> >
> > if(!is_array($originalArray)) { return $res; }
> >
> > for($i=1;$i<count($args);$i++) {
> > if(!is_array($args[$i])) { continue; }
> > foreach ($args[$i] as $key => $data) {
> > if (isset($originalArray[$key]) && !isset($res[$key])) {
> > $res[$key] = $originalArray[$key];
> > }
> > }
> > }
> >
> > return $res;
> > }
> >
> >
> >
> >
> > >
> > > Basic example, but I think you can modify this to work with
> > what you're doing.
> > >
> > > Let me know if you have any questions about this example.
> > >
> > > -TG
> > >
> > >
> > >
> > > = = = Original message = = =
> > >
> > > Hi all,
> > >
> > > I'm really struggling here! I have a large, multi-dimensional array
> > > that I want to "clean-up" a bit before committing to a database.
> > >
> > > I want to remove quite a bit of the array but using the
> > KEYs not the
> > > values. I know the keys I want to keep and I know the keys
> > I want to
> > > get rid of. I want to keep the structure and sequence of
> > the array in tact.
> > >
> > > All of the array traversing functions in PHP seem to
> > either: only work
> > > on the values, or do not allow the removal of elements of the array!
> > >
> > > Can anyone offer a clue bat to a tired old array walker!
> > >
> > > Thanks
> > >
> > > Alan
> > >
> > >
> > > ___________________________________________________________
> > > Sent by ePrompter, the premier email notification software.
> > > Free download at http://www.ePrompter.com.
> > >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I have just installed PHP5. I am using Windows XP and have already installed
MySQL.

When I try and make a connection to a database on MySQL via Dreamweaver I
get the following error message: "An unidentified error has occurred".

What could be wrong and how can I fix this problem?

Jacques

attached mail follows:


> I have just installed PHP5. I am using Windows XP and have already
installed
> MySQL.
>
> When I try and make a connection to a database on MySQL via Dreamweaver I
> get the following error message: "An unidentified error has occurred".
>
> What could be wrong

Have a look at this:
http://uk2.php.net/mysql_error

attached mail follows:


Back to the list - please use reply-all
----- Original Message -----
From: "Andreja Simovic" <andrejabeogradnet.com>
To: "Mark Rees" <mreesitsagoodprice.com>
Sent: Thursday, October 13, 2005 9:58 AM
Subject: Re: [PHP] Re: Connecting to MySQL Sever using PHP5

> Sometimes this error may ocure
> if you do not place trailing slash in define sites url
> http://localhost/mysite1/
> from my expirience
>
> ----- Original Message -----
> From: "Mark Rees" <mreesitsagoodprice.com>
> To: <php-generallists.php.net>
> Sent: Thursday, October 13, 2005 10:43 AM
> Subject: [PHP] Re: Connecting to MySQL Sever using PHP5
>
>
> >> I have just installed PHP5. I am using Windows XP and have already
> > installed
> >> MySQL.
> >>
> >> When I try and make a connection to a database on MySQL via Dreamweaver
I
> >> get the following error message: "An unidentified error has occurred".
> >>
> >> What could be wrong
> >
> > Have a look at this:
> > http://uk2.php.net/mysql_error
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> > __________ NOD32 1.1251 (20051012) Information __________
> >
> > This message was checked by NOD32 antivirus system.
> > http://www.eset.com
> >
> >
>
>

attached mail follows:


----- Original Message -----
From: "Mark Rees" <mreesitsagoodprice.com>
To: <php-generallists.php.net>
Sent: Thursday, October 13, 2005 11:54 AM
Subject: Fw: [PHP] Re: Connecting to MySQL Sever using PHP5

> Back to the list - please use reply-all
> ----- Original Message -----
> From: "Andreja Simovic" <andrejabeogradnet.com>
> To: "Mark Rees" <mreesitsagoodprice.com>
> Sent: Thursday, October 13, 2005 9:58 AM
> Subject: Re: [PHP] Re: Connecting to MySQL Sever using PHP5
>
>
>> Sometimes this error may ocure
>> if you do not place trailing slash in define sites url
>> http://localhost/mysite1/
>> from my expirience
>>
>> ----- Original Message -----
>> From: "Mark Rees" <mreesitsagoodprice.com>
>> To: <php-generallists.php.net>
>> Sent: Thursday, October 13, 2005 10:43 AM
>> Subject: [PHP] Re: Connecting to MySQL Sever using PHP5
>>
>>
>> >> I have just installed PHP5. I am using Windows XP and have already
>> > installed
>> >> MySQL.
>> >>
>> >> When I try and make a connection to a database on MySQL via
>> >> Dreamweaver
> I
>> >> get the following error message: "An unidentified error has occurred".
>> >>
>> >> What could be wrong
>> >
>> > Have a look at this:
>> > http://uk2.php.net/mysql_error
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>> >
>> >
>> > __________ NOD32 1.1251 (20051012) Information __________
>> >
>> > This message was checked by NOD32 antivirus system.
>> > http://www.eset.com
>> >
>> >
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> __________ NOD32 1.1251 (20051012) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>

attached mail follows:


[snip]
I have just installed PHP5. I am using Windows XP and have already installed

MySQL.

When I try and make a connection to a database on MySQL via Dreamweaver I
get the following error message: "An unidentified error has occurred".

What could be wrong and how can I fix this problem?
[/snip]

Since the error is "unidentified" I'll need to use ESPN to figure it out. My
SWAG is that a solid whack on the top of the box will fix it. Yes, do that.

http://www.catb.org/~esr/faqs/smart-questions.html

What version of MySQL are you using?

attached mail follows:


Hallo,

I've problem with 404 ErrorDocument in safe mode on version 5.1.0RC1. I'm using error script to
redirect nonexisting URLs to pages with content from database (something like mod_rewrite).
After when my webhosting provider upgrades to 5.1.0RC1 my pages returns this error message :

================================================================================================
*Warning*: Unknown: SAFE MODE Restriction in effect. The script
whose uid is 46790 is not allowed to access
/path/to/404.phtml owned by uid 23708 in *Unknown* on line *0*

*Warning*: Unknown: failed to open stream: No such file or directory in *Unknown* on line *0*

*Warning*: Unknown: Failed opening '/path/to/404.phtml' for inclusion (include_path='.') in *Unknown* on line *0
*================================================================================================
Note : /path/to/404.phtml is not real path, I'm changed it only for illustration

*
*When I'm trying to open 404.phtml script directly from browser everything gone OK. Have anyone idea to fix this.
Sorry for my English.

--
Kody

attached mail follows:


On 10/13/05, -k. <telirumyahoo.com> wrote:
> --- Jasper Bryant-Greene <jasperbryant-greene.name> wrote:
> > $source_dir = escapeshellarg( '/some/dir/Dir That Won't Move/' );
>
>
> Unfortunately escapeshellarg doesn't work for all cases, it will escape the " ' " in that example
> but it doesn't escape other characters such as " ) ". So...
>
> $source_dir = escapeshellarg( '/some/dir/Dir That (Won't Move)/' );
>
> ...fails as well. Any other ideas?

<?php
  rename("/some/dir/Dir That (Won't Move)/", '/some/other/dir/');
?>

Or if you must use shell_exec(), use addcslashes() to escape the
annoying characters first.

 -robin

attached mail follows:


cc wrote:
> yes, its possible, consider this:
>
> /**
> * param $file_to_include path to php file you want to get its content
> * return included contents
> */
> function get_output($file_to_include){
> ob_start();
> include $file_to_include;
> return ob_get_clean();
> }

this will break if the included file assumes its being included
in the global scope (and/or has functions that assume certain globals
exists - which they would do if the file wasn't included within a
function) ...

which brings the OP back to his original problem :-)

>
> of course, you may extend this function to better fit into your situation.
> Good luck.
>
> On 10/12/05, Claudio <karfunckel-phpyahoo.de> wrote:
>
>>Is it possible to process the file in second php instance?
>>An only get its output?
>>
>>Claudio
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>

attached mail follows:


the answer

cc wrote:
> yes, its possible, consider this:
>
> /**
> * param $file_to_include path to php file you want to get its content
> * return included contents
> */
> function get_output($file_to_include){
> ob_start();
> include $file_to_include;
> return ob_get_clean();
> }

is to the question

On 10/12/05, Claudio <karfunckel-phpyahoo.de> wrote:
> Is it possible to process the file in second php instance?
> An only get its output?
>
> Claudio

to ``Is there a way to include this files to global scope? So that difined vars
and functions are global accesseble?'',

there is another answer,

consider these code,

<?php
$ov=1;
function o(){
  $iv=1;
  function i(){
  echo "i\n";
  var_dump(get_defined_vars());
}
echo "o\n";
var_dump(get_defined_vars());
i();
}

o();
i();
var_dump(get_defined_vars());

On 10/13/05, Jochem Maas <jochemiamjochem.com> wrote:
> cc wrote:
> > yes, its possible, consider this:
> >
> > /**
> > * param $file_to_include path to php file you want to get its content
> > * return included contents
> > */
> > function get_output($file_to_include){
> > ob_start();
> > include $file_to_include;
> > return ob_get_clean();
> > }
>
> this will break if the included file assumes its being included
> in the global scope (and/or has functions that assume certain globals
> exists - which they would do if the file wasn't included within a
> function) ...
>
> which brings the OP back to his original problem :-)
>
> >
> > of course, you may extend this function to better fit into your
> situation.
> > Good luck.
> >
> > On 10/12/05, Claudio <karfunckel-phpyahoo.de> wrote:
> >
> >>Is it possible to process the file in second php instance?
> >>An only get its output?
> >>
> >>Claudio
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
>
>

attached mail follows:


I'm looking for a document describing differences between C and PHP,
important points for programmers who already know C,C++, and things that
must be taken care.
I'm googling for about an our but i can't find anything. Any suggestions.?
:)

attached mail follows:


Turgut Hakkı ÖZDEMİR wrote:
> I'm looking for a document describing differences between C and PHP,

php is a weak & dynamaically typed, intepreted language - C is not.
(aka 'a world of difference')

the php/zend engine are written in C btw.

> important points for programmers who already know C,C++, and things that
> must be taken care.
> I'm googling for about an our but i can't find anything. Any suggestions.?
> :)

if you can write C/C++ then php should be easy to get to grips with.
php tutorials specifically for C/C++ programmers don't really exist AFAICT
because C/C++ programmers generally know more than enough to start using php
without the help of some patronizing tutorial.

but you could read here:
http://php.net
http://php.net/tut.php
http://php.net/manual/en/

that should cover it.

>

attached mail follows:


On Thu, Oct 13, 2005 at 02:13:37PM +0300, Turgut Hakk? ?ZDEM?R wrote:
> I'm looking for a document describing differences between C and PHP,
> important points for programmers who already know C,C++, and things that
> must be taken care.
> I'm googling for about an our but i can't find anything. Any suggestions.?

I don't see why anyone would write such a document. Other than sharing a
similar syntax and flow control (curly braces, if/else blocks, while
loops etc.), they're different languages. For a start C is compiled
whereas PHP is interpreted, and you can't just jump between the two. You
also don't have to bother, most of the time, with using the right
variable types in PHP because it will handle conversions automatically.

Paul

--
Rogue Tory
http://www.roguetory.org.uk

attached mail follows:


I have a position open for someone in Johannesburg South Africa with
the following skills.

php
mysql
css
xml
xhtml

Image and artwork a bonus (ImageReady,Photoshop, Paintshop, The gimp)
Flash a bonus

Please email me directly at paul.kaingmail.com

attached mail follows:


Thanks Connor. I changed the line to the following. Is it correct now?
The array $output[] is now being populated. However, when I go to
print the values of the $output array using a foreach loop, it prints
out the word "Array" for each array item.

$output[] = array_slice ($textArray, $int_range[start][$i],
$int_range[end][$i]);

On 10/12/05, Ethilien <spamethilien.info> wrote:
> Are you trying to put each return from array_slice into $output as an
> array? You need to replace $output = array_slice... with $output[] =
> array_slice...
>
> Also, you cannot just echo an array (even of characters). It must be a
> string, or else echo will only produce the output 'Array'.
>
> Hope this helps,
> -Connor McKay
>
> Rodney Green wrote:
> > Hello,
> >
> > I'm using a for loop to iterate through an array and slice parts of
> > the array and add into another array.
> >
> > When array_slice is called the variable $i is not being substituted
> > with the current value of
> > $i and the $output array is empty after running the script. Can
> > someone look at the code below and give me a clue as to why this
> > substitution is not happening? If I uncomment the "echo $i;" statement
> > the value of $i is printed just fine.
> >
> > Thanks,
> > Rod
> >
> > Here's my code:
> >
> >
> > $number = count ($int_range[start]);
> > //echo $number;
> > for ($i = 0; $i <= $number; $i++) {
> >
> > //echo $i;
> >
> > $output = array_slice ($textArray, $int_range[start][$i],
> > $int_range[end][$i]);
> >
> > }
> >
> >
> >
> >
> > foreach ($output as $value) {
> >
> > echo $value;
> > }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
There are 10 kinds of people in this world: those who understand
binary data, and those who
don't.

-------------------------------------------------------
Get Firefox Web Browser at the link below! You won't regret it!
http://tinyurl.com/4cqbv

attached mail follows:


$output[] = array_slice ($textArray, $int_range[start][$i],
$int_range[end][$i]); is creating a multi-dimensional array as
$output. In my foreach loop I was treating $output as a
single-dimensional array. That's why it wasn't working. print_r() is
my friend. :-)

On 10/13/05, Rodney Green <rodgreengmail.com> wrote:
> Thanks Connor. I changed the line to the following. Is it correct now?
> The array $output[] is now being populated. However, when I go to
> print the values of the $output array using a foreach loop, it prints
> out the word "Array" for each array item.
>
> $output[] = array_slice ($textArray, $int_range[start][$i],
> $int_range[end][$i]);
>
>
>
> On 10/12/05, Ethilien <spamethilien.info> wrote:
> > Are you trying to put each return from array_slice into $output as an
> > array? You need to replace $output = array_slice... with $output[] =
> > array_slice...
> >
> > Also, you cannot just echo an array (even of characters). It must be a
> > string, or else echo will only produce the output 'Array'.
> >
> > Hope this helps,
> > -Connor McKay
> >
> > Rodney Green wrote:
> > > Hello,
> > >
> > > I'm using a for loop to iterate through an array and slice parts of
> > > the array and add into another array.
> > >
> > > When array_slice is called the variable $i is not being substituted
> > > with the current value of
> > > $i and the $output array is empty after running the script. Can
> > > someone look at the code below and give me a clue as to why this
> > > substitution is not happening? If I uncomment the "echo $i;" statement
> > > the value of $i is printed just fine.
> > >
> > > Thanks,
> > > Rod
> > >
> > > Here's my code:
> > >
> > >
> > > $number = count ($int_range[start]);
> > > //echo $number;
> > > for ($i = 0; $i <= $number; $i++) {
> > >
> > > //echo $i;
> > >
> > > $output = array_slice ($textArray, $int_range[start][$i],
> > > $int_range[end][$i]);
> > >
> > > }
> > >
> > >
> > >
> > >
> > > foreach ($output as $value) {
> > >
> > > echo $value;
> > > }
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> There are 10 kinds of people in this world: those who understand
> binary data, and those who
> don't.
>
> -------------------------------------------------------
> Get Firefox Web Browser at the link below! You won't regret it!
> http://tinyurl.com/4cqbv
>

--
There are 10 kinds of people in this world: those who understand
binary data, and those who
don't.

-------------------------------------------------------
Get Firefox Web Browser at the link below! You won't regret it!
http://tinyurl.com/4cqbv

attached mail follows:


jonathan wrote:
> do you then have to do the reverse operation to get it back for
> rendering. Since it was erroring on me during DOM creation, I feel like
> I'm going around it to put it into a format it likes but then on
> display via XSL transformation, I will have to convert it back. Or am I
> missing something?

I'm only on the sending end; I don't know if the people I send the
documents too have to convert it back. Don't quote me on this, but if
you're going to display the information in a web browser, *I think* it
will display the decimal value properly.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Liam Delahunty wrote:
> I'm sure this is a pretty basic question, but I have searched for a
> decent answer and can't find one.
>
> I have a client that want to be able to write newsletters
> (newsleters_tbl.email_body) and use fields from his contact table, so
> as we grind through the contact list for newsletters subscribers it
> may pull out $first_name, or $last_name, or perhaps the address and so
> on, and send an individual email and have it in the $email_body field
> from another table.
>
> $email_body is a free form text field, and he wants to be able to type
> in anything he desires and have it pulled from the contact table.
>
> I've tried with and without addslashes, and htmlentities. Is there a
> solution or I will I have to resort to getting him to use
> {{$first_name}} etc.
>
> Lastly, if I have to use {{whatever}} then what's the reason I can't
> use $field_name in the database?
>
> --
> Kind regards,
> Liam Delahunty

Consider using serialize(). It's simple and foolproof. Read the manual on Serialize Objects.

attached mail follows:


On 10/10/05, Richard Lynch <ceol-i-e.com> wrote:
> > $email_body is a free form text field, and he wants to be able to type
> > in anything he desires and have it pulled from the contact table.
> >

Firstly please accept my aplogies for the deay in responding to your
questions, I;ve had the most terrible flu.

pseudo code (ish), as I've completely bastardised what I had when I
posed the question.

// insert newsletter into newsleter_tbl in database ...
from a form, body in a textarea field, client wants to type in
whatever he likes with database column names as varibles, eg $email,
$first_name

this is the newsletter write on newsletter_new.php

if ($submit){
        // removed error checking etc

    $email_subject = htmlentities(addslashes($email_subject));
        // tried various combintions of htmlentities, addslashes and nothing
when writting field to DB
    if ($email_style == "1"){
      $email_body = htmlentities(addslashes($email_body));
    }else{
      $email_body = addslashes($email_body);
    }
    $email_style = htmlentities(addslashes($email_style));

    $query = "INSERT INTO newsletters_tbl (email_subject, email_body,
email_date, email_style) VALUES ('$email_subject', '$email_body',
NOW(), '$email_style')";
    if ($result = mysql_query($query, $connection)) {
      $newsletter_id= mysql_insert_id($connection);
      print ("<p><b>Success</b> Add newsletter (# $newsletter_id)
successful. </p>\n");
      print ("<p><a
href=\"newsletter_test.php?this_nid=$newsletter_id&amp;sid=$sid&amp;page=$page\">CLICK
HERE TO TEST</td></p>\n");
    } else {
      printf ("<p><b>Error: %s\n", mysql_errno () . "</b><br>");
      printf ("%s\n", mysql_error () . "<br>");
      print ("$query</p>\n");
    }
  }
}

// BTW the contact details are in another table in database already.

// Sending out the newsletter
$nquery=" SELECT c.id, first_name, email FROM contact_tbl c LEFT OUTER
JOIN newsletters_contacts_tbl nct ON nct.contact_id =c.id AND
newsletter_id = '$this_nid' WHERE nct.contact_id IS NULL AND
newsletter = '$email_style' GROUP BY email LIMIT 1";
if ($nresult = mysql_query($nquery, $connection)){
  if (mysql_num_rows($nresult) > 0){
    while ($myrow = mysql_fetch_row($nresult)) {
      $uid=$myrow[0];
      $first_name=stripslashes($myrow[1]);
      $email=stripslashes($myrow[2]);

      $query = "SELECT * FROM newsletters_tbl WHERE id = '$this_nid' ";
      $result = mysql_query($query, $connection);
      if($result){
        while ($myrow = mysql_fetch_row($result)){
          $newsletter_id = $myrow[0];
          $email_subject = stripslashes($myrow[1]);
          $email_body = stripslashes($myrow[2]);
          $email_date = $myrow[3];
          $email_style = $myrow[4];
          $email_status = $myrow[5];
        }
        if ($email_status == "0"){
          print ("<p>Requires Confirmation</p>");
        }elseif($email_status == "1"){

          /*
          // NOW USING {{ }} as in many templating systems
          // so familar to those sorts of users.
          // would prefer if I could just use $columnName from
          // contact_tbl.
          // Why doesn't it just know the var as we've already
                  // got it above...?
          */
                
          $email_body = ereg_replace ("\{\{uid\}\}", $uid, $email_body);
          $email_body = ereg_replace ("\{\{email\}\}", $email, $email_body);
          $email_body = ereg_replace ("\{\{first_name\}\}",
$first_name, $email_body);

          if ($email_style == "1"){
            // INSERT PLAIN TEXT HEADER
          }elseif ($email_style == "2"){
            // INSERT HTML MIME HEADERS
          }

          $outquery="INSERT INTO newsletters_contacts_tbl
(newsletter_id, contact_id, sent_date) VALUES ('$newsletter_id',
'$uid', NOW())";
          if ($outresult = mysql_query($outquery, $connection)) {
            // SEND IT CODE
          } else {
            // ERROR CODE
          }
      }
    }
  }
}else{
  // ERROR CODE
}

Many thanks for your help on this mater.

--
Kind regards,
Liam

attached mail follows:


Does anyone have a function that will check if an ip address falls with
a starting/ending ip address range>>

 

Thanks,

Dave

 

 

**********************************************************************
HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.
**********************************************************************

attached mail follows:


On 10/13/05, Bosky, Dave <Dave.Boskyhtcinc.net> wrote:
> Does anyone have a function that will check if an ip address falls with
> a starting/ending ip address range>>

#!/usr/bin/php
<?php

$ip = '10.0.0.1';
$ip2 = '10.0.0.2';
$ip3 = '10.0.0.3';

$ip = abs( ip2long( $ip ) );
$ip2 = abs( ip2long( $ip2 ) );
$ip3 = abs( ip2long( $ip3 ) );

if( $ip2 > $ip && $ip2 < $ip3
    || $ip2 < $ip && $ip2 > $ip3 )
{
    echo "In range\n";
}
else
{
    echo "Not in range\n";
}

?>

--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

attached mail follows:


Hi cc and others.

I have had quite a struggle with this. But finally, the end result looks
quite
simple...

Here is the array of Keys Names I want to preserve:

$filter = array(
   'CategoryId' => 1, 'CategoryLevel' => 1, 'CategoryName' => 1,
'CategoryParentId' => 1
);

Here is the routine which (for ease, creates a new array containing only
the array
keys contained in $filter:

foreach ($orig_arr as $key => $data) {

   if (is_array($data)) {
   foreach ($data as $subkey => $subdata) {
         if (isset($filter[$subkey])) {
         $sub_arr[$subkey] = $subdata;
         }
      }
   }
   $new_arr[] = $sub_arr;
}

$new_arr has just what I need :-)

This only works on a two dimensional array. But with a bit of tweaking
and turing
into a function, it could probably be used on any number of dimensions
by making
it recursive?

Thanks to the contributors who supplied ideas and knowledge..

If anyone thinks this could be done a better way, please feel free to
comment!

Alan

> -----Original Message-----
> From: cc [mailto:nyvsldgmail.com]
> Sent: 13 October 2005 07:43
> To: Alan Lord
> Cc: php-generallists.php.net
> Subject: Re: Removing Items from an Array
>
> could Alan give samples about the input and expected output
> of the black box?
> then we can consider implement it.
>
> On 10/13/05, Alan Lord <lord_alanhotmail.com> wrote:
> > Thanks for the replies gents.
> >
> > I have cludged together something from your solutions but
> it isn't yet
> > working. I've been staring at multi-dim arrays all day and
> am getting
> > tired, so I'll carry on tomorrow.
> >
> > Thanks again,
> >
> > Alan
> >
> > > -----Original Message-----
> > > From: Jochem Maas [mailto:jochemiamjochem.com]
> > > Sent: 12 October 2005 19:18
> > > To: tg-phpgryffyndevelopment.com
> > > Cc: php-generallists.php.net; lord_alanhotmail.com
> > > Subject: Re: [PHP] Removing Items from an Array
> > >
> > > Id like to continue where TG left off ...
> > >
> > > hth.
> > >
> > > tg-phpgryffyndevelopment.com wrote:
> > > > If I understand what you're asking, then maybe this will help:
> > > >
> > > > $arrset1 = array("Apples" => 3, "Oranges" => 5,
> "Apricots" => 1);
> > > > $arrset2 = array("Couches" => 6, "Chairs" => 2, "Benches" => 5);
> > > >
> > > > $alldataarr["Fruits"] = $arrset1;
> > > > $alldataarr["Furniture"] = $arrset2;
> > > >
> > > > Say we want to remove "Chairs", and let's do it the hard way:
> > > >
> > > > foreach ($alldataarr as $key => $data) {
> > > > foreach ($data as $subkey => $subdata) {
> > > > if ($subkey == "Chairs) {
> > > > unset($alldataarr[$key][$subkey]);
> > > > }
> > > > }
> > > > }
> > > >
> > > > using foreach $arr as $key => $data you can get the
> > > key/index name as well as the actual value stored in that part of
> > > your array. Then all you have to do is refer back up to the main
> > > array using the current $key/$subkey values as your indexes.
> > > >
> > >
> > > $filter = array(
> > > 'Fruits' => array('Apples' => 1, 'Oranges' => 1),
> > > 'Furniture' => array('Couches' => 1, 'Chairs' => 1), );
> > >
> > > $alldataarr = array();
> > > $alldataarr["Fruits"] = array("Apples" => 3, "Oranges" => 5,
> > > "Apricots" => 1); $alldataarr["Furniture"] = array("Couches"
> > > => 6, "Chairs" => 2, "Benches" => 5);
> > >
> > > foreach ($alldataarr as $key => $data) {
> > > if (!isset($filter[$key]) {
> > > // we want it all;.
> > > continue;
> > > }
> > > $alldataarr[$key]= array_intersect_keys($data,
> $filter[$key]); }
> > >
> > >
> > > // heres one I prepared earlier:
> > >
> > >
> > > /**
> > > * array_intersect_keys()
> > > * ^--- the internal function (php5.x+?)
> > > has no 's'
> > > *
> > > * returns the all the items in the 1st array whose keys
> are found
> > > in any of the other arrays
> > > *
> > > * return array()
> > > */
> > > function array_intersect_keys()
> > > {
> > > $args = func_get_args();
> > > $originalArray = $args[0];
> > > $res = array();
> > >
> > > if(!is_array($originalArray)) { return $res; }
> > >
> > > for($i=1;$i<count($args);$i++) {
> > > if(!is_array($args[$i])) { continue; }
> > > foreach ($args[$i] as $key => $data) {
> > > if (isset($originalArray[$key]) &&
> !isset($res[$key])) {
> > > $res[$key] = $originalArray[$key];
> > > }
> > > }
> > > }
> > >
> > > return $res;
> > > }
> > >
> > >
> > >
> > >
> > > >
> > > > Basic example, but I think you can modify this to work with
> > > what you're doing.
> > > >
> > > > Let me know if you have any questions about this example.
> > > >
> > > > -TG
> > > >
> > > >
> > > >
> > > > = = = Original message = = =
> > > >
> > > > Hi all,
> > > >
> > > > I'm really struggling here! I have a large, multi-dimensional
> > > > array that I want to "clean-up" a bit before committing
> to a database.
> > > >
> > > > I want to remove quite a bit of the array but using the
> > > KEYs not the
> > > > values. I know the keys I want to keep and I know the keys
> > > I want to
> > > > get rid of. I want to keep the structure and sequence of
> > > the array in tact.
> > > >
> > > > All of the array traversing functions in PHP seem to
> > > either: only work
> > > > on the values, or do not allow the removal of elements
> of the array!
> > > >
> > > > Can anyone offer a clue bat to a tired old array walker!
> > > >
> > > > Thanks
> > > >
> > > > Alan
> > > >
> > > >
> > > > ___________________________________________________________
> > > > Sent by ePrompter, the premier email notification software.
> > > > Free download at http://www.ePrompter.com.
> > > >
> > >
> > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit:
> > http://www.php.net/unsub.php
> >
> >
>

attached mail follows:


Hello Gustav,

Wednesday, October 12, 2005, 12:55:11 PM, you wrote:
> Someone know of any good free tool for converting from Access to
> Mysql. I just need to import certain tables into an already
> existance database.

DBTools (freeware)
http://www.dbtools.com.br/

I use it quite a bit.

--
                          TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B
 __ ____ ____ ____ Geocaching: http://gps.PCWize.com
( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp
 )(__ )__) _)(_ )__) Roguemoticons & Smileys: http://PCWize.com/thebat
(____)(____)(____)(__) PHP Tutorials and snippets: http://www.DevTek.org

MCSE == Minesweeper Consultant / Solitaire Expert

attached mail follows:


[code]
$xml = array
(
  'NEWSFEED' => array
  (
    '0' => array
    (
      'MESSAGE' => array
      (
        '0' => array
        (
          'ATTRIBUTES' => array
          (
            'ID' => 'test2',
            'TID' => 'test4'
          ),
          'TITLE' => array
          (
            '0' => array
            (
               'VALUE' => 'Title #1'
            ),
            '1' => array
            (
               'VALUE' => 'Title #2'
            )
          ),
           'BODY' => array
          (
            '0' => array ( 'VALUE' => 'Body #1' )
          ),
          'REFERENCE' => array
          (
            '0' => array ( 'VALUE' => 'Reference #1' )
          )
        ),
        '1' => array
        (
          'TITLE' => array
          (
            '0' => array ( 'VALUE' => 'Title #2' )
          ),
          'BODY' => array
          (
            '0' => array ( 'VALUE' => 'Body #2' )
          ),
        ),
        '2' => array
        (
          'ATTRIBUTES' => array
          (
            'ID' => 'test3'
          ),
          'BODY' => array
          (
            '0' => array ( 'VALUE' => 'Body #3' )
          ),
        )
      )
    )
  ),
 );

echo $xml['NEWSFEED']['0']['MESSAGE']['0']['BODY'];
echo $xml['NEWSFEED']['0']['MESSAGE']['1']['BODY'];
echo $xml['NEWSFEED']['0']['MESSAGE']['2']['BODY'];[/code]

What is the safest way to destroy or take out the
$xml['NEWSFEED']['0']['MESSAGE']['2']..... associative arrays starting with
['2'] and those arrays inside of the ['2'] array path?

The unset() would make it not possible to reassign the data to this array
once again, that is what I do not want.

Thanks,
FletchSOD

attached mail follows:


On Wed, Oct 05, 2005 at 03:12:51PM -0400, Scott Fletcher wrote:
> What is the safest way to destroy or take out the
> $xml['NEWSFEED']['0']['MESSAGE']['2']..... associative arrays starting with
> ['2'] and those arrays inside of the ['2'] array path?
>
> The unset() would make it not possible to reassign the data to this array
> once again, that is what I do not want.

Could you not just do:

$xml['NEWSFEED']['0']['MESSAGE']['2'] = null;

I think that would still keep the array element open, but there would be
no data there.

Paul

--
Rogue Tory
http://www.roguetory.org.uk

attached mail follows:


Well, apache use the "nobody:nobody" permission...

""Keith Spiller"" <larentiumhosthive.com> wrote in message
news:d3e901c5c8a7$239a8530$6401a8c0Evolution...
> Hi Jasper,
>
> When using my Php script, I don't see any error messages.
>
> I have logged in using SSH, but the directories created are
> owned by 48 and not my ftp user and so I have to switch
> to a super user to make any changes.
>
> Also, even though I use:
> mkdir("$endpath", 0777);
> The resulting directories end up as 755.
>
> Yeah I have a feeling that you are right, that apache on
> my server does not have chown permissions.
>
> Thank you very mych for your help.
>
>
> Keith
>
> ----- Original Message -----
> From: "Jasper Bryant-Greene" <jasperbryant-greene.name>
> To: <php-generallists.php.net>
> Sent: Monday, October 03, 2005 11:27 PM
> Subject: Re: [PHP] chown function
>
>
> > Keith Spiller wrote:
> >> I'm using:
> >>
> >> chown("$endpath", "admin");
> >>
> >> to try to change the owner of directories after using mkdir()
> >> to create them. It continues to fail on my remote Fedora server.
> >
> > With what error message? Have you tried logging in with SSH or similar
and
> > trying the same command?
> >
> > More than likely the user apache is running as doesn't have permissions
to
> > chown -- in fact I believe that in order to chown files one must be root
> > (at least that's the way it seems to work on my system).
> >
> > You could use chmod instead to allow the "admin" user access to your
> > files.
> >
> > --
> > Jasper Bryant-Greene
> > Freelance web developer
> > http://jasper.bryant-greene.name/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Scott Fletcher wrote:
> Well, apache use the "nobody:nobody" permission...

Apache runs whatever you configure user:group to be. Default is
nobody:nobody.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Then do something like this...

0,5,10,15,20,25,30,35,40,45,50,55 * * * *
/usr/local/bin/inquiry_pull_test.php

in the crontab file.... Depending on your situation, you might will need to
add or not add the "#!/usr/local/bin/php" at the top of the php scripts...
I don't know if your php script is a shell script or not so I'm just brought
that up.

FletchSOD

attached mail follows:


On 10/5/05, Scott Fletcher <scottabcoa.com> wrote:
> Then do something like this...
>
> 0,5,10,15,20,25,30,35,40,45,50,55 * * * *
> /usr/local/bin/inquiry_pull_test.php

Or more simply: */5

--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

attached mail follows:


Scott Fletcher wrote:
> Then do something like this...
>
> 0,5,10,15,20,25,30,35,40,45,50,55 * * * *
> /usr/local/bin/inquiry_pull_test.php

Or just...

*/5 * * * * /path/to/script.php

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Greg Donald wrote:
> On 10/5/05, Scott Fletcher <scottabcoa.com> wrote:
>
>>Then do something like this...
>>
>>0,5,10,15,20,25,30,35,40,45,50,55 * * * *
>>/usr/local/bin/inquiry_pull_test.php
>
>
> Or more simply: */5

Jinx. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com