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-help_at_lists.php.net
Date: Thu Jul 25 2002 - 08:23:07 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    php-general Digest 25 Jul 2002 13:23:07 -0000 Issue 1485

    Topics (messages 109396 through 109490):

    Re: HTTP_POST_FILES undefined - What happen?
            109396 by: Dave [Hawk-Systems]
            109406 by: Rija

    Re: Trouble with \
            109397 by: John Holmes

    Re: Speeding up PHP or MySQL
            109398 by: John Holmes

    datetime field - still a newbie
            109399 by: Alexander Ross
            109405 by: David Freeman
            109453 by: John Holmes

    Re: best way to log bad email address'
            109400 by: Mike Mannakee
            109434 by: Miguel Cruz
            109448 by: Justin French

    Re: date
            109401 by: John Holmes

    Re: How do I validate input using php?
            109402 by: Mike Mannakee
            109437 by: Miguel Cruz

    Strange problem with objects
            109403 by: Evan
            109404 by: Evan

    web page function
            109407 by: Steve Minter
            109408 by: David Buerer
            109409 by: Tech Support

    Grab value of mail headers
            109410 by: Nicklas af Ekenstam
            109415 by: Jason Wong
            109417 by: Michael Sims

    newline problem
            109411 by: Wormy .
            109413 by: Jason Wong
            109423 by: Justin French

    Re: modify an element of a HTML tag within a string
            109412 by: Analysis & Solutions

    Re: vertical word match SOLUTION
            109414 by: Analysis & Solutions

    Re: POST question
            109416 by: Analysis & Solutions

    Re: CRLF Injection in mail()
            109418 by: Analysis & Solutions

    Newman's PHP sessions management.
            109419 by: Philip J. Newman
            109420 by: Richard Baskett
            109424 by: Justin French

    Password Generator Script
            109421 by: Monty
            109422 by: Richard Baskett
            109433 by: Liam MacKenzie

    Re: Php and Apache
            109425 by: S.Murali Krishna

    install issues on Solaris
            109426 by: Peter
            109435 by: Peter
            109454 by: David Robley

    mail() function
            109427 by: wm
            109428 by: Peter

    Re: Sessions don't work?
            109429 by: Lord Loh.

    Facing some problem with mySQL Installation
            109430 by: Manisha
            109444 by: S.
            109445 by: S.

    The page before for newman.
            109431 by: Philip J. Newman
            109432 by: Miguel Cruz
            109446 by: Justin French

    Newman Asks, Do i have to use session_name('sid') every ...
            109436 by: Philip J. Newman
            109438 by: Richard Baskett
            109439 by: Philip J. Newman
            109450 by: Justin French

    Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0
            109440 by: Miguel Cruz

    Re: PHP Security Advisory: Vulnerability in PHP versions4.2.0 and 4.2.1
            109441 by: Miguel Cruz

    Image Resizing
            109442 by: Nicholas Mercier

    Follow Up
            109443 by: Nicholas Mercier

    Re: Accessing upper directory of public_html directory
            109447 by: Miguel Cruz

    Re: control structure question
            109449 by: Miguel Cruz

    Re: can there be a fax gateway?
            109451 by: Miguel Cruz

    NT2000 ARGH!
            109452 by: Francis
            109459 by: Francis

    Re: [PHP-DB] Re: arrays, variables, and register_globals
            109455 by: David Robley

    testing
            109456 by: lallous
            109458 by: lallous

    include() limits
            109457 by: lallous
            109461 by: Jason Wong

    Re: preview an html file.
            109460 by: Alia Mikati
            109462 by: lallous

    uploading pictures
            109463 by: Oliver Witt
            109464 by: Alexander Kuznetsov
            109468 by: Alexander Kuznetsov

    Reg exp to remove line feeds before lines starting with white space
            109465 by: Nicklas af Ekenstam
            109479 by: lallous

    pop3 authentication
            109466 by: Henry

    Applying XSL to XML with PHP
            109467 by: ctan
            109480 by: Peter Clarke
            109482 by: Peter Clarke

    timing header("Location: " )
            109469 by: JJ Harrison
            109470 by: Rnald CASAGRAUDE

    PHP extension names
            109471 by: Peter
            109472 by: lallous

    Re: Creating a calender / diary
            109473 by: lallous

    preg_match() occurence position
            109474 by: lallous
            109475 by: Jason Wong
            109476 by: Alexander Kuznetsov
            109477 by: John Holmes
            109478 by: David Robley
            109481 by: lallous
            109484 by: Michael Sims
            109486 by: Tim Fountain
            109488 by: Justin French

    Re: Newman Asks, List Asks ...
            109483 by: Jay Blanchard

    Re: How to store an image into a mysql database using php language?
            109485 by: lallous

    Re: PHP 4.2.2 install woe: cannot stat libs/libphp.so
            109487 by: Reuben D. Budiardja

    automatic job execution
            109489 by: Paul O'Neil
            109490 by: Scott

    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:


    >Thought I turned on register_globals on in the php.ini, my server
    >didn't know the HTTP_POST_FILES.
    >
    >echo $HTTP_POST_FILES[$file]['type'] ;
    >
    >echo $HTTP_POST_FILES[$file]['name'] ;
    >
    >echo $HTTP_POST_FILES[$file]['size'] ;
    >
    >I've always get these messages:
    >
    >PHP Warning: Undefined variable: HTTP_POST_FILES in
    >c:\inetpub\wwwroot\ohabolana\scripts\sary_vaovao.inc on line 4 PHP
    >Warning: Undefined variable: HTTP_POST_FILES in
    >c:\inetpub\wwwroot\ohabolana\scripts\sary_vaovao.inc on line 5 PHP
    >Warning: Undefined variable: HTTP_POST_FILES in
    >c:\inetpub\wwwroot\ohabolana\scripts\sary_vaovao.inc on line 6

    first, you are uploading the file to this page correct?

    perhaps a bit of code showing your file handling?

    FYI/

    depending on version you can use $_FILES for short

    if register globals is on you can refer to the files as the form field name for
    your file upload
            $upfile[$i]
            $upfile_name[$i]
            $upfile_type[$i]
            $upfile_size[$i]

    you may wish to reconsider globals defaulting to on though, (see security
    section on file uploads) also check to see that the file was indeed uploaded...
    features.file-upload

    attached mail follows:


    Thanks all,

    This is the correct script :

    Function verify($file) {
    GLOBAL $HTTP_POST_FILES ;
    echo $HTTP_POST_FILES['file']['type'] ;

    echo $HTTP_POST_FILES['file']['name'] ;

    echo $HTTP_POST_FILES['file']['size'] ;

    ...

    }

    I forgot to put the GLOBAL in the front of the function. Now, my script work
    well.

    Ravelomanana Rija
    rijavatu.com
    BP 1528 Port Vila
    Vanuatu
    ----- Original Message -----
    From: "Tom Rogers" <trogerskwikin.com>
    To: "Tom Rogers" <trogerskwikin.com>
    Cc: "Rija" <rijavatu.com>; "PHP-General" <php-generallists.php.net>
    Sent: Thursday, July 25, 2002 12:19 PM
    Subject: Re[2]: [PHP] HTTP_POST_FILES undefined - What happen?

    > Hi,
    >
    > Thursday, July 25, 2002, 11:15:33 AM, you wrote:
    > TR> Hi,
    >
    > TR> Thursday, July 25, 2002, 10:39:08 AM, you wrote:
    > R>> Hi all,
    >
    > R>> Thought I turned on register_globals on in the php.ini, my server
    didn't know the HTTP_POST_FILES.
    >
    > R>> echo $HTTP_POST_FILES[$file]['type'] ;
    >
    > R>> echo $HTTP_POST_FILES[$file]['name'] ;
    >
    > R>> echo $HTTP_POST_FILES[$file]['size'] ;
    >
    > R>> I've always get these messages:
    >
    > R>> PHP Warning: Undefined variable: HTTP_POST_FILES in
    c:\inetpub\wwwroot\ohabolana\scripts\sary_vaovao.inc on line 4 PHP Warning:
    Undefined variable: HTTP_POST_FILES in
    > R>> c:\inetpub\wwwroot\ohabolana\scripts\sary_vaovao.inc on line 5 PHP
    Warning: Undefined variable: HTTP_POST_FILES in
    c:\inetpub\wwwroot\ohabolana\scripts\sary_vaovao.inc on line 6
    >
    > R>> Any suggestions ?
    >
    > R>> Ravelomanana Rija
    > R>> rijavatu.com
    > R>> BP 1528 Port Vila
    > R>> Vanuatu
    >
    > TR> If they are being used in a function you will need to do:
    > TR> function whatever(){
    > TR> global $HTTP_POST_VARS;
    > TR> .
    > TR> .
    > TR> .
    > TR> }
    >
    > TR> Just a guess :)
    >
    >
    > TR> --
    > TR> Best regards,
    > TR> Tom
    >
    >
    >
    > sorry that should have been
    > global $HTTP_POST_FILES;
    >
    > --
    > Best regards,
    > Tom
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >

    attached mail follows:


    > > Try this function:
    > > http://www.php.net/manual/en/function.stripslashes.php
    >
    > Oddly enough, as I told John, I did that as well and it doesn't work.

    Are the \ there to escape anything, like ' or " or are they just in
    there by themselves..as a delimiter or something. If the \ is by itself,
    then stripslashes() won't do anything to it. Maybe you should just try

    $newtext = str_replace("\","",$old_text);

    Without seeing a sample of your file and some more information, all I
    can give is "snooty" answers, evidently.

    ---John Holmes...

    attached mail follows:


    > Is there anyways to speed up MySQL queries? Or showing the results
    > through
    > PHP? I have several queries that have about 8 left joins or so.. Yes
    very
    > huge and when you have lots of people using these functions at once it
    > really slows down.. Are there any practices that you can think of that
    > would
    > speed up any sql queries? I was thinking of using stored procedures,
    but
    > after a bit of research I found ou= t that MySQL doesn=B9t have that
    yet
    > so
    > that's a no go :( Or is there a way of storing common query results?
    I
    > am
    > looking for _anything_ that will speed up showing results to large
    > queries..

    How about an index on your tables?

    ---John Holmes...

    attached mail follows:


    I have a datetime field in one of my mysql tables...when displaying some of
    my records I want to display the date in the aforementioned datetime field,
    but if the date is today I want to display "today" instead. If the date is
    yesterday I want it to display that .... so I how do I compare the date in
    my record to todays date? Thanks

    Alex

    attached mail follows:


    > I have a datetime field in one of my mysql tables...when
    > displaying some of
    > my records I want to display the date in the aforementioned
    > datetime field,
    > but if the date is today I want to display "today" instead.
    > If the date is
    > yesterday I want it to display that .... so I how do I
    > compare the date in
    > my record to todays date? Thanks

    First up, extract your date as part of your query in a standard format -
    if you're looking to do date manipulations you're probably going to be
    benefit from extracting it as a unix timestamp.

    Once you've got your date information, along with whatever else you're
    extracting, you can then process it in php.

    You'll most likely have some sort of while() loop to increment through
    your query data.

    While you're incrementing through you can do an test the date
    information against "today" and "yesterday". Have a read of the php
    manual for date() and mktime() as you'll almost certainly need to use
    these two functions.

    Basically what you'll need to do is test to see if the date information
    from your database query is the same as your date information based on
    working out what "today" or "yesterday" are when expressed in the same
    format as the date information from your database.

    The rest is pretty much display stuff - substitute date information for
    appropriate words as required.

    Hope that heads you in the right direction.

    CYA, Dave

    attached mail follows:


    > I have a datetime field in one of my mysql tables...when displaying
    some
    > of
    > my records I want to display the date in the aforementioned datetime
    > field,
    > but if the date is today I want to display "today" instead. If the
    date
    > is
    > yesterday I want it to display that .... so I how do I compare the
    date in
    > my record to todays date? Thanks

    I posted this response earlier...did you get it? Are you looking for a
    MySQL solution or a PHP solution??

    SELECT IF(TO_DAYS(CURDATE()) =
    TO_DAYS(date_column),'Today',IF(TO_DAYS(CURDATE())-1 =
    TO_DAYS(date_column),'Yesterday',date_column)) FROM your_table;

    If you want a PHP solution, then just select the regular MySQL date
    format YYYYMMDD and use something like this when looping through your
    results.

    switch($your_row['Date_Column'])
    {
      case date("Ymd"):
        echo "Today";
        break;
      case date("Ymd",strtotime("-1 day")):
        echo "Yesterday";
        break;
      default:
        echo $your_row['Date_Column'];
    }

    Untested code, of course...

    ---John Holmes...

    attached mail follows:


    You'll have to make sure that your headers include a reply-to email address.
    Also set up with your server administrator that the outgoing emails from
    your site have a correct sender. The mail function's return value only
    tells you that it made it to the outgoing mail server. That the server
    actually sends it is completely unverified. You could try setting up an
    IMAP function that logs onto the mail server and collects the returned mails
    for you, automatically deleting them from your database, but I wouldn't have
    that run for at least 24 hours after the mail is sent, to make certain to
    catch the returns.

    Mike

    "Justin French" <justinindent.com.au> wrote in message
    news:B9658F22.B426%justinindent.com.au...
    > Hi,
    >
    > what's the best way to log the bad email address' from a mail() loop?
    >
    > my guess is:
    >
    > <?
    > $log = '';
    > $to = 'memy.com';
    > $subj = 'foo';
    > $msg = 'blah';
    > $head = 'From: memy.com';
    >
    > if(!mail($to,$sub,$msg,$head))
    > {
    > $log .= "{$to}\n";
    > }
    >
    > // write $log to screen, or to a file
    > ?>
    >
    > But I'm interested in people's experience with what mail() returns:
    > From the manual:
    > "mail() returns TRUE if the mail was successfully accepted for delivery,
    > FALSE otherwise."
    >
    > Is the definition of "accepted for delivery" dependent on each server, or
    is
    > there are general definition of what it means?
    >
    > ie, when am I likely to get a returned value of FALSE?
    >
    >
    > Also, I'm on a shared server. Is there any way I can specify the email
    > address that bounces return to with either an ini_set or with an email
    > header?
    >
    > Because my assumption is that there will be email address' that return
    TRUE,
    > but later bounce.
    >
    > Can't see what it might be in the php.ini file though.
    >
    >
    > Thanks in advance,
    >
    > Justin French
    >

    attached mail follows:


    On Thu, 25 Jul 2002, Justin French wrote:
    > what's the best way to log the bad email address' from a mail() loop?
    >
    > >From the manual:
    > "mail() returns TRUE if the mail was successfully accepted for delivery,
    > FALSE otherwise."
    >
    > Is the definition of "accepted for delivery" dependent on each server, or is
    > there are general definition of what it means?

    In almost every case, mail() will return true, regardless of how bogus the
    destination email address is.

    mail() just dumps it into the mail queue. There's a lot that goes on
    between there and delivery, and mail() doesn't wait around.

    You'll need to catch bounces as they come in. To make life easier, assign
    your own unique Message-IDs and remember them, so you can easily
    invalidate addresses.

    miguel

    attached mail follows:


    on 25/07/02 5:37 PM, Miguel Cruz (mncstoic.net) wrote:

    > In almost every case, mail() will return true, regardless of how bogus the
    > destination email address is.
    >
    > mail() just dumps it into the mail queue. There's a lot that goes on
    > between there and delivery, and mail() doesn't wait around.

    That's what I figured/feared :)

    > You'll need to catch bounces as they come in. To make life easier, assign
    > your own unique Message-IDs and remember them, so you can easily
    > invalidate addresses.

    Erm, I'm on a shared server, so I don't *think* it's that easy unfortunately
    -- I can't get a message to bounce to the From: or Reply-To: headers I set.
    My guess is it goes to an address set in php.ini, or somewhere else, and is
    global to the entire server (doesn't help me).

    Unless I can set it was .htaccess or ini_set().

    TIA

    Justin French

    attached mail follows:


    > I am not sure it works, since isn't tested, but here we go. It's
    pure
    > Mysql, and it would be probaly easier, faster, and more readable to do
    > with
    > PHP mixed. But where's the fun of it? ;-)
    >
    > date_field is the name of your date column.
    >
    > $sql = "SELECT IF(DAYOFMONTH(date_field) = DAYOFMONTH(CURRENT_DATE),
    > 'Today', IF (date_field = DATE_SUB(date_field, INTERVAL 1 DAYS),
    > 'Yesterday', date_field)) FROM table"....

    I don't think you want DAYOFMONTH. Otherwise if today is July 24th, then
    a date column with June 24th, or any 24th, will come up as Today.

    Something like this will work, though...

    SELECT IF(TO_DAYS(CURDATE()) =
    TO_DAYS(date_column),'Today',IF(TO_DAYS(CURDATE())-1 =
    TO_DAYS(date_column),'Yesterday',date_column)) FROM your_table;

    Hope that helps...

    ---John Holmes...

    > Julio Nobrega
    > Pode acessar:
    > http://www.inerciasensorial.com.br
    >
    >
    > "Alexander Ross" <alexrossbleen.net> escreveu na mensagem
    > news:20020724203928.45708.qmailpb1.pair.com...
    > > I have a column in one of my mysql tables which holds the date &
    time
    > that
    > > the record was inserted. When I run a query later on I want to
    display
    > the
    > > date, but if the date is today or yesterday I want to display
    "today" or
    > > "yesterday" instead .. how do i compare to stored date with todays
    date?
    > > todays date -1? Thanks
    > >
    > >
    >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Here's the code I use to validate emails:

    function check_email($email)
     {
      global $email;
      $regex="^([a-z0-9_]|\\-|\\.)+(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$";
      return eregi($regex, $email, $trash);
     }

    Hope this helps,

    Mike

    "Ystein HLand" <molenmbox302.swipnet.se> wrote in message
    news:20020724224014.62119.qmailpb1.pair.com...
    > I've tried a function like this:
    > function validate() { //
    > if ( is_numeric($input1) && is_numeric($input2) && ctype_alpha($input3) &&
    > ctype_alpha($input4) )
    > return true;
    > }
    >
    >
    > And then I call the function:
    >
    > if (validate() == false) {
    > some action;
    > }
    >
    > My problem is I get the action every time, even though the input is of the
    > right type. And, is ctype_alpha() the only way to check for only
    alphabetic
    > characters?
    > And (this started with one question), anyone got a good solution on
    > validating email-adresses with php?
    >
    >

    attached mail follows:


    On Wed, 24 Jul 2002, Mike Mannakee wrote:
    > Here's the code I use to validate emails:
    >
    > function check_email($email)
    > {
    > global $email;
    > $regex="^([a-z0-9_]|\\-|\\.)+(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$";
    > return eregi($regex, $email, $trash);
    > }

    Please search the archives on this topic; it's been covered exhaustively,
    and each time it comes up we get 25 bad functions and eventually one good
    one. The above function will bark at valid domains (.museum, etc.) and
    will allow patently invalid domains (anything containing _).

    miguel

    attached mail follows:


    Hey all,

    I'm having a strange problem with objects that I'm hoping someone out there can
    help me track down. I'll give a run down of the setup here, please note that
    register_globals is off.

    A page creates two objects.

    $document - this is always a new object and uses the ob_ functions to control
    the output. ob_start is called with a customer callback that writes the output
    to a file based on $_SERVER variables.

    $session - this is an object that gets serialized whenever a request finishes
    and unserialized when the request begins.

    Each object uses register_shutdown_function(array($this, "desconstructor")) to
    set a hook to clean up after itself which works without problems.

    The following is then set.
    $document->session =& $session;
    $session->document =& $document;

    Everything works fine through out the page all properties of the session can be
    accessed and set via $session->whatever or $document->session->whatever and vice
    versa for the $document object.

    The problem arises when the $document->deconstructor function is called. As
    described above the ob_ callback fires and properly writes the captured output
    to a file then calls ob_end_clean() to dump the buffer and returns nothing, then
    right after the deconstructor function is called which does the following:
    include("a header file.php");
    include("the temp file from ob_");
    include("a footer file.php");
    unlink("the temp file from ob_");

    Now this works beautifully, except that some of the object properties get
    destoryed. For instance since the includes are called from
    $document->deconstructor it makes sense that $this should reference the document
    object and that $this->session should reference the session object, but the
    following happens. In the file I have this:

    $this is a <?=get_class($this)?><br>
    $tihs->session is a <?get_class($this->session)?><br>

    Which returns:

    $this is a rj_document
    $this->session is a

    Now I thought that it might be because the session object is destroyed before
    the document object fires its deconstructor call so when the objects are
    associated I changed the document line to be:
    $document->session = $session
    But I get the same results.

    Anyone have any insight?

    Thanks,
    Evan

    attached mail follows:


    Never mind, I just found and exceptable work around.
    $GLOBALS["session"] & $GLOBALS["document"] contain the objects.

    (and after all that typing :)

    -Evan

    On Wed, Jul 24, 2002 at 10:21:32PM -0400, Evan said:

    > Hey all,
    >
    > I'm having a strange problem with objects that I'm hoping someone out there can
    > help me track down. I'll give a run down of the setup here, please note that
    > register_globals is off.
    >
    > A page creates two objects.
    >
    > $document - this is always a new object and uses the ob_ functions to control
    > the output. ob_start is called with a customer callback that writes the output
    > to a file based on $_SERVER variables.
    >
    > $session - this is an object that gets serialized whenever a request finishes
    > and unserialized when the request begins.
    >
    > Each object uses register_shutdown_function(array($this, "desconstructor")) to
    > set a hook to clean up after itself which works without problems.
    >
    > The following is then set.
    > $document->session =& $session;
    > $session->document =& $document;
    >
    > Everything works fine through out the page all properties of the session can be
    > accessed and set via $session->whatever or $document->session->whatever and vice
    > versa for the $document object.
    >
    > The problem arises when the $document->deconstructor function is called. As
    > described above the ob_ callback fires and properly writes the captured output
    > to a file then calls ob_end_clean() to dump the buffer and returns nothing, then
    > right after the deconstructor function is called which does the following:
    > include("a header file.php");
    > include("the temp file from ob_");
    > include("a footer file.php");
    > unlink("the temp file from ob_");
    >
    > Now this works beautifully, except that some of the object properties get
    > destoryed. For instance since the includes are called from
    > $document->deconstructor it makes sense that $this should reference the document
    > object and that $this->session should reference the session object, but the
    > following happens. In the file I have this:
    >
    > $this is a <?=get_class($this)?><br>
    > $tihs->session is a <?get_class($this->session)?><br>
    >
    > Which returns:
    >
    > $this is a rj_document
    > $this->session is a
    >
    >
    > Now I thought that it might be because the session object is destroyed before
    > the document object fires its deconstructor call so when the objects are
    > associated I changed the document line to be:
    > $document->session = $session
    > But I get the same results.
    >
    >
    > Anyone have any insight?
    >
    >
    > Thanks,
    > Evan
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >

    attached mail follows:


    I am tring to refer to a web page using a function. What function refers to a web page?
    example: if (page=index.php)
    {
    print $something
    }

    What function should "page" be?

    Thanks

    Steve

    attached mail follows:


    Try This

    if(strtoupper($REQUEST_URI)=='INDEX.PHP')
    {
      ...statements...
    }
    ----- Original Message -----
    From: "Steve Minter" <sminterhouston.rr.com>
    To: <php-generallists.php.net>
    Sent: Wednesday, July 24, 2002 7:50 PM
    Subject: [PHP] web page function

    I am tring to refer to a web page using a function. What function refers to
    a web page?
    example: if (page=index.php)
    {
    print $something
    }

    What function should "page" be?

    Thanks

    Steve

    attached mail follows:


    Hi Steve,

    try this:

    if (basename($SCRIPT_NAME) == "index.php")
        print "some silly message";

    Jim Grill
    Support
    Web-1 Hosting
    http://www.web-1hosting.net
    ----- Original Message -----
    From: "Steve Minter" <sminterhouston.rr.com>
    To: <php-generallists.php.net>
    Sent: Wednesday, July 24, 2002 9:50 PM
    Subject: [PHP] web page function

    I am tring to refer to a web page using a function. What function refers to
    a web page?
    example: if (page=index.php)
    {
    print $something
    }

    What function should "page" be?

    Thanks

    Steve

    attached mail follows:


    Hi

    Could someone please enlighten me on a good way to grab the value for
    a given mail header once I've fetched the entire headers to a string
    using php:s imap_fetchheader() function?

    For an example I would like to look for a header called List-Id which
    may look like this:

    List-Id: <php-general.lists.php.net>

    And grab the value - <php-general.lists.php.net> - into a variable to
    use later on in my script.

    Bonus points if you could tell me a way to parse the entire headers
    into something useful like a set of key, value pairs using the header
    name as key and the value as value.

    Tia,
    Nicklas

    attached mail follows:


    On Thursday 25 July 2002 11:47, Nicklas af Ekenstam wrote:
    > Hi
    >
    > Could someone please enlighten me on a good way to grab the value for
    > a given mail header once I've fetched the entire headers to a string
    > using php:s imap_fetchheader() function?
    >
    > For an example I would like to look for a header called List-Id which
    > may look like this:
    >
    > List-Id: <php-general.lists.php.net>
    >
    > And grab the value - <php-general.lists.php.net> - into a variable to
    > use later on in my script.

    You can preg_match(). Or you can probably use explode() with ': ' as the
    separator.

    > Bonus points if you could tell me a way to parse the entire headers
    > into something useful like a set of key, value pairs using the header
    > name as key and the value as value.

    Once you've got one header working use a loop.

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

    /* We must believe that it is the darkest before the dawn of a beautiful new world. We will see it when we believe it. -- Saul Alinsky */

    attached mail follows:


    On Thu, 25 Jul 2002 05:47:57 +0200, you wrote:

    >Bonus points if you could tell me a way to parse the entire headers >into something useful like a set of key, value pairs using the header >name as key and the value as value.

    $lines = split("\r?\n",$headerstring);

    foreach($lines as $line) { if(preg_match("/^([^:]+):\s*(.*)$/",$line,$matches)) { $headers[$matches[1]] = $matches[2]; } }

    I think IMAP headers are split on newlines only, but I don't know if some Windoze servers (such as Exchange) put CRLF in there or not. The regex above should work, assuming that everything before the first colon is the header name and everything after it is the value. I haven't read the RFC in detail so there may be a better pattern to match against than the one above. That is assuming that the above pattern works, I haven't tested it. HTH.

    attached mail follows:


    Dear all, this sounds like a silly problem but i really dunno how to fix it!

    In the php manual on php.net said we can use an embedded newline just by writing the string on different line by pressing "enter" key. This doesn't work for me. Another thing is \n also work. For example:

    <?php echo ' You can also have embedded newlines in strings, like this way.'; echo 'I am trying to include at this point: \n a newline'; ?>

    the output i get is: "You can also have embedded newlines in strings, like this way.I am trying to include at this point: \n a newline"

    Am I doing anything wrong? Thanks!

    Ser Yee

    _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com

    attached mail follows:


    On Thursday 25 July 2002 12:11, Wormy . wrote: > Dear all, > this sounds like a silly problem but i really dunno how to fix it! > > In the php manual on php.net said we can use an embedded newline just > by writing the string on different line by pressing "enter" key. This > doesn't work for me. Another thing is \n also work. For example: > > <?php > echo ' You can also have embedded newlines in strings, > like this way.'; > echo 'I am trying to include at this point: \n a newline'; > ?> > > the output i get is: > "You can also have embedded newlines in strings, like this way.I am trying > to include at this point: \n a newline" > > Am I doing anything wrong? Thanks!

    Stuff like \n are only interpreted if they are enclosed in double-quotes:

    "This works\n" 'This does not work\n'

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

    /* Iron Law of Distribution: Them that has, gets. */

    attached mail follows:


    A new line is NOT a <br> or <br /> in HTML.

    Assuming this output is for HTML (browser) purposes, the browser will ignore newlines.

    <?php echo 'this is first line<br>second line<br>third line'; // works for HTML ?> Will print...

    this is first line second line third line

    ... to the browser.

    If you have a $string with \n's in it, you can convert these to <br />'s with the function nl2br():

    <? // with newlines typed in, will work in email and text files: $string = 'this is first line\nsecond line\nthird line';

    // convert \n's to <br>'s for HTML output $string_html = nl2br($string);

    // newlines done with hitting return will work in email and txt files $string = 'this is first line second line third line';

    // convert \n's to <br>'s for HTML output $string_html = nl2br($string);

    ?>

    Think about it -- this HTML...

    <P> something something something </P>

    ... will output somethingsomethingsomething to the browser, because browsers ignore newlines, tabs, and other whitespace in text. On the other hand, this HTML...

    <P> something<br> something<br> something </P>

    ... would achieve three separate lines, so you need to do the same thing when echoing.

    HTH

    Justin French

    on 25/07/02 2:11 PM, Wormy . (w_lsyhotmail.com) wrote:

    > Dear all, > this sounds like a silly problem but i really dunno how to fix it! > > In the php manual on php.net said we can use an embedded newline just > by writing the string on different line by pressing "enter" key. This > doesn't work for me. Another thing is \n also work. For example: > > <?php > echo ' You can also have embedded newlines in strings, > like this way.'; > echo 'I am trying to include at this point: \n a newline'; > ?> > > the output i get is: > "You can also have embedded newlines in strings, like this way.I am trying > to include at this point: \n a newline" > > Am I doing anything wrong? Thanks! > > Ser Yee > > _________________________________________________________________ > Join the worlds largest e-mail service with MSN Hotmail. > http://www.hotmail.com >

    attached mail follows:


    Hi Justin:

    On Fri, Jul 19, 2002 at 01:50:08PM +1000, Justin French wrote: > > 1. look for a given tag eg DIV > 2. capture the tag (everything from '<DIV' up to the '>') > 3. look for a given attribute (eg ID="foo", ID=foo, ID='foo' -- all valid > ways) > 4. capture it > 5. be given the opportunity to manipulate the attribute's value, delete it, > etc > 6. place captured tag (complete with modifed elements) back into the string > in it's original position > 7. return to step 1, looking for the next occurence of a DIV tag

    This can be done with preg_replace() and a function. Here are some variations on such an expression / function combo.

    <?php

    $Val = 'begin <div> middle <div id="idattr"> end';

    function alter($var) { return "_$var" . '_'; }

    # To grab all attributes... $Out = preg_replace('/((<div)([^>]*))/i', '\\2' . alter("\\3"), $Val); # \\1 contains whole match # \\2 contains tag type # \\3 contains attributes

    echo htmlspecialchars($Out);

    echo '<hr />';

    # To grab just the id attribute... $Out = preg_replace('/((<div) ?(id=(?:"|\')([^\'"]*)(?:"|\'))*)/i', '\\2' . alter("\\4"), $Val); # \\2 contains tag type # \\3 contains whole id attribute statement # \\4 contains the attribute value

    echo htmlspecialchars($Out);

    ?>

    Of course, be a good hacker and modify it to suit your actual needs. :)

    Enjoy,

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    Hi Joe:

    On Fri, Jul 19, 2002 at 12:50:53PM -0500, 'Joe Rice' wrote: > > $answer = "hello\na\np\np\nl\ne\n"; /*from textarea in form*/ > /* replace all whitespace and newlines with nothing */ > $tempanswer = preg_replace("/\s*|\n*/","",$answer);

    Easier:

    $tempanswer = preg_replace('/\s/', '', $answer);

    The \s includes all white space, including line breaks. You don't need the *'s in there because all of them get replaced anyway.

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    Jadiel:

    On Sat, Jul 20, 2002 at 12:58:25AM -0500, Jadiel Flores wrote:

    > header("Location: computer.php");

    Do note, proper syntax uses complete URI's, not just the page name. Also, you can do this with single quotes.

    header('Location: http://www.foo.org/computer.php');

    Enjoy,

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    John:

    On Fri, Jul 19, 2002 at 11:19:59PM -0400, John Holmes wrote: > Maybe I'm behind the times, but I just found out about this one today. > Basically if a user can take your form that sends an email, and send a > value like "This is my subject\nBcc: myemailmyisp.com" for the subject, > then they will get Bcc'd on every email your script later sends.

    Well, as mentioned by others, not every email, just the one being sent at that time. But, more importantly, folks can put in other people's addresses into the Bcc and spam them all using your resources. This has already been exploited on some web to mail forms.

    My email form functions check user input for unwanted characters, including \r and \n via ereg. If any are found, they're removed and the form is redisplayed saying they can't use such characters.

    Later,

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    One question.

    When i start a new session i get the veriable PHPSESSID=what ever added to links that I want PHPSESSID to be called sid. How can i do this?

    ---
    Philip J. Newman.
    PhilipNZ.com Design Solutions
    http://www.philipnz.com/
    infophilipnz.com
    

    Mob: +64 (25) 6144012. Tele: +64 (25) 6144012.

    Personal Site: Philip J. Newman Internet Developer http://www.philipsdomain.com/ newmanpjphilipsdomain.com

    attached mail follows:


    You can either change it in your php.ini file or using the session_name() function

    Rick

    "The greater danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it." - Michelangelo

    > From: "Philip J. Newman" <phpphilipnz.com> > Date: Thu, 25 Jul 2002 16:41:07 +1200 > To: <php-generallists.php.net> > Subject: [PHP] Newman's PHP sessions management. > > One question. > > When i start a new session i get the veriable PHPSESSID=what ever added to > links that I want PHPSESSID to be called sid. How can i do this? > > --- > Philip J. Newman. > PhilipNZ.com Design Solutions > http://www.philipnz.com/ > infophilipnz.com > > Mob: +64 (25) 6144012. > Tele: +64 (25) 6144012. > > Personal Site: > Philip J. Newman > Internet Developer > http://www.philipsdomain.com/ > newmanpjphilipsdomain.com > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    session_name()

    JF

    on 25/07/02 2:41 PM, Philip J. Newman (phpphilipnz.com) wrote:

    > One question. > > When i start a new session i get the veriable PHPSESSID=what ever added to > links that I want PHPSESSID to be called sid. How can i do this? > > --- > Philip J. Newman. > PhilipNZ.com Design Solutions > http://www.philipnz.com/ > infophilipnz.com > > Mob: +64 (25) 6144012. > Tele: +64 (25) 6144012. > > Personal Site: > Philip J. Newman > Internet Developer > http://www.philipsdomain.com/ > newmanpjphilipsdomain.com > > >

    attached mail follows:


    Can anyone recommend where I could find a decent script that automatically generates passwords? I don't care if they are readable or just random letters, numbers.

    Thanks!

    attached mail follows:


    Credits are with the file. Cheers!

    Rick

    "Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." - Ralph Waldo Emerson

    > From: Monty <monty3hotmail.com> > Date: Thu, 25 Jul 2002 00:49:17 -0400 > To: php-generallists.php.net > Subject: [PHP] Password Generator Script > > Can anyone recommend where I could find a decent script that automatically > generates passwords? I don't care if they are readable or just random > letters, numbers. > > Thanks! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    I )U#y">*U:Q g8xNv9<pƣS;G0*UDGKsD.~n :Z͇l=?!ZM%>dVۋ4+7eT>'J۞5~ьڒzgV; dBgaU_d\Ժ˭JfQW] XFw^ sՓSzt>sn<{PZ:0v5waaRhpSOh83N[M7ӁTz_a Y^zR"W=ۅlEpCL"%8(<wȴ˔6$eAO&”R" ] - qZD(W ZxռY1"ĂYaj^ ZWa<K_AJe,H|y]N)'^ }f^ ZdIHR1ׁg/3}D4:d=8KW`^ 䉾TA!(,WQǧ=[+z%hwv|wM<h5-]+]x`N|)b*A vAj A ?Nߤ/$oL CDȐ(:d)Tr-chɶ#y4T[Hh mJޮQ SbmY|B \ ppkNRJm 7f=T&HOm`)<-6ݞnb~W(g`Å;)yՁ7p #` L+ W5SnӆЗa.PW\WaT̉t"t4̆N/Dk_JuiYfyr9|Nc$-D7\\W[_FF'$_"_E{kwiXnߕR: _J}GfC+Pxt{Ewp.ê.)>di9TjUg"6&eeDbx-0(ѣ}yyVK ~%KKG`B6Y.ъ&J]!йp OC!=8ɌCI<IEr>!eZ[ W}Sy Om+3Twr% AzEK jUV}e9V% :l8<xXFܻws]3Nޥ,Mm7}&WTZLeG)fJb^g<1"f?ʜ^C?o(6n+hW:ػ_NeL}1\,5jjjjjW7RK

    attached mail follows:


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

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

    In action: http://scripts.operationenigma.net/passgen.php

    Have fun :-)

    ----- Original Message ----- From: "Monty" <monty3hotmail.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 2:49 PM Subject: [PHP] Password Generator Script

    > Can anyone recommend where I could find a decent script that automatically > generates passwords? I don't care if they are readable or just random > letters, numbers. > > Thanks! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    On Wed, 24 Jul 2002, Varsha Agarwal wrote:

    >Hi, >I have istalled php from the red hat cd at the time i >installed red hat itself. I downloaded apache and >installed it. Can anyone tell me how to configure php >on apache server? I mean what do I do next to run php >scripts? I am totally new to all this. Please help. >-Varsha

    If you installed php from redhat CD, then why not apache. The Apache rpm in redhat 7.3 comes as precompiled support for Dynamic shared object so there is no need for doing anything except install your Apache and Php from rpms as it is.

    Then keep your php files in /var/www/html/ or whatever you configured for <DocumentRoot> Directive in Apache.

    If you don't have apache you can download it from redhat site. ----------------------------------------------------------- S.Murali Krishnan Internet: ismklinuxfreemail.com -----------------------------------------------------------

    attached mail follows:


    hi there,

    some of you may remember my post from yesterday ( titled install to unix ... hastles ) as I said in that one I was using Solaris 9 ( the newest ver of the Solaris OS ) i have since gone back to Solaris 8 and am having the same problem when I go to do the "make" looking through the ./configure output i discovered it can find "unix.h" but when I do the make (and inparticular when it goes through the Zend Makefile ) it cannot find it.. any one got any clues or suggestions? ( Solaris does come with an old ver (4.0.6 I think) on a companion CD but I wanna try and figure this one out as it's a newer ver of php (4.2.1) )

    any help would be apreciated... I can attach soft copies of both the make and the configure screen outputs for any that are interested...

    Cheers

    Peter "the only dumb question is the one that wasn't asked"

    attached mail follows:


    ok unix.h problem solved but now it's saying can't locate .libs/libZend.a .... any ideas?

    ~thinks: sheeeeeesh no wonder more and more people just use windose for PHP since it looking like its too bloody hard to install any where else lol~

    > -----Original Message----- > From: Peter [mailto:phpvfsa.com.au] > Sent: Thursday, 25 July 2002 3:46 PM > To: php_gen > Subject: [PHP] install issues on Solaris > > > hi there, > > some of you may remember my post from yesterday ( titled install to unix > ... hastles ) > as I said in that one I was using Solaris 9 ( the newest ver of > the Solaris > OS ) i have since gone back to Solaris 8 and am having the same > problem when > I go to do the "make" looking through the ./configure output i > discovered it > can find "unix.h" but when I do the make (and inparticular when it goes > through the Zend Makefile ) it cannot find it.. any one got any clues or > suggestions? ( Solaris does come with an old ver (4.0.6 I think) on a > companion CD but I wanna try and figure this one out as it's a > newer ver of > php (4.2.1) ) > > any help would be apreciated... I can attach soft copies of both the make > and the configure screen outputs for any that are interested... > > Cheers > > Peter > "the only dumb question is the one that wasn't asked" > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    In article <DPEPKCNEFOKBCNNANCIPEEOMCGAA.phpvfsa.com.au>, phpvfsa.com.au says... > ok unix.h problem solved but now it's saying can't locate .libs/libZend.a > .... any ideas? > > > ~thinks: sheeeeeesh no wonder more and more people just use windose for PHP > since it looking like its too bloody hard to install any where else lol~ >

    Furrfu - don't tar all *nix with the same brush :-) Presumably, for some reason, that file hasn't been created? Have a look in the libs directory under your tarball extraction directory; but perhaps the few lines out of make output prior to the error might be useful?

    Cheers

    -- 
    David Robley
    Temporary Kiwi!
    

    Quod subigo farinam

    attached mail follows:


    hi all,

    what has to be configured, and how, on a bsd server to allow the mail() function to work in php? using sendmail?

    thanks,

    wm

    attached mail follows:


    1) read the manual 2) make sure you have sendmail installed 3) make sure sendmail is working 4) look at php.ini it has it all in there you just have to uncomment it and maybe change the location for sendmail

    > -----Original Message----- > From: wm [mailto:webmasterblanktv.com] > Sent: Thursday, 25 July 2002 3:55 PM > To: php-generallists.php.net > Subject: [PHP] mail() function > > > hi all, > > what has to be configured, and how, on a bsd server to allow the mail() > function to work in php? using sendmail? > > thanks, > > wm > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    From the PHP docs... ============================= <?php session_register ("count"); $count++; ?>

    Hello visitor, you have seen this page <?php echo $count; ?> times.<p>;

    <?php # the <?=SID?> is necessary to preserve the session id # in the case that the user has disabled cookies ?>

    To continue, <A HREF="nextpage.php?<?=SID?>">click here</A>

    attached mail follows:


    I know I should not ask this question - but as I am not getting prompt reply from mysql mailing list posting it here too - Just in case anybody knows about it

    ---------------------------------------- I am trying to install the mySQL on our remote server thr putty (SSH). Following are the set of commands given by me,

    I have downloaded mysql-3.23 for BSDi.

    1)put into /usr/home/mysql-src directory and given following 2 commands going into shell>cd /usr/home/mysql-src shell>gunzip mysql-xxxx.tar.gz shell>tar xvf mysql-xxxx.tar

    This is creating the directory mysql-xxxx 2)Config -

    shell>cd /usr/home/mysql-src/mysql-xxxx shell>./configure -basedir=/usr/home/mysql -with-low-memory

    This command is giving me problem - saying - at the end shell>Starting mysqld daemon with database from /usr/home/mysql-src/mysql-xxxx/data rm /tmp/mysql.sock - Operation not permitted mysqld end

    Can anybody help me in this matter - What is the meaning of it ?

    Thanks in advance and regards Manisha

    attached mail follows:


    Maybe it's a permission problem: if you read the installation procedure of MySQL, you can find that some file system permission modifies are required (you must modify the permissions of 2 or 3 file (or directories)); Have you chenged theese permission?

    S.

    Il 08:52, gioved 25 luglio 2002, Manisha ha scritto: > I know I should not ask this question - but as I am not getting prompt > reply from mysql mailing list posting it here too - Just in case anybody > knows about it > > ---------------------------------------- > I am trying to install the mySQL on our remote server thr putty (SSH). > Following are the set of commands given by me, > > I have downloaded mysql-3.23 for BSDi. > > 1)put into /usr/home/mysql-src directory and given following 2 commands > going into > shell>cd /usr/home/mysql-src > shell>gunzip mysql-xxxx.tar.gz > shell>tar xvf mysql-xxxx.tar > > This is creating the directory mysql-xxxx > 2)Config - > > shell>cd /usr/home/mysql-src/mysql-xxxx > shell>./configure -basedir=/usr/home/mysql -with-low-memory > > This command is giving me problem - saying - at the end > shell>Starting mysqld daemon with database from > /usr/home/mysql-src/mysql-xxxx/data > rm /tmp/mysql.sock - Operation not permitted > mysqld end > > > Can anybody help me in this matter - What is the meaning of it ? > > Thanks in advance and regards > Manisha

    attached mail follows:


    Maybe it's a permission problem: if you read the installation procedure of MySQL, you can find that some file system permission modifies are required (you must modify the permissions of 2 or 3 file (or directories)); Have you chenged theese permission?

    S.

    Il 08:52, gioved 25 luglio 2002, Manisha ha scritto: > I know I should not ask this question - but as I am not getting prompt > reply from mysql mailing list posting it here too - Just in case anybody > knows about it > > ---------------------------------------- > I am trying to install the mySQL on our remote server thr putty (SSH). > Following are the set of commands given by me, > > I have downloaded mysql-3.23 for BSDi. > > 1)put into /usr/home/mysql-src directory and given following 2 commands > going into > shell>cd /usr/home/mysql-src > shell>gunzip mysql-xxxx.tar.gz > shell>tar xvf mysql-xxxx.tar > > This is creating the directory mysql-xxxx > 2)Config - > > shell>cd /usr/home/mysql-src/mysql-xxxx > shell>./configure -basedir=/usr/home/mysql -with-low-memory > > This command is giving me problem - saying - at the end > shell>Starting mysqld daemon with database from > /usr/home/mysql-src/mysql-xxxx/data > rm /tmp/mysql.sock - Operation not permitted > mysqld end > > > Can anybody help me in this matter - What is the meaning of it ? > > Thanks in advance and regards > Manisha

    attached mail follows:


    I'm looking for the global veriable that lists the page before the page that i just came from. Anyone know what i'm talking about?

    ---
    Philip J. Newman.
    PhilipNZ.com Design Solutions
    http://www.philipnz.com/
    infophilipnz.com
    

    Mob: +64 (25) 6144012. Tele: +64 (25) 6144012.

    Personal Site: Philip J. Newman Internet Developer http://www.philipsdomain.com/ newmanpjphilipsdomain.com

    attached mail follows:


    On Thu, 25 Jul 2002, Philip J. Newman wrote: > I'm looking for the global veriable that lists the page before the page > that i just came from. Anyone know what i'm talking about?

    $_SERVER['HTTP_REFERER']

    miguel

    attached mail follows:


    $_GLOBAL['HTTP_REFERER']

    Which I found myself by going to the manual, looking at the variables section, looking under predefined variables, and having a bit of a dig around :)

    Be warned, HTTP_REFERER does NOT have to be set by the browser, so you shouldn't rely on it AT ALL for mission critical stuff.

    Justin French

    on 25/07/02 5:27 PM, Philip J. Newman (phpphilipnz.com) wrote:

    > I'm looking for the global veriable that lists the page before the page that > i just came from. Anyone know what i'm talking about? > > --- > Philip J. Newman. > PhilipNZ.com Design Solutions > http://www.philipnz.com/ > infophilipnz.com > > Mob: +64 (25) 6144012. > Tele: +64 (25) 6144012. > > Personal Site: > Philip J. Newman > Internet Developer > http://www.philipsdomain.com/ > newmanpjphilipsdomain.com > > >

    attached mail follows:


    session_name('sid'); session_start();

    Do i have to use session_name('sid'); every time i use session_start(); or can session_name be used once?

    ---
    Philip J. Newman.
    PhilipNZ.com Design Solutions
    http://www.philipnz.com/
    infophilipnz.com
    

    Mob: +64 (25) 6144012. Tele: +64 (25) 6144012.

    Personal Site: Philip J. Newman Internet Developer http://www.philipsdomain.com/ newmanpjphilipsdomain.com

    attached mail follows:


    Just once when you first create the session.

    Rick

    This is the final test of a gentleman--his respect for those who can be of no possible service to him. - William Lyon Phelps

    > From: "Philip J. Newman" <newmanpjphilipnz.com> > Date: Thu, 25 Jul 2002 19:43:23 +1200 > To: <php-generallists.php.net> > Subject: [PHP] Newman Asks, Do i have to use session_name('sid') every ... > > session_name('sid'); > session_start(); > > Do i have to use session_name('sid'); every time i use session_start(); or > can session_name be used once? > > --- > Philip J. Newman. > PhilipNZ.com Design Solutions > http://www.philipnz.com/ > infophilipnz.com > > Mob: +64 (25) 6144012. > Tele: +64 (25) 6144012. > > Personal Site: > Philip J. Newman > Internet Developer > http://www.philipsdomain.com/ > newmanpjphilipsdomain.com > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    http://crushme.clients.philipnz.com/crushweb.php?startWeb=guest_book&sid=63e 9864efec3df8d84455e9e7fdb39a2&PHPSESSID=810e806280e1f6e26a3d04fea3242766

    sid = the session, and when session_name('sid'); it adds &PHPSESSID=810e806280e1f6e26a3d04fea3242766 to the url?

    whats up with that?

    ----- Original Message ----- From: "Richard Baskett" <phpbaskettcase.com> To: "Philip J. Newman" <newmanpjphilipnz.com>; "PHP General" <php-generallists.php.net> Sent: Thursday, July 25, 2002 7:50 PM Subject: Re: [PHP] Newman Asks, Do i have to use session_name('sid') every...

    > Just once when you first create the session. > > Rick > > This is the final test of a gentleman--his respect for those who can > be of no possible service to him. - William Lyon Phelps > > > From: "Philip J. Newman" <newmanpjphilipnz.com> > > Date: Thu, 25 Jul 2002 19:43:23 +1200 > > To: <php-generallists.php.net> > > Subject: [PHP] Newman Asks, Do i have to use session_name('sid') every ... > > > > session_name('sid'); > > session_start(); > > > > Do i have to use session_name('sid'); every time i use session_start(); or > > can session_name be used once? > > > > --- > > Philip J. Newman. > > PhilipNZ.com Design Solutions > > http://www.philipnz.com/ > > infophilipnz.com > > > > Mob: +64 (25) 6144012. > > Tele: +64 (25) 6144012. > > > > Personal Site: > > Philip J. Newman > > Internet Developer > > http://www.philipsdomain.com/ > > newmanpjphilipsdomain.com > > > > > > > > > > -- > > 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:


    on 25/07/02 5:43 PM, Philip J. Newman (newmanpjphilipnz.com) wrote:

    > session_name('sid'); > session_start(); > > Do i have to use session_name('sid'); every time i use session_start(); or > can session_name be used once?

    *sigh*

    How about testing it on two pages?

    Or better still, LOOK IN THE MANUAL!!!!

    php.net/session_name CLEARLY states:

    " The session name references the session id in cookies and URLs. It should contain only alphanumeric characters; it should be short and descriptive (i.e. for users with enabled cookie warnings). The session name is reset to the default value stored in session.name at request startup time. Thus, you need to call session_name() for every request (and before session_start() or session_register() are called). "

    Justin French

    attached mail follows:


    On Wed, 24 Jul 2002, Scott Fletcher wrote: > It work very nicely!!!! The whole process take 30 to 45 minutes for just > one server. I wonder how does someone did 12 computers in 10 minutes. > Cool!

    cd /usr/src/local tar -zxf php-4.2.2.tar.gz cd php-4.2.2 ../php-4.2.1/config.nice make install for i in server1 server2 server3 server4 server5 serverN scp ../apache_1.3.26/src/httpd ${i}:/usr/local/apache/bin/

    Most of the time was watching 'make install'.

    miguel

    attached mail follows:


    On Tue, 23 Jul 2002, Richard Lynch wrote: > This is excluding support contracts for software you paid for -- Once you > pay Oracle enough money for Support Contracts, they have pretty good > support, from what I hear... :-)

    They're attentive and responsive and about as knowledgeable as you could hope for (definitely not your typical tech support script readers), but the product is so hopelessly complex that it's still easy to stump them.

    miguel

    attached mail follows:


    Okay. Unless I failed a math course in high school (which is possible) I think my formulas are sound. However I'm having issues with this code.

    The Intended result: Take any image larger then 180x200 (WxH) and resize it proportionally so it fits within 200x180. What I'm getting, exactly what I want, except images come back deformed or miscreated. I've attached 2 jpegs that are produced by this script. If anyone can help out it would be greatly appreciated

    $lastnumQry = "SELECT imageID FROM images ORDER BY imageID DESC"; $lastnumRslt = mysql_query($lastnumQry, $conn); $lastnum = mysql_fetch_array($lastnumRslt); $newnum = $lastnum['imageID']+1;

    //Set image dir $image_root = $DOCUMENT_ROOT.'/images/';

    //Create a temp image file from uploaded jpeg $tempimage = imagecreatefromjpeg("$f_image"); $temp_h = ImageSX($tempimage); $temp_w = ImageSY($tempimage);

    //Checks that the image is not too small if($temp_h < 50 && $temp_w <50) { echo "ERROR: Image is less then 50x50."; exit; } //set file name

    $filename = $newnum.'.jpg';

    //save image if(!ImageJpeg($tempimage, $image_root.$filename)) { echo "ERROR: Image unable to upload!"; exit; } $smallfilename = $newnum.'_t.jpg';

    if($temp_h < 200 && $temp_w <180) { //Save thumbnail if(!ImageJpeg($tempimage, $image_root.$smallfilename)) { echo "ERROR: Thumbnail Image unable to upload!"; exit; } } else { echo "Resize beginning.<BR>"; if(($temp_h*1.8) > ($temp_w*2)) { $ratio = $temp_h/$temp_w; $dest_w = 200*$ratio; $dest_h = 200; echo "ONE - $dest_w - $dest_h"; } if(($temp_h*1.8) < ($temp_w*2)) { $ratio = $temp_w/$temp_h; echo "Ratio - $ratio <br>"; $dest_w = 180; $dest_h = 180*$ratio; echo "TWO - $dest_w - $dest_h"; } if(($temp_h*1.8) == ($temp_w*2)) { $dest_w = 180; $dest_h = 200; } $image_t = imagecreatetruecolor($dest_w, $dest_h); imagecopyresampled($image_t, $tempimage, 0, 0, 0, 0, $dest_w, $dest_h, $temp_w, $temp_h); if(!ImageJpeg($image_t, $image_root.$smallfilename)) { echo "ERROR: Thumbnail Image unable to Upload!"; exit; } }

    attached mail follows:


    Okay, I somehow fixed it. But to make sure I am clear on this ImageSY Will give the vertical height of an image and ImageSX will give the width?

    Sorry to spam with such a stupid mistake...

    Me.

    attached mail follows:


    On Wed, 24 Jul 2002, Justin French wrote: > If your ISP doesn't allow you to use .htaccess files in this way, AND can't > provide you with a directory outside the document root for placing sensitive > files, then I'd recommend switching hosts, because they clearly don't have > an understanding of what you need.

    It's possible they put each of their customer in a chroot jail, in which case - barring gross mistakes on the part of the customer - keeping the password in a .php file in the docroot is quite secure.

    miguel

    attached mail follows:


    On Tue, 23 Jul 2002, Javier Montserat wrote: > So refering back, i re-wrote the original example using the switch syntax... > > switch (true) { > case doStep1(): > case doStep2(): > case doStep3(): > error(); > break; > default: > valid(); > } > > Each case expressions is evaluated, until one of them evaluates to a value > equal (==) to the switch expression (in this case a boolean error flag). > > The error() code will only be called if one of the doStep() evaluates to > false. > > And the valid() code will only be evaluated if the switch reached the > default, which means that none of the above check returned false > > I think for this example the switch syntax is more elegant than using a > series of if() statements.

    That's pretty clever!

    miguel

    attached mail follows:


    On Wed, 24 Jul 2002, Briggsy wrote: > Altn-N have a product called relayfax which is used with e-mail. You could > use forms to send an email and have realyfax fax it > > www.altn.com They have awesome support for their mailserver MDaemon so I > would say realyfax would be equally as good

    Also, there's a free volunteer network of fax servers you can read about at:

    http://www.tpc.int/

    Coverage is not universal, and you might get ads on the cover sheet, but I've used it plenty of times over the years (this has been around for a decade or so) and it's served me well.

    miguel

    attached mail follows:


    Ok PHP was working fine on this NT2000 box and now its totally smegged. Every PHP page gives the error:

    -2147467259 (0x80004005)

    Then IIS restarts itself, i've tried reinstalling with the latest version (4.2.2) of PHP, rebooted, no joy, then reinstalled IIS rebooted thenthen it constantly asked for a username and password (NT authentication box) for php files ONLY, if you typed in the admin password it seemed to work ok, rebooted again and now I get the above error message. Is 4.2.2 a stable release? not that it really matters as I was getting the same problems with 4.2.1

    HELP! :)

    attached mail follows:


    ok change to cgi, seems to be alot more stable now.

    "Francis" <newsradnip.com> wrote in message news:20020725084027.61769.qmailpb1.pair.com... > Ok PHP was working fine on this NT2000 box and now its totally smegged. > Every PHP page gives the error: > > -2147467259 (0x80004005) > > Then IIS restarts itself, i've tried reinstalling with the latest version > (4.2.2) of PHP, rebooted, no joy, then reinstalled IIS rebooted thenthen it > constantly asked for a username and password (NT authentication box) for php > files ONLY, if you typed in the admin password it seemed to work ok, > rebooted again and now I get the above error message. Is 4.2.2 a stable > release? not that it really matters as I was getting the same problems with > 4.2.1 > > HELP! :) > >

    attached mail follows:


    On 25 Jul 2002 at 2:04, GOLD, MATTHEW wrote:

    > thank you very much for your quick response. > > How do I run mysql_fetch_row before the while loop? I don't want two > loops, because I just want this variable to print out once. > > I tried this, but it didn't work: > > $query = "Select blah1, blah2, blah3 from blahtable"; > $result = mysql_query ($query) > or die ("Cannot complete query"); > > $row = mysql_fetch_row ($result)) > print ("$row[4]"); > > while ($row = mysql_fetch_row ($result)) > { > print "$row[1], $row[2], etc."); > } > > ?> > > I realize that my problem is that I don't really understand arrays...but I > am new to all of this, and I very much appreciate your help. > > best, > > Matt

    So what you want to do is print a field from the first row extracted from the table, then loop through all the rows and print several fields? I think you want mysql_data_seek.

    Whenever you do a mysql_fetch_row, php grabs the current row from the result set, and shifts a pointer to the next record in the result set. In this case it seems you need to print from the first record, then reset the pointer to the first record and print from all records found. So:

    $row = mysql_fetch_row ($result)) print ("$row[4]");

    mysql_data_seek($result, 0); // Add this

    while ($row = mysql_fetch_row ($result))

    Unless I misunderstand what you are trying to do....

    Cheers

    -- 
    David Robley
    Temporary Kiwi!
    Quod subigo farinam
    

    "I've been to a film festival in the South of France," said Tom cannily.

    attached mail follows:


    test

    attached mail follows:


    test ok!

    attached mail follows:


    Hello,

    I wonder how much I can include files?

    does it matter if the size sum of the source code included are above 1MB ?

    thanks,

    elias

    attached mail follows:


    On Thursday 25 July 2002 18:41, lallous wrote: > Hello, > > I wonder how much I can include files? > > does it matter if the size sum of the source code included are above 1MB ?

    Instead of testing the mailing list, why not try the above for yourself?

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

    /* Deadwood, n.: Anyone in your company who is more senior than you are. */

    attached mail follows:


    Hello everybody, I hope u can help me with this. I'll be very grateful! This file retrieves a list of files from a folder on the server and then has to diplay a list of them. When selecting one of them in the list, it should display a preview (i.e. its contents) in the same file. I think i should use frames but donno how to do it :(. Thx a lot

    <?PHP $d = dir("/home/mcms/public_html/MCMS/Alia/pageTmp"); ?>

    <html> <head> </head> <body> <form method="POST" action="showTree.php"> <p><b>Plz select a page template:</b></p> <p><select size="1" name="pageList" >

    <?PHP while (false !== ($entry = $d->read())) { if ($entry != '.' && $entry != '..') echo '<option value="'.$entry.'">'.$entry.'</option>.\n'; } ?>

    </select></p> <p><input type="submit" value="Create" name="createButton" > <input type="hidden" value="/home/mcms/public_html/MCMS/Alia/pageTmp/" name="pageField" /></p>

    <?PHP /*if (!$file = fopen("/home/mcms/public_html/MCMS/Alia/pageTmp/ $pageList", "rb")){ echo("couldnt open the file."); } else{ fpassthru($file); }*/ ?>

    </form> </body> </html>

    <?PHP $d->close(); ?>

    attached mail follows:


    Hello,

    1. you must have a frame system with two frames: frame1 called fileslist, fametwo called: preview when you build the files list do like this: <? while (list(, $filename) = each($filesarray)) { echo "<li><a href="javascript:display('$filename')">$filename</a>"; } ?>

    then declare a javascript function as: <script> function display(filename) { window.frames['preview'].location = filename; } </script>

    should work.

    //Elias

    "Alia Mikati" <Aliaminvestcomholding.com> wrote in message news:0GZS002JKUW47Ltyphoon.idm.net.lb... > Hello everybody, > I hope u can help me with this. I'll be very grateful! > This file retrieves a list of files from a folder on the server and then > has to diplay a list of them. When selecting one of them in the list, it > should display a preview (i.e. its contents) in the same file. I think i > should use frames but donno how to do it :(. > Thx a lot > > > > <?PHP > $d = dir("/home/mcms/public_html/MCMS/Alia/pageTmp"); > ?> > > <html> > <head> > </head> > <body> > <form method="POST" action="showTree.php"> > <p><b>Plz select a page template:</b></p> > <p><select size="1" name="pageList" > > > <?PHP > while (false !== ($entry = $d->read())) > { > if ($entry != '.' && $entry != '..') > echo '<option value="'.$entry.'">'.$entry.'</option>.\n'; > } > ?> > > </select></p> > <p><input type="submit" value="Create" name="createButton" > > <input type="hidden" > value="/home/mcms/public_html/MCMS/Alia/pageTmp/" name="pageField" /></p> > > > <?PHP > /*if (!$file = fopen("/home/mcms/public_html/MCMS/Alia/pageTmp/ > $pageList", "rb")){ > echo("couldnt open the file."); > } else{ > fpassthru($file); > }*/ > ?> > > </form> > </body> > </html> > > <?PHP > $d->close(); > ?> > >

    attached mail follows:


    Hi! I got a problem with uploading pictures. Using a script following this schema:

    if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { copy($HTTP_POST_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file"); } else { echo "Possible file upload attack. Filename: " . $HTTP_POST_FILES['userfile']['name'];

    the script always returns: Warning: Unable to create '/*.jpg': Permission denied in fotos2.php on line 62

    I do not understand why that happens. Do I need to include a password somewhere or somehitng like that? Thank you for your help! Oliver

    attached mail follows:


    Hello Oliver,

    Thursday, July 25, 2002, 1:23:24 PM, you wrote:

    OW> Hi! OW> I got a problem with uploading pictures. Using a script following this OW> schema:

    OW> if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { OW> copy($HTTP_POST_FILES['userfile']['tmp_name'], OW> "/place/to/put/uploaded/file"); OW> } else { OW> echo "Possible file upload attack. Filename: " . OW> $HTTP_POST_FILES['userfile']['name'];

    OW> the script always returns: OW> Warning: Unable to create '/*.jpg': Permission denied in fotos2.php on OW> line 62

    OW> I do not understand why that happens. Do I need to include a password OW> somewhere or somehitng like that? Thank you for your help! OW> Oliver

    i think u should set write permissions to directory where u r trying to copy file

    -- 
    Best regards,
    Alexander Kuznetsov
    Leading Web-programmer
    sanychcstrade.koenig.ru
    Centre of engineering technologies CS Trade
    http://www.cstrade.ru
    

    attached mail follows:


    Hello Oliver,

    Thursday, July 25, 2002, 1:42:05 PM, you wrote:

    OW> Alexander Kuznetsov schrieb:

    >> i think u should set write permissions to directory >> where u r trying to copy file

    OW> Thank you for answering. OW> But how do I set write permisisons? With a .htaccess file? OW> Oliver

    i think the reason is write permission on file system of the server and u have to type chmod command:

    shell> chmod a+r /place/to/put/uploaded/file

    P.S. When reply message use Reply-To All option for you answer will be accessible in PHP-general mailing list ;)

    -- 
    Best regards,
    Alexander Kuznetsov
    

    attached mail follows:


    Hi

    I'm trying to do some parsing of mail headers and since not all headers follow the pattern:

    X-Header-A: A string X-Header-B: Another string that is longer X-Header-C: And this string is very very long compared

    But may very well look like this:

    X-Header-A: A string X-Header-B: Another string that is longer X-Header-C: And this string is very very long compared

    (Note that two of the header lines above wrap more than one line.)

    In order to read the headers into an array of header key/value fields i would like a reg exp to remove all new lines/line feeds before a line starting with one or more white spaces or tabs.

    I've tried myself but I'm just nog good with reg exps.

    Thanks in advance, Nicklas

    attached mail follows:


    <? $mem='Newsgroups: php.general Path: news.php.net Xref: news.php.net php.general:109465 Return-Path: <nillecomology.se> Mailing-List: contact php-general-helplists.php.net; run by ezmlm Delivered-To: mailing list php-generallists.php.net Received1: (qmail 60843 invoked from network); 25 Jul 2002 10:36:29 -0000 Received: from unknown (HELO parker.comology.com) (213.187.218.7) by pb1.pair.com with SMTP; 25 Jul 2002 10:36:29 -0000 Received2: (qmail 14308 invoked by uid 500); 25 Jul 2002 10:36:27 -0000 Date: Thu, 25 Jul 2002 12:36:27 +0200 To: php-generallists.php.net Message-ID: <20020725103627.GE4663nille.org> Reply-To: Nicklas af Ekenstam <nillecomology.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Operating-System: Linux parker 2.4.10-4GB X-PGP-Key: http://nille.org/pubkey.txt Organization: comology.se Subject: Reg exp to remove line feeds before lines starting with white space From: nillecomology.se (Nicklas Af Ekenstam)

    Hi

    Im trying to do some parsing of mail headers and since not all headers follow the pattern: ';

    $lines = split("\n", $mem);

    for ( $c = count($lines), $i=0, $headers = array(), $lastkey = 'x' ;$i<$c ;$i++) { $t = $lines[$i]; if (preg_match('/^([a-z].+?):\s*(.+)/i', $t, $result)) { $lastkey = $result[1]; $headers[$lastkey] = trim($result[2]); } else { $headers[$lastkey] .= "\n" . $t; }

    // end of headers? if (trim($t)=='') break; }

    while (list($key, $val) = each($headers)) echo "$key=$val\n"; ?>

    note: i have renamed headers with same name! like 'received' cause I don't know how you want to handle them!

    good luck,

    //elias

    "Nicklas Af Ekenstam" <nillecomology.se> wrote in message news:20020725103627.GE4663nille.org... > Hi > > I'm trying to do some parsing of mail headers and since not all > headers follow the pattern: > > X-Header-A: A string > X-Header-B: Another string that is longer > X-Header-C: And this string is very very long compared > > But may very well look like this: > > X-Header-A: A string > X-Header-B: Another string that is > longer > X-Header-C: And this string is very very long > compared > > (Note that two of the header lines above wrap more than one line.) > > In order to read the headers into an array of header key/value fields > i would like a reg exp to remove all new lines/line feeds before a > line starting with one or more white spaces or tabs. > > I've tried myself but I'm just nog good with reg exps. > > > Thanks in advance, > Nicklas

    attached mail follows:


    i've got this code for domain/email authentication:

    function validateEmail ($email) { // $d = explode('',$email) ; $domain = $d[1] ; $link = fsockopen($domain, 80, &$errno, &$errstr, 30) ; if (!$link) {return false ;} else { return true ; } }

    in addition i'd like to check a pop3 server on the domain, is this possible using php?? anyone have demo code for something like this?

    cheers Henry

    attached mail follows:


    I'm trying to apply XSL to XML stored in a MySQL database with PHP. How do I go about doing this? I've tried following the example on php.net but I seem to run into a lot of trouble. Here's how the code looks like (BTW aml is XML stored in the argument Table):

    if (! empty($searchword ))

    $query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'"; $result = mysql_query($query) or die ("Query failed"); $line = mysql_fetch_array($result, MYSQL_ASSOC);

    // Create an array $arguments = array('/_xml'=> $line);

    //XSL file $xsl = "./sheet1.xsl";

    // Create an XSLT processor $xslthandler = xslt_create();

    // Perform the transformation $html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, $arguments);

    // Detect errors if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler));

    // Destroy the XSLT processor xslt_free($xslthandler);

    // Output the resulting HTML print $html;

    What I get on the screen is:

    Array ( [0] => "With the contents of my variable...")

    And:

    Warning: Sablotron error on line 1: XML parser error 2: syntax error in /home/httpd/html/ctan/resultworkingcopy2.php on line 93 XSLT processing error: XML parser error 2: syntax error

    What gives? I really need to solve this urgent. Thanks...

    Chia

    attached mail follows:


    Ctan wrote: > I'm trying to apply XSL to XML stored in a MySQL database with PHP. How do I > go about doing this? I've tried following the example on php.net but I seem > to run into a lot of trouble. Here's how the code looks like (BTW aml is XML > stored in the argument Table): > > > if (! empty($searchword )) > > $query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'"; > $result = mysql_query($query) or die ("Query failed"); > $line = mysql_fetch_array($result, MYSQL_ASSOC); > > // Create an array > $arguments = array('/_xml'=> $line); > > //XSL file > $xsl = "./sheet1.xsl"; > > // Create an XSLT processor > $xslthandler = xslt_create(); > > // Perform the transformation > $html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, $arguments); > > // Detect errors > if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler)); > > // Destroy the XSLT processor > xslt_free($xslthandler); > > // Output the resulting HTML > print $html; > > > What I get on the screen is: > > > Array ( [0] => "With the contents of my variable...") > > > And: > > > Warning: Sablotron error on line 1: XML parser error 2: syntax error in > /home/httpd/html/ctan/resultworkingcopy2.php on line 93 XSLT processing > error: XML parser error 2: syntax error > > > What gives? I really need to solve this urgent. Thanks... > > Chia

    What is the xml. There may be a content encoding problem or some other xml issue.

    Peter

    attached mail follows:


    Ctan wrote: > I'm trying to apply XSL to XML stored in a MySQL database with PHP. How do I > go about doing this? I've tried following the example on php.net but I seem > to run into a lot of trouble. Here's how the code looks like (BTW aml is XML > stored in the argument Table): > > > if (! empty($searchword )) > > $query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'"; > $result = mysql_query($query) or die ("Query failed"); > $line = mysql_fetch_array($result, MYSQL_ASSOC); > > // Create an array > $arguments = array('/_xml'=> $line); > > //XSL file > $xsl = "./sheet1.xsl"; > > // Create an XSLT processor > $xslthandler = xslt_create(); > > // Perform the transformation > $html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, $arguments); > > // Detect errors > if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler)); > > // Destroy the XSLT processor > xslt_free($xslthandler); > > // Output the resulting HTML > print $html; > > > What I get on the screen is: > > > Array ( [0] => "With the contents of my variable...") > > > And: > > > Warning: Sablotron error on line 1: XML parser error 2: syntax error in > /home/httpd/html/ctan/resultworkingcopy2.php on line 93 XSLT processing > error: XML parser error 2: syntax error > > > What gives? I really need to solve this urgent. Thanks... > > Chia

    What is the xml. There may be a content encoding problem or some other xml issue.

    Peter

    attached mail follows:


    Is it possible to make the browser wait say, 5 seconds before redirection by outputting headers? I know you can do it with meta tags but not how by outputting headers

    --
    JJ Harrison
    webmastertececo.com
    www.tececo.com
    

    attached mail follows:


    On Thursday, July 25, 2002, at 01:02 PM, JJ Harrison wrote:

    > Is it possible to make the browser wait say, 5 seconds before > redirection by > outputting headers? I know you can do it with meta tags but not how by > outputting headers

    http://www.php.net/manual/en/function.sleep.php

    R.

    attached mail follows:


    Hi,

    I need to use extension_loaded() to try and detect which database interface(s) are installed on some servers. Nowhere have I been able to find a list of the internal extension names that is the string required as the function argument. I know I can see those in my build of PHP using

    % php -m

    but that's not the complete list. Can someone help? Thanks, Peter

    attached mail follows:


    try: function_exists('mysql_query') <- if TRUE then MySql is supported, etc...

    "Peter" <petermapledesign.co.uk> wrote in message news:1103_1027596662news.php.net... > Hi, > > I need to use extension_loaded() to try and detect which database interface(s) are installed on some servers. Nowhere have I been able to find a > list of the internal extension names that is the string required as the function argument. I know I can see those in my build of PHP using > > % php -m > > but that's not the complete list. Can someone help? > Thanks, > Peter

    attached mail follows:


    try www.hotscripts.com there are lots of scripts as your request.

    "Craig" <craigsitedesign.net> wrote in message news:20020724082406.95321.qmailpb1.pair.com... > i am using dreamweaver mx and want to acheive the following > > 9:00 task 1 > 9:30 task 2 > 10:00 task 3 > task 4 > task 5 > 10:30 task 6 > > i have a recordset that displays the tasks ordered by the time but what i > dont want is to display the time for every item, or if an entry is at 10:15 > for example. > > Any ideas??? > > > Craig > > >

    attached mail follows:


    Hello,

    Can I get the starting position of my string occurence when using any regexps searching functions in PHP ?

    for example: $mem='this is a test'; preg_match('/test/', ...) should return me somehow: 10

    Thanks

    attached mail follows:


    On Thursday 25 July 2002 20:40, lallous wrote: > Hello, > > Can I get the starting position of my string occurence when using any > regexps searching functions in PHP ? > > for example: > $mem='this is a test'; > preg_match('/test/', ...) should return me somehow: 10

    No.

    If search string does not involve a regex then just use the plain string search functions.

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

    /* We will have solar energy as soon as the utility companies solve one technical problem -- how to run a sunbeam through a meter. */

    attached mail follows:


    Hello lallous,

    Thursday, July 25, 2002, 3:40:32 PM, you wrote:

    l> Hello,

    l> Can I get the starting position of my string occurence when using any l> regexps searching functions in PHP ?

    l> for example: l> $mem='this is a test'; l> preg_match('/test/', ...) should return me somehow: 10

    l> Thanks

    why regexps? what about simple string fuctions in PHP?

    for your example they will be more usefull:

    strrpos - http://www.php.net/manual/en/function.strrpos.php

    sample:

    $text = "string"; echo strrpos($text, "r"); // must show 2 as result

    -- 
    Best regards,
    Alexander Kuznetsov
    

    attached mail follows:


    > Can I get the starting position of my string occurence when using any > regexps searching functions in PHP ? > > for example: > $mem='this is a test'; > preg_match('/test/', ...) should return me somehow: 10

    Does it have to be a regular expression you are searching for? If not, you can use strpos().

    www.php.net/strpos

    ---John Holmes...

    attached mail follows:


    In article <20020725113938.23973.qmailpb1.pair.com>, phplistlgwm.org says... > Hello, > > Can I get the starting position of my string occurence when using any > regexps searching functions in PHP ? > > for example: > $mem='this is a test'; > preg_match('/test/', ...) should return me somehow: 10 > > > Thanks

    strpos might be useful

    -- 
    David Robley
    Temporary Kiwi!
    

    Quod subigo farinam

    attached mail follows:


    Yes, I'm aware of the strpos() or any other non-regexp string functions...

    but it is either I use regexp to match a certain pattern or I'll have to write a char-by-char parser to emulate regexp searching and yet get the position of the occurence!

    Thank you all anyway.

    //Elias

    "Alexander Kuznetsov" <sanychcstrade.koenig.ru> wrote in message news:7586019379.20020725144631cstrade.koenig.ru... > Hello lallous, > > Thursday, July 25, 2002, 3:40:32 PM, you wrote: > > l> Hello, > > l> Can I get the starting position of my string occurence when using any > l> regexps searching functions in PHP ? > > l> for example: > l> $mem='this is a test'; > l> preg_match('/test/', ...) should return me somehow: 10 > > > l> Thanks > > > why regexps? > what about simple string fuctions in PHP? > > for your example they will be more usefull: > > strrpos - http://www.php.net/manual/en/function.strrpos.php > > sample: > > $text = "string"; > echo strrpos($text, "r"); // must show 2 as result > > > > -- > Best regards, > Alexander Kuznetsov > >

    attached mail follows:


    On Thu, 25 Jul 2002 15:05:36 +0200, you wrote:

    > l> for example: > l> $mem='this is a test'; > l> preg_match('/test/', ...) should return me somehow: 10

    How about this:

    $mem='this is a test';

    if(preg_match("/(.*)test/",$mem,$matches)) { echo strlen($matches[1]); }

    Of course, if "test" occurs more than once then the above won't work, since regex's are "greedy"...

    attached mail follows:


    On Thursday, July 25, 2002, Michael Sims wrote:

    > On Thu, 25 Jul 2002 15:05:36 +0200, you wrote:

    >> for example: >> $mem='this is a test'; >> preg_match('/test/', ...) should return me somehow: 10

    > How about this:

    > $mem='this is a test';

    > if(preg_match("/(.*)test/",$mem,$matches)) { > echo strlen($matches[1]); > }

    > Of course, if "test" occurs more than once then the above won't > work, since regex's are "greedy"...

    If you add a ? after the * then that'll make it non-greedy won't it?

    -- 
    Tim Fountain (timtfountain.co.uk)
    http://www.tfountain.co.uk/
    

    attached mail follows:


    on 25/07/02 11:05 PM, lallous (phplistlgwm.org) wrote:

    > Yes, I'm aware of the strpos() or any other non-regexp string functions... > > but it is either I use regexp to match a certain pattern or I'll have to > write a char-by-char parser to emulate regexp searching and yet get the > position of the occurence!

    Actually, I've just written one of them, and they're not that hard, as long as the sub-set of what you want to do is limited.

    Justin French

    attached mail follows:


    ..do you have access to http://www.php.net? Nothing personal Newman, but RTFM. Most of the answers, if not all are there. Also, did you know that http://www.vaahq.com is down? Just thought I'd let you know since it is in your portfolio.

    Oh, and that whole tird-person Newman thing....boring and irritating.

    "Put more FUN in dysFUNctional"

    ************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************

    attached mail follows:


    insert into table(imagefield) values(load_file('/path/to/image.jpg'))

    i remember that worked for me.

    //elias

    "Rija" <rijavatu.com> wrote in message news:001501c231f5$72337a40$3d00a8c0workelp3... I want to store image data into mysql table using BLOB but I don't know how to read it after. To record the image, I doesn't have any problem, but to read the file after and to view the image, I can't do anything the variable show only comment like this: memobin24.bin

    So how can I do?

    This was the script.

    <?

    Include("connect.inc") ;

    $fp = fopen("image/photo.jpg","r") ;

    if ($fp) {

    $code2 = "" ;

    while (!feof($fp)) {

    $buffer = fgets($fp, 4096);

    $code2 = $code2.$buffer;

    }

    }

    $code2 = addslashes($code2) ;

    $table = 'image' ;

    $instruction = mysql_query("INSERT into $table values ('','fichier inage','$code2','') or die("FATAL ERROR") ;

    ?>

    attached mail follows:


    Hi, Thanks for the reply, but somehow I got it to work yesterday. Someone else in this list pointed out the same problem and file a bug report. They say it's fixed in CVS.

    http://bugs.php.net/?id=18522&edit=2

    Reuben D. Budiardja

    On Wed, 2002-07-24 at 19:49, David Robley wrote: > In article <1027515843.3284.11.camelarcturus.phys.utk.edu>, > reubendbinnovativethought.com says... > > On Wed, 2002-07-24 at 08:29, Ian Ball wrote: > > > Assuming you are installing from your php-4.2.2 directory, it would appear > > > the libphp4.so hasn't actually been made, which would point to a possible > > > error in the configuration parameters. I am also assuming your php 4.2.1 > > > made OK which would mean all necessary libraries etc are available on your > > > system. What are you using for the configure? On my system it was > > > ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs > > > I did have ldap in there too, but for most people this is not necessary. > > > > Here is my configure line. Yes, my prev php 4.2.1 made and install fine > > with the same configure line. I did exactly the same steps as when I > > install 4.2.1 > > > > OK - after you do 'make' is there a file libphp4.so in the lib directory > under where you unpacked the install tarball? If not, something has > apparently gone wrong with the make process or the configure; you might > check (I think it is) config.log in the top of the install directory for > any clues. > > I'm not sure, but it might be --enable-track-vars (unless that is a typo); > check with configure --help | grep track

    > Cheers > -- > David Robley > Temporary Kiwi! > > Quod subigo farinam > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    I have a php script I would like run like a cron job every so many minutes. How is this done?

    attached mail follows:


    Depends on what system you are running, let us know and we can better answer the question.

    On Thu, 25 Jul 2002, Paul O'Neil wrote:

    > I have a php script I would like run like a cron job every so many minutes. > How is this done? > > >