OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 17 Jul 2003 04:22:11 -0000 Issue 2180

php-general-digest-helplists.php.net
Date: Wed Jul 16 2003 - 23:22:11 CDT


php-general Digest 17 Jul 2003 04:22:11 -0000 Issue 2180

Topics (messages 155452 through 155526):

Re: Passing $Vars between 2 php pages
        155452 by: John Manko
        155453 by: Valentin
        155454 by: Valentin
        155502 by: Jeff Harris
        155525 by: John Manko

Re: XML Array
        155455 by: Lee Doolan
        155460 by: Lee Doolan

Re: multi file multi colomn
        155456 by: John Manko

Re: KEEP IMAGE RATIO
        155457 by: Reuben D. Budiardja
        155470 by: John Manko

Re: Problem with Apache Web Server config file and PHP (please give advice on what problem may be me)
        155458 by: Marek Kilimajer

Re: HTTPS POST without user/client intervention
        155459 by: Jeff Harris

MySQL query problems
        155461 by: Beauford.2005
        155468 by: Marek Kilimajer
        155477 by: Beauford.2005
        155492 by: Nomadeous
        155509 by: Beauford.2005

Re: Verifying a certain amount of numbers
        155462 by: Curt Zirzow
        155506 by: Justin French

Test (ignore)
        155463 by: Robert Cummings

Re: get size of variable n bytes
        155464 by: David Nicholson

PHP explodes without using isset()
        155465 by: John Manko
        155466 by: David Nicholson
        155467 by: Curt Zirzow

How to address __FILE__ constant in extensions?
        155469 by: Sam Baum

Opening a Window with JavaScript
        155471 by: Todd Cary
        155473 by: Curt Zirzow
        155474 by: Aaron Gould
        155503 by: Brenton Dobell

Odd Error (PHP4 & IIS)
        155472 by: Shena Delian O'Brien
        155475 by: Johnny Martinez
        155476 by: Shena Delian O'Brien

reading from dir and displaying thumbs
        155478 by: Ryan A

Regex help needed
        155479 by: Sid
        155487 by: Curt Zirzow
        155491 by: Nomadeous

Re: Object can not be used after a session
        155480 by: Matt Silva
        155481 by: Matt Silva
        155495 by: Mike Migurski
        155505 by: Matt Silva

Regex and variable usage
        155482 by: Gerard Samuel
        155483 by: Curt Zirzow
        155485 by: Gerard Samuel
        155489 by: Nomadeous

really no way to get byte size of variable?
        155484 by: Petre Agenbag
        155499 by: Baroiller Pierre-Emmanuel

include statement giving me hives! - help
        155486 by: DougD
        155498 by: Baroiller Pierre-Emmanuel
        155501 by: DougD

PHP & MS Exchange Server problem
        155488 by: Charles Vos
        155497 by: Baroiller Pierre-Emmanuel

Anyone for cookies and milk? :-)
        155490 by: Ryan A
        155493 by: Nomadeous
        155494 by: Chris Shiflett

Re: Using Extensions
        155496 by: Nomadeous

Re: How to store a file into MSSQL?
        155500 by: Javier

Re: correct session format?
        155504 by: Bill MacAllister

PROBLEMS WITH STRINGS & SQL DATABASE
        155507 by: Dale Hersh
        155508 by: David Nicholson

bcc on php
        155510 by: Louie Miranda
        155511 by: Ralph Guzman

Need Help: Please click on Test Link
        155512 by: Suhas Pharkute
        155514 by: David Nicholson

Re: pdf information..
        155513 by: Miranda, Joel Louie M
        155515 by: Louie Miranda
        155519 by: Justin French
        155520 by: Stephen Rainey
        155521 by: Louie Miranda
        155523 by: daniel.electroteque.org

Re: socket programming
        155516 by: Michael P. Carel

Re: XML
        155517 by: Hardik Doshi

fwrite not working in php3
        155518 by: daniel.electroteque.org

jpeg photo file upload problem
        155522 by: John T. Beresford

How unsafe is register_globals?
        155524 by: Paul Chvostek
        155526 by: Chris Shiflett

Administrivia:

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

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

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

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

attached mail follows:


page1.php
$_SESSION['myvars_VARNAME'] = $varname;
the 'myvars_' is just for identification purposes, so avoid over-writing
anthing that you might not want to.

page2.php
$varname = $_SESSION['myvars_VARNAME'];

Valentin wrote:

>Hi,
>is any way to pass a $Var from one to other php pages without using <FORM>
>and Cookies?
>
>Thanks,
>
>
>
>
>
>

attached mail follows:


Thank you Robert!
But, I forgot to mention... "and without URI"

attached mail follows:


Thanks John!

attached mail follows:


|Valentin wrote:
|
|>Hi, is any way to pass a $Var from one to other php pages without using
|><DEFANGED_FORM> and Cookies?
|>
|>Thanks,
|>
On Jul 16, 2003, "John Manko" claimed that:

|page1.php
|$_SESSION['myvars_VARNAME'] = $varname;
|the 'myvars_' is just for identification purposes, so avoid over-writing
|anthing that you might not want to.
|
|page2.php
|$varname = $_SESSION['myvars_VARNAME'];

Session still either use cookies or URI:
"There are two methods to propagate a session id: Cookies, URL parameter"

Thus sayeth the oracle:
http://www.php.net/manual/en/ref.session.php

The only way that I can see of passing a variable from page to page
without using cookies or URI would be to make sure that only one person
can access the entire site at one time and use either a database or a file
on the server.

Jeff
--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.

attached mail follows:


why not build a GET QUERY_STRING, save it in a database along with the
session_id, the read it on the second page, parsing the string.

Jeff Harris wrote:

>|Valentin wrote:
>|
>|>Hi, is any way to pass a $Var from one to other php pages without using
>|><DEFANGED_FORM> and Cookies?
>|>
>|>Thanks,
>|>
>On Jul 16, 2003, "John Manko" claimed that:
>
>|page1.php
>|$_SESSION['myvars_VARNAME'] = $varname;
>|the 'myvars_' is just for identification purposes, so avoid over-writing
>|anthing that you might not want to.
>|
>|page2.php
>|$varname = $_SESSION['myvars_VARNAME'];
>
>Session still either use cookies or URI:
>"There are two methods to propagate a session id: Cookies, URL parameter"
>
>Thus sayeth the oracle:
>http://www.php.net/manual/en/ref.session.php
>
>The only way that I can see of passing a variable from page to page
>without using cookies or URI would be to make sure that only one person
>can access the entire site at one time and use either a database or a file
>on the server.
>
>Jeff
>
>

attached mail follows:


>>>>> "Michael" == Michael Smith <msmithprattmuseum.org> writes:

    Michael> Hey, I'm looking for a function to take an XML file and
    Michael> turn it into a PHP array with the same structure.

here's something that I found on the internet a few months back. I've
used it a number of times:

---- C U T H E R E ---- C U T H E R E ---- C U T H E R E ----

/* xmlize() is by Hans Anderson, mehansanderson.com
 *
 * Ye Ole "Feel Free To Use it However" License [PHP, BSD, GPL].
 * some code in xml_depth is based on code written by other PHPers
 * as well as one Perl script. Poor programming practice and organization
 * on my part is to blame for the credit these people aren't receiving.
 * None of the code was copyrighted, though.
 *
 * This is a stable release, 1.0. I don't foresee any changes, but you
 * might check http://www.hansanderson.com/php/xml/ to see
 *
 * usage: $xml = xmlize($array);
 *
 * See the function traverse_xmlize() for information about the
 * structure of the array, it's much easier to explain by showing you.
 * Be aware that the array is somewhat tricky. I use xmlize all the time,
 * but still need to use traverse_xmlize quite often to show me the structure!
 *
 */

function xmlize($data, $WHITE=1) {

    $data = trim($data);
    $vals = $index = $array = array();
    $parser = xml_parser_create();
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $WHITE);
    xml_parse_into_struct($parser, $data, $vals, $index);
    xml_parser_free($parser);

    $i = 0;

    $tagname = $vals[$i]['tag'];
    if ( isset ($vals[$i]['attributes'] ) )
    {
        $array[$tagname][''] = $vals[$i]['attributes'];
    } else {
        $array[$tagname][''] = array();
    }

    $array[$tagname]["#"] = xml_depth($vals, $i);

    return $array;
}

/*
 *
 * You don't need to do anything with this function, it's called by
 * xmlize. It's a recursive function, calling itself as it goes deeper
 * into the xml levels. If you make any improvements, please let me know.
 *
 *
 */

function xml_depth($vals, &$i) {
    $children = array();

    if ( isset($vals[$i]['value']) )
    {
        array_push($children, $vals[$i]['value']);
    }

    while (++$i < count($vals)) {

        switch ($vals[$i]['type']) {

           case 'open':

                if ( isset ( $vals[$i]['tag'] ) )
                {
                    $tagname = $vals[$i]['tag'];
                } else {
                    $tagname = '';
                }

                if ( isset ( $children[$tagname] ) )
                {
                    $size = sizeof($children[$tagname]);
                } else {
                    $size = 0;
                }

                if ( isset ( $vals[$i]['attributes'] ) ) {
                    $children[$tagname][$size][''] = $vals[$i]["attributes"];
                }

                $children[$tagname][$size]['#'] = xml_depth($vals, $i);

            break;

            case 'cdata':
                array_push($children, $vals[$i]['value']);
            break;

            case 'complete':
                $tagname = $vals[$i]['tag'];

                if( isset ($children[$tagname]) )
                {
                    $size = sizeof($children[$tagname]);
                } else {
                    $size = 0;
                }

                if( isset ( $vals[$i]['value'] ) )
                {
                    $children[$tagname][$size]["#"] = $vals[$i]['value'];
                } else {
                    $children[$tagname][$size]["#"] = '';
                }

                if ( isset ($vals[$i]['attributes']) ) {
                    $children[$tagname][$size]['']
                                             = $vals[$i]['attributes'];
                }

            break;

            case 'close':
                return $children;
            break;
        }

    }

        return $children;

}

/* function by acebonef2s.com, a HUGE help!
 *
 * this helps you understand the structure of the array xmlize() outputs
 *
 * usage:
 * traverse_xmlize($xml, 'xml_');
 * print '<pre>' . implode("", $traverse_array . '</pre>';
 *
 *
 */

function traverse_xmlize($array, $arrName = "array", $level = 0) {

    foreach($array as $key=>$val)
    {
        if ( is_array($val) )
        {
            traverse_xmlize($val, $arrName . "[" . $key . "]", $level + 1);
        } else {
            $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n";
        }
    }

    return 1;

}

--
Flowers of morning glory. +-----------------------------------------+
The sky above this street |donate to causes I care about: |
Begins to overcast. | http://svcs.affero.net/rm.php?r=leed_25 |
                   --Sugita +-----------------------------------------+

attached mail follows:


>>>>> "Lee" == Lee Doolan <leed_25lycos.com> writes:
>>>>> "Michael" == Michael Smith <msmithprattmuseum.org> writes:
    Michael> Hey, I'm looking for a function to take an XML file and
    Michael> turn it into a PHP array with the same structure.

    Lee> here's something that I found on the internet a few months
    Lee> back.

here I am following up my own post yet again.. I forgot to include an example of
use. here's a little snippet that uses xmlize():

    ## probably actually should use join here. I guess I was too concerned
    ## about the whitespace
    $xData="";
    while (list($k, $v)= each($xml)) {
        $xData .= trim($v);
    }

    ## turn the XML into an array
    $ary= xmlize($xData);

    ## split into several different arrays depending on donation amount
    $hofTable= $ary['patronHofTable']['#']['tableData']['0']['#']['hofTableEntry'];
    $platinumAry= $goldAry= $silverAry= $insiderAry= array();

    if (!isset($hofTable['0']['#']['text'])) {
        foreach($hofTable as $hofkey => $hofVal) {
            $entry= $hofVal['#']['Data']['0']['#'];
            if ($entry > 999) {
                $platinumAry[]= $hofVal;

            } else if ($entry > 499) {
                $goldAry[]= $hofVal;

            } else if ($entry > 99) {
                $silverAry[]= $hofVal;

            } else {
                $insiderAry[]= $hofVal;
            }
        }
    }

attached mail follows:


is there a max file handle pool in php?

look at:
http://us3.php.net/fopen
http://us3.php.net/fwrite

FB wrote:

>Hi,
>
>I have 40 text files.. each files have 1 colomn of a data. I want to write a
>script to merge them like
>
>datafrom1;datafrom2;datafrom3;....datafrom40
>
>how can I do that?
>
>TIA
>
>
>
>
>

attached mail follows:


On Wednesday 16 July 2003 09:46 am, John Manko wrote:
> Ok, before you go responding with percentages, I should note this.
>
> consider this:
> Image1 : 100x100 (Ratio = 1:1)
> Image2 : 100x200 (Ratio = 1:2)
>
> Space available for display : 75x75
>
> now, i can say "width=75% height=75%", but this will
> only work for Image1, since Image2 will end up
> as 75x150 (which clearly does not fit the 75x75 constraints)
>
> now, if i specify "width=75 height=75", again, this works for Image1, but
> not Image2, since the new Image2 ratio will be 1:1, with Image2 losing
> 1/2 of it's heigth ratio.

And I still don't see how your proposed method handles the problem you
mentioned above with Image2...

RDB

> John Manko wrote:
> > Ok, I'm surprised that this is not taken care of with HTML.
> >
> > I propose the following standard (but also looking for a PHP
> > workaround if available)
> > for the Img HTML tag:
> >
> > RATIO = Keep|Ignore, default Ignore
> >
> > &lt; img width='x' height='y' RATIO='Keep|Ignore' &gt;
> >
> > Where, RATIO=Keep will inlarge the image to a
> > max WIDTH or HEIGHT (which ever comes first),
> > without changing the perspective ratio.
> >
> > I don't want to have to use Photoshop or Gimp to
> > ensure that the images a width=x or heigth=y will keep ratio.
> >
> > If anyone belongs to W3C, please consider this.
> >
> > Thanks

--
-------------------------------------------------
/"\ ASCII Ribbon Campaign against HTML
\ / email and proprietary format
 X attachments.
/ \
-------------------------------------------------
Have you been used by Microsoft today?
Choose your life. Choose freedom.
Choose LINUX.
-------------------------------------------------

attached mail follows:


>And I still don't see how your proposed method handles the problem you
>mentioned above with Image2...
>
>RDB

Now, first, what would you prefer? Second, I hope you understand how the new
feature would address the issue (and that you know what the issue is - if i
explained it clearly, of course)

As sent to www-talkw3c.org (please read in total, some stuff added)

----------------------------------------------------------------------
consider:

Image1 : 100x100 (Ratio = 1:1)
Image2 : 100x200 (Ratio = 1:2)

Space available for display : 75x75

now, i can say "width=75% height=75%", but this will
only work for Image1, since Image2 will end up
as 75x150 (which clearly does not fit the 75x75 constraints)

now, if i specify "width=75 height=75",
again, this works for Image1, but
not Image2, since the new Image2 ratio will be 1:1,
with Image2 losing 1/2 of it's heigth ratio.

Rather, with "img width=75 height=75 ratio=keep", we will have the
following results:

Final Display:
Image1 : 75x75 : (RATIO 1x1)
Image2 : 38x75 (37.5x75) : (RATIO 1:2)

This is something simple enough for the browser to handle, and I think
it should.
-------------------------------------------------------------------------------------

Now, as far as not seeing how this helps, keep in mind that this is NOT
a feature, but
SHOULD, and a reponse I got from www-talkw3c.org is the following:

=========================================================
this is what I use to maintain aspect ratio and constrain the image to
the limits I have
 
 
if($image_path == "")
    {
        $relative_directory = "/images/logo.gif";
        $size = GetImageSize(getenv("DOCUMENT_ROOT").$relative_directory);
    }
    else
    {
        $relative_directory = "/images/gallery/$sportid/";
        $size =
GetImageSize(getenv("DOCUMENT_ROOT").$relative_directory."/".$image_path);
    }
    $width = $size[0];
    $height = $size[1];
    if($width > 500)
    {
        if(($width > 500)&&($height > 400))
        {
            $width2 = ($size[0] - ( $size[0] * (1 - (500/$size[0]))));
            $height2 = ($size[1] - ( $size[1] * (1 - (400/$size[1]))));
        }
        else
        {
            $width2 = ($size[0] - ( $size[0] * (1 - (500/$size[0]))));
            $height2 = $size[1];
        }
    }
    else
    {
        $width2 = $size[0];
        $height2 = $size[1];
    }
 

========================================================

attached mail follows:


Did you add these lines to http.conf?:
LoadModule php4_module c:/php4/sapi/php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php

If you did, did you restart apache afterwards?

karen santmyer wrote:

> HI:
>
> Can anyone refer me to someone that can help with the problem below.
>
> I installed Apache Web Server on my laptop which has Windows XP. I then installed PHP. I followed the directions in the book I had on installing apache and php and what to add to the apache configuration file.
>
> Here is what is happening: After installing everything, I tested my Apache web server installation first and saw the apache web server page like the book said. Then it said to do a little php program - which had phpinfo() in it. But when I retyped the url I got a message that asked me did I want to download a file, which was the php program file.
>
> The PHP is 4.3.2 and the apache web server is 2.0. What am I doing wrong? Should I use apache 1.3.2?
>
> Please help. I understand everything, just don't know why it is prompting me to download a file.
>
> Thanks.
>
> Karen
>
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!

attached mail follows:


|-----Original Message-----
|From: PHP List [mailto:phplistnfri.com]
|Sent: Tuesday, July 15, 2003 1:02 PM
|To: php-generallists.php.net
|Subject: [PHP] HTTPS POST without user/client intervention
|
|I am writing a php script to accept an HTTPS POST of data from a remote
|site, process the data, and send an HTTPS POST response back (not
|necessarily to the same remote site). I can do this pretty easily in
|PERL (which I may have to if I can't find a PHP solution). Also I need
|to do the https post without any kind of client or user interaction. I
|have checked through php.net and phpbuilder.com but have only come up
|with things for HTTP POST (no SSL Encryption). Anyone run across
|something like this, or can point me in a direction to look?
|

On Jul 16, 2003, "Ralph Guzman" claimed that:
|
|I think what you are looking for is socket connections:
|http://www.php.net/manual/en/function.fsockopen.php
|
|Or CURL
|
|http://www.php.net/manual/en/ref.curl.php
|

Another option for you is to ouput a blank page with just a form pointing
where you need it to, with hidden inputs, and at the end of the page or in
a <body onLoad=''>,

<script language="JavaScript">
document.form.submit();
</script>

Assuming your client has JavaScript.

Jeff Harris
--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.

attached mail follows:


Hi,

Not sure if the problem here is PHP or MySQL, but here we go. I am
trying to do two queries on a database - one after the other, but the
second one never seems to get executed. The two queries are identical
except for two variables. I have checked my form and they are correct
and are being sent to the PHP script the way they should be.

The variables are $playerto, $playerfrom, $nameto, $namefrom. The 'TO'
query is the one that doesn't work.

Here is my code. Any help is appreciated.

if ($namefrom != $nameto) {
        if ($playerfrom != $playerto) {

                include("2004server.inc");
                if($error) {
                        include("trades-input.php");
                exit;
                }

                $query1 = "select manager.idn, manager.total,
roster.idp, position, points from roster join reference
                join manager where manager.idn=reference.idn and
reference.idp=roster.idp and manager.idn like '$namefrom' and
                roster.idp like '$playerfrom'";

                $result1 = mysql_query($query1) or $mysqlerror =
mysql_error();
                if ($mysqlerror) {
                    $error = "$d_base_error$email_error";
                        include("trades-input.php");
                        exit;
                }
                
                $line = mysql_fetch_row($result1);

                mysql_free_result($result1);
        
                $query2 = "select manager.idn, manager.total,
roster.idp, position, points from roster join reference
                join manager where manager.idn=reference.idn and
reference.idp=roster.idp and manager.idn like '$nameto' and
                roster.idp like '$playerto'";
        
                $result2 = mysql_query($query2) or $mysqlerror =
mysql_error();
                if ($mysqlerror) {
                    $error = "$d_base_error$email_error";
                        include("trades-inputs.php");
                        exit;
                }
                 
                $row = mysql_fetch_array($result2);
                 
                mysql_free_result($result2);
        }
}

attached mail follows:


Change $email_error to $mysqlerror and hopefully some error message will
appear.

Beauford.2005 wrote:
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-input.php");
> exit;
> }

attached mail follows:


I tried that, but there is no error to stop the script at this point.
The script continues past this point and to the end of the script -
there are just no values in the variables for the second query, which
obviously gives me the wrong results.

-----Original Message-----
From: Marek Kilimajer [mailto:kilimajerwebglobe.sk]
Sent: July 16, 2003 1:18 PM
To: Beauford.2005
Cc: PHP
Subject: Re: [PHP] MySQL query problems

Change $email_error to $mysqlerror and hopefully some error message will

appear.

Beauford.2005 wrote:
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-input.php");
> exit;
> }

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

attached mail follows:


But what's your prob ?
When you say the second one seems to never be executed ...
Does the line:
$row = mysql_fetch_array($result2);
launches a Php Error ?

And pay attention, because you're using mysql_fetch_array and
mysql_fetch_row, be sure that
you are not treating the result in the same way ;-)

"Beauford.2005" <beauford.2005rogers.com> a écrit dans le message de news:
000001c34bb5$5772a200$6401a8c0p1...
> Hi,
>
> Not sure if the problem here is PHP or MySQL, but here we go. I am
> trying to do two queries on a database - one after the other, but the
> second one never seems to get executed. The two queries are identical
> except for two variables. I have checked my form and they are correct
> and are being sent to the PHP script the way they should be.
>
> The variables are $playerto, $playerfrom, $nameto, $namefrom. The 'TO'
> query is the one that doesn't work.
>
> Here is my code. Any help is appreciated.
>
> if ($namefrom != $nameto) {
> if ($playerfrom != $playerto) {
>
> include("2004server.inc");
> if($error) {
> include("trades-input.php");
> exit;
> }
>
> $query1 = "select manager.idn, manager.total,
> roster.idp, position, points from roster join reference
> join manager where manager.idn=reference.idn and
> reference.idp=roster.idp and manager.idn like '$namefrom' and
> roster.idp like '$playerfrom'";
>
> $result1 = mysql_query($query1) or $mysqlerror =
> mysql_error();
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-input.php");
> exit;
> }
>
> $line = mysql_fetch_row($result1);
>
> mysql_free_result($result1);
>
> $query2 = "select manager.idn, manager.total,
> roster.idp, position, points from roster join reference
> join manager where manager.idn=reference.idn and
> reference.idp=roster.idp and manager.idn like '$nameto' and
> roster.idp like '$playerto'";
>
> $result2 = mysql_query($query2) or $mysqlerror =
> mysql_error();
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-inputs.php");
> exit;
> }
>
> $row = mysql_fetch_array($result2);
>
> mysql_free_result($result2);
> }
> }
>

attached mail follows:


Not sure what the problem was, but I dug up a similar script I used for
something else and modifed it for this project, and voila. I then put
the two side by side and I still can't see where the problem is.

Thanks for the input.

-----Original Message-----
From: Nomadeous [mailto:nomadeousfree.fr]
Sent: July 16, 2003 5:31 PM
To: php-generallists.php.net
Subject: [PHP] Re: MySQL query problems

But what's your prob ?
When you say the second one seems to never be executed ...
Does the line:
$row = mysql_fetch_array($result2);
launches a Php Error ?

And pay attention, because you're using mysql_fetch_array and
mysql_fetch_row, be sure that you are not treating the result in the
same way ;-)

"Beauford.2005" <beauford.2005rogers.com> a écrit dans le message de
news: 000001c34bb5$5772a200$6401a8c0p1...
> Hi,
>
> Not sure if the problem here is PHP or MySQL, but here we go. I am
> trying to do two queries on a database - one after the other, but the
> second one never seems to get executed. The two queries are identical
> except for two variables. I have checked my form and they are correct
> and are being sent to the PHP script the way they should be.
>
> The variables are $playerto, $playerfrom, $nameto, $namefrom. The 'TO'

> query is the one that doesn't work.
>
> Here is my code. Any help is appreciated.
>
> if ($namefrom != $nameto) {
> if ($playerfrom != $playerto) {
>
> include("2004server.inc");
> if($error) {
> include("trades-input.php");
> exit;
> }
>
> $query1 = "select manager.idn, manager.total,
> roster.idp, position, points from roster join reference
> join manager where manager.idn=reference.idn and
> reference.idp=roster.idp and manager.idn like '$namefrom' and
> roster.idp like '$playerfrom'";
>
> $result1 = mysql_query($query1) or $mysqlerror = mysql_error();
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-input.php");
> exit;
> }
>
> $line = mysql_fetch_row($result1);
>
> mysql_free_result($result1);
>
> $query2 = "select manager.idn, manager.total,
> roster.idp, position, points from roster join reference
> join manager where manager.idn=reference.idn and
> reference.idp=roster.idp and manager.idn like '$nameto' and roster.idp

> like '$playerto'";
>
> $result2 = mysql_query($query2) or $mysqlerror = mysql_error();
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-inputs.php");
> exit;
> }
>
> $row = mysql_fetch_array($result2);
>
> mysql_free_result($result2);
> }
> }
>

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

attached mail follows:


Justin French <justinindent.com.au> wrote:
> If you care about performance at all, try and find away around the
> problem without regular expressions...
>
> I tested
>
> if( (strlen($str) == 6) && (is_int($str)) )
>
I did some more tests on this problem is that $str is still considered a
string and not an integer here is my test script and results:

<?php
// is_int() testing

// standard string
$str = "123";
if (is_int($str)) print "$str: yes \n";
else print "$str: no \n";

//cast to integer
$str = (integer)"123";
if (is_int($str)) print "$str: yes \n";
else print "$str: no \n";

// implied cast to integer
$str = "123";
$str += 0;
if (is_int($str)) print "$str: yes \n";
else print "$str: no \n";

// force to be integer
$str = "123";
settype($str, 'integer');
if (is_int($str)) print "$str: yes \n";
else print "$str: no \n";

/*
Results:

123: no
123: yes
123: yes
123: yes

*/
?>

attached mail follows:


On Thursday, July 17, 2003, at 12:17 AM, Curt Zirzow wrote:

> Excellent point! I find my self using regex's a bit to often when there
> are other solutions available.
>
> btw, have you ever tested the difference between
>
> if(ereg('^[0-9]{6}$',$str))
> if(preg_grep('^[0-9]{6}$',$str))
>
> I've been meaning to find out advantages/disadvantages with PERL vs.
> POSIX compatible.

Hi,

I haven't, but feel free to do your own :)

Use the sample found on http://au.php.net/microtime

Justin

attached mail follows:


Some of my mail hasn't appeared on list for a while,
just testing if connection is working.

IGNORE THIS MESSAGE :)

--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'

attached mail follows:


Hello,

This is a reply to an e-mail that you wrote on Wed, 16 Jul 2003 at 16:35,
lines prefixed by '>' were originally written by you.
> Yes, well, that complicates things.
> You see, I'm trying to determine the size that the $_POST variable
> will be
> in bytes, because there is a byte limit in the php.ini file for POST
> variable size, so I was hoping for something easy like
> bytes_size($_POST)...
> Would also be handy to calculate how much memory your script will
> use/need.
> So, you say there is no such function or no way to determine it?

The POST data is all sent as text anyway so what I said about assuming 1
character = 1 byte will be the best way of calculatuing the size of the
entire request (remember to include all variable names, ?, & and =
characters as well though).

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

attached mail follows:


I've tried checking if $_POST and $_GET vars are set with just

if($_POST['yuck'])

When 'yuck' is not present my code always explodes with
*"Notice*: Undefined index: yuck" on the page output.
I never see any mention in the codes examples referencing a php
function that instructs the preprocessor not to output
such messages, but I've seen this used a lot of places.
I'm forced to use isset() with everything. Now, if there is
a switch to set in php.ini, this will do my no good since I
only have access to it on my dev box. Am I missing out
on something here, or do people just accept such messages (doubt it).

attached mail follows:


Hello,

This is a reply to an e-mail that you wrote on Wed, 16 Jul 2003 at 17:37,
lines prefixed by '>' were originally written by you.
> I've tried checking if $_POST and $_GET vars are set with just
> if($_POST['yuck'])
> When 'yuck' is not present my code always explodes with
> *"Notice*: Undefined index: yuck" on the page output.
> I never see any mention in the codes examples referencing a php
> function that instructs the preprocessor not to output
> such messages, but I've seen this used a lot of places.
> I'm forced to use isset() with everything. Now, if there is
> a switch to set in php.ini, this will do my no good since I
> only have access to it on my dev box. Am I missing out
> on something here, or do people just accept such messages (doubt it).

If you have error reporting set to E_ALL this is the expected behaviour
as you are trying to utilise an array index that does not exist. It is
the better coding style to check the variable with isset() but if you do
not want to do that you will have to turn down error reporting.

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

attached mail follows:


John Manko <xeridadelphia.net> wrote:
> I've tried checking if $_POST and $_GET vars are set with just
>
> if($_POST['yuck'])
>
> When 'yuck' is not present my code always explodes with
> *"Notice*: Undefined index: yuck" on the page output.

You can use the error suppressor.

if ($_POST['yuck']))

> I never see any mention in the codes examples referencing a php
> function that instructs the preprocessor not to output
> such messages, but I've seen this used a lot of places.
> I'm forced to use isset() with everything. Now, if there is
> a switch to set in php.ini, this will do my no good since I
> only have access to it on my dev box. Am I missing out
> on something here, or do people just accept such messages (doubt it).

if you dont want to use the other alternatives are:
  1. .htaccess is turned on, you can issue a php_value to set the error
         reporting.
  2. use ini_set().

HTH,
Curt
--

attached mail follows:


Hi there,

i am not getting it. How can I read out the magical __FILE__ constant inside
an _extension_ (a loadable module) ? Its not in symbol_table, so where is
it?

bg

Sam

attached mail follows:


I want to have a link on a php page that when opened, has to be closed
in order to move on. I have done this on pages using a button and
JavaScript as follows:

<input name="btnHelp" type="button" value="Help"
onClick="MM_openBrWindow('help.html','', 'toolbar=no, status=yes,
scrollbars=no, resizable=no, width=790, height=600')";">

When the button is clicked, the form is *NOT* submitted - this is what I
want.

However, if I use an anchor, the form is submitted. Is there a way to
prevent this? Here is the code I tried:

<a href="#" onClick="MM_openBrWindow('legal.php', '', 'toolbar=no,
status=yes, scrollbars=no, resizable=no, width=790, height=600')";">

When the above is executed, the page is submitted, and I do not want
that....

Todd
--

attached mail follows:


Todd Cary <toddaristesoftware.com> wrote:
> [...]
> However, if I use an anchor, the form is submitted. Is there a way to
> prevent this? Here is the code I tried:
>
> <a href="#" onClick="MM_openBrWindow('legal.php', '', 'toolbar=no,
> status=yes, scrollbars=no, resizable=no, width=790, height=600')";">

I believe you can put something like (not tested):
<a href="javascript:MM_openBrWindow('legal.php', '', 'toolbar=no,
 status=yes, scrollbars=no, resizable=no, width=790, height=600')";">

>
> Todd
> --

Curt
--

attached mail follows:


Try this (note the "return false;" addition at the end):

<a href="legal.php" onClick="MM_openBrWindow('this.href', '', 'toolbar=no,
status=yes, scrollbars=no, resizable=no, width=790, height=600'); return
false;">

--
Aaron Gould
Web Developer
Parts Canada

----- Original Message -----
From: "Curt Zirzow" <curtzirzow.dyndns.org>
To: <php-generallists.php.net>
Sent: Wednesday, July 16, 2003 2:15 PM
Subject: Re: [PHP] Opening a Window with JavaScript

> Todd Cary <toddaristesoftware.com> wrote:
> > [...]
> > However, if I use an anchor, the form is submitted. Is there a way to
> > prevent this? Here is the code I tried:
> >
> > <a href="#" onClick="MM_openBrWindow('legal.php', '', 'toolbar=no,
> > status=yes, scrollbars=no, resizable=no, width=790, height=600')";">
>
> I believe you can put something like (not tested):
> <a href="javascript:MM_openBrWindow('legal.php', '', 'toolbar=no,
> status=yes, scrollbars=no, resizable=no, width=790, height=600')";">
>
> >
> > Todd
> > --
>
> Curt
> --
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


I also know with the javascript open window, you can force the print window
to popup, what do you have to add to this link below??

Thanks

-----Original Message-----
From: Aaron Gould [mailto:webdevelpartscanada.com]
Sent: Thursday, July 17, 2003 3:48 AM
To: Curt Zirzow; php-generallists.php.net
Subject: Re: [PHP] Opening a Window with JavaScript

Try this (note the "return false;" addition at the end):

<a href="legal.php" onClick="MM_openBrWindow('this.href', '', 'toolbar=no,
status=yes, scrollbars=no, resizable=no, width=790, height=600'); return
false;">

--
Aaron Gould
Web Developer
Parts Canada

----- Original Message -----
From: "Curt Zirzow" <curtzirzow.dyndns.org>
To: <php-generallists.php.net>
Sent: Wednesday, July 16, 2003 2:15 PM
Subject: Re: [PHP] Opening a Window with JavaScript

> Todd Cary <toddaristesoftware.com> wrote:
> > [...]
> > However, if I use an anchor, the form is submitted. Is there a way to
> > prevent this? Here is the code I tried:
> >
> > <a href="#" onClick="MM_openBrWindow('legal.php', '', 'toolbar=no,
> > status=yes, scrollbars=no, resizable=no, width=790, height=600')";">
>
> I believe you can put something like (not tested):
> <a href="javascript:MM_openBrWindow('legal.php', '', 'toolbar=no,
> status=yes, scrollbars=no, resizable=no, width=790, height=600')";">
>
> >
> > Todd
> > --
>
> Curt
> --
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

attached mail follows:


Hi -

Got PHP4 running on IIS as a testing server (only used internally for my
own testing purposes). It suddenly just flurbed on pages it worked fine
on minutes ago. Now suddenly it gives me this error (with popups telling
me about the missing files):

Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI
variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual
page for CGI security.

For more information about changing this behaviour or re-enabling this
webserver, consult the installation file that came with this
distribution, or visit the manual page.
PHP Warning: Unknown(): Unable to load dynamic library
'/usr/lib/php4\imap.so' - The specified module could not be found. in
Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library
'/usr/lib/php4\ldap.so' - The specified module could not be found. in
Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library
'/usr/lib/php4\pgsql.so' - The specified module could not be found. in
Unknown on line 0

I don't know why it's looking in /usr/lib - I'm running WinXP and IIS,
not apache, and not linux. I looked in php.ini and there's no pointers
to directories like that there! Ugh.. furthermore cgi.force_redirect is
set to 0 like it should!

Any assistance is appreciated.

attached mail follows:


I see this randomly on my little server. Just hit the refresh button :P

J

-----Original Message-----
From: Shena Delian O'Brien [mailto:shenadarklock.com]
Sent: Wednesday, July 16, 2003 10:57 AM
To: php-generallists.php.net
Subject: [PHP] Odd Error (PHP4 & IIS)

Hi -

Got PHP4 running on IIS as a testing server (only used internally for my
own testing purposes). It suddenly just flurbed on pages it worked fine
on minutes ago. Now suddenly it gives me this error (with popups telling
me about the missing files):

Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI
variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual
page for CGI security.

For more information about changing this behaviour or re-enabling this
webserver, consult the installation file that came with this
distribution, or visit the manual page.
PHP Warning: Unknown(): Unable to load dynamic library
'/usr/lib/php4\imap.so' - The specified module could not be found. in
Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library
'/usr/lib/php4\ldap.so' - The specified module could not be found. in
Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library
'/usr/lib/php4\pgsql.so' - The specified module could not be found. in
Unknown on line 0

I don't know why it's looking in /usr/lib - I'm running WinXP and IIS,
not apache, and not linux. I looked in php.ini and there's no pointers
to directories like that there! Ugh.. furthermore cgi.force_redirect is
set to 0 like it should!

Any assistance is appreciated.

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

attached mail follows:


Tried. Didn't work then, isn't working now.

Johnny Martinez wrote:
> I see this randomly on my little server. Just hit the refresh button :P
>
> J
>
> -----Original Message-----
> From: Shena Delian O'Brien [mailto:shenadarklock.com]
> Sent: Wednesday, July 16, 2003 10:57 AM
> To: php-generallists.php.net
> Subject: [PHP] Odd Error (PHP4 & IIS)
>
>
> Hi -
>
> Got PHP4 running on IIS as a testing server (only used internally for my
> own testing purposes). It suddenly just flurbed on pages it worked fine
> on minutes ago. Now suddenly it gives me this error (with popups telling
> me about the missing files):
>
> Security Alert! The PHP CGI cannot be accessed directly.
>
> This PHP CGI binary was compiled with force-cgi-redirect enabled. This
> means that a page will only be served up if the REDIRECT_STATUS CGI
> variable is set, e.g. via an Apache Action directive.
>
> For more information as to why this behaviour exists, see the manual
> page for CGI security.
>
> For more information about changing this behaviour or re-enabling this
> webserver, consult the installation file that came with this
> distribution, or visit the manual page.
> PHP Warning: Unknown(): Unable to load dynamic library
> '/usr/lib/php4\imap.so' - The specified module could not be found. in
> Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library
> '/usr/lib/php4\ldap.so' - The specified module could not be found. in
> Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library
> '/usr/lib/php4\pgsql.so' - The specified module could not be found. in
> Unknown on line 0
>
> I don't know why it's looking in /usr/lib - I'm running WinXP and IIS,
> not apache, and not linux. I looked in php.ini and there's no pointers
> to directories like that there! Ugh.. furthermore cgi.force_redirect is
> set to 0 like it should!
>
> Any assistance is appreciated.
>
>

attached mail follows:


Hi guys,
I want to convert my old java greetings programs into php scripts but am
stuck on one little thing.
I have a bunch of thumbnails in a 3 directories, the problem is the number
of thumbnails in each directory is differient...how do i first make the
script look into the directory, display (maybe 15 per page?) thumbnails with
a link to the main program which will take one parameter depending on the
thumbnail name.
eg:
thumbnail name is 1.jpg so that thumbnail should have a link such as <a href
/somescript.php?name=1>

Anybody have any ideas or links please tell me.
Cheers!
-Ryan

attached mail follows:


Hello,

Well I am doing by first reg ex operations and I am having problems which I just cannot figure out.

For example I tried
echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\">\s*purchasing power parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1"><td><font size="2">Purchasing power parity');
and this worked perfectly,

but when I chnaged that to
echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\">\s*purchasing\s+power\s+parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1"><td><font size="2">Purchasing power parity');
It does not detect the string. Srange. According to what I know, \s+ will detect a single space also. I tried chnaging the last 2 \s+ to \s* but this did not work also.
Any ideas on this one?

As I proceed I would like the expression to detect the optional face attribute also, so I tried
echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\"(\s+face=\"Verdana, Arial, Helvetica, sans-serif\"|)>\s*purchasing power parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1" face="Verdana, Arial, Helvetica, sans-serif"><td><font size="2">Purchasing power parity');
... and this gave me an error like
Warning: eregi_replace(): REG_EMPTY:çempty (sub)expression in D:\sid\dg\test.php on line 2

Any ideas? BTW any place where I can get started on regex? I got a perl book that explains regex, but I have got to learn perl first (I dont know any perl)

Thanks in advance.

- Sid

attached mail follows:


Sid <sidhhathway.com> wrote:
> Hello,
>
> Well I am doing by first reg ex operations and I am having problems which I just cannot figure out.
>
> For example I tried
> echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\">\s*purchasing power parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1"><td><font size="2">Purchasing power parity');
> and this worked perfectly,
>
> but when I chnaged that to
> echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\">\s*purchasing\s+power\s+parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1"><td><font size="2">Purchasing power parity');
> It does not detect the string. Srange. According to what I know, \s+ will detect a single space also. I tried chnaging the last 2 \s+ to \s* but this did not work also.
> Any ideas on this one?

I'd do something like this, unless your string must have to have the
attributes to the html elements.

<tr[^>]*>[[:space:]]*<td[^>]*>[[:space:]]*<font[^>]*>[[:space:]]*purchasing[[:space:]]*power[[:space:]]*parity

> As I proceed I would like the expression to detect the optional face attribute also, so I tried
> echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\"(\s+face=\"Verdana, Arial, Helvetica, sans-serif\"|)>\s*purchasing power parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1" face="Verdana, Arial, Helvetica, sans-serif"><td><font size="2">Purchasing power parity');
> ... and this gave me an error like
> Warning: eregi_replace(): REG_EMPTY:çempty (sub)expression in D:\sid\dg\test.php on line 2

(\s+face=\"Verdana, Arial, Helvetica, sans-serif\"|)>\s*purchasing power parity
the problem is regex is expecting something here---^

you can change it to:
(\s+face=\"Verdana, Arial, Helvetica, sans-serif\">|>)\s*purchasing power parity

>
> Any ideas? BTW any place where I can get started on regex? I got a perl book that explains regex, but I have got to learn perl first (I dont know any perl)

Go right to the source:
http://www.oreilly.com/catalog/regex/

>
> Thanks in advance.
>
> - Sid

Curt
--

attached mail follows:


First, the prob you got : WARNING ....
comes from the following error:
(\s+face=\"Verdana, Arial, Helvetica, sans-serif\"|)>
After the | (OR) sign, you must define another case, example:
echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font
size=\"2\"(\s+face=\"Verdana, Arial, Helvetica,
sans-serif\"|\s)>\s*purchasing power parity", '%POWER%',
'<td><tr>sdsdss<tr bgcolor="#f8f8f1" face="Verdana, Arial, Helvetica,
sans-serif"><td><font size="2">Purchasing power parity');

Secondly, it's right that the \s expression is not recognised in
" purchasing\s+power\s+parity " , a little strange, but you can use two
different ways instead of '\s':
  - [[:space:]]
  - [ ]
The brackets allows you to define a sequence of characters patterns (in
the second case above, the space character).
It will give:
echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font
size=\"2\">\s*purchasing[[:space:]]+power[[:space:]]+parity", '%POWER%',
'<td><tr>sdsdss<tr bgcolor="#f8f8f1"><td><font size="2">Purchasing power
parity');

Just a little help, you can find on the page
http://www.php.net/manual/en/ref.regex.php that could be useful for you:

^ Start of line
$ End of line
n? Zero or only one single occurrence of character 'n'
n* Zero or more occurrences of character 'n'
n+ At least one or more occurrences of character 'n'
n{2} Exactly two occurrences of 'n'
n{2,} At least 2 or more occurrences of 'n'
n{2,4} From 2 to 4 occurrences of 'n'
. Any single character
() Parenthesis to group expressions
(.*) Zero or more occurrences of any single character, ie, anything!
(n|a) Either 'n' or 'a'
[1-6] Any single digit in the range between 1 and 6
[c-h] Any single lower case letter in the range between c and h
[D-M] Any single upper case letter in the range between D and M
[^a-z] Any single character EXCEPT any lower case letter between a and z.

Pitfall: the ^ symbol only acts as an EXCEPT rule if it is the
very first character inside a range, and it denies the
entire range including the ^ symbol itself if it appears again
later in the range. Also remember that if it is the first
character in the entire expression, it means "start of line".
In any other place, it is always treated as a regular ^ symbol.
In other words, you cannot deny a word with ^undesired_word
or a group with ^(undesired_phrase).
Read more detailed regex documentation to find out what is
necessary to achieve this.

[_4^a-zA-Z] Any single character which can be the underscore or the
number 4 or the ^ symbol or any letter, lower or upper case

?, +, * and the {} count parameters can be appended not only to a single
character, but also to a group() or a range[].

therefore,
^.{2}[a-z]{1,2}_?[0-9]*([1-6]|[a-f])[^1-9]{2}a+$
would mean:

^.{2} = A line beginning with any two characters,
[a-z]{1,2} = followed by either 1 or 2 lower case letters,
_? = followed by an optional underscore,
[0-9]* = followed by zero or more digits,
([1-6]|[a-f]) = followed by either a digit between 1 and 6 OR a
lower case letter between a and f,
[^1-9]{2} = followed by any two characters except digits
between 1 and 9 (0 is possible),
a+$ = followed by at least one or more
occurrences of 'a' at the end of a line.

Sid a écrit:
Hello,

Well I am doing by first reg ex operations and I am having problems
which I just cannot figure out.

For example I tried
echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font
size=\"2\">\s*purchasing power parity", '%POWER%', '<td><tr>sdsdss<tr
bgcolor="#f8f8f1"><td><font size="2">Purchasing power parity');
and this worked perfectly,

but when I chnaged that to
echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font
size=\"2\">\s*purchasing\s+power\s+parity", '%POWER%',
'<td><tr>sdsdss<tr bgcolor="#f8f8f1"><td><font size="2">Purchasing power
parity');
It does not detect the string. Srange. According to what I know, \s+
will detect a single space also. I tried chnaging the last 2 \s+ to \s*
but this did not work also.
Any ideas on this one?

As I proceed I would like the expression to detect the optional face
attribute also, so I tried
echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font
size=\"2\"(\s+face=\"Verdana, Arial, Helvetica,
sans-serif\"|)>\s*purchasing power parity", '%POWER%',
'<td><tr>sdsdss<tr bgcolor="#f8f8f1" face="Verdana, Arial, Helvetica,
sans-serif"><td><font size="2">Purchasing power parity');
... and this gave me an error like
Warning: eregi_replace(): REG_EMPTY:çempty (sub)expression in
D:\sid\dg\test.php on line 2

Any ideas? BTW any place where I can get started on regex? I got a perl
book that explains regex, but I have got to learn perl first (I dont
know any perl)

Thanks in advance.

- Sid

Sid a écrit:
> Hello,
>
> Well I am doing by first reg ex operations and I am having problems which I just cannot figure out.
>
> For example I tried
> echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\">\s*purchasing power parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1"><td><font size="2">Purchasing power parity');
> and this worked perfectly,
>
> but when I chnaged that to
> echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\">\s*purchasing\s+power\s+parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1"><td><font size="2">Purchasing power parity');
> It does not detect the string. Srange. According to what I know, \s+ will detect a single space also. I tried chnaging the last 2 \s+ to \s* but this did not work also.
> Any ideas on this one?
>
> As I proceed I would like the expression to detect the optional face attribute also, so I tried
> echo eregi_replace ("<tr bgcolor=\"#F8F8F1\">(\s*)<td>\s*<font size=\"2\"(\s+face=\"Verdana, Arial, Helvetica, sans-serif\"|)>\s*purchasing power parity", '%POWER%', '<td><tr>sdsdss<tr bgcolor="#f8f8f1" face="Verdana, Arial, Helvetica, sans-serif"><td><font size="2">Purchasing power parity');
> ... and this gave me an error like
> Warning: eregi_replace(): REG_EMPTY:çempty (sub)expression in D:\sid\dg\test.php on line 2
>
> Any ideas? BTW any place where I can get started on regex? I got a perl book that explains regex, but I have got to learn perl first (I dont know any perl)
>
> Thanks in advance.
>
> - Sid

attached mail follows:


Wow thats strange?? I am using PHP 4.3.2 as well and I don't see that happening where
it serializes the object when assigning it to the $_SESSION. I am using the dbg
debugger and nusphere PHP editor and I can step through the code and as I do
it shows that the session var is not serialized. However when I checked the session
data in the /tmp directorie it appears to serialized

It could be that my version of PHP doesn't match the dbg version and dbg reporting back
false information (which I have to look into that). Also I checked my ini settings and
it shows the session.serialize_handler = php which should be default.

Another thing is that I didn't come accross in my reading of
http://www.php.net/manual/en/language.oop.serialization.php where it says that objects
assigned to the global $_SESSION var is automatically serialized. I did see that if you
use the session_register() function it automatically serializes but again I'd like
to avoid that.

Right now it seems I have many unkowns, so i'm going to narrow them down ....

Matt

Mike Migurski wrote:

>>$customer = new Customer($_GET['facilityID'], $_GET['customerID']);
>>$_SESSION['acceptPayment']['serializedCustomer'] = serialize($customer);
>>
>>so now when I have moved on to another page or another instance of the
>>same page and I want to access the object from the session var, I do so
>>like this:
>>
>>$customer =
>>unserialize($_SESSION['acceptPayment']['serializedCustomer']);
>>
>>and now you can access the object. There is a hidden jewl about this
>>method, I now no longer have to include or require the class file because
>>it is already defined in the serialized string.
>
>
> Really, you don't need the serialize/unserialize in there, as they are
> handled automagically. $_SESSION['customer'] = $customer; and
> $customer = $_SESSION['customer'] should work just fine. I'm doing this
> with 4.3.2, and a casual glance at my sess_* files in /tmp shows that the
> objects are stored in serialized form and the __sleep() method is called
> the usual way.
>
> My understanding is that classes must be defined prior to unserializing an
> object if you dan't want to risk having the object becoming disassociated
> from its class, but your method above does have the advantage that you
> decide when that serialization takes places and can load the classes
> there, rather than having to do so prior to session_start().
>
> http://www.php.net/manual/en/language.oop.serialization.php
>
> ---------------------------------------------------------------------
> michal migurski- contact info and pgp key:
> sf/ca http://mike.teczno.com/contact.html
>

attached mail follows:


Wow thats strange?? I am using PHP 4.3.2 as well and I don't see that happening where
it serializes the object when assigning it to the $_SESSION. I am using the dbg
debugger and nusphere PHP editor and I can step through the code and as I do
it shows that the session var is not serialized. However when I checked the session
data in the /tmp directorie it appears to serialized

It could be that my version of PHP doesn't match the dbg version and dbg reporting back
false information (which I have to look into that). Also I checked my ini settings and
it shows the session.serialize_handler = php which should be default.

Another thing is that I didn't come accross in my reading of
http://www.php.net/manual/en/language.oop.serialization.php where it says that objects
assigned to the global $_SESSION var is automatically serialized. I did see that if you
use the session_register() function it automatically serializes but again I'd like
to avoid that.

Right now it seems I have many unkowns, so i'm going to narrow them down ....

Matt

Mike Migurski wrote:

>>$customer = new Customer($_GET['facilityID'], $_GET['customerID']);
>>$_SESSION['acceptPayment']['serializedCustomer'] = serialize($customer);
>>
>>so now when I have moved on to another page or another instance of the
>>same page and I want to access the object from the session var, I do so
>>like this:
>>
>>$customer =
>>unserialize($_SESSION['acceptPayment']['serializedCustomer']);
>>
>>and now you can access the object. There is a hidden jewl about this
>>method, I now no longer have to include or require the class file because
>>it is already defined in the serialized string.
>
>
> Really, you don't need the serialize/unserialize in there, as they are
> handled automagically. $_SESSION['customer'] = $customer; and
> $customer = $_SESSION['customer'] should work just fine. I'm doing this
> with 4.3.2, and a casual glance at my sess_* files in /tmp shows that the
> objects are stored in serialized form and the __sleep() method is called
> the usual way.
>
> My understanding is that classes must be defined prior to unserializing an
> object if you dan't want to risk having the object becoming disassociated
> from its class, but your method above does have the advantage that you
> decide when that serialization takes places and can load the classes
> there, rather than having to do so prior to session_start().
>
> http://www.php.net/manual/en/language.oop.serialization.php
>
> ---------------------------------------------------------------------
> michal migurski- contact info and pgp key:
> sf/ca http://mike.teczno.com/contact.html
>

attached mail follows:


>Wow thats strange?? I am using PHP 4.3.2 as well and I don't see that
>happening where it serializes the object when assigning it to the
>$_SESSION.

It doesn't do it when you assign it into the $_SESSION array, it does it
when the script completes and updated session data is written to the
session file. This actually caused me a lot of grief a while back, when
scripts were bombing out and session data was being lost - I ended up
writing another layer on top of the session that explicitly wrote crucial
data at critical junctures, rather than relying on the built-in support.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html

attached mail follows:


Hi Mike

Yes your right about when the session data is updated. The problem then
lies in when I try to read the object from the session var. I include at
the top of the file the class definition.

Not to get sidetracked but when you say you wrote another layer, are you
talking
about utilizing the __sleep() and __wakeup functions and then
serializing/unserializing
within those functions?

so far manually serialize-ing and unserialize-ing prior to assigning the
object and
after retrieving the object seems to work.

Matt

Mike Migurski wrote:

>>Wow thats strange?? I am using PHP 4.3.2 as well and I don't see that
>>happening where it serializes the object when assigning it to the
>>$_SESSION.
>>
>>
>
>It doesn't do it when you assign it into the $_SESSION array, it does it
>when the script completes and updated session data is written to the
>session file. This actually caused me a lot of grief a while back, when
>scripts were bombing out and session data was being lost - I ended up
>writing another layer on top of the session that explicitly wrote crucial
>data at critical junctures, rather than relying on the built-in support.
>
>
>---------------------------------------------------------------------
>michal migurski- contact info and pgp key:
>sf/ca http://mike.teczno.com/contact.html
>
>
>

attached mail follows:


Has anyone had any success with using variables in a regex shown below??

$foo = 3;
$bar = 4;
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{$foo, $bar}$/', $some_string)

or even
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar . '}$/',
$some_string)

but this would work
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{3,4}$/', $some_string)

Thanks for any pointers..

attached mail follows:


Gerard Samuel <gsamtrini0.org> wrote:
> Has anyone had any success with using variables in a regex shown below??
>
> $foo = 3;
> $bar = 4;
> preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{$foo, $bar}$/', $some_string)

You have single quotes, so php wont expand the variables inside.

>
> or even
> preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar . '}$/',
> $some_string)

that should work.

but you could do this:
$pattern = "/^[a-z0-9\-_\.]+\.[a-z0-9]{$foo, $bar}\$/";
preg_match($pattern, $some_string)

> but this would work
> preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{3,4}$/', $some_string)
>
> Thanks for any pointers..

Curt
--

attached mail follows:


Curt Zirzow wrote:

>Gerard Samuel <gsamtrini0.org> wrote:
>
>
>>or even
>>preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar . '}$/',
>>$some_string)
>>
>>
>
>that should work.
>
Unfortunately it doesn't for some reason. Don't know why.

>
>but you could do this:
>$pattern = "/^[a-z0-9\-_\.]+\.[a-z0-9]{$foo, $bar}\$/";
>preg_match($pattern, $some_string)
>
But this does, so Im good. Thanks for the tips...

attached mail follows:


Gerard Samuel a écrit:
> Curt Zirzow wrote:
>
>> Gerard Samuel <gsamtrini0.org> wrote:
>>
>>
>>> or even
>>> preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar .
>>> '}$/', $some_string)
I think, you Forgot, a \ before the $ at the end of the expression...

>>>
>>
>>
>> that should work.
>>
> Unfortunately it doesn't for some reason. Don't know why.
>
>>
>> but you could do this:
>> $pattern = "/^[a-z0-9\-_\.]+\.[a-z0-9]{$foo, $bar}\$/";
>> preg_match($pattern, $some_string)
>>
> But this does, so Im good. Thanks for the tips...
>

attached mail follows:


Hi List
Just want to make sure:

Is there no way for me to easily determine the byte size occupied by a
variable (regardless of type)?

It might be trivial, or I'm missing the point (as per usual)...

I would like to find the actual byte size that is transmitted when say a
$_POST variable is sent, or how much memory a particular variable is taking
up.

Just want to make sure. Some of the post received so far suggest that "one
character = one byte" etc, but I would love to work with something more
precise if possible, also, is a variable contains a multi-dimensional array,
would that "one character = one byte" formula still return a fair
representation?

Thanks.

attached mail follows:


Hi,

did you try count($value) and strlen($value) ?
count($value) will give size of an array, and strlen($value) size of a
string ...

Regards,
P.E. Baroiller

"Petre Agenbag" <internetvsa.co.za> a écrit dans le message de
news:GHECKHHDJAJPBIMDNCHOCEAHCAAA.internetvsa.co.za...
> Hi List
> Just want to make sure:
>
> Is there no way for me to easily determine the byte size occupied by a
> variable (regardless of type)?
>
> It might be trivial, or I'm missing the point (as per usual)...
>
> I would like to find the actual byte size that is transmitted when say a
> $_POST variable is sent, or how much memory a particular variable is
taking
> up.
>
> Just want to make sure. Some of the post received so far suggest that "one
> character = one byte" etc, but I would love to work with something more
> precise if possible, also, is a variable contains a multi-dimensional
array,
> would that "one character = one byte" formula still return a fair
> representation?
>
> Thanks.
>
>

attached mail follows:


I am new to all this, but here is the basic code:

 $link_titles = file('links/master.txt');
 $links_include = $link_titles[$point]; // path to directory
  include $links_include;

If I echo the value of $links_include just prior to the include() function
it contains what I would expect it to contain and the file does exist. But I
get an error:

Warning: main(./main/links/topsites.php ) [function.main]: failed to create
stream: No such file or directory in ..... on line 23

Warning: main() [function.main]: Failed opening './main/links/topsites.php '
for inclusion (include_path='.:/usr/local/lib/php') in .... on line 23

If I add the line:

$links_include = "path to intended include file";

just prior to the include statement it works fine.

Am I missing something? I've tried a variety of renditions of the include()
statement and can't get it to react unless I 'hard code' the value of
$links_include.

Appreciate your help!!

-Doug

attached mail follows:


Hi,

when you call your script, is $point defined somewhere ?
if $point is empty, you'll get an empty string for $links_include and
include $links_include will not work.

Regards,
P.E. Baroiller
"Dougd" <infobigfresh.com> a écrit dans le message de
news:20030716203734.44862.qmailpb1.pair.com...
> I am new to all this, but here is the basic code:
>
> $link_titles = file('links/master.txt');
> $links_include = $link_titles[$point]; // path to directory
> include $links_include;
>
> If I echo the value of $links_include just prior to the include() function
> it contains what I would expect it to contain and the file does exist. But
I
> get an error:
>
> Warning: main(./main/links/topsites.php ) [function.main]: failed to
create
> stream: No such file or directory in ..... on line 23
>
> Warning: main() [function.main]: Failed opening './main/links/topsites.php
'
> for inclusion (include_path='.:/usr/local/lib/php') in .... on line 23
>
> If I add the line:
>
> $links_include = "path to intended include file";
>
> just prior to the include statement it works fine.
>
> Am I missing something? I've tried a variety of renditions of the
include()
> statement and can't get it to react unless I 'hard code' the value of
> $links_include.
>
> Appreciate your help!!
>
> -Doug
>
>
>

attached mail follows:


yes, I should have mentioned: $point is defined in the URL string
http://something.com/index.html?point=12

"Baroiller Pierre-Emmanuel" <baroillerdaoditu.com> wrote in message
news:20030716220011.17511.qmailpb1.pair.com...
> Hi,
>
> when you call your script, is $point defined somewhere ?
> if $point is empty, you'll get an empty string for $links_include and
> include $links_include will not work.
>
> Regards,
> P.E. Baroiller
> "Dougd" <infobigfresh.com> a écrit dans le message de
> news:20030716203734.44862.qmailpb1.pair.com...
> > I am new to all this, but here is the basic code:
> >
> > $link_titles = file('links/master.txt');
> > $links_include = $link_titles[$point]; // path to directory
> > include $links_include;
> >
> > If I echo the value of $links_include just prior to the include()
function
> > it contains what I would expect it to contain and the file does exist.
But
> I
> > get an error:
> >
> > Warning: main(./main/links/topsites.php ) [function.main]: failed to
> create
> > stream: No such file or directory in ..... on line 23
> >
> > Warning: main() [function.main]: Failed opening
'./main/links/topsites.php
> '
> > for inclusion (include_path='.:/usr/local/lib/php') in .... on line 23
> >
> > If I add the line:
> >
> > $links_include = "path to intended include file";
> >
> > just prior to the include statement it works fine.
> >
> > Am I missing something? I've tried a variety of renditions of the
> include()
> > statement and can't get it to react unless I 'hard code' the value of
> > $links_include.
> >
> > Appreciate your help!!
> >
> > -Doug
> >
> >
> >
>
>

attached mail follows:


Hello All---
 
    I'm having some trouble getting PHP to communicate with my Windows 2000 MS Exchange Server... I'm running PHP 4.3.2 on a Win2000 machine serving with Apache 1.3.
 
The code I'm using is:
 
$mbox = imap_open("{x.x.x.x:143}","admin","adminpass", OP_HALFOPEN);
$err = imap_errors();
while (list($key, $val) = each($err))
    print imap_utf7_decode($val)."<br>\n";
$alrt = imap_alerts();
while (list($key, $val) = each($alrt))
    print imap_utf7_decode($val)."<br>\n";
 
This yields the error:
Warning: imap_open(): Couldn't open stream {x.x.x.x:143} in c:\apache\apache\htdocs\sdimail.php on line 11
Connection refused

If I change the imap_open command to use {x.x.x.x:143\yyyy} as the host, I get a different error:
 
Warning: imap_open(): Couldn't open stream {x.x.x.x:143\yyyy} in c:\apache\apache\htdocs\sdimail.php on line 11
Can't open mailbox {192.168.0.3:143\yyyy}: invalid remote specification

which makes me suspect that I am actually able to connect but PHP isn't finding anything it likes (what is it looking for?)
 
can anyone help me with this or at least point me towards a tutorial on using PHP with MS Exchange?
 
Thanks in advance for your help,
 
-Charlie
cvossurvdata.com

attached mail follows:


Hi...

are your sure your Exchanger server has imap enabled and port 143 is open ?
If you've got the message "connection refused", it can be :
- not imap server is running
- your login/password couple is wrong
or
- you can't connect to the port 143...

regards,
P.E. Baroiller

"Charles Vos" <CVossurvdata.com> a écrit dans le message de
news:14E783AB1B496142B8472C283202581A1DEEC9sdi_email_dr.SDI...
Hello All---

    I'm having some trouble getting PHP to communicate with my Windows 2000
MS Exchange Server... I'm running PHP 4.3.2 on a Win2000 machine serving
with Apache 1.3.

The code I'm using is:

$mbox = imap_open("{x.x.x.x:143}","admin","adminpass", OP_HALFOPEN);
$err = imap_errors();
while (list($key, $val) = each($err))
    print imap_utf7_decode($val)."<br>\n";
$alrt = imap_alerts();
while (list($key, $val) = each($alrt))
    print imap_utf7_decode($val)."<br>\n";

This yields the error:
Warning: imap_open(): Couldn't open stream {x.x.x.x:143} in
c:\apache\apache\htdocs\sdimail.php on line 11
Connection refused

If I change the imap_open command to use {x.x.x.x:143\yyyy} as the host, I
get a different error:

Warning: imap_open(): Couldn't open stream {x.x.x.x