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 15 Dec 2003 12:55:31 -0000 Issue 2474

php-general-digest-helplists.php.net
Date: Mon Dec 15 2003 - 06:55:31 CST


php-general Digest 15 Dec 2003 12:55:31 -0000 Issue 2474

Topics (messages 172697 through 172729):

Re: PHP IDE?
        172697 by: Peter Walter
        172702 by: Pablo Gosse
        172713 by: rush
        172720 by: SLanger.spirit21.de
        172723 by: Wouter van Vliet

Pear install problem
        172698 by: Pablo Gosse

How could I count the elements of each dimension of an array?
        172699 by: orlandopozo.icnet.com.ve
        172700 by: Al

Re: Operation in an Array
        172701 by: Al

Printing PHP Source with a PHP Script
        172703 by: Gohaku
        172704 by: John W. Holmes
        172706 by: Mike
        172707 by: Gohaku

Re: treu type fonts
        172705 by: cj
        172714 by: Jason Wong

Re: Trying to check for a valid URL String.
        172708 by: Al
        172710 by: Justin French

Re: session_start() make netscape 4.7 reload page.
        172709 by: Jonathan Zhang

true type fonts again
        172711 by: cj
        172716 by: Jason Wong

PHP and Palm Pilot interaction
        172712 by: Dave G
        172715 by: Adam i Agnieszka Gasiorowski FNORD

Problem with adding quotations to a mysql insert statement
        172717 by: Richard Kurth

$GLOBALS containing itself!!!
        172718 by: Gerard Samuel
        172719 by: Robert Cummings
        172725 by: Wouter van Vliet

searching and replacing in a file
        172721 by: Richard Kurth
        172722 by: Richard Kurth
        172724 by: olinux
        172727 by: John Nichel

problem with files bigger than 2GB
        172726 by: php-admin.kabeljournal.de

Re: trouble parsing an XML document
        172728 by: alfredo

Re: Fatal Error: PDFlib error ...
        172729 by: Sven

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:


Rush,

templatetamer looks like an environment that I would be interested in
using; however, what support resources are available for templatetamer?
Is there a news server, bulletin board, or other help resource for
people new to templatetamer?

Peter

Rush wrote:
> "Jough Jeaux" <phpjoughyahoo.com> wrote in message
> news:20031213170656.23833.qmailweb11908.mail.yahoo.com...
>
>>Was wondering what everyone's favortie IDE is for
>>coding in PHP. I've got a big PHP project in the
>>works. I'll be doing alot with it and am looking for
>>ways to boost my productivity.
>
>
> If you are going to work with templates, you can take a look at
> TemplateTamer, which has IDE geared for such development.
>
> rush
> --
> http://www.templatetamer.com/

attached mail follows:


<snip>
>Was wondering what everyone's favortie IDE is for
>coding in PHP. I've got a big PHP project in the
>works. I'll be doing alot with it and am looking for
>ways to boost my productivity.
>
>--Jough
</snip>

If you're willing to purchase a commercial product I'd highly recommend
Zend's IDE. I've been working on a large PHP development project for a
little over a year now and switched to the Zend IDE about three months
ago and it has really increased my productivity.

My $0.02 CDN ($0.0151483 USD).

P.

attached mail follows:


"Peter Walter" <pwalteritlsys.com> wrote in message
news:3FDCFBAA.9090505itlsys.com...
> Rush,
>
> templatetamer looks like an environment that I would be interested in
> using; however, what support resources are available for templatetamer?
> Is there a news server, bulletin board, or other help resource for
> people new to templatetamer?

Hello,

currently there is only Wiki, and mail support. However, to compensate, I
try my best not to affer only answers to strictly technical support
questions, but also to all various questions on how to do something with TT,
or how to approach some problem with it. Quite often I compile answer to
such question and put it afterwards on the wiki as an example, so I have
double benefit from it. In the future I may open a mailing list or something
similar.

Hope that helps, and if you have any questions please do not hesitate to
mail me.

rush
--
http://www.templatetamer.com/

attached mail follows:


Hello

If you don't mind running a JVM you can use PHPEclipse with the Eclipse
Framework. Additionally to the php plugin there are a lot of other plugins
out there that can assist you.

http://www.phpeclipse.org

Regards
Stefan Langer

attached mail follows:


Yeah .. vim is my god too. You can do so many things with so little
keystrokes. And it basically has the best syntax highlighting I've ever
seen. With some easy tricks you can even let it highlight your own
functions. I haven't doen so, but I know it's possible :P... Also, it exists
on most servers so you can work directly on the server. Without having to
mess with (Samba) filesharing. Another advantage is that it runs both on
Linux as well as on Windows.

W.

(ps. Ahbaid or anyone else .. how can I get code to re-fold. I've setup my
vim to fold every PHP function and class, which works when I load te file.
But when I'm done editing a certain block, what do I do to make it fold back
in again?)

On zondag 14 december 2003 18:27 Ahbaid Gaffoor told the butterflies:
> with folding you can "fold" your code in chunks, you
> basically setup a "start fold" and an "end fold" and place
> code between them, then you can open and close (fold) that
> block of code as you need to or don't need to see it...
>
> for example:
>
> # {{{ PHP Code to do something...
>
> ..
> ..
> 10000 lines of code...
> ..
> ..
> # }}}
>
> would collapse to one line when folded.... and look something like:
>
> + PHP Code to do something
>
> then when you hit space on it it expands. (I use {{{ and }}}
> as my start and end folds)
>
>
> ctags allows you to build a dictionary of words which you can
> hook into
> vim, that way you can do tab completion on PHP words etc.
>
> I also like to map keystrokes to coding templates for things like
> functions, loops, declarations etc.
>
> Everyone's got their own setup :)
>
> Plus I always use a CVS repository for my work, so my routine
> of, code,
> test, commit is habit.
>
> Looking at the responses there seems to be a lot of neat editors out
> there, to each his own.
>
> regards,
>
> Ahbaid.
>
> Jough Jeaux wrote:
>
> > Hmm, I'm currently a vim user also. You'll have to
> > elaborate on this folding and ctag business though...
> >
> >
> > --- Ahbaid Gaffoor <ahbaidatt.net> wrote:
> >
> >
> > > vim - with folding and ctags
> > >
> > > sweet.
> > >
> > > Ahbaid
> > >
> > > Jough Jeaux wrote:
> > >
> > >
> > >
> > > > Was wondering what everyone's favortie IDE is for
> > > > coding in PHP. I've got a big PHP project in the
> > > > works. I'll be doing alot with it and am looking
> > > >
> > > >
> > > for
> > >
> > >
> > > > ways to boost my productivity.
> > > >
> > > > --Jough
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > New Yahoo! Photos - easier uploading and sharing.
> > > > http://photos.yahoo.com/
> > > >
> > > >
> > > >
> > > >
> > > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> >
> > __________________________________
> > Do you Yahoo!?
> > New Yahoo! Photos - easier uploading and sharing.
> > http://photos.yahoo.com/

attached mail follows:


Hi all. I'm trying to install PHPDocumentor (www.phpdoc.org) and I'm
getting an error when using the pear install feature.

I've got the necessary files stored in /home/phpDocumentor-1.2.2 but
when I run pear install /home/phpDocumentor-1.2.2/package.xml I get the
following error:

Invalid checksum : 44835 calculated, 0 expected

I've been looking around on google but I haven't been able to find much
of any use.

Can anyone give me an idea as to what's causing this and how to fix it?

Cheers and TIA,

Pablo

attached mail follows:


How could I count the elements of each dimension of an array?

I have this script, but it failed, thanks for any help

<?
$ojpp[0] = "1";
$ojpp[1] = "2";
$ojpp[2] = "3";
$ojpp[3] = "4";
$ojpp[0][1] = "1";
$ojpp[0][2] = "2";
$ojpp[0][3] = "3";
$ojpp[0][0][1] = "1";
$ojpp[0][0][2] = "2";
$test1 = count($ojpp); // first dimension
$test2 = count($ojpp[0]); // second dimension
$test3 = count($ojpp[0][0]); // third dimension
echo $test1;
echo $test2;
echo $test3;
echo "<pre>";
print_r($ojpp);
echo "</pre>";
?>

attached mail follows:


<orlandopozoicnet.com.ve> wrote in message
news:001701c3c2a7$c958c1b0$938852c8ojpp...
>How could I count the elements of each dimension of an array?
>I have this script, but it failed, thanks for any help
>$ojpp[0] = "1";
>$ojpp[1] = "2";
>$ojpp[2] = "3";
>$ojpp[3] = "4";
>$ojpp[0][1] = "1";
>$ojpp[0][2] = "2";
>$ojpp[0][3] = "3";
>$ojpp[0][0][1] = "1";
>$ojpp[0][0][2] = "2";
>$test1 = count($ojpp); // first dimension
>$test2 = count($ojpp[0]); // second dimension
>$test3 = count($ojpp[0][0]); // third dimension
>echo $test1;
>echo $test2;
>echo $test3;
>echo "<pre>";
>print_r($ojpp);
>echo "</pre>";

The problem with the code above isn't with how you count the dimensions of
the array, but how you assign values to the second and third dimensions.

Ordinarily, the code $ojpp[0][1] = "1" will create an array at $ojpp[0] and
set it's second element to be "1". On the first line of your code, however
you have *already* assigned the string value "1" to $ojpp[0].

So when PHP sees the code $ojpp[0][1] = "1" it thinks you're trying to use
the 'curly braces' syntax for accessing single characters of a string. This
syntax is not widely known, but essentially means you can access characters
in a string like elements of an array, by using curly braces. For example,<?
echo $string{2}; ?> will print the third character in $string. For reasons
unknown to me, PHP will also let you use square brackets on a string to
perform the same action ... eg <? echo $string[2]; ?> although this
alternate syntax is being phased out. ( For more info see:
http://us2.php.net/manual/en/language.types.string.php ).

So essentially PHP intereperets $ojpp[0][1] = "1" as being an attempt to
assign "1" as the second character to the string already assigned to
$ojpp[0]. Which begs the question: why assign "1" to $ojpp in the first line
of your code when you seem to want to reaplce it with an array on lines 5 -
8?

This kind of coding bug is a by-product of a type-juggling, permissive
languge that doesn't require you to pre-declare variables. To fix your code,
change the first line of your code to read:

$ojpp[0] = array();

Hope that helps,

Al

attached mail follows:


"Harry.De" <harald.mohringgmx.de> wrote in message
news:20031214113105.50630.qmailpb1.pair.com...
> How can i make an operation like adding variables in an array for example
> $array[$a+$b];

You'll have to be more specific. What exactly do you want to do? Add values
of an array together? Their keys?

Al

attached mail follows:


Hi everyone,
I'm trying to output PHP source within a PHP Script. The following
script seems to work(Viewing HTML Source reveals the PHP Source), but
the Browser output is very different. Is there a function or header I
should set before echoing the PHP Source? Thanks.

<?
//filereader.php
//script arguments: filereader.php?file=
$fh = fopen($file,"rb");
$src = fread($fh,filesize($file));
fclose($fh);
echo '<html><meta http-equiv="Content-Type" content="text/plain">';
echo $src;
echo '</html>';
?>

attached mail follows:


Gohaku wrote:

> Hi everyone,
> I'm trying to output PHP source within a PHP Script. The following
> script seems to work(Viewing HTML Source reveals the PHP Source), but
> the Browser output is very different. Is there a function or header I
> should set before echoing the PHP Source? Thanks.
>
>
> <?
> //filereader.php
> //script arguments: filereader.php?file=
> $fh = fopen($file,"rb");
> $src = fread($fh,filesize($file));
> fclose($fh);
> echo '<html><meta http-equiv="Content-Type" content="text/plain">';
> echo $src;
> echo '</html>';
> ?>
>

echo htmlentities($src);

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


John W. Holmes wrote:
> Gohaku wrote:
>
>> Hi everyone,
>> I'm trying to output PHP source within a PHP Script. The following
>> script seems to work(Viewing HTML Source reveals the PHP Source), but
>> the Browser output is very different. Is there a function or header I
>> should set before echoing the PHP Source? Thanks.
>>
>>
>> <?
>> //filereader.php
>> //script arguments: filereader.php?file=
>> $fh = fopen($file,"rb");
>> $src = fread($fh,filesize($file));
>> fclose($fh);
>> echo '<html><meta http-equiv="Content-Type" content="text/plain">';
>> echo $src;
>> echo '</html>';
>> ?>
>>
>
> echo htmlentities($src);
>

there is a function just for this

highlight_file($file);

is all you need

Mike

attached mail follows:


On Sunday, December 14, 2003, at 09:51 PM, John W. Holmes wrote:

> Gohaku wrote:
>
>> Hi everyone,
>> I'm trying to output PHP source within a PHP Script. The following
>> script seems to work(Viewing HTML Source reveals the PHP Source), but
>> the Browser output is very different. Is there a function or header
>> I should set before echoing the PHP Source? Thanks.
>> <?
>> //filereader.php
>> //script arguments: filereader.php?file=
>> $fh = fopen($file,"rb");
>> $src = fread($fh,filesize($file));
>> fclose($fh);
>> echo '<html><meta http-equiv="Content-Type" content="text/plain">';
>> echo $src;
>> echo '</html>';
>> ?>
>
> echo htmlentities($src);
>

Thank you, that's just what I was looking for.
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


sorry for the late delay.

How would I output the image to a file on the hard drive

Thanks

-----Original Message-----
From: Jason Wong [mailto:php-generalgremlins.biz]
Sent: Thursday, 11 December 2003 11:19 AM
To: php-generallists.php.net
Subject: Re: [PHP] treu type fonts

On Thursday 11 December 2003 06:06, cj wrote:

> I tried the png like you suggested and the same thing happens.
> I get nothing on the screen but if I do a right click and properties on
the
> spot where the image should be the image type is a png image.

1) Enable FULL error reporting.
2) For debugging purposes, instead outputting the image directly, write it
to
disk first.

--
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
------------------------------------------
/*
"We are on the verge: Today our program proved Fermat's next-to-last
theorem."
                -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
*/

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

attached mail follows:


On Monday 15 December 2003 11:13, cj wrote:

> How would I output the image to a file on the hard drive

Assuming you're using the gd lib functions, then whatever function you're
using to output the image has an option to write to disk. As always see
manual for details.

--
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
------------------------------------------
/*
"The vast majority of successful major crimes against property are
perpetrated by individuals abusing positions of trust."
-- Lawrence Dalzell
*/

attached mail follows:


"Philip J. Newman" <NewmanPjPhilipNZ.com> wrote in message
news:007d01c3c1d3$c94924a0$0401a8c0jupiter...
> so far i got ...
> if (!ereg("^http:\/\/([_\.0-9a-zA-Z-]+\.)+[a-zA-Z]/i",$websiteUrl) {

On a quick glance, three things stand out:

1) You allow underscores in the website domain, but these are not valid
characters for domain names.
2) You allow dashes in the first pattern, but do not escape the dash
character.
3) You have not provided a quantifier to the top-level domain pattern:
[a-zA-Z], so it is only looking for one character fits the class [a-zA-Z].

Hope that helps,

Al

attached mail follows:


On Monday, December 15, 2003, at 02:34 PM, Al wrote:

> "Philip J. Newman" <NewmanPjPhilipNZ.com> wrote in message
> news:007d01c3c1d3$c94924a0$0401a8c0jupiter...
>> so far i got ...
>> if (!ereg("^http:\/\/([_\.0-9a-zA-Z-]+\.)+[a-zA-Z]/i",$websiteUrl) {
>
> On a quick glance, three things stand out:
>
> 1) You allow underscores in the website domain, but these are not valid
> characters for domain names.
> 2) You allow dashes in the first pattern, but do not escape the dash
> character.
> 3) You have not provided a quantifier to the top-level domain pattern:
> [a-zA-Z], so it is only looking for one character fits the class
> [a-zA-Z].

I'd also add (depending on the situation):

4) allow for https:// and ftp:// and other schemes
5) allow for .htaccess password combinations
(guest:passwordwww.example.com)
6) allow for a trailing slash (http://example.com/)
7) allow for directories and files [paths]
(http://example.com/path/to/foo.something)
8) allow for query strings (everything after the ?) and anchors (#)

#7 & #8 may seem stupid, but not everyone's base url is a full domain
-- sometimes people are burried a few levels deep in directories, and
you will undoubtedly get people copying and pasting things like
'example.com/index.html?id=5#foo'

Now, the above is starting to look pretty complex huh?

Take a look at http://php.net/parse_url

It returns the URL as an array of manageable chunks (scheme, domain,
path, query, fragment) which you can then perform small, focused checks
and regexp's on to check the url conforms to what you want.

Justin French

attached mail follows:


Marek,

Thank you very much.

"Marek Kilimajer" <kilimajerwebglobe.sk> wrote in message
news:3FDC86E4.1070001webglobe.sk...
> Jonathan Zhang wrote:
> > test.php
> > -->
> > <?
> > session_start();
> > ?>
> > <form>
> > <input type="text" name="test">
> > </form>
> >
> > For Win2kpro+netscape 4.7,all form data you enter in this page will lost
> > when resize the browser's window size, ns4.7 have reload this page when
> > resize the window.
> > But if you remove the session_start() from this page, the issue will not
> > exist.
> >
> > Is there any solution for it?
> >
> > thanks,
> > Jonathan Zhang
> >
>
> Netscape 4.x has this annoying behavior, it tries to fetch a fresh copy
> whenever you resize window, view source code or print the page.
>
> You might try to use session_cache_limiter() function to control the
> cache headers send, try private_no_expire first. Do not set it to public
> if the page contains private information.

attached mail follows:


G'day all
I have been able to the the image to display, which is a gif image of a
rectange.
But the text doesn't get displayed on the image.

There are no error messages on the screen
The other messages entitled true type fonts is a thread I started as well,
but the image was not being displayed on the screen at all.
So now I have the image but no text on the image.

What could be causing this, and what should I have a look at?

Thanks
P.S: the code I use is below

<?php
  header("Content-type: image/gif");
  $im = imagecreate(400,30);
  $white = imagecolorallocate($im, 202,112,112);
  $black = imagecolorallocate($im, 255,255,255);
  // Replace path by your own font path
  imagettftext($im, 20, 0, 10, 20, $black, "arial", "Testing... Omega:
&amp;#937;");
  imagegif($im);
  imagedestroy($im);
?>

The Glennies Group
P.O. Box 5136
Studfield Post Office
WANTIRNA SOUTH VIC 3152

Ph: 61 3 9800 3906
E-mail: enquiriesglennies.com.au
Website: glennies.com.au

attached mail follows:


On Monday 15 December 2003 13:26, cj wrote:

> I have been able to the the image to display, which is a gif image of a
> rectange.
> But the text doesn't get displayed on the image.
>
> There are no error messages on the screen
> The other messages entitled true type fonts is a thread I started as well,
> but the image was not being displayed on the screen at all.
> So now I have the image but no text on the image.
>
> What could be causing this, and what should I have a look at?

If you had read and followed the advice given in response to your earlier
posts I'm sure you would've solved your problem by now.

Again:

1) Enable FULL error reporting by including these lines at the top of your
code:

  error_reporting (E_ALL);
  ini_set('display_errors', 1);

2) Output the image to file. Remember to comment out the header() for the time
being.

3) And someone else suggested that you may have specified the name of your
font file incorrectly. In my experience you *have* to specify a path to your
font file. So if the font file was in the same directory as your script then
use './name_of_font_file'. So if you had followed the above steps (at the
least step 1) you would have seen the following error:

  PHP Warning: imagettftext(): Could not find/open font in ...

and would have clued you into what the problem was.

--
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
------------------------------------------
/*
Alone, adj.:
        In bad company.
                -- Ambrose Bierce, "The Devil's Dictionary"
*/

attached mail follows:


PHP Gurus,
        I have a web site that helps people sign up for workshops and
classes. The classes happen away from any computer or web access. What I
want to do is be able to collect data about payment and attendance and
be able to send it to the web site for inclusion into the MySQL
database.
        Of course, I could go low tech and just have people write things
down and then later type in results when they finally get web access.
        However, if possible, I would like to take advantage of the fact
that the teachers of these classes all carry Palm Pilots. If it were
possible, could they record data in some fashion that would allow them
to copy the data over to their PC when they hot synch, and then upload
it to a page where it would automatically be integrated into the site
database.
        I have only the faintest notions about how this could work, and
I suspect it may simply not be possible.
        But on the other hand, I was wondering if it may be possible to
make use of the simple text editor on the Palm, or perhaps the newer
Excel editors (which I have not yet tried), to create a file of flat
data which could then be uploaded and interpreted by PHP and then
entered into the DB. It seems to me that a simple text file would
probably be easy to upload and read by PHP, but then I'd have to do more
work to get the teachers to conform to layout standards and do more
error checking since the text file allows for a wide range of mistakes
to happen. The Excel file would make it easier for the teachers to see
where to enter data and have less mistakes, but then it might be more
difficult to get the data out of it, through PHP, and into the database.
        If anyone has any pointers or advice about how to best approach
this problem, please let me know.

--
Yoroshiku!
Dave G
mlautotelic.com

attached mail follows:


Dave G wrote:

        [...]

> But on the other hand, I was wondering if it may be possible to
> make use of the simple text editor on the Palm, or perhaps the newer
> Excel editors (which I have not yet tried), to create a file of flat
> data which could then be uploaded and interpreted by PHP and then
> entered into the DB. It seems to me that a simple text file would
> probably be easy to upload and read by PHP, but then I'd have to do more
> work to get the teachers to conform to layout standards and do more
> error checking since the text file allows for a wide range of mistakes
> to happen. The Excel file would make it easier for the teachers to see
> where to enter data and have less mistakes, but then it might be more
> difficult to get the data out of it, through PHP, and into the database.

        [...]

        Make a custom sheet in Excel for the
 teachers. Excel can generate a comma delimited
 (CSV) file out of a sheet. The you can very
 easily import that file into your PHP program
 :8] (there is even a function for it, IIRC).

--
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info { iWanToDie } WiNoNa ) (
http://szatanowskie-ladacznice.0-700.pl foReVeR( * )
Poznaj jej zwiewne kształty... http://www.opera.com 007

attached mail follows:


I need to add extra quotation marks in to the following insert command for
mysql.

I need one that is part of the info right before the |$wrapper resend and
right after the
$outgoing,nobody
$query = "insert into majordomoaliases
(domain,listname,var,address1,address2)values
(/"$domname/",\"$listname\",\"a\",\"$listdomain-$listname:\",\" |$wrapper
resend -C $domaincf -l
$listname -h $listdomain $listdomain-$listname-$outgoing,nobody\")";

The whole line should look like this when it is printed out to the page it
will be written to from the database
"|/var/wrapper resend -C /var/domaincf -l list1 -h domain.com
domain.com-list1-outgoing,nobody"

I am totaly stuped on haw to add this extra quotation mark no mater what I
do I get mysql errors.

attached mail follows:


Just curious about something I came across.
I was looking at the $GLOBAL array, to see what my script was leaving behind.
$GLOBALS contains a reference to itself.
Even though its a reference, whats the sense with that??
Once its global, why should it have to call on itself?
Im currently running php 4.3.4 on FreeBSD 4.9

Thanks

A script to try out ->
<?php

header('content-type: text/plain');

var_dump(isset($GLOBALS['GLOBALS']['GLOBALS'])); // returns true

// Prints out the $GLOBALS array
// including one reference to itself
// then starts another but quits with *RECURSION*
var_dump($GLOBALS);

?>

attached mail follows:


On Mon, 2003-12-15 at 04:23, Gerard Samuel wrote:
> Just curious about something I came across.
> I was looking at the $GLOBAL array, to see what my script was leaving behind.
> $GLOBALS contains a reference to itself.
> Even though its a reference, whats the sense with that??
> Once its global, why should it have to call on itself?

It's global isn't it? SOunds like completeness.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On maandag 15 december 2003 10:24 Gerard Samuel told the butterflies:
> Just curious about something I came across.
> I was looking at the $GLOBAL array, to see what my script was leaving
> behind. $GLOBALS contains a reference to itself.
> Even though its a reference, whats the sense with that??
> Once its global, why should it have to call on itself?
> Im currently running php 4.3.4 on FreeBSD 4.9
>
> Thanks
>
> A script to try out ->
> <?php
>
> header('content-type: text/plain');
>
> var_dump(isset($GLOBALS['GLOBALS']['GLOBALS'])); // returns true
>
> // Prints out the $GLOBALS array
> // including one reference to itself
> // then starts another but quits with *RECURSION* var_dump($GLOBALS);
>
> >

Well .. it basically just "Contains a reference to every variable which is
currently available within the global scope of the script. The keys of this
array are the names of the global variables.". Since $GLOBALS itself is
global, that too is contained.

So:

        
var_dump(isset($GLOBALS['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS
']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBAL
S']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBA
LS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOB
ALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLO
BALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GL
OBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['G
LOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['
GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS'][
'GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']
['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS'
]['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS
']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBAL
S']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBA
LS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOB
ALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLO
BALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GL
OBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['G
LOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['
GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS'][
'GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']
['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS'
]['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS
']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBAL
S']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBA
LS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOB
ALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLO
BALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GL
OBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['G
LOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['
GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS'][
'GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']
['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS']['GLOBALS'
]));

Will still print out true. the displaying of *RECURSION* is to prevent, well
.. ehmm, recursively printing out the $GLOBALS array over and over again.
This is something new in PHP 4.0.4. Read the manual on page
http://nl3.php.net/manual/en/function.print-r.php:

        Note: Prior to PHP 4.0.4, print_r() will continue forever if given
an array or object that contains a direct or indirect reference to itself.
An example is print_r($GLOBALS) because $GLOBALS is itself a global variable
that contains a reference to itself.

:),
Wouter

attached mail follows:


How can I read through a file and find a string and then replace it with a
new string and then save the whole file.

Below is a peace of what I need to search through. I need to find the string
subscribe_policy = open and replace it with subscribe_policy = open+confirm.
Then save the whole file.

I have tried str_replace but it just wipes out the original file.

$file = "/var/lib/majordomo/domain.com/lists/listname.config";
$fp = fopen("$file", "w+");
$content = fread($fp, filesize($file));
$replace= "subscribe_policy = open+confirm";
$search_str = "subscribe_policy = open";
$content2 = str_replace($search_str,$replace, $content);
fwrite($fp,$content2);
fclose($fp);

# restrict_post [restrict_post] (autoupdates) <resend>
# If defined, only addresses listed in these files (colon or space
# separated) can post to the mailing list. By default, these files
# are relative to the lists directory. These files are also checked
# when get_access, index_access, info_access, intro_access,
# which_access, or who_access is set to 'list'. This is less useful
# than it seems it should be since there is no way to create these
# files if you do not have access to the machine running resend.
# This mechanism will be replaced in a future version of
# majordomo/resend.
restrict_post = autoupdates.posters

# subscribe_policy [enum] (open) <majordomo> /open;closed;auto;op
# One of three values: open, closed, auto; plus an optional
# modifier: '+confirm'. Open allows people to subscribe themselves
# to the list. Auto allows anybody to subscribe anybody to the list
# without maintainer approval. Closed requires maintainer approval
# for all subscribe requests to the list. Adding '+confirm', ie,
# 'open+confirm', will cause majordomo to send a reply back to the
# subscriber which includes a authentication number which must be
# sent back in with another subscribe command.
subscribe_policy = open

# unsubscribe_policy [enum] (closed) <majordomo> /open;closed;auto/
# One of three values: open, closed, auto. Open allows people to
# unsubscribe themselves from the list. Auto allows anybody to
# unsubscribe anybody to the list without maintainer approval. The
# existence of the file <listname>.auto is the same as specifying
# the value auto. Closed requires maintainer approval for all
# unsubscribe requests to the list. In addition to the keyword, if
# the file <listname>.closed exists, it is the same as specifying
# the value closed. The value of this keyword overrides the value
# supplied by any existent files.
unsubscribe_policy = open

attached mail follows:


How can I read through a file and find a string and then replace it with a
new string and then save the whole file.

Below is a peace of what I need to search through. I need to find the string
subscribe_policy = open and replace it with subscribe_policy = open+confirm.
Then save the whole file.

I have tried str_replace but it just wipes out the original file.

$file = "/var/lib/majordomo/domain.com/lists/listname.config";
$fp = fopen("$file", "w+");
$content = fread($fp, filesize($file));
$replace= "subscribe_policy = open+confirm";
$search_str = "subscribe_policy = open";
$content2 = str_replace($search_str,$replace, $content);
fwrite($fp,$content2);
fclose($fp);

# restrict_post [restrict_post] (autoupdates) <resend>
# If defined, only addresses listed in these files (colon or space
# separated) can post to the mailing list. By default, these files
# are relative to the lists directory. These files are also checked
# when get_access, index_access, info_access, intro_access,
# which_access, or who_access is set to 'list'. This is less useful
# than it seems it should be since there is no way to create these
# files if you do not have access to the machine running resend.
# This mechanism will be replaced in a future version of
# majordomo/resend.
restrict_post = autoupdates.posters

# subscribe_policy [enum] (open) <majordomo> /open;closed;auto;op
# One of three values: open, closed, auto; plus an optional
# modifier: '+confirm'. Open allows people to subscribe themselves
# to the list. Auto allows anybody to subscribe anybody to the list
# without maintainer approval. Closed requires maintainer approval
# for all subscribe requests to the list. Adding '+confirm', ie,
# 'open+confirm', will cause majordomo to send a reply back to the
# subscriber which includes a authentication number which must be
# sent back in with another subscribe command.
subscribe_policy = open

# unsubscribe_policy [enum] (closed) <majordomo> /open;closed;auto/
# One of three values: open, closed, auto. Open allows people to
# unsubscribe themselves from the list. Auto allows anybody to
# unsubscribe anybody to the list without maintainer approval. The
# existence of the file <listname>.auto is the same as specifying
# the value auto. Closed requires maintainer approval for all
# unsubscribe requests to the list. In addition to the keyword, if
# the file <listname>.closed exists, it is the same as specifying
# the value closed. The value of this keyword overrides the value
# supplied by any existent files.
unsubscribe_policy = open

attached mail follows:


$filename = '/path/to/file.txt';

$contents = file_get_contents($filename);
$contents = str_replace($search,$replace,$contents);

$handle = fopen($filename, "w");
if (fwrite($handle, $contents)) {
   echo 'file write successful';
} else {
   echo 'file write failed';
   exit;
}
fclose($handle);

also - there's no need to enclose the variable $file
in quotes here:
> $fp = fopen("$file", "w+");

olinux

--- Richard Kurth <rdkurthdirectphp.com> wrote:
> How can I read through a file and find a string and
> then replace it with a
> new string and then save the whole file.
>

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

attached mail follows:


Richard Kurth wrote:

> How can I read through a file and find a string and then replace it with a
> new string and then save the whole file.
>
> Below is a peace of what I need to search through. I need to find the string
> subscribe_policy = open and replace it with subscribe_policy = open+confirm.
> Then save the whole file.
>
> I have tried str_replace but it just wipes out the original file.
<snip>

Have php...

1) Make a copy of the original:

if ( ! copy ( $old_file, $backup_file . ".bak" ) ) {
        // Uh-oh, there's an error
}

2) Read the original and open a temp file:

$file_contents = file ( $old_file );
if ( ! $fp = fopen ( $temp_file, "w+" ) ) {
        // Oh my, can't open the file
}

3) Parse and write:

for ( $i = 0; $i < sizeof ( $file_contents ); $i++ ) {
        $write_this = preg_replace ( $pattern, $replacement, $file_contents[$i] );
        if ( ! fwrite ( $fp, $write_this ) ) {
                // Darn, can't write to the temp file
        }
}

4) Cleanup and copy temp file:

fclose ( $fp );
if ( ! copy ( $temp_file, $old_file ) ) {
        // Zoinks, there seems to be a problem
}

It's 5:00 am for me, and I'm typing all this from memory, so there may
be bugs :) You can remove the temp file if you so desire if the above
runs without error.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


I use PHP 4.1.2 under Linux (Kernel 2.4.18).
On files bigger than 2GB the php-function 'file_exists'
exits with 'Warning: stat failed on ... (errno=75 -
Value too large for defined data type') ...

How can I solve this problem?
Thanks for every help.

attached mail follows:


thank you,
but the error:
>> Parse error: parse error, unexpected '$', expecting T_VARIABLE in
(mypath)...on line...

refers to the line whit the
>> var ${'REG-ORIG'};

code, anyway I took the code by the PHP manual.
bye
Alfredo

Raditha Dissanayake wrote:

> doesn't look like a xml parser problem. I haven't tried your code but
i think the error is $this->$k
>
> alfredo wrote:
>
>> Hello,
>> I'm trying to parse a XML doc, but the doc has some tags like:
>> <REG-ORIG>
>>
>> so when I try to initialize variables:
>>
>> class Documenti {
>> var $FILE; //nomefile
>> var $NUMERO; //numerodiserie
>> var ${'REG-OR;IG'}; // here is the broblem
>> function Documenti($aa) {
>> foreach ($aa as $k=>$v)
>> $this->$k = $aa[$k];
>> }
>>
>> i have an error:
>> Parse error: parse error, unexpected '$', expecting T_VARIABLE...
>>
>> I tryed changing the $ position:
>> var {$'REG-ORIG'}; // here is the broblem
>>

>> does not change anything:
>> Parse error: parse error, unexpected '{', expecting T_VARIABLE...
>>
>> thanks for any suggestion,
>> Alfredo (Italy)
>>
>
>

attached mail follows:


Matthias Nothhaft schrieb:

> Hi,
>
> I'm trying to get the pdflib work...
>
> I use pdflib 4.0.3 downloaded from pdflib.de and php 4.3.4 on Debian Linux.
>
> I wrote this test code:

hi matthias,
if you want to use this lib it's good to be familiar with classes and
objects in php. the manual can help you at this. now to your code.
>
> <?php
>
> dl("libpdf_php.so");
>
> $pdf = pdf_new();
you just created a php-object $pdf.
for your further methods you must explicit declare them to your objects:
> pdf_begin_page($pdf, 421, 595);
$pdf->pdf_begin_page($pdf, 421, 595);
... and so on.
hth SVEN