php-general Digest 6 Apr 2002 20:30:48 -0000 Issue 1271

Topics (messages 91849 through 91888):

Re: help condensing regular expressions
        91849 by: Tom Rogers

Re: Headers not working
        91850 by: Michael Virnstein

limit posts and have a next page?
        91851 by: Hawk
        91852 by: Jason Wong
        91867 by: The_RadiX

htmlentities
        91853 by: Joerg Hanke [ML-php]
        91855 by: Jason Wong

Re: nl2br returns <BR />? normality or a bug?
        91854 by: James Arthur
        91880 by: Justin French
        91888 by: Lars Torben Wilson

using font properties in generated posts.
        91856 by: Randum Ian
        91877 by: Miguel Cruz

How to convert a website to a txtfile....?
        91857 by: Raymond Lilleodegard
        91879 by: Miguel Cruz

regular expressions: HUGE speed differences
        91858 by: Ando
        91863 by: heinisch.creaction.de

Executing functions within ereg_replace() output
        91859 by: Adam Wan

Mystery Binary Characters in My Files
        91860 by: Jeff Levy
        91865 by: heinisch.creaction.de
        91869 by: Jeff Levy

F/U on Returned Mail
        91861 by: Anthony Rodriguez
        91862 by: Jason Wong
        91864 by: heinisch.creaction.de
        91866 by: Jason Wong

- Flock manual clarification please  ;-)
        91868 by: Matt Friedman

how to sort by value in associative array
        91870 by: Peter J. Schoenster

MAC file upload
        91871 by: Shane McBride
        91875 by: Miguel Cruz

Re: Can't get this code to work...
        91872 by: Analysis & Solutions
        91882 by: Rob Packer

Newbie and includes
        91873 by: Dean Ouellette
        91874 by: Timothy J. Luoma

HELP!
        91876 by: Georgie Casey
        91878 by: Miguel Cruz

redirector
        91881 by: Joerg Hanke [ML-php]
        91883 by: Miguel Cruz
        91887 by: phplists.woodenpickle.com

superglobals -sessions-clookies
        91884 by: cyberskydive
        91886 by: heinisch.creaction.de

PHP on Apache 2.0 -- Does it work?
        91885 by: Steve Magruder, D2 Director

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 ---
Hi
I have never used .htaccess but I'll read up on it, I am the ISP so it 
won't be a problem :)

Tom

At 06:12 PM 6/04/2002, Chris Adams wrote:
>In article <[EMAIL PROTECTED]>, Tom
>Rogers wrote:
> > Thats what I was after :)
>
>Glad I could help.
>
> > At the top of each page I now do
> >
> > $reltoroot = preg_replace("|/[^/]+|", "../", 
> dirname($_SERVER['PHP_SELF']));
> > ini_set 
> ("include_path",ini_get("include_path").":".$reltoroot."../include");
> >
> > which takes care of the include path
>
>Out of curiosity, couldn't you put something like
>php_value include_path .:/document/root/include:/usr/lib/php
>
>in a .htaccess file? Or has your ISP disabled .htaccess files?
>
>Chris
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
this might be because you use the cgi version of php. to be able to send
e.g.
404 header, you have to run php as webserver module which currently only
works with apache and linux afaik. otherwise these headers get send by the
webserver and you cannot affect them.

if you use php with apache as module, you should use this:

header('WWW-Authenticate: Basic realm="Private"');
header('HTTP/1.0 401 Unauthorized');

or look at this tutorial: http://www.zend.com/zend/tut/authentication.php



"Sheridan Saint-Michel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
002501c1dccb$75fd7060$[EMAIL PROTECTED]">news:002501c1dccb$75fd7060$[EMAIL PROTECTED]...
> I was trying to write a some code that would disallow specific users
access
> to certain pages.  I had thought this would be as simple as looking at
> $PHP_AUTH_USER and sending a 401 header if it was a user that shouldn't
have
> access to that page.
>
> The problem is the HTTP header was not going out.  I tried 404 and 401,
and
> then I thought perhaps the HTTP authentication was preventing me from
> sending the header, so I tried several different headers (all copied and
> pasted from the PHP manual) in an unprotected directory.  I also tried
both
> IE6 and Mozilla to make sure there wasn't a borwser issue.
>
> The header line seems to be completely overlooked as things echoed below
the
> header were appearing in the original script.
>
> The test scripts in the unprotected directory are all very simple, for
> example:
>
> <?php
>   header("Status: 404 Not Found");
> ?>
>
> I have saved three test scripts as both .php and .phps so you can view
them.
> In addition, I put up an info.php so you can see my entire PHP config in
> case that is the problem. (links below).  Also header(Location:) seems to
> work without any problems.
>
> So what am I overlooking?
>
> http://www.foxjet.com/info.php
> http://www.foxjet.com/test1.php
> http://www.foxjet.com/test1.phps
> http://www.foxjet.com/test2.php
> http://www.foxjet.com/test2.phps
> http://www.foxjet.com/test3.php
> http://www.foxjet.com/test3.phps
>
> Sheridan Saint-Michel
> Website Administrator
> FoxJet, an ITW Company
> www.foxjet.com
>


--- End Message ---
--- Begin Message ---
This is just speculations, but I thought I'd as well ask now before I get to
work
Lets say I have a news page, and I only want the last ten posts to show on
it, then I ORDER BY id ASC LIMIT 10 right?
but how do I add the next page?
count rows from the database and see if its more than 10 lines, and then ?
saw something about a MAX and a MIN mysql command, but how do I use it? and
should I use it for that purpose? :)
like... ORDER BY id ASC LIMIT 10 MIN(10) MAX(20) or something?
I dont know really.. just speculations as I said :)

Håkan


--- End Message ---
--- Begin Message ---
On Saturday 06 April 2002 16:57, Hawk wrote:
> This is just speculations, but I thought I'd as well ask now before I get
> to work
> Lets say I have a news page, and I only want the last ten posts to show on
> it, then I ORDER BY id ASC LIMIT 10 right?
> but how do I add the next page?
> count rows from the database and see if its more than 10 lines, and then ?
> saw something about a MAX and a MIN mysql command, but how do I use it? and
> should I use it for that purpose? :)
> like... ORDER BY id ASC LIMIT 10 MIN(10) MAX(20) or something?
> I dont know really.. just speculations as I said :)

Rather than indulging in idle speculation, consult the mysql manual :)

For the first 10:

  ... ORDER BY id ASC LIMIT 0, 10 


For the next 10:

  ... ORDER BY id ASC LIMIT 10, 10 


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Nothing is so firmly believed as that which we least know.
                -- Michel de Montaigne
*/
--- End Message ---
--- Begin Message ---
Yes I have built many a forums and product listings/search engines like this..


simply make it check using COUNT how many rows there are total..


now let's say your viewing page 1..

so we can see listing 1 - 10 therefore the first offset is 1

so the next set will logically be 11-20

so with this info:

<?
$page=(isset($HTTP_GET_VARS["page"])?$HTTP_GET_VARS["page"]?1);
$item_count=mysql_fetch_array(mysql_query("SELECT count(*) FROM tablename",$DB));
if($item_count-$page>10) echo "<a href=".$PHP_SELF."?page=".($page+10).">Next Page 
>></a>";
?>


now as you can see I use $HTTP_GET_VARS["page"] here so this means that the page will 
add in the GET var by itself as the user browses around the place..

For extra functionality: (code from before plus some new bits)

<?
$page=(isset($HTTP_GET_VARS["page"])?$HTTP_GET_VARS["page"]?1);
$item_count=mysql_fetch_array(mysql_query("SELECT count(*) FROM tablename",$DB));
if($page>10) echo "<a href=".$PHP_SELF."?page=".($page-10)."><< Previous Page</a>";
if($item_count-$page>10) echo "<a href=".$PHP_SELF."?page=".($page+10).">Next Page 
>></a>";
?>

this simply adds a backward control to the form as well..


from here you can design it as you wish... generally placed in a table on bottom left 
and right, using this same system you can also expand it to create a numerical fast 
page index at the bottom with a listing of available pages (1 2 3 4 5 6) as links etc..


endless possibilities..





okay then... I hope I was able to help someone out here..






:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Julien Bonastre [The-Spectrum.org CEO]
A.K.A. The_RadiX
[EMAIL PROTECTED]
ABN: 64 235 749 494
Mobile: 0407 122 268
QUT Student #: 04475739
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::




----- Original Message ----- 
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 7:25 PM
Subject: Re: [PHP] limit posts and have a next page?


> On Saturday 06 April 2002 16:57, Hawk wrote:
> > This is just speculations, but I thought I'd as well ask now before I get
> > to work
> > Lets say I have a news page, and I only want the last ten posts to show on
> > it, then I ORDER BY id ASC LIMIT 10 right?
> > but how do I add the next page?
> > count rows from the database and see if its more than 10 lines, and then ?
> > saw something about a MAX and a MIN mysql command, but how do I use it? and
> > should I use it for that purpose? :)
> > like... ORDER BY id ASC LIMIT 10 MIN(10) MAX(20) or something?
> > I dont know really.. just speculations as I said :)
> 
> Rather than indulging in idle speculation, consult the mysql manual :)
> 
> For the first 10:
> 
>   ... ORDER BY id ASC LIMIT 0, 10 
> 
> 
> For the next 10:
> 
>   ... ORDER BY id ASC LIMIT 10, 10 
> 
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> 
> /*
> Nothing is so firmly believed as that which we least know.
> -- Michel de Montaigne
> */
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
--- End Message ---
--- Begin Message ---
hi!

i've got the following problem and hope one of you is able to help me
solving that:

i've got a system in php that writes data (e.g. variable-name = $data)
to a mysql database. there are two more scripts: one for displaying the
data and one for writing the data into a formular. the displaying-script
includes a link to the formular-script which submits the values for
$data. i use the command 'htmlentities' to express the value (there is
an html-tag like <img src="http:...">) correctly. when the
formular-script is executed via this link i get a wrong result: <img
src=\"....\"> there are these backslashes...


what 2 do??

thX,
George

--- End Message ---
--- Begin Message ---
On Saturday 06 April 2002 18:34, Joerg Hanke [ML-php] wrote:
> hi!
>
> i've got the following problem and hope one of you is able to help me
> solving that:
>
> i've got a system in php that writes data (e.g. variable-name = $data)
> to a mysql database. there are two more scripts: one for displaying the
> data and one for writing the data into a formular. the displaying-script
> includes a link to the formular-script which submits the values for
> $data. i use the command 'htmlentities' to express the value (there is
> an html-tag like <img src="http:...">) correctly. when the
> formular-script is executed via this link i get a wrong result: <img
> src=\"....\"> there are these backslashes...
>
>
> what 2 do??

You most likely have "magic_quotes_runtime" enabled in php.ini. Either 
disable it or use stripslashes() on the data you retrieve from the db.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Loan-department manager:  "There isn't any fine print.  At these
interest rates, we don't need it."
*/
--- End Message ---
--- Begin Message ---
On Saturday 06 Apr 2002 07:56, Miguel Cruz wrote:
> On Sat, 6 Apr 2002, Justin French wrote:
> > on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED]) 
wrote:
> >> It DOES NOT work fine in every browser. I'd love to give you a prov, but
> >> because I am lazy I will just tell you this formula:
> >
> > Again.  I was only stating MY experience.  "Every browser I can get my
> > hands on".  I do extensive testing, and have never seen a <BR> or <BR/>
> > or <BR /> misbehave.
> >
> > If you have seen it perform unexpectedly, I'm keen to hear about.
>
> For what it's worth, I just tried on the following browsers (all I have at
> my disposal at home) and it works fine:
>
> links 0.96
> lynx 2.8.3
> Opera 5.0.498 (Mac)
> IE 5.1.3 (Mac)
> Mozilla 0.9.9 (Mac)
> Netscape 6.1 (Mac)

Add Konqueror on Linux to this list.

Also note that links 0.84 (the latest version on Debian Stable) does _not_ 
parse XHTML tags correctly.

--jaa
--- End Message ---
--- Begin Message ---
>> links 0.96
>> lynx 2.8.3
>> Opera 5.0.498 (Mac)
>> IE 5.1.3 (Mac)
>> Mozilla 0.9.9 (Mac)
>> Netscape 6.1 (Mac)
> Add Konqueror on Linux to this list.
> 
> Also note that links 0.84 (the latest version on Debian Stable) does _not_
> parse XHTML tags correctly.

Okay, I've tested it on everything I've got, and didn't have a problem at
all.

This includes (Mac):
- IE
  4.0
  4.5
  5.0
  5.1

- Netscape
  2.02
  3.01
  3.04
  4.04
  4.6
  6.2
- iCab 2.71

- Opera 5.0

I couldn't get IE3 to run (missing an extension?), but on the above lists,
I'm pretty satisfied that <br /> works for 99.9999% of Mac users.

I'm sure a PC user can fill in the blanks to confirm everything, but I'm
pretty comfortable using <br />, or using nl2br() "as is" on my sites, and
won't be going back thru all my code :)


Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------


--- End Message ---
--- Begin Message ---
On Fri, 2002-04-05 at 18:34, Justin French wrote:
> on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED]) wrote:
> 
> > You're deadly wrong, Justin. Years of coding and I have never seen this
> > behavior of nl2br(). Perhaps I missed its new behavior's introduction
> > (guilty as charged if so) but I only remember it returning me <BR> not
> > <BR>. I have several regex depending on it.

'Deadly' wrong? Wow.

> Well, I've been at this PHP thing for 2 years, and like I said, "for as long
> as *I* can remember, it's been <BR />".  Perhaps it was introduced in PHP4,
> perhaps earlier.  I was not an in depth user of PHP3.

Justin is right on this one. This was changed on Dec 27, 2000. So it's 
been around for quite a long time.

It was added because it's valid XML *and* valid HTML. It is true that 
some browsers will not correctly interpret <br/> (note the lack of a 
space before the /) but everything I've ever tested has been just fine
with <br />. As they should.

This has been discussed a zillion times on the mailing lists. Maxim, you
could have found lots of background on the change by searching the list
archives (http://marc.theaimsgroup.com) the bug database 
(http://bugs.php.net) and the CVS repository (http://cvs.php.net). Some
links which may explain things a bit better:

A thread on the topic:
http://marc.theaimsgroup.com/?l=php-dev&m=99321596031773&w=2

The CVS entry itself:
http://cvs.php.net/diff.php/php4/ext/standard/string.c?r1=1.176&r2=1.177


Torben
 
> But I can't be "deadly wrong" :)
> 
> 
> > False!
> > 
> > It DOES NOT work fine in every browser. I'd love to give you a prov, but
> > because I am lazy I will just tell you this formula:
> > 
> > 
> > if("I found this issue"=="I noticed screwed pages on my site") {
> > All I did: preg_replace("<BR[^>]*>", "<BR>", $text); {
> > ...and pages became pretty again.
> > }
> > }
> > 
> > /// preg 'couse I had no idea what comes up next :-)
> 
> Again.  I was only stating MY experience.  "Every browser I can get my hands
> on".  I do extensive testing, and have never seen a <BR> or <BR/> or <BR />
> misbehave.
> 
> If you have seen it perform unexpectedly, I'm keen to hear about.
> 
> 
> In fact, if this is the case, then I'll be writing my own nl2br function
> which returns a <br>, to avoid this problem ever again.
> 
> 
> Perhaps in future releases, nl2br() should have an option flag for switching
> between XHTML and HTML?  I can't see why the powers that be would have
> included XHTML compliance if it wasn't backwards compatible.
> 
> 
> 
> > when was it changed? Is there any reference?
> 
> I went to php.net/nl2br and this line of text was in there:
> 
> "Note: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All versions
> before 4.0.5 will return string with '<br>' inserted before newlines instead
> of '<br />'."
> 
> :)
> 
> So it would appear that I've only been using nl2br since I got my hands on
> PHP4.05+, which according to the earliest date I can find, was released
> sometime around 2001-04-30.
> 
> 
> 
> Justin French
> --------------------
> Creative Director
> http://Indent.com.au
> --------------------
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506

--- End Message ---
--- Begin Message ---
Hi there, I want to use text in a textarea to be submitted and converted
into an email with Rich Text.

Can someone please tell me what I need to add in the additional headers in
order for me to do this please?

Kind Regards,

Ian Roke
Webmaster, DancePortal (UK) Limited
[EMAIL PROTECTED]
http://www.danceportal.co.uk
DancePortal.co.uk - Global dance music media

--- End Message ---
--- Begin Message ---
On Sat, 6 Apr 2002, Randum Ian wrote:
> Hi there, I want to use text in a textarea to be submitted and converted
> into an email with Rich Text.
> 
> Can someone please tell me what I need to add in the additional headers in
> order for me to do this please?

Content-Type: text/enriched

http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1896.html

miguel

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

I have this website with a webshop that customers can order some products.
And when the products are listed up in the cart on the screen, would I like
to get the output
into a new txtfile and save it on the server. Then it is possible to get it
faxed, and that is the goal.

Anyone who has done this before?

Thanks for all help!

Best regards

Raymond Lilleodegard


--- End Message ---
--- Begin Message ---
On Sat, 6 Apr 2002, Raymond Lilleodegard wrote:
> I have this website with a webshop that customers can order some products.
> And when the products are listed up in the cart on the screen, would I like
> to get the output
> into a new txtfile and save it on the server. Then it is possible to get it
> faxed, and that is the goal.

If it's your web site, you have all the data, so why not just generate the 
text yourself at the same time as you're generating the HTML? You can 
write it to a file or email it to your fax server.

miguel

--- End Message ---
--- Begin Message ---
Im using a regular expression, to get all urls from a file.
When using it on the webserver, it processes a 25kb html file
about 0.25 seconds (PIII 350, 128mb ram, linux 2.2.13-7mdk, php 3.0.12).

When i try the same on my machine (Celeron 300A, 192mb ram.), it does it
about 14-17 seconds, which is about 60-70 times slower.
Tested it on:
redhat 7.2, php 4.1.1 - 16 seconds
windows 98, php 4.1.1 - 14 seconds
windows 98, php 3.0.12 - 17 seconds.

The machine speed differences arent that big, especially considering
that other(simpler) regexps run at the almost the same speed (20-30%
difference).

Where can this enourmous speed difference come from

Regexp im using is following:

while
(eregi("(<frame[^>]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\"]refresh['\"]
*content=['\"][0-9]+;url[[:blank:]]*=|window[.]location[[:blank:]]*=|window[.]open[[:blank:]]*[(])[[:blank:]]*[\'\"]?(([[a-z]{3,5}://(([.a-zA-Z0-9-])+(:[0-9]+)*))*([:%/?=&;\\,._a-zA-Z0-9-]*))(#[.a-zA-Z0-9-]*)?[\'\"
]?",$file,$regexp))
    {
    print $regexp[2]."\n";
    $file=str_replace($regexp[0], "", $file);
    }

Anyone care to test it on there machine? Full code (20 lines) with
timing function would be:
<?
function getmicrotime(){
    list($usec, $sec) = explode(" ",microtime());
    return ((float)$usec + (float)$sec);
    }
//change to some html file around 25kb in size
$lines = @file('test.html');
if (is_array($lines))
    {
    while (list($id,$line) = each($lines))
           $file .= $line;
   }

$start_time=getmicrotime();

while
(eregi("(<frame[^>]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\"]refresh['\"]
*content=['\"][0-9]+;url[[:blank:]]*=|window[.]location[[:blank:]]*=|window[.]open[[:blank:]]*[(])[[:blank:]]*[\'\"]?(([[a-z]{3,5}://(([.a-zA-Z0-9-])+(:[0-9]+)*))*([:%/?=&;\\,._a-zA-Z0-9-]*))(#[.a-zA-Z0-9-]*)?[\'\"
]?",$file,$regexp))
 {
 print $regexp[2]."\n";
 $file=str_replace($regexp[0], "", $file);
 }
$end_time = getmicrotime()- $start_time;
print "Completed in ".$end_time." seconds";
?>

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

PIII 400MHz, 512Mb, SuSe 6.4, 2.2.14 smp, php 3.0.16, Completed in 
0.76187908649445 seconds
PIII 350MHz, 256Mb, Suse 7.3, 2.4.9, php 4.0.6, Completed in 
2.6342689990997 seconds
File Size:28537kb,
But for "real tests", send the original file you use direct

BTW How the hell did you develop this monstrous eregi?
For better maintenance, I´d cut it in several pieces,
or first make the inputfile smaller using grep " a href" > to test.file , 
This will reduce
fileaccess a lot, and takes microseconds to proceed.
Oliver
At 06.04.2002  15:01, you wrote:
>
>Im using a regular expression, to get all urls from a file.
>When using it on the webserver, it processes a 25kb html file
>about 0.25 seconds (PIII 350, 128mb ram, linux 2.2.13-7mdk, php 3.0.12).
>
>When i try the same on my machine (Celeron 300A, 192mb ram.), it does it
>about 14-17 seconds, which is about 60-70 times slower.
>Tested it on:
>redhat 7.2, php 4.1.1 - 16 seconds
>windows 98, php 4.1.1 - 14 seconds
>windows 98, php 3.0.12 - 17 seconds.
>
>The machine speed differences arent that big, especially considering
>that other(simpler) regexps run at the almost the same speed (20-30%
>difference).
>
>Where can this enourmous speed difference come from
<snip>

Anyone care to test it on there machine? Full code (20 lines) with
>timing function would be:
><?
>function getmicrotime(){
>     list($usec, $sec) = explode(" ",microtime());
>     return ((float)$usec + (float)$sec);
>     }
>//change to some html file around 25kb in size
>$lines = @file('test.html');
>if (is_array($lines))
>     {
>     while (list($id,$line) = each($lines))
>            $file .= $line;
>    }
>
>$start_time=getmicrotime();
>
>while
>(eregi("(<frame[^>]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\"]refresh['\"]
>*content=['\"][0-9]+;url[[:blank:]]*=|window[.]location[[:blank:]]*=|window[.]open[[:blank:]]*[(])[[:blank:]]*[\'\"]?(([[a-z]{3,5}://(([.a-zA-Z0-9-])+(:[0-9]+)*))*([:%/?=&;\\,._a-zA-Z0-9-]*))(#[.a-zA-Z0-9-]*)?[\'\"
>]?",$file,$regexp))
>  {
>  print $regexp[2]."\n";
>  $file=str_replace($regexp[0], "", $file);
>  }
>$end_time = getmicrotime()- $start_time;
>print "Completed in ".$end_time." seconds";
>?>

--- End Message ---
--- Begin Message ---
I'm really curious as to how to output data from ereg_replace() in a
standard way.

I'm familiar with "\\1" to ouput the original string, but not sure as to how
I can use functions within the output parameter to process this value
further.

---------------------
// here is a simple example of what i'm trying to do

$content = 'string string 12463409834234 string string';
$content = ereg_replace( "[0-9]{14}" , substr("\\1",0,5) , $content );

// this is the output i want, but the above doesnt seem to be the right way
to generate it.

string string 12363 string string
--------------------

any ideas?
-Adam


--- End Message ---
--- Begin Message ---
or "How I Learned To Stop Breathing and Oxygenate By Osmosis"...

Hello,

I'm having a problem, hopefully the experts in this group can help me
around it.

I read in the contents of an old mysql database, and made XML files out
of the data contained in it. The total job came out to about 6800 files,
or "Documents".

I'm finding that, sporadically, when reading these XML files, and passing
the xmldata to sablotron, I'm getting sablotron errors. These errors stem
from characters I'm finding throughout these documents. This is the meat
of my problem.

I take a look at a file which is giving errors by using 'less'. When
looking at the file, I'll see chars like this: <A1> or <91> or <92> and
so on, and so on. The chars are hilighted in bold reverse text,
indicating that they are 'binary'??. I'm not sure whether to call them
binary or hex... perhaps someone can tell me how to appropriately address
these chars...

Anyhow... these chars sometimes correspond to valid characters. Such as
<A9>... this is a "copyright" char, or &amp;copy.

I've been manually replacing these characters as errors are generated,
but it's getting a little tiring.

Is there anyway I can force PHP to either strip out these 'binary'
characters, or whatever they are, when I read the file?

Is there any way to keep php from saving these chars to NEW documents
when they are created?

Does anyone even know what I'm talking about?? hehe.

Thanks for any help, I hope to hear from someone about this.
--- End Message ---
--- Begin Message ---
At 06.04.2002  08:36, you wrote:

>I read in the contents of an old mysql database, and made XML files out
>of the data contained in it. The total job came out to about 6800 files,
>or "Documents".
>
>I'm finding that, sporadically, when reading these XML files, and passing
>the xmldata to sablotron, I'm getting sablotron errors. These errors stem
>from characters I'm finding throughout these documents. This is the meat
>of my problem.
>
>I take a look at a file which is giving errors by using 'less'. When
>looking at the file, I'll see chars like this: <A1> or <91> or <92> and
>so on, and so on. The chars are hilighted in bold reverse text,
>indicating that they are 'binary'??. I'm not sure whether to call them
>binary or hex... perhaps someone can tell me how to appropriately address
>these chars...
>
>Anyhow... these chars sometimes correspond to valid characters. Such as
><A9>... this is a "copyright" char, or &amp;copy.
>
>I've been manually replacing these characters as errors are generated,
>but it's getting a little tiring.
>
>Is there anyway I can force PHP to either strip out these 'binary'
>characters, or whatever they are, when I read the file?
>
>Is there any way to keep php from saving these chars to NEW documents
>when they are created?
>
>Does anyone even know what I'm talking about?? hehe.
Seems that you work on a win*box, as a tip (don´t know if it works, as I 
use LAMP)
try manual -> string functions ->

get_html_translation_table — Returns the translation table used by 
htmlspecialchars() and htmlentities()
htmlentities — Convert all applicable characters to HTML entities
htmlspecialchars — Convert special characters to HTML entities

Maybe here you´ll find something that make you happy.
Otherwise, as I learned the last two weeks on the list, ereg_replace or 
eregi could
make your life easier.
HTH Oliver

--- End Message ---
--- Begin Message ---
I already do an htmlentities/specialchars on input data, but some of
these characters are still creeping in...

is there any way, on fread(), to strip out these boolsh*t chars?

On Sat, 06 Apr 2002 10:04:11 -0500, heinisch wrote:

> At 06.04.2002  08:36, you wrote:
> 
>>I read in the contents of an old mysql database, and made XML files out
>>of the data contained in it. The total job came out to about 6800 files,
>>or "Documents".
>>
>>I'm finding that, sporadically, when reading these XML files, and
>>passing the xmldata to sablotron, I'm getting sablotron errors. These
>>errors stem from characters I'm finding throughout these documents. This
>>is the meat of my problem.
>>
>>I take a look at a file which is giving errors by using 'less'. When
>>looking at the file, I'll see chars like this: <A1> or <91> or <92> and
>>so on, and so on. The chars are hilighted in bold reverse text,
>>indicating that they are 'binary'??. I'm not sure whether to call them
>>binary or hex... perhaps someone can tell me how to appropriately
>>address these chars...
>>
>>Anyhow... these chars sometimes correspond to valid characters. Such as
>><A9>... this is a "copyright" char, or &amp;copy.
>>
>>I've been manually replacing these characters as errors are generated,
>>but it's getting a little tiring.
>>
>>Is there anyway I can force PHP to either strip out these 'binary'
>>characters, or whatever they are, when I read the file?
>>
>>Is there any way to keep php from saving these chars to NEW documents
>>when they are created?
>>
>>Does anyone even know what I'm talking about?? hehe.
> Seems that you work on a win*box, as a tip (don´t know if it works, as I
> use LAMP)
> try manual -> string functions ->
> 
> get_html_translation_table — Returns the translation table used by
> htmlspecialchars() and htmlentities() htmlentities — Convert all
> applicable characters to HTML entities htmlspecialchars — Convert
> special characters to HTML entities
> 
> Maybe here you´ll find something that make you happy. Otherwise, as I
> learned the last two weeks on the list, ereg_replace or eregi could make
> your life easier.
> HTH Oliver
>
--- End Message ---
--- Begin Message ---
In line 6 (below) I tried both "Return_Path:<[EMAIL PROTECTED]>" and 
"[EMAIL PROTECTED]". I still don't get back the e-mail sent to a 
non-existent address.

Can you help?

Thank you!

Anthony Rodriguez
([EMAIL PROTECTED])

--- PHP script ---

(1) <?php
(2) mail("[EMAIL PROTECTED]",
(3) "Test",
(4) "Test",
(5) "From:SBW Research <[EMAIL PROTECTED]>\r\n".
(6) "[EMAIL PROTECTED]\r\n");
(7) exit;
(8) ?>

--- End Message ---
--- Begin Message ---
On Saturday 06 April 2002 21:33, Anthony Rodriguez wrote:
> In line 6 (below) I tried both "Return_Path:<[EMAIL PROTECTED]>" and

There needs to be a space after the colon -

Return_Path: <[EMAIL PROTECTED]>

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
I'm pretending I'm pulling in a TROUT!  Am I doing it correctly??
*/
--- End Message ---
--- Begin Message ---
At 06.04.2002  08:33, you wrote:
>In line 6 (below) I tried both "Return_Path:<[EMAIL PROTECTED]>" and 
>"[EMAIL PROTECTED]". I still don't get back the e-mail sent to a 
>non-existent address.
>
>Can you help?
>
>
>(1) <?php
>(2) mail("[EMAIL PROTECTED]",
>(3) "Test",
>(4) "Test",
>(5) "From:SBW Research <[EMAIL PROTECTED]>\r\n".
>(6) "[EMAIL PROTECTED]\r\n");

try "Reply-To: [EMAIL PROTECTED]\r\n");

>(7) exit;
>(8) ?>
Maybe you should replace \r\n by a single \n (only a suggestion as I work 
on LAMP, never dealed
with \r\n, but never had probs)
HTH Oliver

--- End Message ---
--- Begin Message ---
On Saturday 06 April 2002 22:58, [EMAIL PROTECTED] wrote:

> Maybe you should replace \r\n by a single \n (only a suggestion as I work
> on LAMP, never dealed
> with \r\n, but never had probs)


The standard (ie correct) way is "\r\n".

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Q:      Why did the chicken cross the road?
A:      He was giving it last rites.
*/
--- End Message ---
--- Begin Message ---
>From the manual:

<snip>
Note: Because flock() requires a file pointer, you may have to use a
special lock file to protect access to a file that you intend to
truncate by opening it in write mode (with a "w" or "w+" argument to
fopen()).
</snip>

The manual indicates that you "may" need to use "a special lock file" if
you intend to open a file with "w" or "w+". I wrote some code to examine
this. (2 files) Each file locks a file after opening using "w" to do so.
Then, the file is locked using LOCK_EX. Subsequently executed, each file
appears to respect the lock applied by the other file. (Each file waits
for the lock to be released by the other) - So, I don't see this manual
entry applying in this case.

In regards to the <snip> above, under what circumstances might you have
to create a separate lock file? Is this an OS issue? Is it an issue when
concurrency is high? The manual says "you may have to"; I am looking for
some clarification as to when exactly you "may have to" follow the
<snip> advice.

Thanks as always,

Matt Friedman
Web Applications Developer
www.SpryNewMedia.com



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

I have the array below and I want to sort on language. Can't figure it 
out. Below the array is what I tried

$ArrayOfNewsLinks = array(
  "http://dailynews.yahoo.com/fc/World/Brazil/"; => array(
    title => 'Yahoo Brazil News',
    category  => 'news',
    language => 'English',

  ),
  "http://news.bbc.co.uk/hi/english/world/americas/default.stm"; => 
array(
    title => 'BBC News',
    category  => 'news',
    language => 'English',

  ),
);

function cmp ($a, $b) {
    if ($a[2] == $b[2]) return 0;
    //return strcmp ( $a[2], $b[2]); // thought this would work
    return ($a[1]>$b[1])?1:-1; 
}


uksort ($ArrayOfNewsLinks, "cmp");

But then I do this:

while (list ($key, $val) = each ($ArrayOfNewsLinks)) {  
    $NewsLinks .= "
<p class=\"CompactLinks\">
<a href=\"$key\" title=\"$val[language] $val[title]\" 
target=\"new\">$val[title]</a>
</p>

";    

}

And the order is not by language.

Peter

http://www.readbrazil.com/
Answering Your Questions About Brazil
--- End Message ---
--- Begin Message ---
Hello,

I am able to upload and download Macintosh files but they seem to lose their
MIME type or extensions. I'm not sure what it is. I'm not a Mac dude.

When you download the file It loses the file association. It's for a company
I do work for that uses a lot of .ai and .psd files.


Any ideas on this?


Shane McBride
RDI Technologies
www.rditech.net
Office: 410-575-6326
Fax:    410-575-6327

--- End Message ---
--- Begin Message ---
On Sat, 6 Apr 2002, Shane McBride wrote:
> I am able to upload and download Macintosh files but they seem to lose
> their MIME type or extensions. I'm not sure what it is. I'm not a Mac
> dude.
> 
> When you download the file It loses the file association. It's for a
> company I do work for that uses a lot of .ai and .psd files.

Macs running OS<=9 don't natively rely on extensions to keep track of file
types; something ending in .psd can be a Word file, .doc can be a PDF,
.pdf can be a JPEG, what have you. The name is just the name, nothing
more, nothing less.

Instead, they rely on metadata stored in the directory entry (parallel to 
name, creation date, etc.) that identifies the application that created 
the file and the data type contained inside. 

When you transfer a file between a Mac and another system, it's up to the
application doing the transferring to reconstruct the data type info. Many
apps do it based on extension, but not all of them know a huge number of
extensions (they may know .gif, .html, .txt, etc.). And the MIME type you
send may override their guess. You should find out what MIME type you are 
sending and what 4-character Type and Creator info is getting saved; 
that'll help immensely in troubleshooting.

Macs running OSX are willing to use extensions in addition to the Mac
style system.

miguel

--- End Message ---
--- Begin Message ---
On Sat, Apr 06, 2002 at 12:32:33AM -0500, Analysis & Solutions wrote:
> 
> <input type="checkbox" name="checkbox['Name']" value="validate" />

And following up to my own following up...  As I shut down the computer, 
I realized I made a boo boo.  The single quotes shouldn't be there.  So, 
make that:
  <input type="checkbox" name="checkbox[Name]" value="validate" />

Later,

--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
 4015 7 Ave, Brooklyn NY 11232    v: 718-854-0335    f: 718-854-0409
--- End Message ---
--- Begin Message ---
Dan,
    Really, thanks for the help. Yeah, as you know I'm not experienced near
enough with PHP. Maybe you could provide me with an e-mail and prices for
consultation(I suppose this is what  'Analysis & Solutions' does?)

Regards,
    Robert Packer
"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sat, Apr 06, 2002 at 12:32:33AM -0500, Analysis & Solutions wrote:
> >
> > <input type="checkbox" name="checkbox['Name']" value="validate" />
>
> And following up to my own following up...  As I shut down the computer,
> I realized I made a boo boo.  The single quotes shouldn't be there.  So,
> make that:
>   <input type="checkbox" name="checkbox[Name]" value="validate" />
>
> Later,
>
> --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
>  4015 7 Ave, Brooklyn NY 11232    v: 718-854-0335    f: 718-854-0409


--- End Message ---
--- Begin Message ---
Newbie who has my include working with this
<?php
include ('includes/footer.php');
?>
 
Problem is when I try to use this with files in other directories I use
<?php
include ('/includes/footer.php');
?>
 
Then get file cannot be found.  Is there a way to do this?
 
Dean
--- End Message ---
--- Begin Message ---
On Sat, 6 Apr 2002, Dean Ouellette wrote:

> Newbie who has my include working with this
> <?php
> include ('includes/footer.php');
> ?>
>
> Problem is when I try to use this with files in other directories I use
> <?php
> include ('/includes/footer.php');
> ?>
>
> Then get file cannot be found.  Is there a way to do this?

You have to prepend the directory that the web server knows, such as
/usr/local/apache/htdocs/includes/footer.php

--- End Message ---
--- Begin Message ---
I need to execute a script on another server in one of my scripts, eg by
visiting a link
http://www.com.com/script.php?var1=blah&var2=blah

i cant use curl or sockets as my server dont have them insatlled. what other
options do i have?
the variables being passed are sensitive so they cant be viewed in the
source HTML

--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***************************
http://www.filmfind.tv
Online Film Production Directory
***************************


--- End Message ---
--- Begin Message ---
On Sat, 6 Apr 2002, Georgie Casey wrote:
> I need to execute a script on another server in one of my scripts, eg by
> visiting a link
> http://www.com.com/script.php?var1=blah&var2=blah
> 
> i cant use curl or sockets as my server dont have them insatlled. what
> other options do i have? the variables being passed are sensitive so
> they cant be viewed in the source HTML

You can use almost any of the filesystem functions to send that request to 
the remote server and collect the output. The request data will not be 
visible in the HTML you send to the end-user's browser unless you choose 
to make it so.

miguel

--- End Message ---
--- Begin Message ---
hi,

i've got the possibility to create alias subdomains, which redirect all
to the document-root...

e.g.:

http://adam.domain.com redirects to http://domain.com

i want to redirect the users who access http://adam.domain.com to
http://domain.com/home/adam

how to do this best in php??

reguards,
george

--- End Message ---
--- Begin Message ---
On Sat, 6 Apr 2002, Joerg Hanke [ML-php] wrote:
> i've got the possibility to create alias subdomains, which redirect all
> to the document-root...
> 
> e.g.:
> 
> http://adam.domain.com redirects to http://domain.com
> 
> i want to redirect the users who access http://adam.domain.com to
> http://domain.com/home/adam
> 
> how to do this best in php??

Do you really need to use PHP for this? The fastest and easiest way is 
using Apache's mod_rewrite.

miguel

--- End Message ---
--- Begin Message ---
First things first, when you say domain.com/home/adam do you mean
/home/httpd/htdocs/home/adam or /home/adam/public_html.. Once you know that
you can make a more educated decision.. Either way, you should be able to
specifiy DocumentRoot /home/adam/public_html or DocumentRoot
/home/httpd/htdocs/home/adam in your httpd.conf file for <VirtualHost
adam.domain.com:80>. Unless you are talking about authenticating users or
something and redirecting specific users to the target and the rest
somewhere else..

Bob

"Joerg Hanke" <[EMAIL PROTECTED]> wrote in message
002701c1dd9a$69c08010$0400a8c0@Joerg">news:002701c1dd9a$69c08010$0400a8c0@Joerg...
> hi,
>
> i've got the possibility to create alias subdomains, which redirect all
> to the document-root...
>
> e.g.:
>
> http://adam.domain.com redirects to http://domain.com
>
> i want to redirect the users who access http://adam.domain.com to
> http://domain.com/home/adam
>
> how to do this best in php??
>
> reguards,
> george
>


--- End Message ---
--- Begin Message ---
I think I've got down how to use the new "superglobals" with data sent from
forms using whichever method needed.

Now I need to learn how to do it with sessions!

this is what I'm trying to accomplish.

my website/ client list is growing and I want to add the ability for them to
login, edit account info, check proress, order new services etc.

How do I use sessions, with the new superglobals, to gather the information
I will need to write to the database?


--- End Message ---
--- Begin Message ---
At 06.04.2002  12:48, you wrote:
>I think I've got down how to use the new "superglobals" with data sent from
>forms using whichever method needed.
>
>Now I need to learn how to do it with sessions!
>
>this is what I'm trying to accomplish.
>
>my website/ client list is growing and I want to add the ability for them to
>login, edit account info, check proress, order new services etc.
>
>How do I use sessions, with the new superglobals, to gather the information
>I will need to write to the database?

Aeh, what about the manual ?
  http://www.php.net/manual/en/

Oliver

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

  I'm currently running PHP 1.1.2 on Apache 1.3.24/Win2K in SAPI mode (and
this configuration has run incredibly well since last summer, albeit with
changing PHP and Apache sub-versions).  I couldn't find any info at php.net
that indicated whether the current or the next version of PHP (1.2.x) will
successfully run on Apache 2.0 (just GA'd).

  Any info on this will be greatly appreciated.

Regards,
   Steve


--- End Message ---

Reply via email to