php-general Digest 26 Mar 2002 12:49:11 -0000 Issue 1249

Topics (messages 90127 through 90174):

Re: PHPTriad Error in Windows XP.
        90127 by: Peter Ruan

Re: Regular Expression Challenge
        90128 by: Christopher William Wesley
        90130 by: Cameron Just
        90148 by: Matt Moreton
        90150 by: Richard Archer
        90155 by: Matt Moreton

Re: Does anyone use UltrDev?
        90129 by: Jerry Artman

Re: mail() function returns TRUE but no email is sent
        90131 by: Demitrious S. Kelly

Database connection problem
        90132 by: Omland Christopher m
        90133 by: Demitrious S. Kelly
        90134 by: Cameron Just

File Edit
        90135 by: Randy Johnson
        90136 by: Rasmus Lerdorf
        90137 by: Randy Johnson
        90139 by: Rasmus Lerdorf
        90141 by: Randy Johnson
        90154 by: Jason Wong

which php book 2 buy ?
        90138 by: Septic Flesh

Find if a html tag was closed
        90140 by: Julio Nobrega

Re: FTP RAW
        90142 by: Analysis & Solutions

Re: Bad Email Addresses
        90143 by: Analysis & Solutions

Re: XML Comparison?
        90144 by: Analysis & Solutions

Re: HTTP_REFERER
        90145 by: Jim Koutoumis

Re: Session Variables
        90146 by: bob

Re: header and session?
        90147 by: bob

Re: Non-Cache in forms?
        90149 by: David Robley
        90152 by: eric.coleman.zaireweb.com

PEAR installation correct?
        90151 by: lmlweb

Re: php and javascript
        90153 by: Dennis Moore

Cookies
        90156 by: Chuck \"PUP\" Payne

RESOLVED --> RE: [PHP] Mime type prepeded at file upload
        90157 by: David McInnis

Re: PHP and Oracle
        90158 by: Thies C. Arntzen

[Newman] PHP causing exceptions in ntserver.
        90159 by: Philip J. Newman

check form - save arrays in hidden fields?
        90160 by: Fabian Krumbholz - 2k web solutions

How to avoid "Warning: Page has Expired" error?
        90161 by: DRaGoNLz

*sigh* xmldom win2k php4.1.2 apache
        90162 by: botsai

image functions => text alignment
        90163 by: Fabio Spinelli

[PHP Upload] problem
        90164 by: Evan
        90165 by: Jaeggi David

Auto password generation
        90166 by: Denis L. Menezes

Re:[PHP] Auto password generation
        90167 by: Liam

PHP, DB, images, ODBC
        90168 by: David JURAS

How to remove ^M characters from a directory?
        90169 by: Balaji Ankem
        90172 by: Andrew Brampton

fsockopen
        90170 by: Christoph Starkmann
        90171 by: Alastair Battrick
        90173 by: Christoph Starkmann
        90174 by: Alastair Battrick

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
I did started MySQL server first.
"Avdija A . Ahmedhodzic" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED]
> says...
> > Hi,
> >   I installed PHPTriad under Windows XP and I keep gettting the
> > following error:
> >
> > Warning: MySQL Connection Failed: Can't connect to MySQL server on
> > 'localhost' (10061) in C:\apache\htdocs\phpmyadmin\lib.inc.php on
line
> > 255
> >
> >
> > It worked before under Windows ME.  WinMySQLadmin1.0 works fine as
well
> > as MySQL when I ran it in the cmd-line mode.  What's the remedy?
> >
> > Thanks in advance,
> > -Peter
> >
> >
> >
> you should start MySQL first.
> --
> Prevencija putem edukacije
> http://www.narkomanija.com/


--- End Message ---
--- Begin Message ---
You won't be able to do that with a regexp alone.  Recursively matching
isn't possible.  You'll need a little help from some additional code.

<?php
        $string = "wed-thurs 9:35, 14:56, 18:35";  // YOUR STRING
        $regexp = "^([a-z]+)-([a-z]+)[\ ]+(.*)$";
        // GETS (day)-(day) (any/all times)
        $find = ereg( $regexp, $string, $matches );
        $times = explode( ",", $matches[3] );  // BREAK APART (.*)
        print( $matches[1] . "<br>\n" . $matches[2] . "<br>\n" );
        while( list( $key, $val ) = each( $times ) ){
                print( trim( ${val} ) . "<br>\n" );
        }
?>

That seems to do the trick.  Hopefully that gets ya closer to where you
want to go.  If you really needed to regexp match on the times, you can
do that within the while loop.

        g.luck,
        ~Chris                         /"\
                                       \ /     Microsoft Security Specialist:
                                        X      The moron in Oxymoron.
                                       / \     http://www.thebackrow.net

On Mon, 25 Mar 2002, Cameron Just wrote:

> Hi,
>
> I am trying to pull out the following information via a regular expression.
>
> The string I am searching on is 'wed-thurs 9:35, 14:56, 18:35'
>
> and I want it to retreive
> wed
> thurs
> 9:35
> 14:56
> 18:35
>
> The regular expression I am using is
> ([a-z]+)-([a-z]+) +([0-9]{1,2}:?[0-9]{0,2})[, ]*
>
> It seems to be grabbing the
> wed
> thurs
> 9:35
> but I can't seem to retrieve the rest of the times.
>
> Anyone have any ideas?
>
> BTW
> There can be any number of 'times' in the string and also the 'times' can
> be with or without the colon and the minutes, hence the '}:?[0-9]{0,2}'
> part of the regexp.

--- End Message ---
--- Begin Message ---
Brilliant. (Sort of)

Thats the answer I needed thankyou.
I was not sure as to whether regexp could do recursive matching and now I
know.

Thankyou for your help.

> You won't be able to do that with a regexp alone.  Recursively matching
> isn't possible.  You'll need a little help from some additional code.
>
> <?php
>        $string = "wed-thurs 9:35, 14:56, 18:35";  // YOUR STRING
>        $regexp = "^([a-z]+)-([a-z]+)[\ ]+(.*)$";
>       // GETS (day)-(day) (any/all times)
>        $find = ereg( $regexp, $string, $matches );
>        $times = explode( ",", $matches[3] );  // BREAK APART (.*)
>        print( $matches[1] . "<br>\n" . $matches[2] . "<br>\n" );
>        while( list( $key, $val ) = each( $times ) ){
>                print( trim( ${val} ) . "<br>\n" );
>        }
> ?>
>
> That seems to do the trick.  Hopefully that gets ya closer to where you
> want to go.  If you really needed to regexp match on the times, you can
> do that within the while loop.
>
>       g.luck,
>        ~Chris                         /"\
>                                       \ /     Microsoft Security
>                                       Specialist:
>                                        X      The moron in Oxymoron.
>                                       / \     http://www.thebackrow.net
>
> On Mon, 25 Mar 2002, Cameron Just wrote:
>
>> Hi,
>>
>> I am trying to pull out the following information via a regular
>> expression.
>>
>> The string I am searching on is 'wed-thurs 9:35, 14:56, 18:35'
>>
>> and I want it to retreive
>> wed
>> thurs
>> 9:35
>> 14:56
>> 18:35
>>
>> The regular expression I am using is
>> ([a-z]+)-([a-z]+) +([0-9]{1,2}:?[0-9]{0,2})[, ]*
>>
>> It seems to be grabbing the
>> wed
>> thurs
>> 9:35
>> but I can't seem to retrieve the rest of the times.
>>
>> Anyone have any ideas?
>>
>> BTW
>> There can be any number of 'times' in the string and also the 'times'
>> can be with or without the colon and the minutes, hence the
>> '}:?[0-9]{0,2}' part of the regexp.



--- End Message ---
--- Begin Message ---
You can do recursive matching using the (?R) syntax in preg functions (Perl
Compatible Regular Expression).

----- Original Message -----
From: "Christopher William Wesley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Cameron Just" <[EMAIL PROTECTED]>
Sent: Tuesday, March 26, 2002 1:01 AM
Subject: Re: [PHP] Regular Expression Challenge


> You won't be able to do that with a regexp alone.  Recursively matching
> isn't possible.  You'll need a little help from some additional code.
>
> <?php
>         $string = "wed-thurs 9:35, 14:56, 18:35";  // YOUR STRING
>         $regexp = "^([a-z]+)-([a-z]+)[\ ]+(.*)$";
> // GETS (day)-(day) (any/all times)
>         $find = ereg( $regexp, $string, $matches );
>         $times = explode( ",", $matches[3] );  // BREAK APART (.*)
>         print( $matches[1] . "<br>\n" . $matches[2] . "<br>\n" );
>         while( list( $key, $val ) = each( $times ) ){
>                 print( trim( ${val} ) . "<br>\n" );
>         }
> ?>
>
> That seems to do the trick.  Hopefully that gets ya closer to where you
> want to go.  If you really needed to regexp match on the times, you can
> do that within the while loop.
>
> g.luck,
>         ~Chris                         /"\
>                                        \ /     Microsoft Security
Specialist:
>                                         X      The moron in Oxymoron.
>                                        / \     http://www.thebackrow.net
>
> On Mon, 25 Mar 2002, Cameron Just wrote:
>
> > Hi,
> >
> > I am trying to pull out the following information via a regular
expression.
> >
> > The string I am searching on is 'wed-thurs 9:35, 14:56, 18:35'
> >
> > and I want it to retreive
> > wed
> > thurs
> > 9:35
> > 14:56
> > 18:35
> >
> > The regular expression I am using is
> > ([a-z]+)-([a-z]+) +([0-9]{1,2}:?[0-9]{0,2})[, ]*
> >
> > It seems to be grabbing the
> > wed
> > thurs
> > 9:35
> > but I can't seem to retrieve the rest of the times.
> >
> > Anyone have any ideas?
> >
> > BTW
> > There can be any number of 'times' in the string and also the 'times'
can
> > be with or without the colon and the minutes, hence the '}:?[0-9]{0,2}'
> > part of the regexp.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
At 11:30 AM +1000 26/3/02, Cameron Just wrote:

>I was not sure as to whether regexp could do recursive matching and now I
>know.

This is crazy! There used to be clue on this list!

<?php

$test = "wed-thurs 9:35, 14:56, 18:35, 6, :12";

$patt = "/([a-z]+|[0-9]*:*[0-9]+)[ ,-]*/";

if (preg_match_all ($patt, $test, $tok)) {
        while (list($k, $v) = each($tok[1])) {
                echo "\$tok[$k] = $v<br>\n";
        }
}

?>

Output:
$tok[0] = wed
$tok[1] = thurs
$tok[2] = 9:35
$tok[3] = 14:56
$tok[4] = 18:35
$tok[5] = 6
$tok[6] = :12

 ...R.
--- End Message ---
--- Begin Message ---
Very nice. I was going to suggest:

<?php

$input = "wed-thurs 9:35, 14:56, 18:35, 21, 22, 23:59";
preg_match( "/([a-z]+)-([a-z]+)((?:\s[0-9]+(?::[0-9]+)?,?)*)/", $input,
$output, PREG_SET_ORDER );
$output[3] = preg_replace( "/,/", "", trim($output[3]) );
$times = explode( " ", $output[3] );


?>

But uhhh, your way is much nicer :]

----- Original Message -----
From: "Richard Archer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 26, 2002 4:04 AM
Subject: Re: [PHP] Regular Expression Challenge


> At 11:30 AM +1000 26/3/02, Cameron Just wrote:
>
> >I was not sure as to whether regexp could do recursive matching and now I
> >know.
>
> This is crazy! There used to be clue on this list!
>
> <?php
>
> $test = "wed-thurs 9:35, 14:56, 18:35, 6, :12";
>
> $patt = "/([a-z]+|[0-9]*:*[0-9]+)[ ,-]*/";
>
> if (preg_match_all ($patt, $test, $tok)) {
>         while (list($k, $v) = each($tok[1])) {
>                 echo "\$tok[$k] = $v<br>\n";
>         }
> }
>
> ?>
>
> Output:
> $tok[0] = wed
> $tok[1] = thurs
> $tok[2] = 9:35
> $tok[3] = 14:56
> $tok[4] = 18:35
> $tok[5] = 6
> $tok[6] = :12
>
>  ...R.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Just gave it up for GoLive6 :)

The php model never worked well.

I even purchased impAKT and Nextensio.
The 1.1 version somewhat worked, the 1.2 was DOA.

Most of those features are in the GL6.
Samples illustrate edit in lists and list and edit areas on same page.

Sessions not as easy.

MacOSX NATIVE!!!!!!!!!

Jerry
Interactivemedianet.com

--- End Message ---
--- Begin Message ---
I would check the mail logs on the smtp server ?(if you have access)
or... try this and see if ANY mail is bveing sent to you (assumes a unix
server with sendmail (or compatible) binary installed)

     $fp=fopen('./tmp', 'w');
     fputs($fp, 'Subject: '.$reportsubject.chr(10));
     fputs($fp, $reportmail);
     fclose($fp);
     foreach($reportaddr as $addr) {
        `cat ./tmp | $sendmail $addr`;
     }
     unlink('./tmp');

(taken from a script I wrote for a server which didn't have mail() due
to an annoying problem.... 

http://www.apokalyptik.com/watchtower/watchtower-1.0.phps

)

-----Original Message-----
From: Kevin Stone [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 25, 2002 4:26 PM
To: php-general-list
Subject: [PHP] mail() function returns TRUE but no email is sent

Anyone run into this problem before?  I've got a simple email parser
that I've set up for our clients to access from their websites.  It just
uses the simple mail() function to send the parsed HTML to their
account.  The mail() function is returning TRUE  but the email no email
is being received.  How does the mail() function check if the email has
actually been sent?  Is it possible that the mail() function could be
given the proper signals to return TRUE but then the server not send the
email?
 
Thanks,
Kevin


--- End Message ---
--- Begin Message ---
Hi, can anyone help me with this problem.
I'm trying to connect to a MySQL database on my computer, I don't have a
hostname for it, so I just insert the IP, something like this.

...
mysql_cos?
Thanks.
-Chris

--- End Message ---
--- Begin Message ---
I have no idea what you meant to ask... but instead of an ip address I
would use the hostname 'localhost' which most servers are setup by
default to understand as 127.0.0.1 (loopback). And you can add an entry
to /etc/hosts or C:\windows\hosts or c:\winnt\(?system(?32?)\?)hosts

But that's just me...

-----Original Message-----
From: Omland Christopher m [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 25, 2002 5:55 PM
To: Cameron Just
Cc: [EMAIL PROTECTED]
Subject: [PHP] Database connection problem

Hi, can anyone help me with this problem.
I'm trying to connect to a MySQL database on my computer, I don't have a
hostname for it, so I just insert the IP, something like this.

...
mysql_cos?
Thanks.
-Chris


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




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

Genenally you can use 'localhost' as the hostname username 'root' and the
password is blank.
I beleive this is a default user when mysql is installed.

The details about how to connect are in the database 'mysql' and the
table 'user'. You should probably add a new user specifically for your php
scripts to this table.

NOTE: If you do add a new user you will need to restart mysql before it can
be accessed via the new user.

Hope that helps.

> Hi, can anyone help me with this problem.
> I'm trying to connect to a MySQL database on my computer, I don't have
> a hostname for it, so I just insert the IP, something like this.
>
> ...
> mysql_cos?
> Thanks.
> -Chris



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


I want to be able to edit part of a file.  via a text box using php  how do i read a 
file and get the part i want to read and edit it and then write it back to that file 
here is an example:

.....
case "$1" in
  start)

100.123.456.789
321.654.987.231
123.45.456.789
123.456.789.12

;;

........

In this example I want to be able to be able to pull the ipaddresses out and edit them 
and add a new one on to the end and then write the data back to the file.


Thanks in advance


Randy


--- End Message ---
--- Begin Message ---
You read the entire file into memory (an array using file() perhaps) and
then edit it in memory and write the entire new file back out.

-Rasmus

On Mon, 25 Mar 2002, Randy Johnson wrote:

> Hello,
>
>
> I want to be able to edit part of a file.  via a text box using php  how do i read a 
>file and get the part i want to read and edit it and then write it back to that file 
>here is an example:
>
> .....
> case "$1" in
>   start)
>
> 100.123.456.789
> 321.654.987.231
> 123.45.456.789
> 123.456.789.12
>
> ;;
>
> ........
>
> In this example I want to be able to be able to pull the ipaddresses out and edit 
>them and add a new one on to the end and then write the data back to the file.
>
>
> Thanks in advance
>
>
> Randy
>
>
>

--- End Message ---
--- Begin Message ---
How do I know what part of it to read in the array?
----- Original Message -----
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "Randy Johnson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, March 25, 2002 9:03 PM
Subject: Re: [PHP] File Edit


> You read the entire file into memory (an array using file() perhaps) and
> then edit it in memory and write the entire new file back out.
>
> -Rasmus
>
> On Mon, 25 Mar 2002, Randy Johnson wrote:
>
> > Hello,
> >
> >
> > I want to be able to edit part of a file.  via a text box using php  how
do i read a file and get the part i want to read and edit it and then write
it back to that file here is an example:
> >
> > .....
> > case "$1" in
> >   start)
> >
> > 100.123.456.789
> > 321.654.987.231
> > 123.45.456.789
> > 123.456.789.12
> >
> > ;;
> >
> > ........
> >
> > In this example I want to be able to be able to pull the ipaddresses out
and edit them and add a new one on to the end and then write the data back
to the file.
> >
> >
> > Thanks in advance
> >
> >
> > Randy
> >
> >
> >
>


--- End Message ---
--- Begin Message ---
You read all of it

On Mon, 25 Mar 2002, Randy Johnson wrote:

> How do I know what part of it to read in the array?
> ----- Original Message -----
> From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> To: "Randy Johnson" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, March 25, 2002 9:03 PM
> Subject: Re: [PHP] File Edit
>
>
> > You read the entire file into memory (an array using file() perhaps) and
> > then edit it in memory and write the entire new file back out.
> >
> > -Rasmus
> >
> > On Mon, 25 Mar 2002, Randy Johnson wrote:
> >
> > > Hello,
> > >
> > >
> > > I want to be able to edit part of a file.  via a text box using php  how
> do i read a file and get the part i want to read and edit it and then write
> it back to that file here is an example:
> > >
> > > .....
> > > case "$1" in
> > >   start)
> > >
> > > 100.123.456.789
> > > 321.654.987.231
> > > 123.45.456.789
> > > 123.456.789.12
> > >
> > > ;;
> > >
> > > ........
> > >
> > > In this example I want to be able to be able to pull the ipaddresses out
> and edit them and add a new one on to the end and then write the data back
> to the file.
> > >
> > >
> > > Thanks in advance
> > >
> > >
> > > Randy
> > >
> > >
> > >
> >
>
>

--- End Message ---
--- Begin Message ---
ok i read all the file into an array,

now do i search each line in the array .

based on my example i do not know how to proceed
after reading it into the array



case "$1" in
start)
100.123.456.789
321.654.987.231
123.45.456.789
123.456.789.12
;;

 ........
----- Original Message -----
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "Randy Johnson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, March 25, 2002 9:11 PM
Subject: Re: [PHP] File Edit


> You read all of it
>
> On Mon, 25 Mar 2002, Randy Johnson wrote:
>
> > How do I know what part of it to read in the array?
> > ----- Original Message -----
> > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> > To: "Randy Johnson" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Monday, March 25, 2002 9:03 PM
> > Subject: Re: [PHP] File Edit
> >
> >
> > > You read the entire file into memory (an array using file() perhaps)
and
> > > then edit it in memory and write the entire new file back out.
> > >
> > > -Rasmus
> > >
> > > On Mon, 25 Mar 2002, Randy Johnson wrote:
> > >
> > > > Hello,
> > > >
> > > >
> > > > I want to be able to edit part of a file.  via a text box using php
how
> > do i read a file and get the part i want to read and edit it and then
write
> > it back to that file here is an example:
> > > >
> > > > .....
> > > > case "$1" in
> > > >   start)
> > > >
> > > > 100.123.456.789
> > > > 321.654.987.231
> > > > 123.45.456.789
> > > > 123.456.789.12
> > > >
> > > > ;;
> > > >
> > > > ........
> > > >
> > > > In this example I want to be able to be able to pull the ipaddresses
out
> > and edit them and add a new one on to the end and then write the data
back
> > to the file.
> > > >
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > > > Randy
> > > >
> > > >
> > > >
> > >
> >
> >
>


--- End Message ---
--- Begin Message ---
On Tuesday 26 March 2002 10:41, Randy Johnson wrote:
> ok i read all the file into an array,
>
> now do i search each line in the array .

Yes. Based on the fragment of file that you've given, here's some psuedo-code.


initialise 3 arrays, $top, $middle, $bottom;
$found_middle = 0; $found_bottom;
for each $line in input array {
  if ($line not digit) {
    if (!$found_middle) { 
      $top[] = $line; }
    else { 
      $bottom[] = $line;
    }}
  else {
    $found_middle = 1;
    $middle[] = $line;
  }
}

// Now you have 3 arrays, 
// $top contains all lines before the IPs,
// $middle contains lines with IPs,
// $bottom contains all lines after the IPs

Do what you need to edit $middle then write $top, $middle, $bottom out to the 
file.



> based on my example i do not know how to proceed
> after reading it into the array
>
>
>
> case "$1" in
> start)
> 100.123.456.789
> 321.654.987.231
> 123.45.456.789
> 123.456.789.12
> ;;
>
>  ........
> ----- Original Message -----
> From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> To: "Randy Johnson" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, March 25, 2002 9:11 PM
> Subject: Re: [PHP] File Edit
>
> > You read all of it
> >
> > On Mon, 25 Mar 2002, Randy Johnson wrote:
> > > How do I know what part of it to read in the array?
> > > ----- Original Message -----
> > > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> > > To: "Randy Johnson" <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > Sent: Monday, March 25, 2002 9:03 PM
> > > Subject: Re: [PHP] File Edit
> > >
> > > > You read the entire file into memory (an array using file() perhaps)
>
> and
>
> > > > then edit it in memory and write the entire new file back out.
> > > >
> > > > -Rasmus
> > > >
> > > > On Mon, 25 Mar 2002, Randy Johnson wrote:
> > > > > Hello,
> > > > >
> > > > >
> > > > > I want to be able to edit part of a file.  via a text box using php
>
> how
>
> > > do i read a file and get the part i want to read and edit it and then
>
> write
>
> > > it back to that file here is an example:
> > > > > .....
> > > > > case "$1" in
> > > > >   start)
> > > > >
> > > > > 100.123.456.789
> > > > > 321.654.987.231
> > > > > 123.45.456.789
> > > > > 123.456.789.12
> > > > >
> > > > > ;;
> > > > >
> > > > > ........
> > > > >
> > > > > In this example I want to be able to be able to pull the
> > > > > ipaddresses
>
> out
>
> > > and edit them and add a new one on to the end and then write the data
>
> back
>
> > > to the file.
> > >
> > > > > Thanks in advance
> > > > >
> > > > >
> > > > > Randy
--- End Message ---
--- Begin Message ---
I wanna buy a book from amazon . . .but don't know which one..
Do you know where I will find examples of shopping carts ? (which book ?)

thanks..


--
~~~~~~~~~~~~~~~~

Sapilas@/dev/pinkeye

~~~~~~~~~~~~~~~~


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

  I am trying to build a regex to check if an array of allowed html tags
were closed. For example:

Wrong:
<b>text</a>
  Should give me something like: Tag <b> was not closed.

  Here's what I came up so far:

$tags_to_check = Array('a','b','i','p');
foreach ($tags_to_check as $tag_check) {
    if (eregi("<". $tag_check . ">(.*)[^</" . $tag_check .
">]",$_POST['form_field'])) {
        ?> Tag <?php echo htmlentities('<' . $tag_check . '>'); ?> not
closed
        <?php
    }
}

  I know there's some optimization that also could be done regarding the
foreach loop, but I haven't come up with any solutions.

  Any help is appreciated, since I promised to myself to learn regex tonight
:-)

  Thanks,

--
Julio Nobrega.


--- End Message ---
--- Begin Message ---
Hi Chris:

On Mon, Mar 25, 2002 at 02:05:30PM -0700, Chris wrote:
> Can anyone help me with the command I need for a RAW FTP file upload?
> I can create connections and they empty file, but I have no idea how to get
> the data into the file and I have tried everything.

Have you tried first creating the file on your system using the fopen(), 
fputs() and fclose() functions?  Once that's done, then you can use 
PHP's FTP functions.

Enjoy,

--Dan

-- 
                PHP scripts that make your job easier
              http://www.analysisandsolutions.com/code/
         SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
--- End Message ---
--- Begin Message ---
Hey Steven:

On Mon, Mar 25, 2002 at 09:40:01AM -0800, Steven Walker wrote:

> I have PHP automated emails sent from my website. Does anybody know a 
> good way to filter returned mail? What I want to do is extract the bad 
> email addresses from returned mail and delete them from my database.

Are you familiar with Procmail?  If you're running on a unix type
system, this will be the best option.  Check out
http://www.zer0.org/procmail/mini-faq.html on how to use it.

Here's a quick sample recipe file I'll call "rc.bounce."  This has NOT
been tested and I'm basing it on some quick assumptions.  You're going
to have to tweak it to conform to your exact conditions.

   # egrep the 'H'eader.
   :0H
   * ^To:.*[EMAIL PROTECTED]
   * ^From:.*<>
   | $HOME/bounce.php

Then, you'll have to write bounce.php to process the incoming mail 
accordingly.

If you don't have procmail, or you don't want to deal with it, you can
direct the returns to a particular mailspool file (aka mailbox).  Write
up a PHP script to parse the file, splitting it up into separate emails,
then gleaning the needed information from each email and update your
database with the relevant data.  Then, whenever you feel like
processing the bounces, run the script.

Here's a regex I use to split mail files (reassemble the linewraps, of
course):

$Emails = preg_split("/[\n\r]+From\s*[^\s]*\s*
   (Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s*
   (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s*\d{1,2} 
   \d{2}:\d{2}:\d{2} (19|20)\d{2}[\n\r]+/", $ContentString);


Enjoy,

--Dan

-- 
                PHP scripts that make your job easier
              http://www.analysisandsolutions.com/code/
         SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
--- End Message ---
--- Begin Message ---
Chris:

On Mon, Mar 25, 2002 at 08:38:16AM -0500, Chris Hilbert wrote:
> I was wondering if anyone would know how I could go about checking two XML
> files for differences, similar to the "diff" command in *nix.  I'm having a
> heck of a time getting a function written to achieve this task.

Which OS are you running on???  Okay, I'll guess Windows.  Ah, yes, your 
mail headers confirm that...

Have you tried the "fc" command?  It does the same thing as the 
"unix" based "cmp" command.

Also, you could pull the contents of both files into variables and then
compare the strings using either a straight "==" evaluation or via one
of the comparison functions such as strcmp(), strncasecmp() or
strcasecmp().

Enjoy,

--Dan

-- 
                PHP scripts that make your job easier
              http://www.analysisandsolutions.com/code/
         SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
--- End Message ---
--- Begin Message ---
Tom,

I sort of do the same here,... think you'll find that index.html is the
'default index' for a directory when a page isn't specified on your web
server and that she's going to http://www.domain.com

Hope this helps.

Jim.....

"Tom Hilton" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi, I am using the $HTTP_REFERER variable to ensure that users of a
website
> are getting to a certain page through a link from the index.html page, and
> not going straight to the page through a bookmark.
>
> $page=$HTTP_REFERER;
> if ($page!="http://www.somedomain.com/index.html";)
>   {
>   echo "<h3>Please log in through the home page</h3><br>";
>   echo "<META HTTP-EQUIV='Refresh'
> CONTENT='1;URL=http://www.somedomain.com/index.html'>";
>   }
>  This is working fine for most users, but one user is telling me that even
> though she is following the link from the index page, she's still getting
> the error message,  and are being bounced back to the index page.  She is
> using Internet Explorer 6.0.  Are there any security or privacy settings
> that might restrict use of the $HTTP_REFERER variable?  Or is there a
better
> way to make sure users follow links to pages, rather than bookmarking and
> going straight to a page?  Thanks for any help you can give me.
>
>


--- End Message ---
--- Begin Message ---
On Mon, 25 Mar 2002 18:18:33 -0000, [EMAIL PROTECTED] (Chad Gilmer)
wrote:

>Hi There,
>
>I am a beginner to PHP and I am tring to use session variables on my site.
>
>I am trying to use Session Variables in PHP on the iPLANIT.tv site
>
>When I use the following code:
>
><?php
> $ses_counter++;
>
> session_register("ses_counter");
>
>?>
>
>I get the following error
>
>Warning: Cannot send session cookie - headers already sent by (output
>started at /home/iplanit/public_html/php/login.php:8) in
>/home/iplanit/public_html/php/login.php on line 11
>
>Warning: Cannot send session cache limiter - headers already sent (output
>started at /home/iplanit/public_html/php/login.php:8) in
>/home/iplanit/public_html/php/login.php on line 11
>
>Any Ideas???
>
>Cheers
>
>Chad
>
put the session_register("") in front of the code.
--- End Message ---
--- Begin Message ---
On Mon, 25 Mar 2002 08:54:27 -0700, [EMAIL PROTECTED] (Johny? ?rk)
wrote:

>Do you have register_globals turned on or off in php.ini? What values are $a
>and $b being set to?
>
>Kirk
>
>> -----Original Message-----
>> From: bob [mailto:[EMAIL PROTECTED]]
>> Sent: Sunday, March 24, 2002 4:21 PM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP] header and session?
>> 
>> 
>>  1.php?                                            2.php
>> session_start();                             session_start();
>> ..........                                                 ..........
>> $_SESSION['a'] =$a;                 echo $_SESSION['a']; 
>> $_SESSION['b'] =$b;                 echo $_SESSION['b']; 
>> header("location: 2.php");
>> 
>> after jump to 2.php ,there is an warning: undefined index a ,b
>> 
>> 
>> if i  change 1.php   to
>>              
>> session_start();     
>> ..........                      
>> $_SESSION['a'] =$a;                            
>> $_SESSION['b'] =$b;                            
>> <a href='2.php' >go on </a>
>> 
>> it works well!
register_globals is on.$a,$b is set to $_SESSION array,which is
global  in any scope.
the problem is i submit a login form to 1.php,which register some
session variable.then,in 2.php,i fail to print them out.
--- End Message ---
--- Begin Message ---
On 25 Mar 2002 at 0:29, [EMAIL PROTECTED] wrote:

> yes, but i send them back to the previous page
> and it shows the form...
> 
> What would be a way around this?
> ----- Original Message -----
> From: "David Robley" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, March 24, 2002 11:39 PM
> Subject: [PHP] Re: Non-Cache in forms?
> 
> 
> > In article <001801c1d38d$6b016eb0$0201a8c0@zaireweb>,
> > [EMAIL PROTECTED] says...
> > > Alright,
> > >
> > > When I submit a form, and shoot out an error, such as "Please fill in
> email address" and then send them back to the form, the form seems to be
> blank... > > > > Why?  What is happening that the form isn't keeping the
> previously posted data? > > > > My error function looks like so > > > >
> function crapout($msg, $hidden_msg = FASE) { > > echo($msg); > >
> if($hidden_msg != "FALSE") { > > echo('<!-- ' . $hidden_msg . ' -->'); > >
> } > > exit; > > } > > > > Thanks, > > Eric Coleman > > > > You are aware
> that exit halts execution of the script? > > -- > David Robley > Temporary
> Kiwi! > > Quod subigo farinam > > -- > PHP General Mailing List
> (http://www.php.net/) > To unsubscribe, visit:
> http://www.php.net/unsub.php > > >

Please respond to the list as well, as you are more likely to get a timely and useful 
response that way.

I notice that your error message is in HTML comment tags? Without seeing more of your 
code, it's a bit hard to tell. But you might try doing a view source and see if there 
is 
anything in the source that might assist. Otherwise, post more relevant parts of your 
code 
to the list.


-- 
David Robley
Temporary Kiwi!
Quod subigo farinam

"I want this statue to look like the Venus de Milo," said Tom disarmingly.


--- End Message ---
--- Begin Message ---
I am putting certin code within comment tags, so it isn't seen...


----- Original Message -----
From: "David Robley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, March 25, 2002 11:00 PM
Subject: Re: [PHP] Re: Non-Cache in forms?


> On 25 Mar 2002 at 0:29, [EMAIL PROTECTED] wrote:
>
> > yes, but i send them back to the previous page
> > and it shows the form...
> >
> > What would be a way around this?
> > ----- Original Message -----
> > From: "David Robley" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, March 24, 2002 11:39 PM
> > Subject: [PHP] Re: Non-Cache in forms?
> >
> >
> > > In article <001801c1d38d$6b016eb0$0201a8c0@zaireweb>,
> > > [EMAIL PROTECTED] says...
> > > > Alright,
> > > >
> > > > When I submit a form, and shoot out an error, such as "Please fill
in
> > email address" and then send them back to the form, the form seems to be
> > blank... > > > > Why?  What is happening that the form isn't keeping the
> > previously posted data? > > > > My error function looks like so > > > >
> > function crapout($msg, $hidden_msg = FASE) { > > echo($msg); > >
> > if($hidden_msg != "FALSE") { > > echo('<!-- ' . $hidden_msg . ' -->'); >
>
> > } > > exit; > > } > > > > Thanks, > > Eric Coleman > > > > You are aware
> > that exit halts execution of the script? > > -- > David Robley >
Temporary
> > Kiwi! > > Quod subigo farinam > > -- > PHP General Mailing List
> > (http://www.php.net/) > To unsubscribe, visit:
> > http://www.php.net/unsub.php > > >
>
> Please respond to the list as well, as you are more likely to get a timely
and useful
> response that way.
>
> I notice that your error message is in HTML comment tags? Without seeing
more of your
> code, it's a bit hard to tell. But you might try doing a view source and
see if there is
> anything in the source that might assist. Otherwise, post more relevant
parts of your code
> to the list.
>
>
> --
> David Robley
> Temporary Kiwi!
> Quod subigo farinam
>
> "I want this statue to look like the Venus de Milo," said Tom disarmingly.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
How do I know if my web hosting server installed PEAR correctly?

I'm trying to create a Search Engine from the PHP Developer's Cookbook,
and so far, here's what I know:

PHP has the PEAR installed ('--with-pear' according phpinfo.php)

And having telnetted into my server, was able to find the PEAR location
at 

/usr/local/bin/, where it is simply called "pear".

In the Find.php file, I set it so that it calls a require_once
'/usr/local/bin/pear';
Originally it was pear.php, but it didn't find it, so I set it as shown
above.

Now, if I run the file, I get this message:
#!/usr/local/bin/php -Cq 
Fatal error: Failed opening required 'PEAR.php' (include_path='') in
/usr/local/bin/pear on line 45

How do I know if PEAR is installed correctly? (The web hosting hasn't
installed Pear before until I requested it)


--- End Message ---
--- Begin Message ---
Your popup window should be an normal PHP page calling your images in the
database.   You can then setup your form to call the popup windows via
javascript using the window.open() method.

/dkm



----- Original Message -----
From: "Scott" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 25, 2002 6:13 PM
Subject: [PHP] php and javascript


> I have some image urls that I have stored in a mysql database.  I want to
be
> able to display the images in a popup window using javascript.  But I
haven't
> been able to figure out how to get the get the info to mysql so that the
> image loads when the popup window appears.  Below is an example of the
form
> without any javascript.
>
> <form action="test.php" method="post">
> <INPUT type="submit" value="See Photo" name="button">
> <INPUT type="hidden" name="item_no" value="<?php echo "$item_no"; ?>">
> </form><br><br>
>
> Any help appreciated.
> Thanks,
> SW
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Can someone point me to a webset that example how to do cookies? I try to do
what the mannual said but, when I go to my temp dir, there no cookie file. I
know it working because my file would print a phrasing error.

Thanks,

 ----------------------------
 | Chuck Payne              |
 | Magi Design and Support  |
 | www.magidesign.com       |
 | [EMAIL PROTECTED]   |
 ----------------------------

BeOS, Macintosh 68K, Classic, and OS X, Linux Support.
Web Design you can afford.

"Never be bullied into silence. Never allow yourself to be made a victim.
Accept no one's definition of your life; define yourself."- Harvey Fierstein


--- End Message ---
--- Begin Message ---
This was a problem with the version of PHP that I had installed.
PHP-4.0.4pl1. Apparently there is a bug that causes this to be written
to the front of the file.

Solution?  Upgrade.

David McInnis

-----Original Message-----
From: David McInnis [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 25, 2002 11:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Mime type prepeded at file upload

When I save a file that has been uploaded through PHP it prepends (adds
to the beginning of the file) the mime type.  This renders the file
unusable when it is downloaded as MS Word cannot open the file and tries
to install some kind of converter.

Any ideas for me?

David McInnis


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


--- End Message ---
--- Begin Message ---
On Mon, Mar 25, 2002 at 02:49:07PM -0500, Scarbrough, Jeb (ISS Atlanta) wrote:
> Is it possible to create a transaction the involves multiple pages using PHP
> and oracle.  For example, can I log onto oracle using OCIPLogon on one page
> named master, insert information, go to the next page named detail, insert
> information and commit both transactions at the same time?

    no you can't - bacause HTTP is stateless and it is unlikely
    that your 2nd page will be served by the same httpd process
    there's no way to have transactions span multiple pages. you
    will have to emulate this behaviour!

    tc
--- End Message ---
--- Begin Message ---
hay everyone can someone recommend a good solution for stopping my server from 
crashing.  I have 4. something installed on my server and something nuts happens with 
the memory causing the server to crash and generate an exception.  The only way I can 
fix this  is to re-start.  I run the isapi module.  Please don't recommend the cgi 
version cos it don't work.

Philip Newman
Internet Developer
http://www.philipnz.com/
[EMAIL PROTECTED]
ICQ#: 20482482




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

I have a contact form (form.php). I check the submitted data with the
same php file.

If the e-mail adress is not valid I ask the user for a valid e-mail adress.
Therefor I create a new form with the field e-mail. The valid date name,
adress, ...
I put into hidden fields, so they don't get lost.

This works fine until I integreate a file upload into my form.
The file data stored in the $_FILES array get lost, when I submit the
form the second time (when the e-mail adress isn't valid).

The same problem occours when I integrate a list box where it is possible to
choose more then one item:

<select name="test[]" size="3" multiple>
  <option value="test1"> test1</option>
  <option value="test2"> test2</option>
  <option value="test3"> test3</option>
</select>

Is there an easy way (in PHP 4.1.2) to store arrays like scalar variables in
hidden fields, without using a database or transforming the array data
into a string?

Thanks,

Fabian Krumbholz
www.2k-web.de

--- End Message ---
--- Begin Message ---
Hi there, i'm building a form that posts to a php page. When I click on back
on my browser and then forward. It gives me this warning. Is there anyways
to avoid this?

thanks!

-David

--- End Message ---
--- Begin Message ---
I worked with the xmldom under php4.0.6 and everything was fine and dandy,
though since I upgraded php on my staging server which is a win2k(pro) box
to 4.1.2 there has been no way to get the libxml to work. I first tried
4.1.1, that wouldnt work, so I had a little bit of hope that 4.1.2 would do
the trick but unfortunately I am still stuck.
I almost cant believe that it isn't possible to get libxml to work on win2k
with php 4.1.2, I tried everything I could possibly come up with, reading
Mad Osterby's guide for 100 times over, looked on every forum I could find,
but no results.

If anybody has an idea (or can state that they could get it running) then
please let me know, I am now developing on the live server which is not a
relaxed situation - if I produce an error 4 portals go down and or show
error msg's to the users untill the time I fixed them, which doesn't
precisely make my commissiongivers happy.

If there's noone out there who got it running, I will have to trash win2k
and install linux, but that would be an enormous job so please please please
if you know something, share this with me!

Thanks very much

*   *   *     *      *       *        *         *          *           *
*
*  Tobias Beuving
*  g a d g e t s    m e d i a
*  http://www.gadgets.nl
*   *   *     *      *       *        *         *          *           *
*


--- End Message ---
--- Begin Message ---
Hi all, I'm writing a script that generate invoices in a PNG files.
My problem is that I have to write the numbers aligned to the right.
I'm using the funciotn ImageTTFText and it haven't a parm that tells the
alignment.
I looked at the IMAGE functions list in www.php.net but I didn't found
nothing about the alignment.
Does anyone know if there's a function or a parameter to write with TTF
fonts aligned to the RIGHT?

Thank, Fabio
www.kel666.it



--- End Message ---
--- Begin Message ---
When running this code:

<?php
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
copy($HTTP_POST_FILES['userfile']['tmp_name'],
"C:\Inetpub\webpub\PHP\upload");
move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],
"C:\Inetpub\webpub\PHP\upload");
} else {
echo "Possible file upload attack. Filename: " .
$HTTP_POST_FILES['userfile']['name'];
}
?>
..................
<form name="form1" method="post" action="upload.php"
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
<p>
<input type="file" name="userfile">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
..................
I got this:

Warning: Unable to create 'C:\Inetpub\webpub\PHP\upload': Permission denied
in c:\Inetpub\webpub\PHP\upload.php on line 3
Warning: Unable to create 'C:\Inetpub\webpub\PHP\upload': Permission denied
in c:\Inetpub\webpub\PHP\upload.php on line 4
Warning: Unable to move 'C:\WINDOWS\TEMP\php187.tmp' to
'C:\Inetpub\webpub\PHP\upload' in c:\Inetpub\webpub\PHP\upload.php on line 4

I must leave "register_globals=Off" !!!
Can anyone help?
Thanks,
Evan


--- End Message ---
--- Begin Message ---
> I got this:
> 
> Warning: Unable to create 'C:\Inetpub\webpub\PHP\upload': 
> Permission denied
> in c:\Inetpub\webpub\PHP\upload.php on line 3
> Warning: Unable to create 'C:\Inetpub\webpub\PHP\upload': 
> Permission denied
> in c:\Inetpub\webpub\PHP\upload.php on line 4
> Warning: Unable to move 'C:\WINDOWS\TEMP\php187.tmp' to
> 'C:\Inetpub\webpub\PHP\upload' in 
> c:\Inetpub\webpub\PHP\upload.php on line 4
> 


Hi!

Make sure you're ok with the filerights in your nt-filesystem. i never tried
it but i think the "IWAM_[Servername]"-User must have write access in the
Upload-folder.

good luck!
dave
--- End Message ---
--- Begin Message ---
Hello friends,

I have a form for registering by the users. This runs on php/mysql.

Can someone tell me how I could include auto password generation and
emailing of this password to users?

Thanks
denis


--- End Message ---
--- Begin Message ---
26/03/2002 9:51:20 PM



<?
$password = substr(ereg_replace("[^A-Za-z0-9]", "", crypt(time())) .
                         ereg_replace("[^A-Za-z0-9]", "", crypt(time())) .
                         ereg_replace("[^A-Za-z0-9]", "", crypt(time())),
                     0, 8);
?>

Random Password : <b><? echo "$password"; ?></b>





"Denis L. Menezes" <[EMAIL PROTECTED]> wrote on 26/03/2002 11:38:14 AM:
>
>Hello friends,
>
>I have a form for registering by the users. This runs on php/mysql.
>
>Can someone tell me how I could include auto password generation and
>emailing of this password to users?
>
>Thanks
>denis
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hi,
I'm working with PHP and ODBC to get images stored in a database (Blob fields). But I 
experiment little problems to display these pics. Has anyone any information about 
PHP/ODBC/images ?

Thanks,

Bilbo

--- End Message ---
--- Begin Message ---
Hi,
 I have moved my php files to linux system.
 Now it z showing (control+M)(^M) characters in the file.
 How can I remove those characters?

 Any help would be appreciable.

Thanks and Regards
Balaji

**************************Disclaimer************************************
      


Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.



 ********************************************************************
--- End Message ---
--- Begin Message ---
Whats showing the ^M? a Linux Editor? Well the ^M are part of the newline
code on windows.

There are programs out that which will strip them, The only one I have
personally used is UltraEdit (but thats a general all purpose text/hex
editor). But I'm pretty sure there are linux command line tools.

BUT If you can put up with them you can keep them, since they won't damage
anything.. OR you could manually delete them all :)

Andrew
----- Original Message -----
From: "Balaji Ankem" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Tuesday, March 26, 2002 12:16 PM
Subject: [PHP] How to remove ^M characters from a directory?


> Hi,
>  I have moved my php files to linux system.
>  Now it z showing (control+M)(^M) characters in the file.
>  How can I remove those characters?
>
>  Any help would be appreciable.
>
> Thanks and Regards
> Balaji
>
>


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


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

--- End Message ---
--- Begin Message ---
Hi!

I'm trying to check the validity of given hyperlinks...
I thought this code should work (Apache 1.3.9, Win98)

$tempUrl = ereg_replace("http://";, "", $url);

$fp = fsockopen ($tempUrl, $tempPort, &$errno, &$errstr, 30);
        
if (!$fp)
{
    echo "<br>error opening $url: \$errstr=$errstr, \$errno=$errno<br>\n";
}
else
{
    fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
        echo "<br>s>>>" . fgets($fp,1024);
    fclose($fp);
}

For each and every url,

$fp = false;
$errstr = "";
$errno = 0;

Where is my mistake? I guess I'm simply getting sth wrong...

Any hint would be great.

Cheers,
Kiko

-----
It's not a bug, it's a feature.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.fh-augsburg.de/~kiko
ICQ: 100601600
-----
--- End Message ---
--- Begin Message ---
Is $tempPort set ?

Alastair Battrick
Senior Developer
Lightwood Consultancy Ltd
http://www.lightwood.net


> -----Original Message-----
> From: Christoph Starkmann [mailto:[EMAIL PROTECTED]]
> Sent: 26 March 2002 12:40
> To: '[EMAIL PROTECTED]'
> Subject: [PHP] fsockopen
>
>
> Hi!
>
> I'm trying to check the validity of given hyperlinks...
> I thought this code should work (Apache 1.3.9, Win98)
>
> $tempUrl = ereg_replace("http://";, "", $url);
>
> $fp = fsockopen ($tempUrl, $tempPort, &$errno, &$errstr, 30);
>
> if (!$fp)
> {
>     echo "<br>error opening $url: \$errstr=$errstr, \$errno=$errno<br>\n";
> }
> else
> {
>     fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
>       echo "<br>s>>>" . fgets($fp,1024);
>     fclose($fp);
> }
>
> For each and every url,
>
> $fp = false;
> $errstr = "";
> $errno = 0;
>
> Where is my mistake? I guess I'm simply getting sth wrong...
>
> Any hint would be great.
>
> Cheers,
> Kiko
>
> -----
> It's not a bug, it's a feature.
> christoph starkmann
> mailto:[EMAIL PROTECTED]
> http://www.fh-augsburg.de/~kiko
> ICQ: 100601600
> -----
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hi!

> Is $tempPort set ?

Yes... 80 as default...

> > $tempUrl = ereg_replace("http://";, "", $url);
> >
> > $fp = fsockopen ($tempUrl, $tempPort, &$errno, &$errstr, 30);
> >
> > if (!$fp)
> > {
> >     echo "<br>error opening $url: \$errstr=$errstr, 
> \$errno=$errno<br>\n";
> > }
> > else
> > {
> >     fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
> >     echo "<br>s>>>" . fgets($fp,1024);
> >     fclose($fp);
> > }

Cheers...
Kiko

-----
It's not a bug, it's a feature.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.fh-augsburg.de/~kiko
ICQ: 100601600
-----
--- End Message ---
--- Begin Message ---
There are a few things that it could be.

Change the ereg_replace to str_replace

Try adding Host: $server_name on the line after the GET:

fputs ($fp, "GET / HTTP/1.0\r\nHost: $server_name\r\n\r\n");

iirc, if the server uses virtual hosts, the GET won't work properly without
it.

If that's not it, try adding this instead of your single echo line:

while (!feof ($fp)) {
  $line = fgets($fp, 4096);
  echo $line;
}

As that will return and echo all the page, not just the header.

Alastair

> -----Original Message-----
> From: Christoph Starkmann [mailto:[EMAIL PROTECTED]]
> Sent: 26 March 2002 12:48
> To: '[EMAIL PROTECTED]'; Christoph Starkmann; [EMAIL PROTECTED]
> Subject: RE: [PHP] fsockopen
>
>
> Hi!
>
> > Is $tempPort set ?
>
> Yes... 80 as default...
>
> > > $tempUrl = ereg_replace("http://";, "", $url);
> > >
> > > $fp = fsockopen ($tempUrl, $tempPort, &$errno, &$errstr, 30);
> > >
> > > if (!$fp)
> > > {
> > >     echo "<br>error opening $url: \$errstr=$errstr,
> > \$errno=$errno<br>\n";
> > > }
> > > else
> > > {
> > >     fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
> > >   echo "<br>s>>>" . fgets($fp,1024);
> > >     fclose($fp);
> > > }
>
> Cheers...
> Kiko
>
> -----
> It's not a bug, it's a feature.
> christoph starkmann
> mailto:[EMAIL PROTECTED]
> http://www.fh-augsburg.de/~kiko
> ICQ: 100601600
> -----

--- End Message ---

Reply via email to