php-general Digest 29 Mar 2008 15:22:36 -0000 Issue 5374

Topics (messages 272267 through 272281):

Re: munge / obfuscate ?
        272267 by: Jack Sasportas
        272268 by: Stut
        272270 by: Casey

Re: GD, changing an images pixel color, color matching, fuzzy picture
        272269 by: Casey
        272271 by: Casey

Re: Developing existing java portal in php
        272272 by: Sangamesh B

Re: optimilize web page loading
        272273 by: Zoltán Németh
        272274 by: Zoltán Németh

Re: why won't my array work?
        272275 by: Zoltán Németh

Re: Posting Summary for Week Ending 28 March, 2008: [EMAIL PROTECTED]
        272276 by: Zoltán Németh

Re: PHP code to write excel spreadsheet  with multiple workbooks
        272277 by: Christian Schmidt

Simple RegEx to pull out content between 2 markers
        272278 by: Jon Bennett
        272279 by: Zoltán Németh
        272280 by: Richard Heyes

Re: How to install PHP 5.x on Windows Server 2000 with IIS 5and MySQL 5.x
        272281 by: edwardspl.ita.org.mo

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 ---
> -----Original Message-----
> From: Robert Cummings [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 27, 2008 10:02 PM
> To: Joey
> Cc: PHP
> Subject: RE: [PHP] munge / obfuscate ?
> 
> Hi Joey,
> 
> Please keep responses on the list so others can also benefit from the
> learning process.
> 
> Comments below...
> 
> On Thu, 2008-03-27 at 21:46 -0400, Joey wrote:
> > > -----Original Message-----
> > > From: Robert Cummings [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, March 27, 2008 9:28 PM
> > > To: Joey
> > > Cc: PHP
> > > Subject: Re: [PHP] munge / obfuscate ?
> > >
> > >
> > > On Thu, 2008-03-27 at 21:10 -0400, Joey wrote:
> > > > Hi All,
> > > >
> > > >
> > > >
> > > > I have written an app to allow a person to go online and see a
picture
> > we
> > > > take of them.  When we link to the picture I don't want it to be
obvious
> > > > that the URL is
> > > >
> > > > Domain.Com/Pix/123.jpg because the next person we take a picture
of may
> > be
> > > > 123.jpg, so I am trying to munge/obfuscate the URL to make it
less
> > obvious.
> > >
> > > <?php
> > >
> > >     $sekret = 'the brown cow stomped on the wittle bug';
> > >
> > >     $id  = isset( $_GET['id'] ) ? (int)$_GET['id'] : 0;
> > >     $key = isset( $_GET['key'] ) ? (string)$_GET['key'] : '';
> > >
> > >     if( $key == sha1( $key.':'.$sekret ) )
> 
> 
> That should have been:
> 
>         if( $key == sha1( $id.':'.$sekret ) )
> 
> > >     {
> > >         header( 'Content-Type: image/jpg' );
> > >         readfile( "/images/not/in/web/path/$id.jpg" )
> > >         exit();
> > >     }
> > >
> > >     //
> > >     // Failure... tell them to bugger off :)
> > >     //
> > >     header( 'Content-Type: image/jpg' );
> > >     readfile( '/images/wherever/you/please/buggerOff.jpg' );
> > >     exit();
> > >
> > > ?>
> >
> > Sorry to be such a newbie...
> >
> > I basically would call this function lets say like:
> > munge( $url );
> >
> > end in the end be returned the munged url, however, I don't
understand the
> > values you have like the readfile with that url -vs- failure?
> 
> I didn't munge... I provided code for a script that sends the
requested
> image if it was requested with the appropriate key (presumably set
> wherever the image was linked). If the key doesn't validate then
another
> image is presented. It can say "bugger off", it can say "not found",
it
> can say whatever you please. By placing the images outside the web
root
> and using a script like this you are virtually guaranteed the visitor
> can't just request images by making a lucky guess.
> 
> Let's say the above script was called: getUserImage.php
> 
> Then you might have the following in your HTML:
> 
> <img
>
src="getUserImage.php?id=123&amp;key=4fad1fea72565105d84cb187d1a3ed3bfb9
aba3b"
> />


I understand what is happening here, however I really want something
simple like:

$link ="http://www.whataver.com/whateverpath/";;
$image = "123456";

new_image = munge($image);

new_link = $link . $new_image;

or maybe

new_link = munge($link . $image);


Which would encode the whole link.

Either way this is what would go into the email message we send out.

Thanks!





--- End Message ---
--- Begin Message ---
On 29 Mar 2008, at 02:15, Jack Sasportas wrote:
I understand what is happening here, however I really want something
simple like:

$link ="http://www.whataver.com/whateverpath/";;
$image = "123456";

new_image = munge($image);

new_link = $link . $new_image;

or maybe

new_link = munge($link . $image);


Which would encode the whole link.

Either way this is what would go into the email message we send out.

Encode in what way? What are you actually trying to stop people doing?

If all you're wanting to do is make sure people can't write a script that simply requests n.jpg over and over again with an incrementing n then all you need to do is obfuscate the filename when you store it on your server. You then store that filename in the database alongside the data it relates to.

$filename = sha1(time()).'.jpg';

Obviously that's just an example. You can generate the filename in any way you choose as long as you check for duplicates before using it.

If that's not the reason please explain exactly what you're trying to achieve rather than how you want to achieve it.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message --- On Mar 28, 2008, at 7:15 PM, "Jack Sasportas" <[EMAIL PROTECTED] > wrote:

-----Original Message-----
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 27, 2008 10:02 PM
To: Joey
Cc: PHP
Subject: RE: [PHP] munge / obfuscate ?

Hi Joey,

Please keep responses on the list so others can also benefit from the
learning process.

Comments below...

On Thu, 2008-03-27 at 21:46 -0400, Joey wrote:
-----Original Message-----
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 27, 2008 9:28 PM
To: Joey
Cc: PHP
Subject: Re: [PHP] munge / obfuscate ?


On Thu, 2008-03-27 at 21:10 -0400, Joey wrote:
Hi All,



I have written an app to allow a person to go online and see a
picture
we
take of them.  When we link to the picture I don't want it to be
obvious
that the URL is

Domain.Com/Pix/123.jpg because the next person we take a picture
of may
be
123.jpg, so I am trying to munge/obfuscate the URL to make it
less
obvious.

<?php

   $sekret = 'the brown cow stomped on the wittle bug';

   $id  = isset( $_GET['id'] ) ? (int)$_GET['id'] : 0;
   $key = isset( $_GET['key'] ) ? (string)$_GET['key'] : '';

   if( $key == sha1( $key.':'.$sekret ) )


That should have been:

       if( $key == sha1( $id.':'.$sekret ) )

   {
       header( 'Content-Type: image/jpg' );
       readfile( "/images/not/in/web/path/$id.jpg" )
       exit();
   }

   //
   // Failure... tell them to bugger off :)
   //
   header( 'Content-Type: image/jpg' );
   readfile( '/images/wherever/you/please/buggerOff.jpg' );
   exit();

?>

Sorry to be such a newbie...

I basically would call this function lets say like:
munge( $url );

end in the end be returned the munged url, however, I don't
understand the
values you have like the readfile with that url -vs- failure?

I didn't munge... I provided code for a script that sends the
requested
image if it was requested with the appropriate key (presumably set
wherever the image was linked). If the key doesn't validate then
another
image is presented. It can say "bugger off", it can say "not found",
it
can say whatever you please. By placing the images outside the web
root
and using a script like this you are virtually guaranteed the visitor
can't just request images by making a lucky guess.

Let's say the above script was called: getUserImage.php

Then you might have the following in your HTML:

<img

src="getUserImage.php? id=123&amp;key=4fad1fea72565105d84cb187d1a3ed3bfb9
aba3b"
/>


I understand what is happening here, however I really want something
simple like:

$link ="http://www.whataver.com/whateverpath/";;
$image = "123456";

new_image = munge($image);

new_link = $link . $new_image;

or maybe

new_link = munge($link . $image);


Which would encode the whole link.

Either way this is what would go into the email message we send out.

Thanks!





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


You could use base64_encode/decode.

Or...
function bitshift_encode($i) {
 return $i << 3;
}

function bitshift_decode($i) {
 return $i >> 3;
}

--- End Message ---
--- Begin Message ---
I have an annoying habit of not using comments :)

Explanations are inline.

On Mar 28, 2008, at 7:10 PM, Lamonte <[EMAIL PROTECTED]> wrote:

Casey wrote:
On Mar 28, 2008, at 4:27 PM, Lamonte <[EMAIL PROTECTED]> wrote:

Okay I created a script that changes a basic smiley face into a red smiley face..but it doesn't replace all the yellow, it looks like a yellow shadow in the background:

<?php
$image = "smiley.png";
$data = getimagesize($image);
$width = intval($data[0]);
$height = intval($data[1]);
$cloneH = 0;
$hex = "FF0000";
$oldhex = "FCFF00";
$im = imagecreatefrompng($image);
$color = imagecolorallocate($im,hexdec(substr($hex,0,2)),hexdec (substr($hex,2,2)),hexdec(substr($hex,4,6)));
for($cloneH=0;$cloneH<$height;$cloneH++)
{
 for($x=0;$x<$width;$x++)
 {
     if( colormatch($im,$x,$cloneH, $oldhex) )
         imagesetpixel($im, $x, $cloneH, $color);
 }   }
header("Content-Type: {$data['mime']}");
imagepng($im);
function colormatch($image,$x,$y,$hex)
{
 $rgb = imagecolorat($image,$x,$y);
 $r = ($rgb >> 16) & 0xFF;
 $g = ($rgb >> 8) & 0xFF;
 $b = $rgb & 0xFF;
   $r2 = hexdec(substr($hex,0,2));
 $g2 = hexdec(substr($hex,2,2));
 $b2 = hexdec(substr($hex,4,6));
 if( $r == $r2 && $b == $b2 && $g == $g2 )
     return true;
 return false;
 //echo "$r $r2, $g $g2, $b $b2";
}
?>

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

Hi!

I have absolutely no clue if this will work. This has been typed directly into my mail client, so no guarantees.

<?php
function toRGB($color) {
return array('r' => ($color >> 16) & 0xFF, 'g' => ($color >> 8) & 0xFF, 'b' => $color & 0xFF);
}
This function returns an array of red, green, and blue from an integer like 0xFFFFFF.


function toColor($r, $g, $b) {
 return $r * $g * $b;
}
This function is basically the opposite of the above. (the integer value from red, green, and blue)


$image = 'smiley.png';
list($w, $h) = getimagesize($image);
$im = imagecreatefrompng($image);

for ($y = 0; $y < $h; $y++) {
 for ($x = 0; $x < $w; $x++) {
Loop through the pixels.

  extract(toRGB(imagecolorat($im, $x, $y)));
Take the values from the array return of toRGB so we can use $r, $g, and $b instead of $array['r'], etc.

  if ($r >= 0xCC && $g >= 0xCC && $b <= 0x33)
After some trial and error (looking at color charts), any red > CC, green > CC, and blue < 33 is some shade of yellow.

   imagesetpixel($im, $x, $y, toColor(($r + $g) / 2, 0, $b));
The expression inside toColor() is my attempt to calculate the correct shade of red from the shade of yellow.

 }
}

header('Content-type: image/png');
imagepng($im);
?>

:)

I don't understand half of that, can you explain what you did? (it works) I was more trying to "fix" my problem then recoding the whole thing though.
I hope that helps.

--- End Message ---
--- Begin Message ---
On Mar 28, 2008, at 7:38 PM, Lamonte <[EMAIL PROTECTED]> wrote:

Casey wrote:
I have an annoying habit of not using comments :)

Explanations are inline.

On Mar 28, 2008, at 7:10 PM, Lamonte <[EMAIL PROTECTED]> wrote:

Casey wrote:
On Mar 28, 2008, at 4:27 PM, Lamonte <[EMAIL PROTECTED]> wrote:

Okay I created a script that changes a basic smiley face into a red smiley face..but it doesn't replace all the yellow, it looks like a yellow shadow in the background:

<?php
$image = "smiley.png";
$data = getimagesize($image);
$width = intval($data[0]);
$height = intval($data[1]);
$cloneH = 0;
$hex = "FF0000";
$oldhex = "FCFF00";
$im = imagecreatefrompng($image);
$color = imagecolorallocate($im,hexdec(substr($hex,0,2)),hexdec (substr($hex,2,2)),hexdec(substr($hex,4,6)));
for($cloneH=0;$cloneH<$height;$cloneH++)
{
for($x=0;$x<$width;$x++)
{
    if( colormatch($im,$x,$cloneH, $oldhex) )
        imagesetpixel($im, $x, $cloneH, $color);
}   }
header("Content-Type: {$data['mime']}");
imagepng($im);
function colormatch($image,$x,$y,$hex)
{
$rgb = imagecolorat($image,$x,$y);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
  $r2 = hexdec(substr($hex,0,2));
$g2 = hexdec(substr($hex,2,2));
$b2 = hexdec(substr($hex,4,6));
if( $r == $r2 && $b == $b2 && $g == $g2 )
    return true;
return false;
//echo "$r $r2, $g $g2, $b $b2";
}
?>

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

Hi!

I have absolutely no clue if this will work. This has been typed directly into my mail client, so no guarantees.

<?php
function toRGB($color) {
return array('r' => ($color >> 16) & 0xFF, 'g' => ($color >> 8) & 0xFF, 'b' => $color & 0xFF);
}
This function returns an array of red, green, and blue from an integer like 0xFFFFFF.


function toColor($r, $g, $b) {
return $r * $g * $b;
}
This function is basically the opposite of the above. (the integer value from red, green, and blue)


$image = 'smiley.png';
list($w, $h) = getimagesize($image);
$im = imagecreatefrompng($image);

for ($y = 0; $y < $h; $y++) {
for ($x = 0; $x < $w; $x++) {
Loop through the pixels.

 extract(toRGB(imagecolorat($im, $x, $y)));
Take the values from the array return of toRGB so we can use $r, $g, and $b instead of $array['r'], etc.

 if ($r >= 0xCC && $g >= 0xCC && $b <= 0x33)
After some trial and error (looking at color charts), any red > CC, green > CC, and blue < 33 is some shade of yellow.

  imagesetpixel($im, $x, $y, toColor(($r + $g) / 2, 0, $b));
The expression inside toColor() is my attempt to calculate the correct shade of red from the shade of yellow.

}
}

header('Content-type: image/png');
imagepng($im);
?>

:)

I don't understand half of that, can you explain what you did? (it works) I was more trying to "fix" my problem then recoding the whole thing though.
I hope that helps.

The thing is, it returns black. not red.
Oh. Replace the toColor function with the imagecolorallocate function and add $im as the first parameter.
--- End Message ---
--- Begin Message ---
Thanks for the reply.

Can it be done by just using php + html or perl + html.

Also, May I know a beginners document to start working on html, php and
perl.

Thanks,
Sangamesh


On Fri, Mar 28, 2008 at 1:50 AM, ganu <[EMAIL PROTECTED]> wrote:

>
>
> On Thu, Mar 27, 2008 at 7:52 AM, Sangamesh B <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
> >
> > Here is one web portal product which is already developed using java
> > tools.
> > I don't know java, php or perl. But I can learn php quickly compared to
> > java.
>
>
> Learning PHP,Perl is very easy as compare to Java.
>
> >
> >
> > My question is: Is it possible to develop such web portal using php &
> > html?
>
>
> Yea, is possible.
>
> >
> >
> > Let me explain how the java portal/product works:
> >
> > The user logs in to the portal with his user name and password thru web
> > browser by using a public ip or for example say xyz-portal.com
> >
> > The user name and password are the user names of the  Linux OS. So
> > username
> > authentication is required.
> >
> > In the next page, the user accesses  the preinstalled applications (
> > these
> > are C or Fortran apps) and submits the job.
> > While submitting the job, he is allowed to give the command line options
> > and
> > input file. The input files are present in his home directory. These
> > files
> > should be listed in combo box.
> >
> > It doesn't mean that, all installed apps in linux must be listed in the
> > portal. There should be a mechanism to add a particular application to
> > the
> > portal ( part of administrator's work). And all apps which are to be
> > displayed in portal are in a different dir, say /usr/local/bin.
> >
> > This portal is totally based on the server. i.e. The user accesses the
> > portal and submits his application job from client system to run the job
> > in
> > the server. The client system uses only web browser. So other software
> > can
> > not be used to do this.
> >
> > Regarding php, I know that linux commands can be bypassed thru php.
> >
> > So can any one tell me whether this can be done using php with the above
> > mentioned conditions/facilities?
> >
> >
> > Thanks & Regards,
> > Sangamesh
>
>
> I think you can do all front end things in PHP and html and you can do all
> system calls with Perl.
> Perl will be fast and easy for all linux things.
>
> you can refer this for calling Perl from PHP page -
> http://devzone.zend.com/node/view/id/1712
>
>
> ---

--- End Message ---
--- Begin Message ---
2008. 03. 28, péntek keltezéssel 10.59-kor Robert Cummings ezt írta:
> On Fri, 2008-03-28 at 15:30 +0100, Zoltán Németh wrote:
> > 2008. 03. 28, péntek keltezéssel 10.24-kor Robert Cummings ezt írta:
> > > On Fri, 2008-03-28 at 14:46 +0100, Zoltán Németh wrote:
> > > > 
> > > > yeah maybe. you're right, the bytecode is the same. but somewhere I
> > > > heard that the parsing is the same too - because escaped characters can
> > > > be in any string, though I'm not that sure about this anymore, as my
> > > > link proved something else ;)
> > > 
> > > Single quoted strings do support some escape characters. As far as I
> > > know only you can only escape a single quote and a backslash when
> > > creating a string via single quotes.
> > 
> > yes, but I think the parser would still need to tokenize the string and
> > verify each token whether it contains an escape character or not - which
> > should be the same process as tokenizing and checking for escape
> > character and $ signs.
> 
> Nope, when processing a single quoted string there should be 4 available
> parse branches:
> 
>     EOF
>     '    (end of string)
>     \
>         EOF
>         \
>         '
>         anything else
>     anything else
> 
> Whereas with a double quoted string you have something along the lines
> of:
> 
>     EOF
>     "    (end of string)
>     $    (begin variable)
>     {    (possible begin interpolation)
>         $    (begin interpolation)
>     \
>         EOF
>         \
>         '
>         "
>         t
>         n
>         r
>         x
>         v
>         f
>         <digit>
>         anything else
>     anything else
> 
> So presuming no variable is embeded and assuming no escaped
> characters... double quotes still need to check for the beginning of
> variable interpolation which has 2 different start possibilities. With
> respect to creating the byte code single quotes have 4 branches, double
> quotes have 6 branches in the simplest of cases with no escape and no
> interpolation. So one would expect compile time for double quotes to be
> approximately 33% slower than for single quotes.

good points, thanks for the detailed info (not that I'd focus on it
while coding but its sooo interesting :) )


>  Once compiled though,
> the point is moot especially since most sites use a bytecode cache like
> eAccelerator or APC. Even without a cache htough, the time difference is
> teeeeeeeency, and this is just for informational purposes :) There are
> usually bigger eggs to fry when optimizing.

sure, these questions like 'echo or print' and 'single or double quotes'
and 'for or while' and so on should never be mentioned when talking
about real life code optimizing, as the difference they may make is so
minimal. talking about these is good only for satisfying some of my (and
maybe some other people's) curiosity about how php works internally :)


>  One last thing though...
> even if this were escaped and even if there were fifty variables
> embedded, a good bytecode optimizer (not quite the same as a bytecode
> cacher) would optimize the bytecode for caching so that the string is
> broken up according to what needs to be interpolated and what does not.

could you tell me more about this bytecode optimizer stuff? how does it
work, how much better/faster is it then APC/EAccelerator/etc?

greets,
Zoltán Németh

> 
> Cheers,
> Rob.


--- End Message ---
--- Begin Message ---
2008. 03. 28, péntek keltezéssel 11.31-kor tedd ezt írta:
> At 9:14 AM +0100 3/28/08, Zoltán Németh wrote:
> >  > This way for literal strings, the PHP parser doesn't have to evaluate
> >  > this string to determine if anything needs to be translated (e.g.,
> >  > $report .= "I like to $foo"). A minimal speedup, but nonetheless...
> >
> >that above statement is simply not true. parsing "foo" and 'foo' is all
> >the same
> >a good read about it:
> >http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html
> >
> >greets,
> >Zoltán Németh
> 
> I read it, but it still doesn't disprove the premise.

yeah, that was morning time and I got mixed up a bit :)

Anyway, I had to admit that I was wrong in this matter, Rob Cummings has
just proven me that there is a difference, however little is it

greets,
Zoltán Németh

> 
> Cheers,
> 
> tedd
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


--- End Message ---
--- Begin Message ---
2008. 03. 28, péntek keltezéssel 12.28-kor Jason Pruim ezt írta:
> Hi everyone :) Happy friday to all of you!
> 
> Here's my issues, I am attempting to echo the results of mysqli query  
> out to my script just so I can make sure it's working right, what I'm  
> hoping to do in the long run is compare what was typed in a text box  
> to this info... It's for verifying a old password before changing to a  
> new password... So here is my query:
> 
> $oldpasswordquery = "SELECT loginPassword, Record FROM current WHERE  
> loginPassword='{$oldPassHash}' AND Record='{$Record}'";
> $chpwold[] = mysqli_query($chpwpostlink, $oldpasswordquery) or  
> die("Sorry read failed: ". mysqli_error($chpwpostlink));
> $chpwresult = $chpwold[0];
> $chpwrow[] = mysqli_fetch_assoc($chpwresult) or die('Sorry it didn\'t  
> work....' .mysqli_error($chpwpostlink));
> echo $chpwrow['loginPassword'];
> print_r($chpwrow);
> 
> 
> The echo and the print_r are for debugging and obviously wont' be in  
> the final script... Here is the error that I am getting:
> 
> [Fri Mar 28 12:14:39 2008] [error] PHP Notice:  Undefined index:   
> loginPassword in /Volumes/RAIDer/webserver/Documents/dev/OLDBv2/admin/ 
> chpwpost.php on line 18
> 
> 
> Line 18 is where the echo is...
> 
> the print_r though shows this:
> 
> Array ( [0] => Array ( [loginPassword] =>  
> 42205baa2581d3fcd8d8f9c6b9746a1f [Record] => 2 ) )
> 
> So why can't I access it via $chpwrow['loginPassword']?  I'm  
> stumped.... Anyone that can help me has a free beer waiting for them  
> the next time they are in my town! :)

from the print_r it looks like that you could access it like
$chpwrow[0]['loginPassword']

greets,
Zoltán Németh

> 
> --
> 
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424-9337
> www.raoset.com
> [EMAIL PROTECTED]
> 
> 
> 


--- End Message ---
--- Begin Message ---
hey I made into the top five! celebrating this, now I top post :D ;)

greets,
Zoltán Németh

2008. 03. 28, péntek keltezéssel 16.00-kor PostTrack [Dan Brown] ezt
írta:
>       Posting Summary for PHP-General List
>       Week Ending: Friday, 28 March, 2008
> 
>       Messages            | Bytes              | Sender
>       --------------------+--------------------+------------------
>       311 (100%)          850774 (100%)       EVERYONE
>       18     (5.8%)      24095   (2.8%)      Daniel Brown <parasane at gmail 
> dot com>
>       18     (5.8%)      24878   (2.9%)      Mark Weaver <mdw1982 at mdw1982 
> dot com>
>       16     (5.1%)      14590   (1.7%)      tedd <tedd dot sperling at gmail 
> dot com>
>       14     (4.5%)      20197   (2.4%)      Nilesh Govindrajan <admin at 
> itech7 dot com>
>       10     (3.2%)      22378   (2.6%)      Zoltán Németh <znemeth at 
> alterationx dot hu>
>       9      (2.9%)      10777   (1.3%)      Casey <heavyccasey at gmail dot 
> com>
>       9      (2.9%)      19224   (2.3%)      Robert Cummings <robert at 
> interjinn dot com>
>       9      (2.9%)      16853   (2%)        Shawn McKenzie <nospam at 
> mckenzies dot net>
>       9      (2.9%)      7941    (0.9%)      Wolf <lonewolf at nc dot rr dot 
> com>
>       8      (2.6%)      15638   (1.8%)      Eric Butera <eric dot butera at 
> gmail dot com>
>       8      (2.6%)      10532   (1.2%)      Andrew Ballard <aballard at 
> gmail dot com>
>       7      (2.3%)      13758   (1.6%)      Jason Pruim <japruim at raoset 
> dot com>
>       7      (2.3%)      12869   (1.5%)      Lamp Lists <lamp dot lists at 
> yahoo dot com>
>       7      (2.3%)      10655   (1.3%)      Al <news at ridersite dot org>
>       7      (2.3%)      11444   (1.3%)      Jim Lucas <lists at cmsws dot 
> com>
>       7      (2.3%)      11986   (1.4%)      Richard Lynch <ceo at l-i-e dot 
> com>
>       4      (1.3%)      13584   (1.6%)      Peter Ford <pete at justcroft 
> dot com>
>       4      (1.3%)      6940    (0.8%)      Philip Thompson <philthathril at 
> gmail dot com>
>       4      (1.3%)      5937    (0.7%)      Robin Vickery <robinv at gmail 
> dot com>
>       4      (1.3%)      5202    (0.6%)      Sudhakar <sudhakararaog at gmail 
> dot com>
>       4      (1.3%)      3466    (0.4%)      Greg Bowser <topnotcher at gmail 
> dot com>
>       3      (1%)        3596    (0.4%)      Alain Roger <raf dot news at 
> gmail dot com>
>       3      (1%)        4162    (0.5%)      Bastien Koert <phpster at gmail 
> dot com>
>       3      (1%)        4872    (0.6%)      VamVan <vamseevan at gmail dot 
> com>
>       3      (1%)        3178    (0.4%)      Colin Guthrie <gmane at colin 
> dot guthr dot ie>
>       3      (1%)        9221    (1.1%)      Richard <php_list at ghz dot fr>
>       3      (1%)        4352    (0.5%)      Michelle Konzack <linux4michelle 
> at freenet dot de>
>       3      (1%)        3090    (0.4%)      Bill <billlab51 at hotmail dot 
> com>
>       3      (1%)        3208    (0.4%)      Richard Heyes <richardh at 
> phpguru dot org>
>       2      (0.6%)      95298   (11.2%)     Andy Chong<fpqkfd at pchome dot 
> com>
>       2      (0.6%)      1890    (0.2%)      Chris <dmagick at gmail dot com>
>       2      (0.6%)      2032    (0.2%)      Bill Guion <bguion at comcast 
> dot net>
>       2      (0.6%)      2417    (0.3%)      Liz Kim <lizkim270 at gmail dot 
> com>
>       2      (0.6%)      95298   (11.2%)     Andy Chong<kwtuvb at yahoo dot 
> com dot sg>
>       2      (0.6%)      2299    (0.3%)      Christoph Boget <christoph dot 
> boget at gmail dot com>
>       2      (0.6%)      10009   (1.2%)      N dot Boatswain <wow_226 at 
> hotmail dot com>
>       2      (0.6%)      95298   (11.2%)     Andy Chong<wjrkcn at yahoo dot 
> com dot cn>
>       2      (0.6%)      1889    (0.2%)      Eric Wood <eric at interplas dot 
> com>
>       2      (0.6%)      2183    (0.3%)      Paul Scott <pscott at uwc dot ac 
> dot za>
>       2      (0.6%)      2549    (0.3%)      Dan <frozendice at gmail dot com>
>       2      (0.6%)      1504    (0.2%)      It Maq <itmaqurfe at yahoo dot 
> com>
>       2      (0.6%)      2288    (0.3%)      Manuel Lemos <mlemos at acm dot 
> org>
>       2      (0.6%)      1704    (0.2%)      Jeremy Privett <jeremy at 
> omegavortex dot net>
>       2      (0.6%)      1591    (0.2%)      Mário Gamito <gamito at gmail 
> dot com>
>       2      (0.6%)      1987    (0.2%)      Aschwin Wesselius <aschwin at 
> illuminated dot nl>
>       2      (0.6%)      2682    (0.3%)      Olivier Dupuis <dupuis dot 
> olivier at lemonde dot fr>
>       2      (0.6%)      2557    (0.3%)      Simon Welsh <simon at welsh dot 
> co dot nz>
>       2      (0.6%)      1606    (0.2%)      M dot  Sokolewicz <tularis at 
> php dot net>
>       2      (0.6%)      95298   (11.2%)     Andy Chong<xbjpwt at ms45 dot 
> url dot com dot tw>
>       2      (0.6%)      3904    (0.5%)      Brandon Orther <brandon dot 
> orther at think-done dot com>
>       2      (0.6%)      2619    (0.3%)      Ron Piggott <ron dot php at 
> actsministries dot org>
>       2      (0.6%)      1371    (0.2%)      Bagus Nugroho <bnugroho at 
> unisemgroup dot com>
>       2      (0.6%)      4248    (0.5%)      Thiago Pojda <thiago dot pojda 
> at softpartech dot com dot br>
>       2      (0.6%)      1942    (0.2%)      Ray Hauge <ray dot hauge dot 
> lists at gmail dot com>
>       2      (0.6%)      2551    (0.3%)      Kirk dot Johnson at zootweb dot 
> com
>       1      (0.3%)      475     (0.1%)      thomas Armstrong <tarmstrong at 
> gmail dot com>
>       1      (0.3%)      1377    (0.2%)      Alfredo CV <acovaleda at 
> loslibrosusados dot net>
>       1      (0.3%)      793     (0.1%)      Rod Clay <rclay at columbus dot 
> rr dot com>
>       1      (0.3%)      1007    (0.1%)      David Lidstone <dnews at elocal 
> dot co dot uk>
>       1      (0.3%)      1576    (0.2%)      jeffry s <paragasu at gmail dot 
> com>
>       1      (0.3%)      1585    (0.2%)      Tom Chubb <tomchubb at gmail dot 
> com>
>       1      (0.3%)      3016    (0.4%)      robert <roadtested at gmail dot 
> com>
>       1      (0.3%)      184     (0%)        Sancar Saran <sancar dot saran 
> at evodot dot com>
>       1      (0.3%)      878     (0.1%)      Shelley <myphplist at gmail dot 
> com>
>       1      (0.3%)      2322    (0.3%)      Ashalintubbi Schouten <evaluates 
> at sesa dot org>
>       1      (0.3%)      670     (0.1%)      Joey <Joey at Web56 dot net>
>       1      (0.3%)      2245    (0.3%)      ganu <ganu dot ullu at gmail dot 
> com>
>       1      (0.3%)      1647    (0.2%)      Christoph Boget <jcboget at 
> yahoo dot com>
>       1      (0.3%)      1022    (0.1%)      Mary Anderson <maryfran at demog 
> dot berkeley dot edu>
>       1      (0.3%)      560     (0.1%)      Hulf <ross at blue-fly dot co 
> dot uk>
>       1      (0.3%)      1764    (0.2%)      Sangamesh B <forum dot san at 
> gmail dot com>
>       1      (0.3%)      550     (0.1%)      Kista Tucker <kista at rochester 
> dot rr dot com>
>       1      (0.3%)      1061    (0.1%)      Haig Dedeyan <hdedeyan at 
> videotron dot ca>
>       1      (0.3%)      1381    (0.2%)      Ashley M dot  Kirchner <ashley 
> at pcraft dot com>
>       1      (0.3%)      187     (0%)        edwardspl at ita dot org dot mo
>       1      (0.3%)      351     (0%)        steve <iamstever at gmail dot 
> com>
>       1      (0.3%)      782     (0.1%)      Jonathan Mast <jhmast dot 
> developer at gmail dot com>
>       1      (0.3%)      667     (0.1%)      admin at buskirkgraphics dot com
>       1      (0.3%)      1200    (0.1%)      n3or <info at n3or dot de>
>       1      (0.3%)      865     (0.1%)      Jonesy <gmane at jonz dot net>
>       1      (0.3%)      1242    (0.1%)      Greg Sims <greg at headingup dot 
> net>
>       1      (0.3%)      622     (0.1%)      cool7 at hosting4days dot com 
> <cool7 at hosting4days dot com>
>       1      (0.3%)      712     (0.1%)      Børge Holen <borge at arivene 
> dot net>
>       1      (0.3%)      961     (0.1%)      Terry Burns-Dyson 
> <hammerstein_02 at msn dot com>
>       1      (0.3%)      743     (0.1%)      Larry Garfield <larry at 
> garfieldtech dot com>
>       1      (0.3%)      253     (0%)        L-Soft list server at 
> AudetteMedia (1 dot 8d)              <LISTSERV at LIST dot AUDETTEMED
>       1      (0.3%)      1736    (0.2%)      Ryan S <genphp at yahoo dot com>
>       1      (0.3%)      8520    (1%)        PostTrack [Dan Brown] 
> <listwatch-php-general at pilotpig dot net>
>       1      (0.3%)      2745    (0.3%)      Nitsan Bin-Nun <nitsanbn at 
> gmail dot com>
>       1      (0.3%)      1861    (0.2%)      Lester Caine <lester at lsces 
> dot co dot uk>
>       1      (0.3%)      736     (0.1%)      Martín Marqués <martin at 
> marquesminen dot com dot ar>
>       1      (0.3%)      1282    (0.2%)      Carlton Whitehead <carlton dot 
> whitehead at cebesius dot com>
>       1      (0.3%)      647     (0.1%)      Per Jessen <per at computer dot 
> org>
>       1      (0.3%)      1512    (0.2%)      Dee Ayy <dee dot ayy at gmail 
> dot com>
>       1      (0.3%)      170     (0%)        alexus <alexus at gmail dot com>
>       1      (0.3%)      4299    (0.5%)      Stefan Langwald <stefanlangwald 
> at googlemail dot com>
>       1      (0.3%)      2473    (0.3%)      Nathan Nobbe <quickshiftin at 
> gmail dot com>
>       1      (0.3%)      1692    (0.2%)      dhorton at iprimus dot com dot au
>       1      (0.3%)      120     (0%)        PHP General Users Mailing List 
> <rakfbghk at haspere dot com>
>       1      (0.3%)      714     (0.1%)      Paul Novitski <paul at 
> juniperwebcraft dot com>
>       1      (0.3%)      326     (0%)        Jay Blanchard <jblanchard at 
> pocket dot com>
>       1      (0.3%)      633     (0.1%)      John Pillion <john at conv-dg 
> dot com>
>       1      (0.3%)      858     (0.1%)      Steven Macintyre <steven at 
> steven dot macintyre dot name>
>       1      (0.3%)      1158    (0.1%)      Ross McKay <rosko at zeta dot 
> org dot au>
>       1      (0.3%)      2008    (0.2%)      Flewid Admin <admin at flewid 
> dot ca>
>       1      (0.3%)      25997   (3.1%)      cbnoffice201 at switched dot com
>       1      (0.3%)      952     (0.1%)      TG <tg-php at gryffyndevelopment 
> dot com>
> 
> 
> NOTE: Numbers may not add up to 100% due to protection of names and addresses 
> upon request.
> 
> DISCLAIMER: If you want your email address omitted from future weekly reports,
> please email me privately at [EMAIL PROTECTED] and it will be removed.
> 
> 


--- End Message ---
--- Begin Message ---
Mary Anderson wrote:
I have a linux based web app which prints an html screen of results. My users really want Excel spreadsheets with the same results. There is a PEAR application which does this, but from the PEAR description it seems to be pretty buggy (65 open bugs, average days open 616 days) and dated.
As long as your spreadsheets are simple without too much formatting etc., I don't think you should worry too much about these bugs. I have used the package in a variety of contexts without problems.

My spreadsheets will be somewhat simple. They will have multiple workbooks and could be as large as 10000 rows spread out over 100 workbooks
I assume you mean multiple worksheets, not workbooks (AFAIK there can be only one workbook per file)? I don't have any experience with a file that big.


You may also have a look at the PHPExcel package:
http://www.phpexcel.net/


Christian

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

I need to grab the what's between 2 markers in a Textile / html
string, but my regex skills aren't all that hot. The text I have is:

<OPEN_MAIN_COLUMN>

h3. Article Content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

p(image). !/app/image/1/large! Caption

p(image). !/app/image/24/large! drunken jonty

<CLOSE_MAIN_COLUMN>

<OPEN_LEFT_COLUMN>

h3. Article Content

!/app/image/7/thumb! Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.

<CLOSE_LEFT_COLUMN>

<OPEN_RIGHT_COLUMN>

h3. Article Content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.

* Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
* Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.
* Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.

<CLOSE_RIGHT_COLUMN>

I'd like to grab the contents of left, right and main individually so
I can place them in separate form fields.

Any help greatly appreciated. I'm certain this is a cinch for people
who use regex often.

Thanks,

Jon


-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--- End Message ---
--- Begin Message ---
2008. 03. 29, szombat keltezéssel 11.26-kor Jon Bennett ezt írta:
> Hi,
> 
> I need to grab the what's between 2 markers in a Textile / html
> string, but my regex skills aren't all that hot. The text I have is:
> 
> <OPEN_MAIN_COLUMN>
> 
> h3. Article Content
> 
> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
> eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
> minim veniam, quis nostrud exercitation ullamco laboris nisi ut
> aliquip ex ea commodo consequat. Duis aute irure dolor in
> reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
> pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
> culpa qui officia deserunt mollit anim id est laborum.
> 
> p(image). !/app/image/1/large! Caption
> 
> p(image). !/app/image/24/large! drunken jonty
> 
> <CLOSE_MAIN_COLUMN>
> 
> <OPEN_LEFT_COLUMN>
> 
> h3. Article Content
> 
> !/app/image/7/thumb! Lorem ipsum dolor sit amet, consectetur
> adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
> magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
> irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
> fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
> sunt in culpa qui officia deserunt mollit anim id est laborum.
> 
> <CLOSE_LEFT_COLUMN>
> 
> <OPEN_RIGHT_COLUMN>
> 
> h3. Article Content
> 
> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
> eiusmod tempor incididunt ut labore et dolore magna aliqua.
> 
> * Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
> nisi ut aliquip ex ea commodo consequat.
> * Duis aute irure dolor in reprehenderit in voluptate velit esse
> cillum dolore eu fugiat nulla pariatur.
> * Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
> officia deserunt mollit anim id est laborum.
> 
> <CLOSE_RIGHT_COLUMN>
> 
> I'd like to grab the contents of left, right and main individually so
> I can place them in separate form fields.
> 
> Any help greatly appreciated. I'm certain this is a cinch for people
> who use regex often.

preg_match('/<OPEN_MAIN_COLUMN>(.*)<CLOSE_MAIN_COLUMN>/sUi', $string,
$matches);
echo $matches[1];

it's not very complicated, the only interesting bits are the s and U
modifiers at the end of the pattern. s makes the dot (.) to match
newlines too, so the matched text can be more than one line, the U makes
the engine 'ungreedy' which means that it stops after the first match.
this means that if you have a string like <open><close><open><close> and
match for <open>(.*)<close>, without the U modifier you would get the
part between the first <open> and the last <close>. with the modifier
you get the parts between any <open> and the next <close>

more info here:
http://hu.php.net/manual/en/reference.pcre.pattern.modifiers.php
http://hu.php.net/manual/en/reference.pcre.pattern.syntax.php

greets,
Zoltán Németh

> 
> Thanks,
> 
> Jon
> 
> 
> -- 
> 
> jon bennett
> w: http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
> 


--- End Message ---
--- Begin Message ---
Jon Bennett wrote:
Hi,

I need to grab the what's between 2 markers in a Textile / html
string, but my regex skills aren't all that hot. The text I have is:

<OPEN_MAIN_COLUMN>

h3. Article Content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

p(image). !/app/image/1/large! Caption

p(image). !/app/image/24/large! drunken jonty

<CLOSE_MAIN_COLUMN>

<OPEN_LEFT_COLUMN>

h3. Article Content

!/app/image/7/thumb! Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.

<CLOSE_LEFT_COLUMN>

<CLOSE_RIGHT_COLUMN>

h3. Article Content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.

* Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
* Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.
* Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.

<CLOSE_RIGHT_COLUMN>

I'd like to grab the contents of left, right and main individually so
I can place them in separate form fields.

Any help greatly appreciated. I'm certain this is a cinch for people
who use regex often.

It's really not that hard if you use three separate expressions:

$left = preg_match('/<OPEN_LEFT_COLUMN>(.*)<CLOSE_LEFT_COLUMN>/is', $text, $matches);

$right = preg_match('/<OPEN_RIGHT_COLUMN>(.*)<CLOSE_RIGHT_COLUMN>/is', $text, $matches);

$main = preg_match('/<OPEN_MAIN_COLUMN>(.*)<CLOSE_MAIN_COLUMN>/is', $text, $matches);

And then, IIRC, the content you're after will be in $matches[1].

--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:

>Paul Scott wrote:
>  
>
>>On Thu, 2008-03-27 at 10:32 -0400, Wolf wrote:
>>    
>>
>>>I'd suggest going with a real operating system (linux) which keeps patches 
>>>updated quicker...
>>>
>>>      
>>>
>>As much of a Free Software advocate as I am, that is not the answer to
>>the question. That being said, however, I would replace the IIS with
>>Apache2 at least...
>>
>>I seem to remember someone posting a really good guide to setting this
>>all up at some stage, so a quick search through the archives should
>>reveal all.
>>
>>
>>--Paul
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>All Email originating from UWC is covered by disclaimer 
>>http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
>>    
>>
>
>Download the zip and read the install.txt.  It doesn't get any easier
>than that. It's very straight forward and has worked for me every time.
>
>-Shawn
>
>  
>
Hello Shawn,

How to enable php 5.2.5 with MySQL 5.0.51a ?

Thank for your help !

Edward.

--- End Message ---

Reply via email to