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: Sun Jan 19 2003 - 22:22:40 CST

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

    php-general Digest 20 Jan 2003 04:22:40 -0000 Issue 1833

    Topics (messages 132181 through 132204):

    Re: SQL+php
            132181 by: Chris Shiflett
            132183 by: John W. Holmes

    Re: Auto Incrementing in PHP
            132182 by: Don Mc Nair
            132185 by: Jason Wong
            132191 by: Don Read

    Re: Changing order of just one array item?
            132184 by: -<[ Rene Brehmer ]>-

    Re: How know how many sessions are active?
            132186 by: Leon Mergen

    Multiplication of double
            132187 by: Cesar Aracena
            132188 by: Foong
            132189 by: Jason Wong
            132195 by: Chris Shiflett

    Re: Free PHP Hosts?
            132190 by: David T-G

    please help
            132192 by: JamsterJAM
            132193 by: Ray Hunter
            132194 by: Jason Sheets

    Text report templates a la Perl
            132196 by: Duncan Hill

    php-4.3.0 and wu-imap failed to compile
            132197 by: Ezra Nugroho

    PHP at LinuxWorld Expo 2003
            132198 by: Hans Zaunere

    php.ini: how to load different ini file depending on host?
            132199 by: Jean-Christian Imbeault
            132201 by: Timothy Hitchens \(HiTCHO\)
            132202 by: Jean-Christian Imbeault
            132203 by: Justin French

    cli class
            132200 by: David T-G

    Mass Mailing with PHP & MySQL
            132204 by: Tim Thorburn

    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:


    --- Sean Burlington <seanuncertainty.org.uk> wrote:
    > I think the bandwidth wasters are those who ask
    > questions poorly (it takes several follow up mails
    > to find out what the question was) and those who
    > don't have a qucik look at the archives first
    > (is someone puuting together an FAQ ?)

    I agree. I think John's response was a simple answer to a
    simple question. He was probably tired of trying to
    interpret questions from this list. I suppose I take a
    similar approach in that I quickly delete questions that
    make no sense or only hint at the real question. Perhaps I
    am being rude, too, but I'm just quieter about it. :-)

    Oh, and here is a link that I think John alluded to:

    http://www.tuxedo.org/~esr/faqs/smart-questions.html

    Chris

    attached mail follows:


    > --- Sean Burlington <seanuncertainty.org.uk> wrote:
    > > I think the bandwidth wasters are those who ask
    > > questions poorly (it takes several follow up mails
    > > to find out what the question was) and those who
    > > don't have a qucik look at the archives first
    > > (is someone puuting together an FAQ ?)
    >
    > I agree. I think John's response was a simple answer to a
    > simple question. He was probably tired of trying to
    > interpret questions from this list. I suppose I take a
    > similar approach in that I quickly delete questions that
    > make no sense or only hint at the real question. Perhaps I
    > am being rude, too, but I'm just quieter about it. :-)
    >
    > Oh, and here is a link that I think John alluded to:
    >
    > http://www.tuxedo.org/~esr/faqs/smart-questions.html

    I'm not tired of anything; it was just too vague of a question to be
    answered, as were the 3 follow-ups that were posted. I still have no
    idea what the OP wants.

    After some more searching, this is the FAQ I was looking for:

    http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-n
    o-answers.html

    Note that the original question started with "Does anyone know..."

    ---John W. Holmes...

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

    attached mail follows:


    Thanks Guys

    I just needed a pointer. I decided to use the database and created two
    tables, one for invoice number and one for order number then defined a
    function to read the current number and the increment it.

    // GET AUTO NUMBER and creates the next one
    // uses the parameter tablename as $table

    function get_auto_number($table)
     {
      if(!$table)
       {
        echo "The Function get_auto_number requires the peramater 'tablename' to
        allow it to know which auto number you want.<br>";
        exit;
       }
      $query = 'select number from '.$table;
      $result = mysql_query($query);
      if (!$result)
       {
        echo "Sorry there is a problem getting the auto_number from the
        table ".$table."<br>";
        exit;
       }
      $current_number = mysql_fetch_row($result);
      global $auto_number;
      $auto_number = $current_number[0];
      $query = "update ".$table." SET number = '".($auto_number +1)."'";
      $result = mysql_query($query);
     }

    Simple when someone tells you what to do :o)

    Thanks and regards.

    "Don Mc Nair" <donmcn.ie> wrote in message
    news:20030118204048.78225.qmailpb1.pair.com...
    > Hi
    >
    > Is there a way for a php page to automatically increment a number and
    store
    > it every time the page is loaded.
    >
    > I want to generate an invoice number that goes up 1 everytime the HTML
    form
    > is sent to it.
    >
    > Thanks
    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.435 / Virus Database: 244 - Release Date: 01/01/2003
    >
    >

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.435 / Virus Database: 244 - Release Date: 02/01/2003
    

    attached mail follows:


    On Sunday 19 January 2003 09:03, Justin French wrote: > on 19/01/03 9:59 AM, John W. Holmes (holmes072000charter.net) wrote: > >> Is there a way for a php page to automatically increment a number and > >> store > >> it every time the page is loaded. > >> > >> I want to generate an invoice number that goes up 1 everytime the HTML > >> form > >> is sent to it. > > > > I assume you're talking about incrementing for everyone that accesses > > your site. For that you need a database to keep track of the number for > > all users. > > Or use a file-based counter. There are 1000's of counter scripts out there > both file based and database based.

    If the application is mission critical then a simple file based counter is wholly inadequate.

    There are issues of concurrent access -- two or more instances of the script trying to read and write to the file at the same time. Using a DBMS means this problem is handled automatically and reliably.

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

    /* SEMPER UBI SUB UBI!!!! */

    attached mail follows:


    On 19-Jan-2003 Don Mc Nair wrote: > Thanks Guys > > I just needed a pointer. I decided to use the database and created two > tables, one for invoice number and one for order number then defined a > function to read the current number and the increment it. >

    That'll work, but it's not atomic. At high traffic loads you can get duplicates.

    You might want to consider a table with a auto_increment field. Do a dummy insert, the get the value with :

    mysql_query('SELECT last_insert_id() as id');

    Regards,

    -- 
    Don Read                                       dreadtexas.net
    -- "Beer is proof that God loves us and wants us to be happy."
    

    attached mail follows:


    Hi Leif K-Brooks,

    The key is but an alias to the value, so other than rewriting the array I cannot see how to split the two apart.

    I don't believe there's any simple way to reorder the key/value order of an array .... dunno, I'm not used at using key'ed arrays ... PHP is the only language (I know) that's got it, and since I program in a couple other languages that don't have it, I'd just get confused by starting to use them.

    Rene

    On Sun, 19 Jan 2003 10:28:58 -0500, you wrote about "Re: [PHP] Changing order of just one array item?" something that looked like this:

    >Thanks, but that's not what I'm trying to do. I know how to change the >keys, but I'm looking to change the internal order of the key/value pairs.

    -- 
    Rene Brehmer
    

    This message was written on 100% recycled spam.

    Come see! My brand new site is now online! http://www.metalbunny.net

    attached mail follows:


    To help even more, if you're on a dedicated, this shell command will provide you the amount of sessions active:

    "ls -l /tmp/sess* | wc -l"

    HTH

    "Justin French" <justinindent.com.au> wrote in message news:BA50DD70.1D23C%justinindent.com.au... If you're on a dedicated server (no other sites on the server), you could just count the session files in /tmp.

    Otherwise, the general consensus seems to be that you need to decide how long a user is "active" for (say a minute, or 3, or an hour?), and save (eg) the SID and timestamp in a file or MySQL table.

    In theory, you then count the number of sessions that were created or reactivated (restamped) within your definition of "active" time (eg 3 mins).

    This has been discussed waaay too many time on the list... do a search on the archives for 'active users', perhaps also try a search with the word "ASP" too :)

    Justin

    on 19/01/03 10:27 PM, Jeremías Grunge (angelcmateoshotmail.com) wrote:

    > Sorry I'm novice. > > There is a way to know how many sessions are active and to get variables or > the id of them? > > Thanks > >

    attached mail follows:


    Hi all,

    I guess this problem might sound childish for most of you, but I'm having it right now. I get two numbers from a FORM, one price and one quantity and I need to make a multiplication with them in order to store the total amount also as a double expression... I'm trying with:

    $totalprice = $price * $qty;

    but when I echo the, it gives me just plain old 0 (zero). Any suggestions?

    Thanks in advance,

    Cesar L. Aracena icaamicaam.com.ar caracenainfovia.com.ar (0299) 156-356688 Neuquén (8300) Capital Argentina

    attached mail follows:


    have you try echo $price and $qty separately to check if they are correct?

    If they are correct, can you post you code? so we can take a look.

    Foong

    Cesar Aracena <icaamicaam.com.ar> wrote in message news:000001c2bfeb$cecbd5c0$7a00a8c0NOTEBOOK... Hi all,

    I guess this problem might sound childish for most of you, but I'm having it right now. I get two numbers from a FORM, one price and one quantity and I need to make a multiplication with them in order to store the total amount also as a double expression... I'm trying with:

    $totalprice = $price * $qty;

    but when I echo the, it gives me just plain old 0 (zero). Any suggestions?

    Thanks in advance,

    Cesar L. Aracena icaamicaam.com.ar caracenainfovia.com.ar (0299) 156-356688 Neuquén (8300) Capital Argentina

    attached mail follows:


    On Monday 20 January 2003 02:51, Cesar Aracena wrote: > Hi all, > > I guess this problem might sound childish for most of you, but I'm > having it right now. I get two numbers from a FORM, one price and one > quantity and I need to make a multiplication with them in order to store > the total amount also as a double expression... I'm trying with: > > $totalprice = $price * $qty; > > but when I echo the, it gives me just plain old 0 (zero). Any > suggestions?

    What is $price and what is $qty?

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

    /* Everything I like is either illegal, immoral or fattening. -- Alexander Woollcott */

    attached mail follows:


    --- Cesar Aracena <icaamicaam.com.ar> wrote: > I get two numbers from a FORM, one price and one > quantity and I need to make a multiplication with > them in order to store the total amount also as a > double expression... I'm trying with: > > $totalprice = $price * $qty; > > but when I echo the, it gives me just plain old 0 > (zero). Any suggestions?

    Without seeing more code, it is hard to say, but I imagine $qty and/or $price are not what you think they are. Here is a little example that you might find useful:

    <? $price = "3.50"; $quantity = 5;

    $total = $price * $quantity;

    echo "$total\n"; printf("$%.2f", $total); ?>

    Chris

    attached mail follows:


    JJ --

    ...and then JJ Harrison said... % % I did do that, and have yet to turn up a useful result. That is why I asked.

    Ah. None of my business, I suppose, but how do you define a useful result? There were at least three that clearly indicated that they provided free PHP hosting in the first page of results alone.

    HTH & HAND

    :-D

    -- 
    David T-G                      * There is too much animal courage in 
    (play) davidtgjustpickone.org * society and not sufficient moral courage.
    (work) davidtgworkjustpickone.org  -- Mary Baker Eddy, "Science and Health"
    http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
    

    -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD)

    iD8DBQE+KwJTGb7uCXufRwARAhW4AJsG6HtOB+BdcsqEOAJ6l65XCfxPjwCfTrkH 2X5s89cS8RrPQ247RdoYb0w= =Y4Ll -----END PGP SIGNATURE-----

    attached mail follows:


    Hi, I have a problem. I have created a guestbook for my server and i have php installed. You enter deatils and the guestbook stores it in guestbook.dat.php file. The guestbook itself is also a php file. I have tryed it on other hosts and it has worked. When i run it on my server it doesnt store the data i have inputted and show it on the guestbook. This might be a bit confusing but if you could help me or forward it to someone who can help me i would be much abliged.

    JAM

    attached mail follows:


    On Sun, 2003-01-19 at 12:57, JamsterJAM wrote: > Hi, > I have a problem. I have created a guestbook for my server and i have php installed. You enter deatils and the guestbook stores it in guestbook.dat.php file. The guestbook itself is also a php file. I have tryed it on other hosts and it has worked. When i run it on my server it doesnt store the data i have inputted and show it on the guestbook. This might be a bit confusing but if you could help me or forward it to someone who can help me i would be much abliged. > > JAM

    We probably need more info to get to the real problem. However, you are probably having a problem with the the webserver (php) writing to the file. Make sure that the webserver has permission to write to the file.

    -- 
    

    Ray Hunter email: bigdogventicon.com www: http://venticon.com

    attached mail follows:


    What version of PHP is running on the server, what version did you develop the script with? Do you know if register globals are on or off?

    You can get a lot of information about PHP by doing <?php phpinfo(); ?>

    Do you receive any error messages indicating the file can not be opened for writing or does it silently discard the data?

    Jason

    On Sun, 2003-01-19 at 12:57, JamsterJAM wrote: > Hi, > I have a problem. I have created a guestbook for my server and i have php installed. You enter deatils and the guestbook stores it in guestbook.dat.php file. The guestbook itself is also a php file. I have tryed it on other hosts and it has worked. When i run it on my server it doesnt store the data i have inputted and show it on the guestbook. This might be a bit confusing but if you could help me or forward it to someone who can help me i would be much abliged. > > JAM

    attached mail follows:


    I've been looking high and low, and haven't had much luck finding a way to mimic the <<<<<<<< templating capability of Perl. Does a class or similar exist?

    attached mail follows:


    I tried to install php-4.3.0 with imap-2001a-10, imap-devel-2001a-10 from RH 7.3

    Of course I added --with-imap --with-imap-ssl, among other things.

    These came out when I did make.

    /php /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libc-client.a(osdep.o): In function `ssl_onceonlyinit': /usr/src/build/90147-i386/BUILD/imap-2001a/c-client/osdep.c:286: the use of `tmpnam' is dangerous, better use `mkstemp' ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': /usr/src/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is dangerous, better use `mkstemp'

    Is there a newer wu-imap package that works with php-4.3.0 ? Did I do something wrong?

    I compiled php-4.2.3 with the same configuration, and it worked fine.

    Thanks,

    ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/

    attached mail follows:


    Greetings,

    LinuxWorld Expo 2003 is January 21-24, and with the indispensable support of members and friends, New York PHP (http://nyphp.org) is excited to offer some great events at LWE.

    "Q&A with Doron Gerstel, CEO, Co-Founder, Zend Technologies" January 22, 2003 1:30pm, NYPHP, Booth #16

    Doron has kindly taken time from his busy schedule to address NY's questions on PHP, Zend, and the community's direction. Join us and get your questions answered by Zend's leading man.

    "PHP Developers Cookbook by Sterling Hughes and Andrei Zmievski Book Raffle" January 22,23,24, 2003 3:30pm, NYPHP, Booth #16

    Get your name entered by 3:30pm each day and have a chance to win this valuable reference for any PHP programmer. Thanks to Sterling Hughes and Sams Publishing.

    Haven't signed up for LinuxWorld Expo yet?

    It's not too late - register for FREE at http://linuxworldexpo.com and stop by Booth #16 for talk, fun and PHP! And if you'd like to take a load off, spend some time behind the booth answering questions and talking with fellow Linux and PHP users.

    --------------------------------------------------------------------- About NYPHP

    New York PHP is a non-profit organization committed to promoting and supporting the PHP programming language, helping New Yorkers share development experiences, and developing Open Source projects for the PHP community.

    Join Us

    Subscribe to our mailing lists and aid the community by sharing your experiences, leading discussions and offering support. Plus, we are always eager for energetic directors to join and help build the NY and worldwide PHP communities.

    Attend Meetings

    Our free monthly meetings are open to the public and held on the 4th Tuesday of the month at Digital Pulp. Check our website for details.

    Acquire Technology

    With PHP connecting many facets of the Internet, we support the AMP (Apache/MySQL/PHP) Technology suite, plus JSP, .NET, ColdFusion, Oracle and a variety of operating systems. Let the NYPHP community help you reach a new level of performance and functionality.

    Learn More

    You'll find NYPHP's projects, mailing lists, announcements, job opportunities, and up-to-the-minute information about meetings, news and events at http://nyphp.org.

    Thank you, and see you at the Expo!

    ===== Hans Zaunere President, New York PHP http://nyphp.org hansnyphp.org

    attached mail follows:


    On my web server (Apache) I have two sites and I would like each site to use a different php.ini.

    What is the correct way for me to have each site use it's own php.ini file? I figure it's a setting in the apache conf file but I can't figure out which ...

    Thanks,

    Jc

    attached mail follows:


    Inside each of the Virtual Host defs you can put most of the php_flag etc settings just like:

    php_admin_value disable_functions 'ob_start' php_admin_value sendmail_path '/usr/sbin/sendmail -f bouceyourdomain.com -t -i'

    Timothy Hitchens (HiTCHO) Open Source Consulting e-mail: timhitcho.com.au

    > -----Original Message----- > From: Jean-Christian Imbeault [mailto:jcmega-bucks.co.jp] > Sent: Monday, 20 January 2003 12:28 PM > To: php-generallists.php.net > Subject: [PHP] php.ini: how to load different ini file > depending on host? > > > On my web server (Apache) I have two sites and I would like > each site to > use a different php.ini. > > What is the correct way for me to have each site use it's own php.ini > file? I figure it's a setting in the apache conf file but I > can't figure > out which ... > > Thanks, > > Jc > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Timothy Hitchens ) wrote: > Inside each of the Virtual Host defs you can put most of the php_flag > etc settings just like:

    Oops .. I forgot to mention that these two website do *not* have different IP addresses. Actually these are two testing website on my local LAN.

    What I have is to have a different php.ini loaded depending on wether the user goes to:

    http://192.168.254.1/test1 or http://192.168.254.1/test2

    I had read up on the Virtual Host directives put it didn't seem to be applicable ... Could I do the same thing you suggested using the apache <Directory> directive?

    Thanks,

    Jc

    attached mail follows:


    You can override parts of your php.ini on a per-directory level with a .htaccess file...

    eg:

    <IfModule mod_php4.c> php_flag register_globals off php_flag magic_quotes_gpc on php_flag magic_quotes_runtime on php_flag magic_quotes_sybase on </IfModule>

    Justin French

    on 20/01/03 2:14 PM, Jean-Christian Imbeault (jcmega-bucks.co.jp) wrote:

    > Timothy Hitchens ) wrote: >> Inside each of the Virtual Host defs you can put most of the php_flag >> etc settings just like: > > > Oops .. I forgot to mention that these two website do *not* have > different IP addresses. Actually these are two testing website on my > local LAN. > > What I have is to have a different php.ini loaded depending on wether > the user goes to: > > http://192.168.254.1/test1 > or > http://192.168.254.1/test2 > > I had read up on the Virtual Host directives put it didn't seem to be > applicable ... Could I do the same thing you suggested using the apache > <Directory> directive? > > Thanks, > > Jc >

    attached mail follows:


    Hi, all --

    I forget, and can't find, who it was who suggested a mailing list for php as a shell programming language and made the comment that it seems that few use it as such. S/He might find

    http://www.phpclasses.org/browse.html/package/954.html

    of interest; it's a CLI class for php :-)

    HTH & HAND

    :-D

    -- 
    David T-G                      * There is too much animal courage in 
    (play) davidtgjustpickone.org * society and not sufficient moral courage.
    (work) davidtgworkjustpickone.org  -- Mary Baker Eddy, "Science and Health"
    http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
    

    -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD)

    iD8DBQE+K2EjGb7uCXufRwARAkjiAKDZKeV2Td7rBhGEBL7bDOr8znviPQCghtHF CNmb7n3ZNnATwu5prjtkzCg= =7uYb -----END PGP SIGNATURE-----

    attached mail follows:


    Hi,

    I'm working on a mailing solution for a client. His site collects email address from a 'Send this site to a friend' page (user enters their email address and up to 10 other addresses - a message is then sent to the 10 addresses from the users own email address). The addresses are then stored in a MySQL database - a column for the users email address, and then a column each for the additional 10 addresses.

    Now the client would like to have the ability to send an email to all addresses collected at once - to inform the addresses of a sale, etc. I'm guessing for this to be done, I'd have to select all the DISTINCT email addresses from the 11 columns (users email, and the 10 addresses), then use a loop to send the mail out.

    I had planned on using PHP's mail() function - does anyone know of any limitations imposed by this method? Normally, I'd contact the ISP and ask them directly, however it's been several weeks since they've answered the phones.

    Does anyone have any other/better options that I should pursue? This will be my first mass mailing typed job so I'm not really sure where to begin or if I'm on the right path at all.

    Thanks -Tim