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: Sat Jan 18 2003 - 08:53:08 CST

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

    php-general Digest 18 Jan 2003 14:53:08 -0000 Issue 1830

    Topics (messages 132074 through 132093):

    Re: Gridwidget - javascript
            132074 by: David Rice
            132077 by: Jason Wong

    Select multiple boxes
            132075 by: Gregory Chagnon
            132092 by: Cal Evans
            132093 by: John W. Holmes

    Re: Sessions or Cookies?
            132076 by: Peter Janett

    Re: $HTTP_GET_VARS
            132078 by: Philip Olson

    Re: Acessing $DOCUMENT_ROOT
            132079 by: Philip Olson

    Unsupported operand types
            132080 by: Brian T. Allen

    Re: Ever complained about lousy PHP programmers?
            132081 by: olinux
            132091 by: Cal Evans

    Re: PHP Review Site
            132082 by: Manuel Lemos

    Free PHP Hosts?
            132083 by: JJ Harrison

    Re: occasional mcrypt problems
            132084 by: Steve Yates

    Upload multiple files
            132085 by: Antti

    Check for start_sessoin without causing header problems
            132086 by: SLanger.spirit21.de

    Re: PUT uploads
            132087 by: Chris Jarecki

    Result in the same page
            132088 by: Ezequiel Sapoznik
            132089 by: Jason Wong
            132090 by: Cal Evans

    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:


    Hi:
    I believe that if you reference the form element like:

    document.forms['mycell[]'].value

    you will get what you want.
    HTH
    David

    On Friday, January 17, 2003, at 08:33 PM, Nico Jansen - NiRo IT
    Consultants B.V. wrote:

    >
    > Hi all,
    >
    > I'm trying to write a grid widget in php. When the user changes the
    > value of
    > a cell the totals must be recalculated at the client side.
    > I can write a javascript when I use simple variables like A1, B1.
    >
    > <td><input type=text name='A1' SIZE=5 MAXLENGTH=5
    > onChange="njrecalculate()"></td>
    > <td><input type=text name='B1' SIZE=5 MAXLENGTH=5
    > onChange="njrecalculate()"></td>
    >
    > This javascript will do the trick:
    >
    > function njrecalculate()
    > {
    > document.forms[0].mytot.value =
    > Math.round(document.forms[0].A1.value)
    > + Math.round(document.forms[0].B1.value) ;
    >
    > }
    >
    > But now I want to create a dynamice grid by using the array variable
    > e.g.
    > mycell[]:
    > <?php
    > echo "<tr><td><input type=text NAME='mycel[]' SIZE=5 MAXLENGTH=5
    > onChange='njrecalculate()' value=$mycel[0]></td></tr>";
    > echo "<tr><td><input type=text NAME='mycel[]' SIZE=5 MAXLENGTH=5
    > onChange='njrecalculate()' value=$mycel[1]></td></tr>";
    > echo "<tr><td><input type=text NAME='mytotals' SIZE=5 MAXLENGTH=5
    > onChange='njrecalculate()' value=$mytot></td></tr>";
    > ?>
    >
    > Does anybody know how to access these mycell form fields on the client
    > side
    > using javascript.
    >
    >
    > Nico Jansen
    >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >

    attached mail follows:


    On Saturday 18 January 2003 10:50, David Rice wrote:

    > > I'm trying to write a grid widget in php. When the user changes the
    > > value of
    > > a cell the totals must be recalculated at the client side.
    > > I can write a javascript when I use simple variables like A1, B1.
    > >
    > > <td><input type=text name='A1' SIZE=5 MAXLENGTH=5
    > > onChange="njrecalculate()"></td>
    > > <td><input type=text name='B1' SIZE=5 MAXLENGTH=5
    > > onChange="njrecalculate()"></td>
    > >
    > > This javascript will do the trick:
    > >
    > > function njrecalculate()
    > > {
    > > document.forms[0].mytot.value =
    > > Math.round(document.forms[0].A1.value)
    > > + Math.round(document.forms[0].B1.value) ;
    > >
    > > }
    > >
    > > But now I want to create a dynamice grid by using the array variable
    > > e.g.
    > > mycell[]:
    > > <?php
    > > echo "<tr><td><input type=text NAME='mycel[]' SIZE=5 MAXLENGTH=5
    > > onChange='njrecalculate()' value=$mycel[0]></td></tr>";
    > > echo "<tr><td><input type=text NAME='mycel[]' SIZE=5 MAXLENGTH=5
    > > onChange='njrecalculate()' value=$mycel[1]></td></tr>";
    > > echo "<tr><td><input type=text NAME='mytotals' SIZE=5 MAXLENGTH=5
    > > onChange='njrecalculate()' value=$mytot></td></tr>";
    > > ?>
    > >
    > > Does anybody know how to access these mycell form fields on the client
    > > side
    > > using javascript.

    > I believe that if you reference the form element like:
    >
    > document.forms['mycell[]'].value
    >
    > you will get what you want.

    Which means you have to give your text elements unique names. IE mycel[0]
    instead of mycel[] etc.

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

    /* Today is a good day for information-gathering. Read someone else's mail file. */

    attached mail follows:


    Hi- Is there any way to get all of the elements in a SELECT MULTIPLE box, not just the ones that are selected? Thanks! -Greg

    attached mail follows:


    use [] in your select box name. When it comes back in the $_POST array you will have an array of options. It breaks HTML standard therefore it is a Bad Thing (tm) but it does work.

    <SELECT name="mySelect[]" multi > <option name='1'>Don't pick me</option> <option name='2'>Pick me</option> </select>

    Selecting both results in:

    $_POST['mySelect'][1] == "Don't pick me" $_POST['mySelect'][2] == "Pick me"

    HTH, =C=

    * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com *

    -----Original Message----- From: Gregory Chagnon [mailto:gregchagnonhotmail.com] Sent: Friday, January 17, 2003 11:14 PM To: php-generallists.php.net Subject: [PHP] Select multiple boxes

    Hi- Is there any way to get all of the elements in a SELECT MULTIPLE box, not just the ones that are selected? Thanks! -Greg

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

    attached mail follows:


    > Is there any way to get all of the elements in a SELECT MULTIPLE box, not > just the ones that are selected? Thanks!

    No. You create the box, so you should know all of the possible values.

    ---John W. Holmes...

    PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

    attached mail follows:


    Sessions themselves use cookies, though, right? So, if you want your app to work for those who don't have cookies, you have to pass the session data in the url string, at least that's my understanding.

    Peter Janett

    New Media One Web Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PostgreSQL coming soon!

    http://www.newmediaone.net webmasternewmediaone.net (303)828-9882

    ----- Original Message ----- From: "Daevid Vincent" <daeviddaevid.com> To: <shiflettphp.net>; "'Cesar Aracena'" <icaamicaam.com.ar>; <php-generallists.php.net> Sent: Friday, January 17, 2003 6:32 PM Subject: RE: [PHP] Sessions or Cookies?

    > Agreed. Sessions are much more secure and convienient to use too. Since > it's not reliant on the client to have cookies enabled, that's another > benefit. Plus it's MUCH harder for a client to spoof/alter a session > variable if you use the $_SESSION['myvar'] > > > -----Original Message----- > > From: Chris Shiflett [mailto:shiflettphp.net] > > Sent: Friday, January 17, 2003 9:29 AM > > To: Cesar Aracena; php-generallists.php.net > > Subject: Re: [PHP] Sessions or Cookies? > > > > > > --- Cesar Aracena <icaamicaam.com.ar> wrote: > > > Should I use the no-so-secure old cookies method > > > or should I start a new session every time a client > > > drops in and handle each cart by session name or ID? > > > > My advice is to only use cookies to identify a Web client. > > Any data you want to associate with that Web client (user > > data, for example) should be stored on the server - > > database, session store, etc. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Everyone from this thread needs to reread this:

    http://www.php.net/variables.external

    Regards, Philip

    attached mail follows:


    > How do I access $DOCUMENT_ROOT when register_gobals is set off? I think > there's an array, something like $HTTP_ENV_VARS['DOCUMENT_ROOT'] but I can't > find it in the documentation.

    http://www.php.net/variables.predefined

    Regards, Philip

    attached mail follows:


    Hi,

    I've just spent the night upgrading my RedHat 6.2 server to:

    Apache 1.3.27 PHP 4.3.0 MySQL 3.23.54a Mod_SSL 2.8.12 OpenSSL 0.9.7 ZendOptimizer 2.1.0

    Now I'm getting (inconsistently):

    PHP Fatal error: Unsupported operand types in /web/domain/html/includes/item.inc on line 35

    That line contains: $variable1 = $variable2 - 1;

    Both variables may be unassigned prior to this line, or may have numeric values.

    In a related piece of weirdness, I have this included at the bottom of every file:

    <?php if(mysql_error()) { $MYSQL_ERROR = mysql_error(); $MYSQL_ERROR_NO = mysql_errno(); $date = (date("l F d, Y g:i A")); mail("briandomain.com", "Database Error", "

    Errors: $MYSQL_ERROR_NO:$MYSQL_ERROR

    Query: $query_log

    Page: $PHP_SELF Date: $date

    ","From: Webmaster <webmasterdomain.com>"); ?>

    Which normally returns something like:

    ------------- Errors: 1062:Duplicate entry 'emaildomain.com' for key 1

    Query:

    Page: /account/new.html Date: Friday January 17, 2003 12:42 PM

    But now it returns: ---------------- Errors: Saturday January 18, 2003 3:18 AM:Saturday January 18, 2003 3:18 AM

    Query: Array

    Page: /community/newsletter.html/2001-03-01 Date: Array -------------

    How can $date be an array, when it gets assigned right above where it gets called?

    What am I missing in this new version of PHP that is making my scripts seemingly incompatible?

    Thanks, Brian Allen

    attached mail follows:


    I prefer single quotes on stuff that doesn't need to be parsed. In most cases this is more efficient, though probably not noticed except on a large scale. I also think it makes it easier to include html strings (because double quotes don't need to be escaped) and I find it easier to work my code in Homesite.

    echo '<p>'.$something.' '.$something_else.'</p>'; rather than echo "<p>$something $something_else</p>";

    --- Peter Hutnick <peter-listshutnick.com> wrote: > Well, here's your chance to criticize a newbie. > > As an exercise in learning PHP I have written a > rot-13 script. It is at > http://hutnick.com/rot13/index.html?show_content=1 . > > I'm soliciting comments on style, technique, etc. > Be brutal, but don't > get your feelings hurt if I don't take your comments > as gospel. > References will help me take comments to heart. > > It will be easier on me if you send or CC comments > to phphutnick.com. > > Thanks a million! > > -Peter > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

    attached mail follows:


    Since no one else has asked, I'll bite. Why not just use str_rot13()?

    <brutal> The biggest problem I have with your code is that you didn't learn enough about the language to know that this was already in the code. As a newb, you need to set down with your favorite version of the manual (I keep the windows help version open at all times) and familiarize yourself with the language. You do not need to memorize each function' signature but it would help if you read the description of each function. You'll be surprised what you find in there. </brutal>

    =C=

    * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com *

    -----Original Message----- From: Peter Hutnick [mailto:peter-listshutnick.com] Sent: Thursday, January 16, 2003 10:40 AM To: php-generallists.php.net Subject: [PHP] Ever complained about lousy PHP programmers?

    Well, here's your chance to criticize a newbie.

    As an exercise in learning PHP I have written a rot-13 script. It is at http://hutnick.com/rot13/index.html?show_content=1 .

    I'm soliciting comments on style, technique, etc. Be brutal, but don't get your feelings hurt if I don't take your comments as gospel. References will help me take comments to heart.

    It will be easier on me if you send or CC comments to phphutnick.com.

    Thanks a million!

    -Peter

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

    attached mail follows:


    Hello,

    On 01/17/2003 11:40 PM, Stephen wrote: > I was just wondering if there were any PHP review sites that review free > and paid scripts? If so, where?

    If your script is in the form of a PHP class of objects, you may want to try uploading it to the PHP Classes site. You will not get explict reviews, bu your work is exposed to tens of thousands of PHP users eager to learn about new classes.

    http://www.phpclasses.org/

    -- 
    

    Regards, Manuel Lemos

    attached mail follows:


    Until now I haven't had the need for a free PHP host because what I have done has been commercial.

    However, In this case I am doing the website for my PC Gaming clan. We are one step below needing php to do alot of stuff.

    Does anyone know of a free php webhost? (Banners, poop-ups etc are exceptable).

    --
    ---
    JJ Harrison
    lizner2002yahoo.com.au
    

    attached mail follows:


    "Steve Yates" <steveteamITS.com> wrote in message news:20030117193854.47374.qmailpb1.pair.com... > After much testing, I think I may have it. It appears that MySQL is > dropping a trailing space from the value being inserted into the database! > For example if the encrypted string is "(.A®¢m¸"¼'À " MySQL stores the > value without the trailing space (and it is a space). Why is that?

    As with many "bugs" it's because I told it to! To my surprise, MySQL varchar fields have their trailing spaces removed on insertion. Tinyblob or Tinytext fields do not, so one needs to use those (or their larger brethren) when saving encrypted or binary data to MySQL. Thanks to those who tried to help!

    - Steve Yates - Computers make very fast, very accurate mistakes.

    ~ Taglines by Taglinator - www.srtware.com ~

    attached mail follows:


    I want to do this for multiple files. I tried to do this with a foreach -loop but I think I made some mistakes with the array "userfile". In this example userfile is just the "name" in the input tag. When uploading multiple files userfile is -ofcourse- an array like this: name='userfile[]'. Now I want to know how to handle with that array in somekind of a loop. For one file the script is this:

    if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { $namename=$_FILES['userfile']['name']; move_uploaded_file($_FILES['userfile']['tmp_name'],"/path/$namename"); if (rename("/path/$namename", "/path/$uartist-$usong.mp3")) { $query = "INSERT INTO table (column1,column2,column3) values ('$value1','$value2','$value3')"; mysql_query($query) or die ("Couldn't make query!"); print "File Upload and rename succesful!"; } else { print "File Upload failed!"; }

    }

    antti

    attached mail follows:


    Hello

    I checked the PHP manual and couldn't find anything on this...

    When I call session_register() an implicit call to session_start() is executed. So if the session handling uses cookies to track the session and the call to session_register() is not before any output this will cause a header allready sent problem. Is this correct?

    If so how can I call a register session from within a class and make sure that the session is allready active and if not just print a warning.

    For background information: The class mentioned above is part of a classlib used by others and I can not guarantee that they call session_start since I have no controll over how my class lib gets included. So the issue here is if it is possible to create a backup for this problem or if I just have to rely on the user of the classlib to understand the mechanisms of session tracking. Any ideas on this? What do you consider best practice in this matter?

    Thanks for all the advice I have received so far

    Stefan

    attached mail follows:


    my php version is 4.3.0 :)

    attached mail follows:


    It is possible to run a query in php when the user press a button an return the result in the same page?

    Thanks!

    Ezequiel

    attached mail follows:


    On Saturday 18 January 2003 20:11, Ezequiel Sapoznik wrote: > It is possible to run a query in php when the user press a button an return > the result in the same page?

    Yes.

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

    /* An idea is not responsible for the people who believe in it. */

    attached mail follows:


    Yes, just user $_SERVER['PHP_SELF'] as the action of your form. This will cause the page to call itself. Then you can branch your processing on the existence of a SUBMIT button (or whatever) and handle the query.

    I do all my pages this way because it keeps all the code in a single page. It's easier for me to find it that way.

    =C=

    * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com *

    -----Original Message----- From: Ezequiel Sapoznik [mailto:ezequielmibbva.com.ar] Sent: Saturday, January 18, 2003 6:11 AM To: php-generallists.php.net Subject: [PHP] Result in the same page

    It is possible to run a query in php when the user press a button an return the result in the same page?

    Thanks!

    Ezequiel

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