OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: php-general-digest-helplists.php.net
Date: Thu Feb 22 2001 - 07:57:11 CST

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

    php-general Digest 22 Feb 2001 13:57:11 -0000 Issue 527

    Topics (messages 41087 through 41146):

    Re: pop textarea field w/ text incl. quotes
            41087 by: Simon Garner
            41091 by: Paul Warner
            41092 by: John Monfort
            41093 by: Simon Garner
            41094 by: Simon Garner
            41095 by: David Allen Reid
            41096 by: Paul Warner

    Re: Form Variables!!!!!
            41088 by: John Monfort

    Re: Tough one?
            41089 by: John Monfort
            41111 by: Tim Ward
            41113 by: Simon Garner

    file upload error w/internet exploder!
            41090 by: Tom Beidler

    htaccess problems disabling phplib
            41097 by: Gfunk
            41098 by: Simon Garner

    Re: How to issue a new session without closing the browser?
            41099 by: Yasuo Ohgaki

    getting what's between <td></td>
            41100 by: Tyler Longren
            41101 by: David Allen Reid
            41109 by: Simon Garner
            41110 by: Simon Garner

    crontab help
            41102 by: Arnold Gamboa
            41103 by: Joe Stump
            41104 by: Arnold Gamboa
            41138 by: PHPBeginner.com

    help change filename.
            41105 by: Jan Grafström
            41106 by: Pavel Jartsev
            41126 by: Christian Reiniger

    Re: array headaches
            41107 by: Matt Williams
            41131 by: PHPBeginner.com

    Re: How to get information from <input type=image ...>
            41108 by: Tim Ward

    file listener
            41112 by: toto
            41140 by: PHPBeginner.com

    Re: PDF Problems
            41114 by: Mathias Meyer

    isset()
            41115 by: Jacky.lilst
            41116 by: Jacky.lilst
            41117 by: Philip Olson
            41123 by: Ernest E Vogelsinger
            41139 by: PHPBeginner.com

    Re: Handling File Uploads : ASCII/Binary transfers
            41118 by: Christian Reiniger

    Re: Displaying an image, that is pulled from a DB, inline
            41119 by: Christian Reiniger

    Re: Warning: page expired and cache-control header
            41120 by: Christian Reiniger

    Re: I'm confused about Regular Expressions.
            41121 by: Christian Reiniger

    Uploading/Timing scripts
            41122 by: Matt

    Re: Print in html <?
            41124 by: Christian Reiniger
            41135 by: PHPBeginner.com
            41136 by: PHPBeginner.com

    Re: Generating percentages of numbers
            41125 by: Christian Reiniger
            41127 by: Simon Garner
            41137 by: PHPBeginner.com
            41144 by: Wico de Leeuw

    Re: system() PHP newbie!!
            41128 by: PHPBeginner.com

    Re: Can you check if someone is online on your homepage?
            41129 by: PHPBeginner.com

    Re: Can you make a file empty?
            41130 by: PHPBeginner.com
            41141 by: Tim Ward
            41142 by: PHPBeginner.com

    Re: POST against GET
            41132 by: PHPBeginner.com

    Re: HTTP_REFERER doesn't work with redirects...?
            41133 by: PHPBeginner.com

    Re: Variable Strangeness
            41134 by: PHPBeginner.com

    size of directory
            41143 by: Andris Jancevskis

    Cookie stored but cannot trigger the function...
            41145 by: Dhaval Desai

    Problems with posix_getpwnam
            41146 by: Liam Gibbs

    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:


    From: "Paul Warner" <pwarnerwinners-circle.com>

    > I seem to be stuck on a very simple (to me) issue. I am trying to build a
    > database of links for a site. A user inputs an HTML link into a text box
    > which is stored in a SQL db. This works fine. I need to display this
    data
    > on pages, and retrieving it into the page displays fine as well. The
    > problem arises when I need to provide a means to edit this link. Here's
    > what I've got:
    >
    > Link as stored in db: <a href="http://winners-circle.com">Winners Circle
    > Design Group</a>
    > variants I've tried to store: <a
    href=\"http://winners-circle.com\">Winners
    > Circle Design Group</a>
    > <a
    > href=\\\"http://winners-circle.com\\\">Winners Circle Design Group</a>
    > <a
    > href='http://winners-circle.com'>Winners Circle Design Group</a>
    >
    > All result in the textarea box in the form being populated with (basicly
    all
    > the output to the end of the page): Winners Circle Design
    > Group</a>"></form></td>\n </tr>
    > <tr>
    > <th width = "40%" align = "right">Created:</th>
    > <td width = "60%">20010221195310</td>
    > </tr>
    > <tr>
    > <th width = "40%" align = "right">Last Modified:</th>
    > <td width = "60%">20010219104604</td>
    > </tr>
    > </table>
    > </div>
    > </body>
    > </html>
    >
    > I'm sure that the answer is right in front of me, but my heads bleeding to
    > badly from hitting the wall so many times, I can't see it!
    >
    > -- Paul
    >

    Don't worry about quotes - the problem is that you have HTML markup inside
    your <textarea>. You just need to convert < and > to &lt; and &gt;,
    respectively, in your link text. The functions htmlspecialchars() or
    strip_tags() can do this for you.

    i.e.:

    <?
        echo "<textarea>" . htmlspecialchars($link) . "</textarea>";
    ?>

    When the form is submitted (and when it's viewed), those entities will be
    converted back to their real characters automatically by the browser.

    Cheers

    Simon Garner

    attached mail follows:


    Simon-

    Thanks for the tip...I trued using the htmlspecialchars() which allowed the
    remainder of the form to display properly, but left no value in the
    textarea. Then I noticed a difference in the method I was using compared to
    yours - I'm still learning the ways of PHP so it will take me a while to
    determine the significance of the syntax differences:

    Mine: <td width = "60%"><?php echo $linkurl . '<br><textarea
    value="htmlspecialchars($linkurl)"></textarea></td>\n' ?>

    Yours: <?php echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>

    I wanted a graphical representation of the present link displayed above the
    textarea and then attempted to use php's substitution to build the text area
    within the same string. I updated my code to be more like yours and arrived
    at:

    <?php echo $linkurl . '<br><form>'?><?php echo "<textarea>" .
    htmlspecialchars($linkurl) . "</textarea>\n"?>

    which seems to make the parser behave as I intended.

    Anyway...thanks!

    -- Paul

    ----- Original Message -----
    From: "Simon Garner" <sgarnerexpio.co.nz>
    To: "Paul Warner" <pwarnerwinners-circle.com>; <php-generallists.php.net>
    Sent: Wednesday, February 21, 2001 8:19 PM
    Subject: Re: [PHP] pop textarea field w/ text incl. quotes
    >
    > Don't worry about quotes - the problem is that you have HTML markup inside
    > your <textarea>. You just need to convert < and > to &lt; and &gt;,
    > respectively, in your link text. The functions htmlspecialchars() or
    > strip_tags() can do this for you.
    >
    > i.e.:
    >
    > <? echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>
    >
    > When the form is submitted (and when it's viewed), those entities will be
    > converted back to their real characters automatically by the browser.
    >

    attached mail follows:


     Is it necessary to include the 'http:' in the DB field?

     It would make your life a lot easier to drop it.

     You would then store the url values as
        www.mydomain.com

     Then, modify your code to add the 'HTTP' whenever it encounter a URL, or
     wherever you will create a link.

     This would eliminate the need to deal with special characters...

    __________John Monfort_________________
    _+-----------------------------------+_
         P E P I E D E S I G N S
           www.pepiedesigns.com
    "The world is waiting, are you ready?"
    -+___________________________________+-

    On Wed, 21 Feb 2001, Paul Warner wrote:

    > Simon-
    >
    > Thanks for the tip...I trued using the htmlspecialchars() which allowed the
    > remainder of the form to display properly, but left no value in the
    > textarea. Then I noticed a difference in the method I was using compared to
    > yours - I'm still learning the ways of PHP so it will take me a while to
    > determine the significance of the syntax differences:
    >
    > Mine: <td width = "60%"><?php echo $linkurl . '<br><textarea
    > value="htmlspecialchars($linkurl)"></textarea></td>\n' ?>
    >
    > Yours: <?php echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>
    >
    > I wanted a graphical representation of the present link displayed above the
    > textarea and then attempted to use php's substitution to build the text area
    > within the same string. I updated my code to be more like yours and arrived
    > at:
    >
    > <?php echo $linkurl . '<br><form>'?><?php echo "<textarea>" .
    > htmlspecialchars($linkurl) . "</textarea>\n"?>
    >
    > which seems to make the parser behave as I intended.
    >
    > Anyway...thanks!
    >
    > -- Paul
    >
    > ----- Original Message -----
    > From: "Simon Garner" <sgarnerexpio.co.nz>
    > To: "Paul Warner" <pwarnerwinners-circle.com>; <php-generallists.php.net>
    > Sent: Wednesday, February 21, 2001 8:19 PM
    > Subject: Re: [PHP] pop textarea field w/ text incl. quotes
    > >
    > > Don't worry about quotes - the problem is that you have HTML markup inside
    > > your <textarea>. You just need to convert < and > to &lt; and &gt;,
    > > respectively, in your link text. The functions htmlspecialchars() or
    > > strip_tags() can do this for you.
    > >
    > > i.e.:
    > >
    > > <? echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>
    > >
    > > When the form is submitted (and when it's viewed), those entities will be
    > > converted back to their real characters automatically by the browser.
    > >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    > For additional commands, e-mail: php-general-helplists.php.net
    > To contact the list administrators, e-mail: php-list-adminlists.php.net
    >
    >

    attached mail follows:


    From: "Paul Warner" <pwarnerwinners-circle.com>

    > Simon-
    >
    > Thanks for the tip...I trued using the htmlspecialchars() which allowed
    the
    > remainder of the form to display properly, but left no value in the
    > textarea. Then I noticed a difference in the method I was using compared
    to
    > yours - I'm still learning the ways of PHP so it will take me a while to
    > determine the significance of the syntax differences:
    >
    > Mine: <td width = "60%"><?php echo $linkurl . '<br><textarea
    > value="htmlspecialchars($linkurl)"></textarea></td>\n' ?>
    >
    > Yours: <?php echo "<textarea>" . htmlspecialchars($link) . "</textarea>"
    ?>
    >
    > I wanted a graphical representation of the present link displayed above
    the
    > textarea and then attempted to use php's substitution to build the text
    area
    > within the same string. I updated my code to be more like yours and
    arrived
    > at:
    >
    > <?php echo $linkurl . '<br><form>'?><?php echo "<textarea>" .
    > htmlspecialchars($linkurl) . "</textarea>\n"?>
    >
    > which seems to make the parser behave as I intended.
    >
    > Anyway...thanks!
    >
    > -- Paul
    >

    Ah, the HTML <TEXTAREA> element does not support a VALUE attribute so your
    way will not work. :)

    Unlike <INPUT> tags, the contents (value) of a textarea should be inserted
    between the <textarea>...</textarea> tags, rather than as an attribute.

    Hence what you need is:

    <td width="60%"><?php echo $linkurl . "<br><textarea>" .
    htmlspecialchars($linkurl) . "</textarea></td>\n"; ?>

    In the outputted HTML this will give you:

    <td width="60%"><a href="http://www.blah.com">Blah</a><br><textarea>&lt;a
    href="http://www.blah.com"&gt;Blah&lt;/a&gt;</textarea>

    Which should render as a link, followed by a textarea with the HTML code for
    that link. If you want the first link to render as code as well then you
    need to run it through htmlspecialchars() too.

    Cheers

    > ----- Original Message -----
    > From: "Simon Garner" <sgarnerexpio.co.nz>
    > To: "Paul Warner" <pwarnerwinners-circle.com>;
    <php-generallists.php.net>
    > Sent: Wednesday, February 21, 2001 8:19 PM
    > Subject: Re: [PHP] pop textarea field w/ text incl. quotes
    > >
    > > Don't worry about quotes - the problem is that you have HTML markup
    inside
    > > your <textarea>. You just need to convert < and > to &lt; and &gt;,
    > > respectively, in your link text. The functions htmlspecialchars() or
    > > strip_tags() can do this for you.
    > >
    > > i.e.:
    > >
    > > <? echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>
    > >
    > > When the form is submitted (and when it's viewed), those entities will
    be
    > > converted back to their real characters automatically by the browser.
    > >

    attached mail follows:


    From: "John Monfort" <monfortkahuna.engineering.sdsu.edu>

    >
    >
    > Is it necessary to include the 'http:' in the DB field?
    >
    > It would make your life a lot easier to drop it.
    >
    > You would then store the url values as
    > www.mydomain.com
    >
    > Then, modify your code to add the 'HTTP' whenever it encounter a URL, or
    > wherever you will create a link.
    >
    > This would eliminate the need to deal with special characters...
    >

    No it wouldn't, as the http:// is not the problem, the problem is the HTML
    markup. What Paul could do is have two DB fields, for the URL and the link
    text, and then form the <A> tag at runtime instead of in the data. But this
    maybe is not what he wants.

    Eg

    <?php
        $linkurl = "http://www.blah.com";
        $linktext = "Blah";

        echo "<a href=\"$linkurl\">$linktext</a>";
    ?>

    >
    > On Wed, 21 Feb 2001, Paul Warner wrote:
    >
    > > Simon-
    > >
    > > Thanks for the tip...I trued using the htmlspecialchars() which allowed
    the
    > > remainder of the form to display properly, but left no value in the
    > > textarea. Then I noticed a difference in the method I was using
    compared to
    > > yours - I'm still learning the ways of PHP so it will take me a while to
    > > determine the significance of the syntax differences:
    > >
    > > Mine: <td width = "60%"><?php echo $linkurl . '<br><textarea
    > > value="htmlspecialchars($linkurl)"></textarea></td>\n' ?>
    > >
    > > Yours: <?php echo "<textarea>" . htmlspecialchars($link) . "</textarea>"
    ?>
    > >
    > > I wanted a graphical representation of the present link displayed above
    the
    > > textarea and then attempted to use php's substitution to build the text
    area
    > > within the same string. I updated my code to be more like yours and
    arrived
    > > at:
    > >
    > > <?php echo $linkurl . '<br><form>'?><?php echo "<textarea>" .
    > > htmlspecialchars($linkurl) . "</textarea>\n"?>
    > >
    > > which seems to make the parser behave as I intended.
    > >
    > > Anyway...thanks!
    > >
    > > -- Paul
    > >
    > > ----- Original Message -----
    > > From: "Simon Garner" <sgarnerexpio.co.nz>
    > > To: "Paul Warner" <pwarnerwinners-circle.com>;
    <php-generallists.php.net>
    > > Sent: Wednesday, February 21, 2001 8:19 PM
    > > Subject: Re: [PHP] pop textarea field w/ text incl. quotes
    > > >
    > > > Don't worry about quotes - the problem is that you have HTML markup
    inside
    > > > your <textarea>. You just need to convert < and > to &lt; and &gt;,
    > > > respectively, in your link text. The functions htmlspecialchars() or
    > > > strip_tags() can do this for you.
    > > >
    > > > i.e.:
    > > >
    > > > <? echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>
    > > >
    > > > When the form is submitted (and when it's viewed), those entities will
    be
    > > > converted back to their real characters automatically by the browser.
    > > >
    > >

    attached mail follows:


    Why store the html in the db? Why not have multiple db fields, say url and desc
    then when you grab them from the db to be outputed put them into the html
    print '<A HREF="'.$url.'">'.$desc.'</A>';

    Then you wouldn't have to input all the html when it gets stored in the db, not
    have to worry about quotes, or htmlspecialchars();. Also out of curiosity are
    you stripping all tags but <A> from the input? Wouldn't want to get any nasty
    users inputting <META> refresh tags or anything...

    -David Reid

    On Wed, 21 Feb 2001 17:46:30 -0800 (PST), John Monfort said:

    >
    >
    > Is it necessary to include the 'http:' in the DB field?
    >
    > It would make your life a lot easier to drop it.
    >
    > You would then store the url values as
    > www.mydomain.com
    >
    > Then, modify your code to add the 'HTTP' whenever it encounter a URL, or
    > wherever you will create a link.
    >
    > This would eliminate the need to deal with special characters...
    >
    > __________John Monfort_________________
    > _+-----------------------------------+_
    > P E P I E D E S I G N S
    > www.pepiedesigns.com
    > "The world is waiting, are you ready?"
    > -+___________________________________+-
    >
    > On Wed, 21 Feb 2001, Paul Warner wrote:
    >
    > > Simon-
    > >
    > > Thanks for the tip...I trued using the htmlspecialchars() which allowed the
    > > remainder of the form to display properly, but left no value in the
    > > textarea. Then I noticed a difference in the method I was using compared to
    > > yours - I'm still learning the ways of PHP so it will take me a while to
    > > determine the significance of the syntax differences:
    > >
    > > Mine: <td width = "60%"><?php echo $linkurl . '<br><textarea
    > > value="htmlspecialchars($linkurl)"></textarea></td>\n' ?>
    > >
    > > Yours: <?php echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>
    > >
    > > I wanted a graphical representation of the present link displayed above the
    > > textarea and then attempted to use php's substitution to build the text area
    > > within the same string. I updated my code to be more like yours and arrived
    > > at:
    > >
    > > <?php echo $linkurl . '<br><form>'?><?php echo "<textarea>" .
    > > htmlspecialchars($linkurl) . "</textarea>\n"?>
    > >
    > > which seems to make the parser behave as I intended.
    > >
    > > Anyway...thanks!
    > >
    > > -- Paul
    > >
    > > ----- Original Message -----
    > > From: "Simon Garner" <sgarnerexpio.co.nz>
    > > To: "Paul Warner" <pwarnerwinners-circle.com>; <php-generallists.php.net>
    > > Sent: Wednesday, February 21, 2001 8:19 PM
    > > Subject: Re: [PHP] pop textarea field w/ text incl. quotes
    > > >
    > > > Don't worry about quotes - the problem is that you have HTML markup inside
    > > > your <textarea>. You just need to convert < and > to &lt; and &gt;,
    > > > respectively, in your link text. The functions htmlspecialchars() or
    > > > strip_tags() can do this for you.
    > > >
    > > > i.e.:
    > > >
    > > > <? echo "<textarea>" . htmlspecialchars($link) . "</textarea>" ?>
    > > >
    > > > When the form is submitted (and when it's viewed), those entities will be
    > > > converted back to their real characters automatically by the browser.
    > > >
    > >
    > >
    > > --
    > > PHP General Mailing List (http://www.php.net/)
    > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    > > For additional commands, e-mail: php-general-helplists.php.net
    > > To contact the list administrators, e-mail: php-list-adminlists.php.net
    > >
    > >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    > For additional commands, e-mail: php-general-helplists.php.net
    > To contact the list administrators, e-mail: php-list-adminlists.php.net
    >
    >

    -- 
    Karl's version of Parkinson's Law:  Work expands to exceed the time alloted it.
    

    attached mail follows:


    This must be why you guys get paid the big $$ <g>. I _never_ thought of looking at the HTML for errors, doh! Given the nature of the user who will be inputting the data (familiar with HTML) I will probable keep this 'quick-n-dirty' for now - I do like the multiple fields concept for future mods as it will allow for less-HTML literate users to easily build their links.

    Thanks a bunch!

    -- Paul

    ----- Original Message ----- From: "Simon Garner" <sgarnerexpio.co.nz> To: "John Monfort" <monfortkahuna.engineering.sdsu.edu>; "Paul Warner" <pwarnerwinners-circle.com> Cc: <php-generallists.php.net> Sent: Wednesday, February 21, 2001 8:53 PM Subject: Re: [PHP] pop textarea field w/ text incl. quotes

    > From: "John Monfort" <monfortkahuna.engineering.sdsu.edu> > > > > > > > Is it necessary to include the 'http:' in the DB field? > > > > It would make your life a lot easier to drop it. > > > > You would then store the url values as > > www.mydomain.com > > > > Then, modify your code to add the 'HTTP' whenever it encounter a URL, or > > wherever you will create a link. > > > > This would eliminate the need to deal with special characters... > > > > > No it wouldn't, as the http:// is not the problem, the problem is the HTML > markup. What Paul could do is have two DB fields, for the URL and the link > text, and then form the <A> tag at runtime instead of in the data. But this > maybe is not what he wants. > > Eg > > <?php > $linkurl = "http://www.blah.com"; > $linktext = "Blah"; > > echo "<a href=\"$linkurl\">$linktext</a>"; > ?>

    attached mail follows:


    Hey...Bruno from Brazil :)

    Try this

    while ( list ( $key,$value ) = each($HTTP_POST_VARS) ) {

    echo "$key: $value<br>"; }

    This will list every variable that was past to the browser.

    Enjoy!

    __________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___________________________________+-

    On Wed, 21 Feb 2001, Bruno Freire wrote:

    > Hi! It's me again.... > Bruno From Brazil!! > > My problem is: > > I wanna know the names of the variables that my actual page recives from the > last page (using the POST method). > > Thanks!! > > Bruno. >

    attached mail follows:


    Actually, you may not have to do all that.

    you can use implode().

    By default, implode will join an array, with the supplied character.

    So, if you have $list = (one two three four);

    you can do $all = implode("," , $list);

    to get $all = "one,two,three,four";

    This works pretty well...

    enjoy!

    __________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___________________________________+-

    On Wed, 21 Feb 2001, Jason Stechschulte wrote:

    > On Wed, Feb 21, 2001 at 01:34:10PM -0500, Mike wrote: > > $keys = array_keys($HTTP_POST_VARS); > > for($x = 2; $x < count($keys); $x++) > > { > > $updateString=$updateString.$keys[$x]."='".$HTTP_POST_VARS[$keys[$x]]."',"; > > } > $updateString = ereg_replace(",$", "", $updateString); > > That should take care of the trailing comma. > > > -- > Jason Stechschulte > jpstechunoh.edu > -- > One of the reasons Perl is faster than certain other unnamed interpreted > languages is that it binds variable names to a particular package (or > scope) at compile time rather than at run time. > -- Larry Wall in <199709050035.RAA29328wall.org> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net > >

    attached mail follows:


    a quite neat (though maybe no more efficient) way would be ...

    $keys = array_keys($HTTP_POST_VARS); $key_list = array(); foreach($keys as $fred) { $key_list() = $fred."='".$HTTP_POST_VARS[$fred]."'"; } $updateString=$updateString.implode(",", $key_list)."'";

    ... I haven't tested the detail of this but the theory is sound, I'm fairly sure.

    Tim Ward Senior Systems Engineer

    Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html

    > -----Original Message----- > From: Shawn Esplin [mailto:sesplincleanup.org] > Sent: 21 February 2001 20:17 > To: 'Mike'; php-generallists.php.net > Subject: RE: [PHP] Tough one? > > > I'm not sure this is the best way to do it, but you could try: > > $keys = array_keys($HTTP_POST_VARS); > for($x = 2; $x < (count($keys) - 1); $x++) > { > > $updateString=$updateString.$keys[$x]."='".$HTTP_POST_VARS[$ke > ys[$x]]."',"; > } > $x++; > $updateString=$updateString.$keys[$x]."='".$HTTP_POST_VARS[$ke > ys[$x]]."'"; > > or: > > $keys = array_keys($HTTP_POST_VARS); > for($x = 2; $x < count($keys); $x++) > { > if($x != (count($keys) - 1)) > { > > $updateString=$updateString.$keys[$x]."='".$HTTP_POST_VARS[$ke > ys[$x]]."',"; > } > else > { > > $updateString=$updateString.$keys[$x]."='".$HTTP_POST_VARS[$ke > ys[$x]]."'"; > } > } > > -----Original Message----- > From: Mike [mailto:mpelosoprinceton.edu] > Sent: Wednesday, February 21, 2001 11:34 AM > To: php-generallists.php.net > Subject: [PHP] Tough one? > > > I am building an update string on the fly from form fields.I > am trying to > add a comma between fields but I cant have one after the last > field.This is > the code that doesnt work.Also I cant have a comma at all in > a table with > only one updated field. > > $keys = array_keys($HTTP_POST_VARS); > for($x = 2; $x < count($keys); $x++) > { > $updateString=$updateString.$keys[$x]."='".$HTTP_POST_VARS[$ke > ys[$x]]."',"; > > Thanks > Mike > mpelosoprinceton.edu > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: > php-list-adminlists.php.net >

    attached mail follows:


    From: "Tim Ward" <tim.wardstivesdirect.com>

    > a quite neat (though maybe no more efficient) way would be ... > > $keys = array_keys($HTTP_POST_VARS); > $key_list = array(); > foreach($keys as $fred) > { $key_list() = $fred."='".$HTTP_POST_VARS[$fred]."'"; > } > $updateString=$updateString.implode(",", $key_list)."'"; > > ... I haven't tested the detail of this but the theory is sound, I'm fairly > sure. > > Tim Ward > Senior Systems Engineer > > Please refer to the following disclaimer in respect of this message: > http://www.stivesdirect.com/e-mail-disclaimer.html > >

    Your syntax is a bit convoluted there :-P

    You could just do:

    <?php foreach ($HTTP_POST_VARS as $var => $value) { $vars[] = "$key=$value"; } echo implode(",", $vars); ?>

    attached mail follows:


    I've created a simple form that uploads file to my server. I noticed that I'm having problems when I use Internet Explorer 4.5 and 5.0 on the Mac (I haven't checked it yet on the pc). It may have something to do with the path to the file. When I use Netscape, the entire path is displayed in the form field prior to upload. IE only displays the file name, no path. Is there a way that I could force the path along, echo maybe?

    >>.>>.>>>.>>>>>.>>>>>>>>> <<<<<<<<<.<<<<<.<<<.<<.<<<.<<<<<< Tom Beidler Orbit Tech Services 805.682.8972 (phone) http://www.orbittechservices.com/ 805.682.5833 (fax) tomorbittechservices.com >>.>>.>>>.>>>>>.>>>>>>>>> <<<<<<<<<.<<<<<.<<<.<<.<<<.<<<<<<

    attached mail follows:


    Hi, I'm trying to disable phplib, and I have a .htaccess file consisting of the line

    php_value auto_prepend_file none

    And now I'm getting a 500 internal server error. Can anybody shed some light on what I'm doing wrong?

    Cheers, Gfunk

    attached mail follows:


    From: "Gfunk" <joshgfunk007.com>

    >Hi, I'm trying to disable phplib, and I have a .htaccess file consisting of the line > >php_value auto_prepend_file none > >And now I'm getting a 500 internal server error. Can anybody shed some light >on what I'm doing wrong? > >Cheers, >Gfunk

    It sounds like your Apache configuration does not allow the php_value directive to appear in an .htaccess file. Check your error_log for a description of the problem.

    In httpd.conf (or access.conf) find an applicable <Directory> block and check the setting of AllowOverride.

    I'm not actually sure what the override setting you need is, but you could try Options or just All.

    http://httpd.apache.org/docs/mod/core.html#allowoverride

    Example:

    <Directory /www/htdocs> AllowOverride All ... </Directory>

    Of course, if you're able to edit httpd.conf then you could just put the php_value directive directly in there. :)

    Cheers

    Simon Garner

    attached mail follows:


    I'm not sure what is the original function design of session_destory(). Committing that, my code does not delete currently registered session data from memory. This result in writing currently registered session write to session database again unless programmer explicitly unregister them. If you want to delete session data in memory, you can do that in pg_session_destory() or anywhere in you can use

    session_unset() to unset all session variables.

    User session handlers are called in this order. session is started explicitly or implicitly then pg_session_open() called and data is read using pg_session_read() at that time programmer can see session variables. (If programer calls my pg_session_destory() it only deletes data in db and data is still in memory) connection is closed. pg_session_write() is called (since session data is in memory, write back to session database) then pg_session_close() is called.

    I thought deleting only session data in database would give more freedom to programmers while working session variables. It might be better to put session_unset() in pg_session_destory(), if it suppose to.

    Regards,

    ---
    Yasuo Ohgaki
    

    === Original Message === Hi! I have used your postgresql session functions in http://www.php.net/manual/en/ref.session.php with few changes. I have a login.php page that register 3 things - the pg_connect string, - a login flag to indicate that we already have done the login - actual time In a second php page I test - if login variable is set, if not I redirect to the login page. - if time has expired, if affirmative redirect to login page I have added a "pg_session_destroy" in your "user functions" to delete the actual session but when I reenter in the login page the session_start() re-creates the data I have just deleted with the same session_id. I would like to know how to issue a new session without closing the browser? What did I missed? - Working with php 4.0.4 - php.ini contains session.auto_start Off session.cache_expire 180 session.cache_limiter nocache session.cookie_domain no value session.cookie_lifetime 0 session.cookie_path / session.cookie_secure Off session.entropy_file no value session.entropy_length 0 session.gc_maxlifetime 60 session.gc_probability 1 session.name PHPSESSID session.referer_check no value session.save_handler user session.save_path /tmp session.serialize_handler php session.use_cookies On - track_vars and gpc_globals are not enabled TIA

    -- Evelio Martínez

    attached mail follows:


    Hello,

    I've been reading a LOT on how to solve my problem today, but haven't been able to come up with anything yet.

    Here's my problem: I have an html file that contains many table rows like this:

    <tr><td>Item1</td><td>Item1 Again</td></tr> <tr><td>Item2</td><td>Item2 Again</td></tr> <tr><td>Item3</tr><td>Item3 Again</td></tr> <tr><td>Item4</tr><td>Item4 Again</td></tr>

    And so on. I want to search this html for a table row that has 'Item3' in the first cell. And the second cell should contain 'Item3 Again'. I know that I can do this with something like this:

    $file = fopen("http://localhost/html.html", "r"); $data = fread($file, 10000); $results = eregi("<tr><td>Item3</tr><td>Item3 Again</td></tr>", $data);

    However, this won't exactly work for me, because that contents of the second cell will change daily, so tomorrow, the third table row could look like this:

    <tr><td>Item3</td><td>Item3 Has Changed</td></tr>

    I was thinking I could use sscanf() to do this, but couldn't get anything to work. I've tried everything I can think of.

    Sorry if the explanation of my problem was hard to understand, I don't exactly understand it myself. Thanks everybody!!!

    Regards, Tyler Longren

    attached mail follows:


    Maybe something along the lines of:

    $results = eregi("<tr><td>Item3</tr><td>[a-Z 0-9]</td></tr>", $data);

    -David

    On Wed, 21 Feb 2001 23:32:04 -0600, Tyler Longren said:

    > Hello, > > I've been reading a LOT on how to solve my problem today, but haven't been > able to come up with anything yet. > > Here's my problem: > I have an html file that contains many table rows like this: > > <tr><td>Item1</td><td>Item1 Again</td></tr> > <tr><td>Item2</td><td>Item2 Again</td></tr> > <tr><td>Item3</tr><td>Item3 Again</td></tr> > <tr><td>Item4</tr><td>Item4 Again</td></tr> > > And so on. I want to search this html for a table row that has 'Item3' in > the first cell. And the second cell should contain 'Item3 Again'. I know > that I can do this with something like this: > > $file = fopen("http://localhost/html.html", "r"); > $data = fread($file, 10000); > $results = eregi("<tr><td>Item3</tr><td>Item3 Again</td></tr>", $data); > > > However, this won't exactly work for me, because that contents of the > second cell will change daily, so tomorrow, the third table row could look > like this: > > <tr><td>Item3</td><td>Item3 Has Changed</td></tr> > > I was thinking I could use sscanf() to do this, but couldn't get anything > to work. I've tried everything I can think of. > > Sorry if the explanation of my problem was hard to understand, I don't > exactly understand it myself. Thanks everybody!!! > > Regards, > Tyler Longren > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    -- 
    TANSTAAFL
    

    attached mail follows:


    From: "Tyler Longren" <tyler.longrenmidiowa.net>

    > Hello, > > I've been reading a LOT on how to solve my problem today, but haven't been > able to come up with anything yet. > > Here's my problem: > I have an html file that contains many table rows like this: > > <tr><td>Item1</td><td>Item1 Again</td></tr> > <tr><td>Item2</td><td>Item2 Again</td></tr> > <tr><td>Item3</tr><td>Item3 Again</td></tr> > <tr><td>Item4</tr><td>Item4 Again</td></tr> > > And so on. I want to search this html for a table row that has 'Item3' in > the first cell. And the second cell should contain 'Item3 Again'. I know > that I can do this with something like this: > > $file = fopen("http://localhost/html.html", "r"); > $data = fread($file, 10000); > $results = eregi("<tr><td>Item3</tr><td>Item3 Again</td></tr>", $data); > > > However, this won't exactly work for me, because that contents of the > second cell will change daily, so tomorrow, the third table row could look > like this: > > <tr><td>Item3</td><td>Item3 Has Changed</td></tr> > > I was thinking I could use sscanf() to do this, but couldn't get anything > to work. I've tried everything I can think of. > > Sorry if the explanation of my problem was hard to understand, I don't > exactly understand it myself. Thanks everybody!!! > > Regards, > Tyler Longren >

    You just need to use a regular expression with eregi:

    <?php $data = "<tr><td>Item3</td><td>Item3 Has Changed</td></tr>";

    eregi("<tr><td>([^>]+)</tr><td>([^>]+)</td></tr>", $data, $regs);

    echo $regs[1]; // "Item3" echo $regs[2]; // "Item3 Has Changed" ?>

    A good guide to regular expressions (which are absolutely indispensible if you want to do much work with strings) is here:

    http://www.delorie.com/gnu/docs/rx/rx_toc.html

    Cheers

    Simon Garner

    attached mail follows:


    > <?php > $data = "<tr><td>Item3</td><td>Item3 Has Changed</td></tr>"; > > eregi("<tr><td>([^>]+)</tr><td>([^>]+)</td></tr>", $data, $regs); > > echo $regs[1]; // "Item3" > echo $regs[2]; // "Item3 Has Changed" > ?>

    Oops sorry, that fourth line should say:

    eregi("<tr><td>([^<]+)</tr><td>([^<]+)</td></tr>", $data, $regs);

    From: "Simon Garner" <sgarnerexpio.co.nz>

    > From: "Tyler Longren" <tyler.longrenmidiowa.net> > > > Hello, > > > > I've been reading a LOT on how to solve my problem today, but haven't been > > able to come up with anything yet. > > > > Here's my problem: > > I have an html file that contains many table rows like this: > > > > <tr><td>Item1</td><td>Item1 Again</td></tr> > > <tr><td>Item2</td><td>Item2 Again</td></tr> > > <tr><td>Item3</tr><td>Item3 Again</td></tr> > > <tr><td>Item4</tr><td>Item4 Again</td></tr> > > > > And so on. I want to search this html for a table row that has 'Item3' in > > the first cell. And the second cell should contain 'Item3 Again'. I know > > that I can do this with something like this: > > > > $file = fopen("http://localhost/html.html", "r"); > > $data = fread($file, 10000); > > $results = eregi("<tr><td>Item3</tr><td>Item3 Again</td></tr>", $data); > > > > > > However, this won't exactly work for me, because that contents of the > > second cell will change daily, so tomorrow, the third table row could look > > like this: > > > > <tr><td>Item3</td><td>Item3 Has Changed</td></tr> > > > > I was thinking I could use sscanf() to do this, but couldn't get anything > > to work. I've tried everything I can think of. > > > > Sorry if the explanation of my problem was hard to understand, I don't > > exactly understand it myself. Thanks everybody!!! > > > > Regards, > > Tyler Longren > > > > > > You just need to use a regular expression with eregi: > > <?php > $data = "<tr><td>Item3</td><td>Item3 Has Changed</td></tr>"; > > eregi("<tr><td>([^>]+)</tr><td>([^>]+)</td></tr>", $data, $regs); > > echo $regs[1]; // "Item3" > echo $regs[2]; // "Item3 Has Changed" > ?> > > A good guide to regular expressions (which are absolutely indispensible if > you want to do much work with strings) is here: > > http://www.delorie.com/gnu/docs/rx/rx_toc.html > > > Cheers > > Simon Garner > >

    attached mail follows:


    hi there.

    is there a way to tell crontab to do:

    "run script every 5 mins for 1 hour"..

    i have this mass email script that is so huge that i need it to chunk into records and make sure that it will run every 5 mins for 1 hour.

    Thanks for any help.

    attached mail follows:


    put a sleep(300); at the end of your while() loop - I did this on my mass mailer and it worked like a charm.

    --Joe

    On Fri, Feb 22, 2002 at 02:53:10PM +0800, Arnold Gamboa wrote: > hi there. > > is there a way to tell crontab to do: > > "run script every 5 mins for 1 hour".. > > i have this mass email script that is so huge that i need it to chunk into > records and make sure that it will run every 5 mins for 1 hour. > > Thanks for any help. >

    -- 
    

    ------------------------------------------------------------------------------- Joe Stump, PHP Hacker, joestump98yahoo.com -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V -------------------------------------------------------------------------------

    attached mail follows:


    thanks for the comment

    let's just say i have 100k emails to send... don't you think that will drain the system resources if i send it all at once even if you have usleep(300) on each while?

    your comment please.

    > put a sleep(300); at the end of your while() loop - I did this on my mass > mailer and it worked like a charm. > > --Joe > > On Fri, Feb 22, 2002 at 02:53:10PM +0800, Arnold Gamboa wrote: > > hi there. > > > > is there a way to tell crontab to do: > > > > "run script every 5 mins for 1 hour".. > > > > i have this mass email script that is so huge that i need it to chunk into > > records and make sure that it will run every 5 mins for 1 hour. > > > > Thanks for any help. > > > > -- > > -------------------------------------------------------------------------- ----- > Joe Stump, PHP Hacker, -o) > http://www.miester.org http://www.care2.com /\\ > "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V > -------------------------------------------------------------------------- ----- > > >

    attached mail follows:


    Yup, it will...

    A good idea is to call exec() of a cgi script which sends email without time outs. CGI has it cute feature - never times out. I've seen it in some software.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Arnold Gamboa [mailto:arnoldphp4us.com] Sent: Friday, February 22, 2002 4:37 PM To: Joe Stump Cc: php-generallists.php.net Subject: Re: [PHP] crontab help

    thanks for the comment

    let's just say i have 100k emails to send... don't you think that will drain the system resources if i send it all at once even if you have usleep(300) on each while?

    your comment please.

    > put a sleep(300); at the end of your while() loop - I did this on my mass > mailer and it worked like a charm. > > --Joe > > On Fri, Feb 22, 2002 at 02:53:10PM +0800, Arnold Gamboa wrote: > > hi there. > > > > is there a way to tell crontab to do: > > > > "run script every 5 mins for 1 hour".. > > > > i have this mass email script that is so huge that i need it to chunk into > > records and make sure that it will run every 5 mins for 1 hour. > > > > Thanks for any help. > > > > -- > > -------------------------------------------------------------------------- ----- > Joe Stump, PHP Hacker, -o) > http://www.miester.org http://www.care2.com /\\ > "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V > -------------------------------------------------------------------------- ----- > > >

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    Hi! I am trying to change a filename this is my php: <? change $filename = "yourfile.php3.xml"; to $filename = "yourfile2.php3.xml"; ?> It doesn´t work do I need some more code to get it working, something like fopen?

    Thanks for any help.

    Regards

    Jan

    attached mail follows:


    Jan Grafström wrote: > > Hi! > I am trying to change a filename this is my php: > <? > change $filename = "yourfile.php3.xml"; > to $filename = "yourfile2.php3.xml"; > ?> > It doesn´t work do I need some more code to get it working, something > like fopen? > > Thanks for any help. > > Regards > > Jan

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

    -- 
    Pavel a.k.a. Papi
    

    attached mail follows:


    On Thursday 22 February 2001 08:57, Jan Grafström wrote:

    > I am trying to change a filename this is my php: > <? > change $filename = "yourfile.php3.xml"; > to $filename = "yourfile2.php3.xml"; > ?> > It doesn´t work do I need some more code to get it working, something > like fopen?

    Well, Use PHP instead of COBOL... Sorry, but read some basic tutorials on PHP.

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    I saw God --------- and she was black.

    attached mail follows:


    <snip> > Why do you need to put the values in an array, then read through the > array to print the values? Why not just print each record as you get it > from the DB?

    The array is formed before the page is called. This is then passed to the page which prints it out.

    M

    > On Thu, 22 Feb 2001 02:11, Matt Williams wrote: > > I have done it this way... > > > > $menu = array(); > > $count = $db->num_rows(); > > for($i = 0; $db->next_record(); $i++) > > { > > $menu[$i]["name"] = $db->f("name"); > > $menu[$i]["url"] = $db->f("topic_id"); > > } > > > > OK, so is there a better way of acheiving the same end result? > > and this is what I've got to print the results > > > > while ( list($name, $subarray) = each($menu) ) > > > > > > echo "<a > > href=\"".$subarray["url"]."\">".$subarray["name"]."<a><br>\n"; > > > > } > > > > is there any better way of doing this?? > > > > thanks > > > > M >

    > > -- > David Robley | WEBMASTER & Mail List Admin > RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ > AusEinet | http://auseinet.flinders.edu.au/ > Flinders University, ADELAIDE, SOUTH AUSTRALIA > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    what I think you've missed is your array starts with []['string']

    remove []...

    $menu['name'] = ... should work ... unless your code is a little specific

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Matt Williams [mailto:mattyewlands.com] Sent: Wednesday, February 21, 2001 11:57 PM To: php-generallists.php.net; PHP_UKegroups. com Subject: [PHP] array headaches

    Hi

    could anybody please help me get my head around the following.

    I get some url information from the database (title, url) I am trying to then put this into an array so I can pass it to the page to display a menu. so a) how do I get the data into the array. would this be the way to do it??

    $menu = array(); while($db->next_record()) { $menu[]["name"] = $db->f("name"); $menu[]["url"] = $db->f("topic_id"); } which leads me onto b) how do I get the data back out. I can't test to see if the above works as I can't get at the data

    TIA

    M

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    use isset($action1) and isset($action2) to test each.

    the nice way to do it would be for them to have the same name but different values as you would do with alternative submit buttons, but I haven't ever needed to find out how to do that and doesn't seem to be quite that simple.

    Tim Ward Senior Systems Engineer

    Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html

    > -----Original Message----- > From: Zenith [mailto:zenithlinuxmail.org] > Sent: 21 February 2001 17:51 > To: php-generallists.php.net > Subject: How to get information from <input type=image ...> > > > Hello everbody, if a have HTML document lik this: > <form action = "submit_to.php"> > <input type="image" src="xxx" name="action1"> > <input type="image" src="xxx" name="action2"> > </form> > > How can know whether the user is pressed on the "action1" or > "action2" image > button?? > > >

    attached mail follows:


    Hi...

    I have a file, say temp.txt. It's just a kind of logging file. When my system write one line data to this file, is there any real time way to know this event from php (or other scripting language) ?

    TIA -toto-

    attached mail follows:


    from PHP - now, but you can set a script which will check the file size each minute and if finds it different does something. It will have to run under cron.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: toto [mailto:yantojetcoms.net] Sent: Thursday, February 22, 2001 6:17 PM To: php-generallists.php.net Subject: [PHP] file listener

    Hi...

    I have a file, say temp.txt. It's just a kind of logging file. When my system write one line data to this file, is there any real time way to know this event from php (or other scripting language) ?

    TIA -toto-

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    > -----Original Message----- > From: Mike Tuller [mailto:mitull01willy.wsc.edu] > Sent: Thursday, February 22, 2001 12:01 AM > To: Michael Stearne; Sam Goin > Cc: php mailing list > Subject: Re: [PHP] PDF Problems > > If anyone knows how to fix this please let me know. > In fact the Maintainers of the PDFlib-Extension in PHP change from PHP 4.0.5. That means, that those functions, already mentioned in the manual will work from then on I guess. I also wondered why those functions are mentioned, although they do not work yet.

    The fix you mentioned, was not really correct, because the comment-parser at php.net replaces the <?php with &lt;?php to avoid trouble with html-tags I guess. The fix describes there was just how to do an example pdf with for example php4.0.4pl1 and pdflib 3.0.3, because there is no pdf_new() in this versions. it worked fine for me and I hate the thought of changing my just finished pdf-project to the new functions.

    you'll find a short text about pdflib and php 4.0.5 at

    http://www.php.net/manual/en/ref.pdf.php

    There is a small text with the heading "Confusion with old PDFlib Versions".

    best regards from germany.

    attached mail follows:


    People I tried to check if teh field has set a vaule in it before submit using isset with the sniplet below

    if ((isset($AgeChild))=="false") { $AgeChild = "NA"; }

    The resule is that it always displays NA whether or not it has vaule in the field, what is the correct way of using isset for this purpose? Or should I use empty() ? Jack jackyactivelifestyle.com "There is nothing more rewarding than reaching the goal you set for yourself"

    attached mail follows:


    [PHP] isset()yes, it is the var from the form Jack jackyactivelifestyle.com "There is nothing more rewarding than reaching the goal you set for yourself" ----- Original Message ----- From: Thiva Charanasri To: 'Jackylilst' Sent: Thursday, February 22, 2001 3:59 AM Subject: [PHP] isset()

    Is $AgeChild is the var that passed from a form?

    < Thiva >

    Thiva Charanasri Web Administrator Can-Thai Consulting Co., Ltd. #50 Soi 13 Sukhumvit Road Bangkok 10110 Thailand Tel: 662-651-0064 Fax: 662-651-0065 24 Hour Service Line: 662-651-0063 http://www.canthai.com Email: thivacanthai.com

    People I tried to check if teh field has set a vaule in it before submit using isset with the sniplet below

    if ((isset($AgeChild))=="false") { $AgeChild = "NA"; }

    The resule is that it always displays NA whether or not it has vaule in the field, what is the correct way of using isset for this purpose? Or should I use empty() ?

    Jack jackyactivelifestyle.com "There is nothing more rewarding than reaching the goal you set for yourself"

    attached mail follows:


    > People > I tried to check if teh field has set a vaule in it before submit using isset with the sniplet below > > if ((isset($AgeChild))="false") { > $AgeChild = "NA"; > }

    if you removed the quotes around "false" it should work (as currently "false" is being treated as a string) but another way to do this is like :

    // if not set then ... if ( !isset($AgeChild) ) {

    $AgeChild = 'NA';

    }

    Regards,

    Philip Olson http://www.cornado.com

    > The resule is that it always displays NA whether or not it has vaule > in the field, what is the correct way of using isset for this purpose? > Or should I use empty() ? Jack jackyactivelifestyle.com

    attached mail follows:


    At 00:07 23.02.2001, Jackylilst said: --------------------[snip]-------------------- >if ((isset($AgeChild))=="false") { >$AgeChild = "NA"; --------------------[snip]--------------------

    isset(): generally spoken, returns true if a variable is _defined_, regardless of it's actual value: isset($myvar) => returns false empty($myvar) => returns true $myvar = "something"; isset($myvar) => returns true empty($myvar) => returns false $myvar = ""; isset($myvar) => returns true empty($myvar) => returns true unset($myvar); isset($myvar) => returns false empty($myvar) => returns true

    My advice: avoid comparing to false or true (and since these are constants, don't put them in quotes ;->). // bad way if (isset($myvar) == false) // better way if (!isset($myvar))

    ...ebird

    >O Ernest E. Vogelsinger (\) http://www.1-at-web.at/ ^ ICQ# 13394035

    attached mail follows:


    If the result is always something, for instance in the worth case it is 'N/A' then do:

    if($AgeChild != 'N/A') you can continue

    isset check if the variable has at least a byte in it.

    so this will return true:

    $var = ' '; if(isset($var)) echo 'got something in it';

    Just check for what you know is inside (or not inside) the variable.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Jackylilst [mailto:jackyactivelifestyle.com] Sent: Friday, February 23, 2001 8:07 AM To: php-generallists.php.net Subject: [PHP] isset()

    People I tried to check if teh field has set a vaule in it before submit using isset with the sniplet below

    if ((isset($AgeChild))=="false") { $AgeChild = "NA"; }

    The resule is that it always displays NA whether or not it has vaule in the field, what is the correct way of using isset for this purpose? Or should I use empty() ? Jack jackyactivelifestyle.com "There is nothing more rewarding than reaching the goal you set for yourself"

    attached mail follows:


    On Wednesday 21 February 2001 12:49, Jeff Gannaway wrote:

    > Here's the deal. My customer needs to upload an ASCII export file of > database info generated by MS Access on their PC. I've written a > script that allows them to upload their Access files then does a LOAD > DATA INFILE command to integrate it into the MySQL database on the web > server.

    HTTP uploads shouldn't mangle *anything*...

    > I ran into this problem before when I was manually FTPing export files > then using LOAD DATA INFILE. I fixed it by switcheing from Binary FTP > to ASCII FTP. How can this be done with a PHP script???

    ... but apparently you *want* it to mangle the data (convert line ends). You server is a Unix machine? What error does Mysql give you on the "broken" files?

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    I saw God --------- and she was black.

    attached mail follows:


    On Wednesday 21 February 2001 17:09, Chris Lee wrote: > dspimage.inc > <?php

    [...]

    > index.php > <?php > echo " > <img src='include/dspimage.inc?product_id=123456'> > "; > ?>

    Note: better name that to dspimage.php, as webservers typically don't execute *.inc

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    I saw God --------- and she was black.

    attached mail follows:


    On Wednesday 21 February 2001 18:13, Janet Valade wrote:

    > Previously on this list, there have been questions about the Warning: > page has expired problem. When you submit a form, then press the back > button, you get this message and have to press refresh before the page > will redisplay. > > I have discovered that if you use the following header command, the > problem does not occur. > > header("Cache-Control: public"); > > The back button takes you back to the form, without a warning message, > and the form redisplays with the info you entered. Does anyone know a > reason that the above header should not be used? Does it cause some > sort of problem that I should be aware of?

    Yes. It allows cache proxies to cache the page. That means e.g. if Joe X (using ISP Y) fetches that page, *all* users of ISP Y will get the same page afterwards (including all his private data). Well, in practice proxies won't cache results of POST queries, but it's still a big security hole (never trust programs you don't admin yourself)

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    I saw God --------- and she was black.

    attached mail follows:


    On Wednesday 21 February 2001 18:42, Kenneth R Zink II wrote:

    > > I was just reading at DevShed on how to use Regular Expressions, but > now I'm even more confused. > > Can someone please explain how I would use a REGEX to determine in and > uploaded file is a .gif or .jpg file?

    if (preg_match ('/\.(gif|jpg)$/i', $filename, $matches)) { echo "Congratulations, it's a " . $matches [1] . "!<br>"; } else { echo "Wrong file type!<br>"; }

    Explanation:

    /.../ are the "regular expression quotes", i.e. the real expression is between these slashes

    The "i" after them means "do a case insensitive match" (a "pattern modifier")

    \.(gif|jpg) means "match if the string contains a dot followed by either "gif" or "jpg""

    The dot has to be escaped (prepended with a backslash) because a dot in a regexp has a special meaning: "match any char". The escaping makes it behave as a literal dot

    The "$" means "here has to be the end of the string" (an "anchor")

    => the entire pattern means "match if the string ends with a dot followed by either 'gif' or 'jpg', and ignore case for this"

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    I saw God --------- and she was black.

    attached mail follows:


    Hi,

    I wondered if anyone knew what would be the better method to use to see if a file has been sent/uploaded?

    method 1: if ($HTTP_POST_FILES['file']['name'] != "none" && $HTTP_POST_FILES['file'] != "") {

    method 2: if ($fp = fopen($HTTP_POST_FILES['file']['tmp_name'],"r")) {

    method 2 seems to work better, and seeing as I have to open the file on the next line testing to see if its there seemed the better way to do it?

    How can I find out how long my scripts take to execute?

    I'm currently using.. $stimer = timer(); // code ...... $etimer = timer(); echo "\n\nPage processed in: ". ($etimer-$stimer);

    Function timer() { $milli = explode(" ", microtime()); return $milli[0]; }

    Which works but is their a better way to do it?

    Thanks, Matt

    attached mail follows:


    On Wednesday 21 February 2001 20:11, Hrishi wrote: > On Thursday 22 February 2001 00:12, Brandon Orther wrote: > > Hello, > > > > I am trying to finish up a script with instructions on how to add my > > banner add script to someone's .phtml file. I need to print <? > > readfile(""); ?> > > use : > echo '<? yaddayadda ?>'; > > the single quotes ensure that php does not evaluate the contents of the > string constant

    => it is sent as is, the browser sees a tag that's unknown to him and simply ignores it. I.e. that doesn't work.

    Use the proper HTML entities for the brackets:

    &lt;? readfile (""); ?&gt;

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    I saw God --------- and she was black.

    attached mail follows:


    if it is in html then do this:

    &lt;?

    but if you are using PHP then echo '<?' will work perfectly.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Brandon Orther [mailto:brandonwebintellects.com] Sent: Thursday, February 22, 2001 3:42 AM To: PHP User Group Subject: [PHP] Print in html <?

    Hello,

    I am trying to finish up a script with instructions on how to add my banner add script to someone's .phtml file. I need to print <? readfile(""); ?> in the html page that has instructions for the user. Anyway when I try to do that it just runs as a script... does anyone know how I can get over this?

    Thank you,

    -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager brandonwebintellects.com 800-994-6364 www.webintellects.com --------------------------------------------

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    However I think double quote will work as well... (am I wrong?)

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Hrishi [mailto:hrishimediaibc.com] Sent: Thursday, February 22, 2001 4:12 AM To: Brandon Orther; PHP User Group Subject: Re: [PHP] Print in html <?

    On Thursday 22 February 2001 00:12, Brandon Orther wrote: > Hello, > > I am trying to finish up a script with instructions on how to add my banner > add script to someone's .phtml file. I need to print <? readfile(""); ?>

    use : echo '<? yaddayadda ?>';

    the single quotes ensure that php does not evaluate the contents of the string constant

    cheers, hrishi

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    On Thursday 22 February 2001 00:04, Simon Garner wrote:

    > > I have a database of numbers: > > > > TOTAL HITS: 1000 > > PAGE 1: 500 > > PAGE 2: 250 > > PAGE 3: 250 > > > > How can I query these numbers and display back a percentage number? > > For instance with the numbers above: > > > > PAGE 1: 50% > > PAGE 2: 25% > > PAGE 3: 25% > > > > Or is their a process by which to store numbers for easily getting > > this to work? > > SELECT (hitcount / 1000) * 100 AS percentage FROM sometable

    Better (if it works): SELECT (hitcount / MAX(hitcount)) * 100 AS percentage FROM sometable

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    I saw God --------- and she was black.

    attached mail follows:


    > Better (if it works): > SELECT (hitcount / MAX(hitcount)) * 100 AS percentage FROM sometable

    Nope unfortunately that does not work :(

    Firstly using MAX() will not work as that finds the largest value in the group; SUM() would be more appropriate as it finds the total for that column in the group. But you can't group the data here (you want to select all page rows from the table) so these grouping functions are not usable.

    He will need to do two queries:

    <?php $result = mysql_query("SELECT SUM(hitcount) FROM pages"); list($totalhits) = mysql_fetch_row($result);

    $result = mysql_query("SELECT (hitcount / $totalhits) * 100 AS percentage FROM pages"); ?>

    I think...

    From: "Christian Reiniger" <creinigmayn.de>

    > On Thursday 22 February 2001 00:04, Simon Garner wrote: > > > I have a database of numbers: > > > > TOTAL HITS: 1000 > > PAGE 1: 500 > > PAGE 2: 250 > > PAGE 3: 250 > > > > How can I query these numbers and display back a percentage number? > > For instance with the numbers above: > > > > PAGE 1: 50% > > PAGE 2: 25% > > PAGE 3: 25% > > > > Or is their a process by which to store numbers for easily getting > > this to work? > > SELECT (hitcount / 1000) * 100 AS percentage FROM sometable

    Cheers

    Simon Garner

    attached mail follows:


    I have once requested a feature like this at PHP-DEV..

    here's the code: http://bugs.php.net/?id=7429

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Blake S. [mailto:blakewebintention.com] Sent: Thursday, February 22, 2001 7:15 AM To: php-generallists.php.net Subject: [PHP] Generating percentages of numbers

    I have a database of numbers:

    TOTAL HITS: 1000 PAGE 1: 500 PAGE 2: 250 PAGE 3: 250

    How can I query these numbers and display back a percentage number? For instance with the numbers above:

    PAGE 1: 50% PAGE 2: 25% PAGE 3: 25%

    Or is their a process by which to store numbers for easily getting this to work?

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    At 11:47 22-2-01 +0100, Christian Reiniger wrote: >On Thursday 22 February 2001 00:04, Simon Garner wrote: > > > > I have a database of numbers: > > > > > > TOTAL HITS: 1000 > > > PAGE 1: 500 > > > PAGE 2: 250 > > > PAGE 3: 250 > > > > > > How can I query these numbers and display back a percentage number? > > > For instance with the numbers above: > > > > > > PAGE 1: 50% > > > PAGE 2: 25% > > > PAGE 3: 25% > > > > > > Or is their a process by which to store numbers for easily getting > > > this to work? > > > > SELECT (hitcount / 1000) * 100 AS percentage FROM sometable > >Better (if it works): >SELECT (hitcount / MAX(hitcount)) * 100 AS percentage FROM sometable

    Should be sum then i think :)

    >-- >Christian Reiniger >LGDC Webmaster (http://sunsite.dk/lgdc/) > >I saw God --------- and she was black. > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribelists.php.net >For additional commands, e-mail: php-general-helplists.php.net >To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    You should escape your backslashes in windows file pathes

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Christian Reiniger [mailto:creinigmayn.de] Sent: Wednesday, February 21, 2001 7:31 PM To: php-generallists.php.net Subject: Re: [PHP] system() PHP newbie!!

    On Tuesday 20 February 2001 21:17, Kevin Connolly wrote:

    > just adding the line: system("C:/temp.exe")?? I have also tried > system("C:\temp.exe)!! This is probably a really silly question but I

    As you use double quotes here, PHP will interpret the "\t" in there as TAB character. Write "C:\\temp.exe" instead.

    > send me an example or tell me what I am doind wrong? Any assistance is > very much appreciated,

    Well, it would help if you'd tell us what goes wrong - error messages, things it should do but doesnt ...

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    What luck for the rulers that men do not think.

    - Adolf Hitler

    -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-helplists.php.net To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    I don't think so, you never know when someone leaves your site.

    you can detect a visit - yes, but nothing so interactive you can do with PHP as with JavaScript. I've seen some JavaScript counters like this ages ago. Search for that.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Jan Grafström [mailto:janlillemanshus.com] Sent: Wednesday, February 21, 2001 7:39 PM To: php-generallists.php.net Subject: [PHP] Can you check if someone is online on your homepage?

    Hi! Can you use a php-script to see if there is someone on your homepage? Im going to make a demo with flash, php,xml and xsl and if more than one at the moment are testing the demo, it won´t work beacause of the work-file is cleaned up every time someone enters.If you can see a digit on the page than you can tell visitor to goto another instance of the page.

    Thanks for help. Regards

    Jan

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    yeah, you can just fputs() an empty string in it and close the file. In this way you'll empty it all.

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Tim Ward [mailto:tim.wardstivesdirect.com] Sent: Wednesday, February 21, 2001 8:30 PM To: 'jangrafstrom.net'; php-generallists.php.net Subject: [PHP] RE: Can you make a file empty?

    does this not already do it? according the manual "w" as the second parameters will "place the file pointer at the beginning of the file and truncate the file to zero length".

    Tim Ward Senior Systems Engineer

    Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html

    > -----Original Message----- > From: Jan Grafström [mailto:janlillemanshus.com] > Sent: 20 February 2001 18:47 > To: php-generallists.php.net > Subject: Can you make a file empty? > > > Hi! > I am trying to delete all text in a file. > $yourfile = "file.txt"; > $fp = fopen($yourfile,w) > "is there any good code to put in here?" > fclose($fp); > > Thanks for any help. > > Regards > > Jan > >

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    the manual implies that you don't need to write anything to the file to clear what's in it already, is this not the case?

    Tim Ward Senior Systems Engineer

    Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html

    > -----Original Message----- > From: PHPBeginner.com [mailto:php-generalphpbeginner.com] > Sent: 22 February 2001 11:15 > To: Tim Ward; jangrafstrom.net; php-generallists.php.net > Subject: RE: [PHP] RE: Can you make a file empty? > > > yeah, you can just fputs() an empty string in it and close the file. > In this way you'll empty it all. > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > maximphpbeginner.com > www.phpbeginner.com > > > > > -----Original Message----- > From: Tim Ward [mailto:tim.wardstivesdirect.com] > Sent: Wednesday, February 21, 2001 8:30 PM > To: 'jangrafstrom.net'; php-generallists.php.net > Subject: [PHP] RE: Can you make a file empty? > > > does this not already do it? according the manual "w" as the second > parameters will "place the file pointer at the beginning of > the file and > truncate the file to zero length". > > Tim Ward > Senior Systems Engineer > > Please refer to the following disclaimer in respect of this message: > http://www.stivesdirect.com/e-mail-disclaimer.html > > > > -----Original Message----- > > From: Jan Grafström [mailto:janlillemanshus.com] > > Sent: 20 February 2001 18:47 > > To: php-generallists.php.net > > Subject: Can you make a file empty? > > > > > > Hi! > > I am trying to delete all text in a file. > > $yourfile = "file.txt"; > > $fp = fopen($yourfile,w) > > "is there any good code to put in here?" > > fclose($fp); > > > > Thanks for any help. > > > > Regards > > > > Jan > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: > php-list-adminlists.php.net > >

    attached mail follows:


    Year.. probably it is ....

    I've never tried ... In this cases If I need it empty I just remove it, and when I write in if it doesn't exists then new file is being generating ... It feels easier to me ...

    -----Original Message----- From: Tim Ward [mailto:tim.wardstivesdirect.com] Sent: Thursday, February 22, 2001 8:15 PM To: 'PHPBeginner.com'; Tim Ward; jangrafstrom.net; php-generallists.php.net Subject: RE: [PHP] RE: Can you make a file empty?

    the manual implies that you don't need to write anything to the file to clear what's in it already, is this not the case?

    Tim Ward Senior Systems Engineer

    Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html

    > -----Original Message----- > From: PHPBeginner.com [mailto:php-generalphpbeginner.com] > Sent: 22 February 2001 11:15 > To: Tim Ward; jangrafstrom.net; php-generallists.php.net > Subject: RE: [PHP] RE: Can you make a file empty? > > > yeah, you can just fputs() an empty string in it and close the file. > In this way you'll empty it all. > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > maximphpbeginner.com > www.phpbeginner.com > > > > > -----Original Message----- > From: Tim Ward [mailto:tim.wardstivesdirect.com] > Sent: Wednesday, February 21, 2001 8:30 PM > To: 'jangrafstrom.net'; php-generallists.php.net > Subject: [PHP] RE: Can you make a file empty? > > > does this not already do it? according the manual "w" as the second > parameters will "place the file pointer at the beginning of > the file and > truncate the file to zero length". > > Tim Ward > Senior Systems Engineer > > Please refer to the following disclaimer in respect of this message: > http://www.stivesdirect.com/e-mail-disclaimer.html > > > > -----Original Message----- > > From: Jan Grafström [mailto:janlillemanshus.com] > > Sent: 20 February 2001 18:47 > > To: php-generallists.php.net > > Subject: Can you make a file empty? > > > > > > Hi! > > I am trying to delete all text in a file. > > $yourfile = "file.txt"; > > $fp = fopen($yourfile,w) > > "is there any good code to put in here?" > > fclose($fp); > > > > Thanks for any help. > > > > Regards > > > > Jan > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: > php-list-adminlists.php.net > >

    attached mail follows:


    strange .. should work ...

    try it again ... search for some HTML errors and see if in your PHP file there's HTTP_GET_VAR, if is there then change the _GET_ into _POST_

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Denis L. Menezes [mailto:menezesdsingnet.com.sg] Sent: Wednesday, February 21, 2001 11:46 PM To: php-generallists.php.net Subject: [PHP] POST against GET

    Hello friends.

    I am running PHP4 on an Intel Win NT server 4 sp6 machine.

    When I use POST the feedback form does not work but itw works when I use GET. Can anyone advise why this is so? The data that I am using are only 2 string variables of one word each.

    thank you denis

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    HTTP_REFERER work ONLY clicking a link which brings you to a page in the SAME window. this value comes from your browser and it is very unreliable

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: Dhaval Desai [mailto:dhaval_adamsyahoo.com] Sent: Thursday, February 22, 2001 12:09 AM To: php-generallists.php.net Subject: [PHP] HTTP_REFERER doesn't work with redirects...?

    Hi!

    I just want to get the URL of the page that is redirecting to the other page. For example..

    I have two files login.php something.php

    Something.php has a line saying:

    <?php

    header ("Location: ./login.php");

    ?>

    So When I open Something.php it automatically takes me to login.php. On the login.php page I have the following lines....

    <?php

    echo $HTTP_REFERER;

    ?>

    It doesn't seem to work. I think the problem is because I don't click and go to something.php. I am getting redirected to the file./ SO is there nay other way I can get the URL of the file Which is redirecting.

    Thanx a lot

    Cheers!~ Dhaval Desai

    __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    you made a comparison in your code. it returned true which is 1.

    what are you trying to do anyway? if you want to compare and print it only if it's yes then do:

    $confidential = 0; echo "$confidential " . $confidential ? 'yes' : '';

    Sincerely,

    Maxim Maletsky Founder, Chief Developer

    PHPBeginner.com (Where PHP Begins) maximphpbeginner.com www.phpbeginner.com

    -----Original Message----- From: php3developersdesk.com [mailto:php3developersdesk.com] Sent: Thursday, February 22, 2001 1:56 AM To: Jason Murray; php-generallists.php.net Subject: Re: [PHP] Variable Strangeness

    Addressed to: Jason Murray <jasonjwebmedia.com> php-generallists.php.net

    ** Reply to note from Jason Murray <jasonjwebmedia.com> Wed, 21 Feb 2001 11:37:40 -0600 > > Hi, > > I came across this: > > $confidential = 0; > echo "$confidential " . ($confidential == "yes"); > > In which "0 1" was printed. >

    $confidential = 0; # Numeric 0

    That explains the 0.

    $confidential == "yes"

    This is a little tricky. The numeric value of 'yes' is 0, so it evaluates to the same thing as 0 == 0, which is true. True has a numeric value of 1, although all values besides 0 are considered true.

    You might want to look at the === operator which checks that both the value and the type of the operands is identical.

    http://www.php.net/manual/en/html/language.operators.comparison.html

    Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    Hi,

    how can I determine size of directory with subdirectories? if I see at "ls -l" it returns directory size 4096. I want to know how large is directory (with files into) without looping all files ...

    thanx,

    -- 
    Andris
    mailto:ajandrisparks.lv
    

    attached mail follows:


    Hi!

    Check ou this website:

    THe problem is that when u Click on anyof the links on the left.. Currently only the Equity link..It will check for a cookie in your browser, if cookie is found then It''ll show u the content but if not found it'll redirect to lohin.php page.

    Before redirecting it will also store a cookie in the browser named camefrom.

    SO then On the login.php page a user enters username and pasword and Submits.. if user is found then It has to get the Cookie value like this:

    $goto = $HTTP_COOKIE_VARS['camefrom'];

    header ("Location: $goto");

    but the problem is that it goes back to login.php instead of equity.php

    Si there any possible reason for this..?

    Thanx!

    Cheers!~ Dhaval Desai

    __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

    attached mail follows:


    What does it mean when I get the line 'posix_getpwnam(username) failed with "Error number not set" in /xx.php3 on line ##' printed? It doesn't return anything anymore.