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: Tue Jul 16 2002 - 16:28:59 CDT

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

    php-general Digest 16 Jul 2002 21:28:59 -0000 Issue 1468

    Topics (messages 107824 through 107972):

    Re: Inclusion error contd..
            107824 by: Sachin Keshavan
            107826 by: PHPCoder

    Formmail replacement?
            107825 by: JJ Harrison
            107892 by: Tim Luoma

    Re: outputting a pdf file to IE browser? POST/GET method bug or not?
            107827 by: gilles
            107837 by: joakim.andersson.cybercom.se
            107860 by: gilles

    IIS5 and PHP4 problems
            107828 by: Peter Stöcker
            107829 by: Nookie
            107833 by: Chris Hewitt
            107836 by: Peter Stöcker
            107838 by: John Holmes
            107915 by: Chris Hewitt

    Re: Problem on file_exists()
            107830 by: Chris Hewitt

    Re: ^k ? -- how do I match that?
            107831 by: Chris Hewitt

    Re: Crazy idea about detecting visitor's connection speed
            107832 by: Jason Wong
            107834 by: Chris Hewitt
            107835 by: joakim.andersson.cybercom.se
            107843 by: Alberto Serra
            107881 by: César Aracena
            107889 by: Jason Wong
            107896 by: Tim Luoma

    Re: Complex session issue
            107839 by: Kondwani Spike Mkandawire
            107856 by: Justin French

    Create Thumbnail from Blob online
            107840 by: Tommi Trinkaus
            107841 by: joakim.andersson.cybercom.se
            107859 by: Lars Olsson

    Re: Submit code
            107842 by: Kondwani Spike Mkandawire
            107861 by: Steve Bradwell
            107863 by: Scott Fletcher
            107925 by: Lee Doolan

    activating php scripts via cron
            107844 by: Andy
            107846 by: Jason Wong
            107848 by: Jay Blanchard
            107852 by: Kondwani Spike Mkandawire
            107853 by: Jay Blanchard
            107906 by: Andy
            107910 by: Jason Wong
            107911 by: Bas Jobsen
            107962 by: Andy

    Re: Good Forum...
            107845 by: Tshering Norbu
            107847 by: Tshering Norbu

    Problem Running my Scripts from IIS...
            107849 by: Kondwani Spike Mkandawire
            107855 by: Richard Black
            107857 by: Kondwani Spike Mkandawire
            107868 by: MindHunter
            107875 by: Kondwani Spike Mkandawire
            107916 by: Chris Hewitt

    read a text file
            107850 by: Edgar
            107851 by: Andrey Hristov
            107854 by: Kondwani Spike Mkandawire

    Re: Training / Courses in Australia
            107858 by: Justin French

    Purpose of $$var ?????
            107862 by: Scott Fletcher
            107866 by: Andrey Hristov
            107867 by: Scott Fletcher
            107869 by: joakim.andersson.cybercom.se
            107871 by: Dave [Hawk-Systems]
            107874 by: Scott Fletcher
            107876 by: Scott Fletcher
            107879 by: Scott Fletcher

    file() and array values contain extra \n
            107864 by: Dave [Hawk-Systems]
            107872 by: Jason Wong
            107878 by: Dave [Hawk-Systems]
            107882 by: Jason Wong
            107922 by: Dave [Hawk-Systems]
            107936 by: Jason Wong
            107966 by: Dave [Hawk-Systems]

    php/mysql simple math
            107865 by: Jay
            107914 by: Chris Hewitt
            107918 by: Adam Voigt
            107933 by: Chris Hewitt

    Classes vs. Functions
            107870 by: Chris Crane
            107884 by: Jay Blanchard
            107893 by: Martin Clifford
            107894 by: Chris Crane
            107897 by: Jay Blanchard
            107898 by: Martin Clifford
            107900 by: Chris Crane
            107901 by: Chris Crane
            107902 by: Steve Bradwell
            107903 by: Jay Blanchard
            107904 by: Martin Clifford
            107905 by: Chris Crane
            107908 by: Chris Crane
            107923 by: Steve Bradwell

    Make error
            107873 by: Paulo Henrique Castro

    Re: php + javascript hard day together ?
            107877 by: Ford, Mike [LSS]

    Problem with implode() function
            107880 by: Balaji Ankem
            107886 by: Jason Wong
            107890 by: Balaji Ankem
            107920 by: John Holmes

    Re: Get Anchor out of Url
            107883 by: Marek Kilimajer

    Search Page question
            107885 by: Mark McCulligh
            107917 by: Peter J. Schoenster

    exec() function question on Solaris
            107887 by: Matt Babineau

    Re: Sorting getmxrr()
            107888 by: Analysis & Solutions

    web-based frontend to Majordomo archives?
            107891 by: jaxon

    Fopen errors out when opening a URL
            107895 by: Conover, Ryan

    no-cache konqueror/opera
            107899 by: Bas Jobsen

    waiting for keyboard echo
            107907 by: David D
            107959 by: Analysis & Solutions

    Re: ' giving problem while inserting in table.
            107909 by: Lars Olsson

    strange beahaviour with a mysql query in php
            107912 by: David D
            107913 by: Martin Clifford

    Using index.php instead of index.html
            107919 by: Sailom
            107924 by: Chris Garaffa
            107926 by: Sailom
            107928 by: Kondwani Spike Mkandawire

    Sessions / logins / cookies / security
            107921 by: Chad Day
            107958 by: Chad Day
            107960 by: Johnson, Kirk
            107961 by: John Holmes

    Exit script early
            107927 by: Michael Zornek
            107929 by: Adam Voigt
            107930 by: Chris Boget
            107931 by: Martin Clifford
            107953 by: John Holmes

    Timer
            107932 by: Thomas \"omega\" Henning
            107934 by: Kevin Stone
            107938 by: Thomas \"omega\" Henning

    Re: Multi-Part PostToHost?
            107935 by: skeller.healthtvchannel.org

    I can't echo object variables
            107937 by: Michael Zornek
            107939 by: Martin Clifford
            107950 by: Michael Zornek
            107972 by: Alberto Serra

    Preventing Multiple Log-Ins after Authentication
            107940 by: Monty
            107941 by: Jay Blanchard
            107945 by: Kondwani Spike Mkandawire
            107952 by: John Holmes
            107954 by: Dennis Moore
            107956 by: Dennis Moore

    Is there a way?
            107942 by: Chris Crane
            107943 by: Darren Gamble
            107944 by: Jay Blanchard
            107946 by: Martin Clifford
            107951 by: Chris Crane

    Re: Apache 2.0 + PHP
            107947 by: Austin Gonyou

    Session and output buffering
            107948 by: Divyank Turakhia
            107949 by: Martin Clifford

    PHP Functions Essential Reference??
            107955 by: jaxon

    libmcal for win32
            107957 by: Anson Smith

    Re: Editing files by line
            107963 by: Onaje Johnston
            107967 by: Analysis & Solutions

    Sessions and Header()
            107964 by: Greg Macek

    Re: Sessions and Header() - Retraction
            107965 by: Greg Macek

    Newbie Question on Efficiency
            107968 by: Michael Kennedy
            107969 by: Martin Clifford
            107970 by: Michael Kennedy

    Good instruction for installing webserver using RPM and tar.gz files???
            107971 by: Scott Fletcher

    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:


    Hello all,

    Thanks for the suggestions. But my .php file does not have any include
    statement any where in the page. Is there any thing which I have to check
    out? The site contains 6 .php files, and it is only in this file the error
    comes.

    I have tested this in my local build (Apache server), and the same file
    executes perfectly. The error comes in the production server, in which PHP
    is configured by a third party (i.e server admin).

    Thanks once again,
    Sachin.

    attached mail follows:


    Check execute permissions on the PHP file, try chmod 755.

    Sachin Keshavan wrote:

    >Hello all,
    >
    >Thanks for the suggestions. But my .php file does not have any include
    >statement any where in the page. Is there any thing which I have to check
    >out? The site contains 6 .php files, and it is only in this file the error
    >comes.
    >
    >I have tested this in my local build (Apache server), and the same file
    >executes perfectly. The error comes in the production server, in which PHP
    >is configured by a third party (i.e server admin).
    >
    >Thanks once again,
    >Sachin.
    >
    >

    attached mail follows:


    Does anyone know a good PHP-based Formmail Replacement(From matt's script
    archive)?

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

    attached mail follows:


    JJ Harrison wrote: > Does anyone know a good PHP-based Formmail Replacement(From matt's script > archive)?

    http://www.google.com/search?q=Formmail+php gave http://www.lumbroso.com/scripts/formmail.php as one of the top results

    attached mail follows:


    nobody?

    does any think this could be a bug or something?

    i would like to know before submitting this as a bug.

    At 19:18 15-7-2002 +0200, gilles wrote: >hi, > >i've run in to a strange problem, > >i'm trying to output a pdf file from disk to the browser. > >this is fine under netscape but IE has problems. > >consider the following code: >------------------------------------------- ><? >error_reporting(E_ALL); > >session_start(); >if (!isset($_SESSION['download'])) { > $_SESSION['download'] = $_GET['download']; >} > >if(isset($_GET["download"])){ > $file_name=$_SESSION['download']; > header("Content-type:application/pdf"); > header("Content-Disposition: inline;filename=\"mypdf.pdf\""); > header("Content-length:".(string)(filesize($file_name))); > header("location: $file_name"); >exit; >} >?> ><form method=get> ><INPUT TYPE="submit" name=download value="mypdf.pdf"> ></form> >------------------------------------------ > >the above code runs fine on NS and IE, >IE immediately loads and opens the pdf file inline. > >but this code which only has the difference of using the POST method >instead of the GET metod results in a "file is corrupt" message! > >------------------------------------------ ><? >error_reporting(E_ALL); > >session_start(); >if (!isset($_SESSION['download'])) { > $_SESSION['download'] = $_POST['download']; >} > >if(isset($_POST["download"])){ > $file_name=$_SESSION['download']; > header("Content-type:application/pdf"); > header("Content-Disposition: inline;filename=\"mypdf.pdf\""); > header("Content-length:".(string)(filesize($file_name))); > header("location: $file_name"); >exit; >} >?> ><form method=post> ><INPUT TYPE="submit" name=download value="mypdf.pdf"> ></form> >------------------------------------------ > > >can anyone explain to me why you can't use the POST method? >is this a bug or is this as expected (i didn't). > >tnx, > >gilles > >i'm running php 4.2.1 on win2000 with IIS5 > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    I really think you should read the user comments in the online PHP-manual before doing anything else...

    Look here: http://www.php.net/manual/en/function.header.php

    Regards Joakim Andersson

    > -----Original Message----- > From: gilles [mailto:phplistclixicon.nl] > Sent: Monday, July 15, 2002 7:19 PM > To: php-generallists.php.net > Subject: [PHP] outputting a pdf file to IE browser? POST/GET > method bug > or not? > > > hi, > > i've run in to a strange problem, > > i'm trying to output a pdf file from disk to the browser. > > this is fine under netscape but IE has problems. > > consider the following code: > ------------------------------------------- > <? > error_reporting(E_ALL); > > session_start(); > if (!isset($_SESSION['download'])) { > $_SESSION['download'] = $_GET['download']; > } > > if(isset($_GET["download"])){ > $file_name=$_SESSION['download']; > header("Content-type:application/pdf"); > header("Content-Disposition: inline;filename=\"mypdf.pdf\""); > header("Content-length:".(string)(filesize($file_name))); > header("location: $file_name"); > exit; > } > ?> > <form method=get> > <INPUT TYPE="submit" name=download value="mypdf.pdf"> > </form> > ------------------------------------------ > > the above code runs fine on NS and IE, > IE immediately loads and opens the pdf file inline. > > but this code which only has the difference of using the POST method > instead of the GET metod results in a "file is corrupt" message! > > ------------------------------------------ > <? > error_reporting(E_ALL); > > session_start(); > if (!isset($_SESSION['download'])) { > $_SESSION['download'] = $_POST['download']; > } > > if(isset($_POST["download"])){ > $file_name=$_SESSION['download']; > header("Content-type:application/pdf"); > header("Content-Disposition: inline;filename=\"mypdf.pdf\""); > header("Content-length:".(string)(filesize($file_name))); > header("location: $file_name"); > exit; > } > ?> > <form method=post> > <INPUT TYPE="submit" name=download value="mypdf.pdf"> > </form> > ------------------------------------------ > > > can anyone explain to me why you can't use the POST method? > is this a bug or is this as expected (i didn't). > > tnx, > > gilles > > i'm running php 4.2.1 on win2000 with IIS5 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    hi,

    well just to make sure, i also ran this test under linux/apache and win2000/apache testing with IE6 and the same error occurs.

    it also doesnt matter if i use sessions,

    so, the following doesnt work either with POST, but it does work with GET: ----------------------------- <? error_reporting(E_ALL); if(isset($_POST["download"])){ $file_name=$_POST["download"]; header("Content-type:application/pdf"); header("Content-Disposition: inline;filename=\"mypdf.pdf\""); header("Content-length:".(string)(filesize($file_name))); header("location: $file_name"); exit; } ?> <form method=post> <INPUT TYPE="submit" name=download value="mypdf.pdf"> </form> ---------------------

    i also opened a brand new browser window and delete all the cache stuff.

    i still find it strange that this only occurs when using the post method and not with the get method, while using appart from that, exactly the same code.

    At 07:05 16-7-2002 -0400, Matt wrote: >I tried this yesterday on my freebsd box with php 4.2.1 and it worked fine >for me in IE6 on Win 2k. I don't see anything wrong in your headers. I >wasn't certain that they way you were mixing the use of >$_SESSION['download'] and $_POST['download'] is really what you intended to >do. As I said below, I'd echo out (or use a sniffer to see) the header >statements on the offending page, and make sure you have a length, and the >location header has a value. Since you only set the $_SESSION['download'] >once, you could have been a victim of previous testing. >----- Original Message ----- >From: "Matt Schroebel" <MSchroebelhsus.org> >To: "'gilles'" <phplistclixicon.nl>; <php-generallists.php.net> >Sent: Monday, July 15, 2002 4:26 PM >Subject: RE: [PHP] outputting a pdf file to IE browser? POST/GET method bug >or not? > > > > > From: gilles [mailto:phplistclixicon.nl] > > > Sent: Monday, July 15, 2002 1:19 PM > > > Subject: [PHP] outputting a pdf file to IE browser? POST/GET > > > method bug or not? > > > <? > > > error_reporting(E_ALL); > > > > > > session_start(); > > > if (!isset($_SESSION['download'])) { > > > $_SESSION['download'] = $_POST['download']; > > > } > > > > > > if(isset($_POST["download"])){ > > > $file_name=$_SESSION['download']; > > > header("Content-type:application/pdf"); > > > header("Content-Disposition: inline;filename=\"mypdf.pdf\""); > > > header("Content-length:".(string)(filesize($file_name))); > > > header("location: $file_name"); > > > exit; > > > } > > > ?> > > > <form method=post> > > > <INPUT TYPE="submit" name=download value="mypdf.pdf"> > > > </form> > > > > Your code runs fine on my freebsd box running php 4.2.1 and apache. I'd >try changing the header into an echo, and see what you're sending to the >browser. Are you meaning to only set the session var one time? You only >set it when it's not set, so if you change the value of $_POST['download', >the session var will still hold the first name. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > >

    attached mail follows:


    Hi there!

    I have a problem with the IIS5.

    After I have installed PHP4 following the instruction on php.net, everything works fine instead of handling forms.

    Each variable deliverd by a form (e.g. test.php?id=5) is empty (id=="" is true).

    Can anybody help??

    Thanks, Peter

    attached mail follows:


    Hello Peter,

    Tuesday, July 16, 2002, 12:28:06 PM, you wrote:

    PS> Hi there!

    PS> I have a problem with the IIS5.

    PS> After I have installed PHP4 following the instruction on php.net, everything PS> works fine instead of handling forms.

    PS> Each variable deliverd by a form (e.g. test.php?id=5) is empty (id=="" is PS> true).

    PS> Can anybody help??

    Check your php.ini -> register_globals ...

    Try use $HTTP_POST_VARS['id'] or $_POST['id']

    -- 
    Pozdrowienia,
     Nookie                          mailto:nookiextina.pl
     http://www.shakira-online.net
     http://www.xtina.pl
     http://www.jessica.prv.pl
    

    attached mail follows:


    Peter Stöcker wrote:

    >Hi there! > >I have a problem with the IIS5. > >After I have installed PHP4 following the instruction on php.net, everything >works fine instead of handling forms. > >Each variable deliverd by a form (e.g. test.php?id=5) is empty (id=="" is >true). > I imagine that the release notes to the version of php you have loaded will inform you that, by default, register_globals is off. I answered this one for another poster yesterday and I was not the only one. People do not seem to look at previous posts or archives or faqs before posting.

    You need to either turn register_globals on in php.ini or, better still, use $_GET['var'] to get the values of GET variables or $_POST['var'] for POST variables.

    HTH Chris

    >

    attached mail follows:


    Hi!

    The register_globals are "on".

    But using $_POST will cause some problems, because I also use generated links like "test.php?id=4&usr=test" without using a form!

    So I don't get the variables by both these genrated links and forms.

    Bye, Peter

    -----Ursprüngliche Nachricht----- Von: Nookie [mailto:nookiextina.pl] Gesendet: Dienstag, 16. Juli 2002 12:30 An: Peter Stöcker Cc: php-generallists.php.net Betreff: Re: [PHP] IIS5 and PHP4 problems

    Hello Peter,

    Tuesday, July 16, 2002, 12:28:06 PM, you wrote:

    PS> Hi there!

    PS> I have a problem with the IIS5.

    PS> After I have installed PHP4 following the instruction on php.net, everything PS> works fine instead of handling forms.

    PS> Each variable deliverd by a form (e.g. test.php?id=5) is empty (id=="" is PS> true).

    PS> Can anybody help??

    Check your php.ini -> register_globals ...

    Try use $HTTP_POST_VARS['id'] or $_POST['id']

    --
    Pozdrowienia,
     Nookie                          mailto:nookiextina.pl
     http://www.shakira-online.net
     http://www.xtina.pl
     http://www.jessica.prv.pl
    

    attached mail follows:


    How about a little reading of the manual...

    Use $_GET for the URL or $_REQUEST if you want it to cover get, post, and cookie data...

    ---John Holmes...

    > -----Original Message----- > From: Peter Stöcker [mailto:peter.stoeckerulm-photonics.de] > Sent: Tuesday, July 16, 2002 7:15 AM > To: php-generallists.php.net > Subject: AW: [PHP] IIS5 and PHP4 problems > > Hi! > > The register_globals are "on". > > But using $_POST will cause some problems, because I also use generated > links like "test.php?id=4&usr=test" without using a form! > > So I don't get the variables by both these genrated links and forms. > > Bye, > Peter > > -----Ursprüngliche Nachricht----- > Von: Nookie [mailto:nookiextina.pl] > Gesendet: Dienstag, 16. Juli 2002 12:30 > An: Peter Stöcker > Cc: php-generallists.php.net > Betreff: Re: [PHP] IIS5 and PHP4 problems > > > Hello Peter, > > Tuesday, July 16, 2002, 12:28:06 PM, you wrote: > > PS> Hi there! > > PS> I have a problem with the IIS5. > > PS> After I have installed PHP4 following the instruction on php.net, > everything > PS> works fine instead of handling forms. > > PS> Each variable deliverd by a form (e.g. test.php?id=5) is empty (id=="" > is > PS> true). > > > PS> Can anybody help?? > > > Check your php.ini -> register_globals ... > > Try use $HTTP_POST_VARS['id'] or $_POST['id'] > > > > -- > Pozdrowienia, > Nookie mailto:nookiextina.pl > http://www.shakira-online.net > http://www.xtina.pl > http://www.jessica.prv.pl >

    attached mail follows:


    Peter Stöcker wrote:

    >Hi! > >The register_globals are "on". > >But using $_POST will cause some problems, because I also use generated >links like "test.php?id=4&usr=test" without using a form! > >So I don't get the variables by both these genrated links and forms. > The url you give above as an example is a GET not POST so you would access them as $_GET['var'], regardless of whether it was generated from a submitted form or a url link.

    HTH Chris

    attached mail follows:


    Jack wrote:

    >Dear all >I had a folder which the path is : (\\nedcoraa\pdf_reports\dealing >room\report) it stores a lot of PDF reports in there. >I'm trying to use the file_exists() function to detect if a specific file >exist in this folder, but i got a problem is : >It seems that php can go through (\\nedcoraa\pdf_reports) but it can't go >through (dealing room) folder. i had made test on it, i moved a file into >(\\nedcoraa\pdf_reports), then php can detect it, but if i move it to >(\\nedcoraa\pdf_reports\dealing room), then it can't detect the file! why? > >I'm using php in windows NT IIS environment! > I think you will need to escape the space, usually with a \

    HTH Chris

    attached mail follows:


    Jimmy Brake wrote:

    >is used in MS Excel when people hit return inside a cell. If they copy >and paste that into a form its ok, but when I export that data to a csv >it gets ugly. > I'd do validation on the user input on the form and remove it there. The ^k is used to show a control code, they begin at ^a (control-A, ASCII 1) so ^k is ASCII 11.

    HTH Chris

    >

    attached mail follows:


    On Tuesday 16 July 2002 17:12, Cedric Veilleux wrote:

    > What I was thinking about is doing a reverse dns lookup on the client's IP > and try to determine quickly if he's on a low or hi speed connection.

    You have to bear in mind that reverse DNS lookups are not instantaneous. It can take anywhere up to around 30 secs for it timeout. Are you prepared to make your users wait that long?

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

    /* "Never make any mistaeks." (Anonymous, in a mail discussion about to a kernel bug report.) */

    attached mail follows:


    Jason Wong wrote:

    >On Tuesday 16 July 2002 17:12, Cedric Veilleux wrote: > >> What I was thinking about is doing a reverse dns lookup on the client's IP >>and try to determine quickly if he's on a low or hi speed connection. >> > >You have to bear in mind that reverse DNS lookups are not instantaneous. It >can take anywhere up to around 30 secs for it timeout. Are you prepared to >make your users wait that long? > I feel the idea is not accurate. My ip address (a static one from my isp) would remain the same if I went to ADSL from my current dial-up access.

    HTH Chris

    attached mail follows:


    > I feel the idea is not accurate. My ip address (a static one from my > isp) would remain the same if I went to ADSL from my current > dial-up access. > > HTH > Chris

    Yes. And how about all corporate networks? If I'm accessing your site from our office I would get the low-speed version until you added our domainname to your list. Then what if I connect to our modem-pool from home... Then you wouldn't know I connected through a modem.

    And my ISP at home doesn't have anything in their dns-names to differentiate adsl from dial-up users. Just my thoughts... Regards Joakim Andersson

    attached mail follows:


    ðÒÉ×ÅÔ!

    joakim.anderssoncybercom.se wrote: >>I feel the idea is not accurate. My ip address (a static one from my >>isp) would remain the same if I went to ADSL from my current >>dial-up access. >> >>HTH >>Chris > > > Yes. And how about all corporate networks? If I'm accessing your site from > our office I would get the low-speed version until you added our domainname > to your list. Then what if I connect to our modem-pool from home... Then you > wouldn't know I connected through a modem. > > And my ISP at home doesn't have anything in their dns-names to differentiate > adsl from dial-up users. > Just my thoughts... > Regards > Joakim Andersson

    Yes, although the problem of determining users' bandwidth *is* real, I guess solution is not to be found in whatver IP address processing you might do.

    But you might consider sampling your actual communication, like sending the browser a sample document of fixed length that will execute some answer action from the browser. If you can time the lenght of this loop you can have a rought idea of what the user bandwidth is at the moment.

    Besides, no matter what your bandwidth to your ISP is, connection performance is influenced by server bandwidth as well. So I guess the only reliable factor would be some *real* measure. Which is far from being absolute, as the network continuously varies its state. Probably you should repeat this step over and over in time to get some average valuable value, that you could then use (for example) to reprocess images on the fly and have output graphic resolution degrade with connection quality to keep speed close to constant (just an idea, not that I'll try to do that very soon) :).

    Still your test must take the most minimal transmission load ever because it would add up and further lower the bandwidth of those who are sitting on a poor connection. Maybe you could add it to the banners. It could serve both as an "okay, printed" mark *and* a performance benchmark. Just have the timestamp recomputed on an invisible iframe (or have something sent along within the link the next time you load a banner, it depends on how quick you need an answer).

    Won't work for *all* browsers, but say 90% of your users will give you the data you look for. You'll have a default strategy that appies when no answer comes, of course.

    For those having banners sent out at regular intervals the average value would be reasonably close to the truth, and with little overhead. Of course you would need to take off the graphical load (size of the image) from your *packet* dimension, when computing the result.

    Just my 2 kopeki :)

    ðÏËÁ áÌØÂÅÒÔÏ óÅÒÒÁ

    -_=}{=_--_=}{=_--_=}{=_--_=}{=_--_=}{=_--_=}{=_--_=}{=_-

    LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is.......

    attached mail follows:


    I think that the best way you can achieve this, considering all the troubles and different configurations you will have to make for each user, is to make them choose the type of connection they want, and set a cookie in the visitor's browser with a one year life time which stores that machine/visitor's connection.

    C.

    > -----Original Message----- > From: joakim.anderssoncybercom.se [mailto:joakim.anderssoncybercom.se] > Sent: Tuesday, July 16, 2002 7:57 AM > To: php-generallists.php.net > Subject: RE: [PHP] Crazy idea about detecting visitor's connection speed > > > I feel the idea is not accurate. My ip address (a static one from my > > isp) would remain the same if I went to ADSL from my current > > dial-up access. > > > > HTH > > Chris > > Yes. And how about all corporate networks? If I'm accessing your site from > our office I would get the low-speed version until you added our > domainname > to your list. Then what if I connect to our modem-pool from home... Then > you > wouldn't know I connected through a modem. > > And my ISP at home doesn't have anything in their dns-names to > differentiate > adsl from dial-up users. > Just my thoughts... > Regards > Joakim Andersson > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    On Tuesday 16 July 2002 22:43, César Aracena wrote: > I think that the best way you can achieve this, considering all the > troubles and different configurations you will have to make for each > user, is to make them choose the type of connection they want, and set a > cookie in the visitor's browser with a one year life time which stores > that machine/visitor's connection.

    Making the user choose is the wisest option. As a user, just because I have a fast connection, it doesn't necessarily mean I would want the 'bloated' version of the website. And conversely, if I had a slow connection I /might/ want to wait 15 mins for the 'enhanced' version to download.

    Don't decide for the user what the user can decide for themselves :)

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

    /* Everything you read in newspapers is absolutely true, except for that rare story of which you happen to have first-hand knowledge. -- Erwin Knoll */

    attached mail follows:


    César Aracena wrote: > I think that the best way you can achieve this, considering all the > troubles and different configurations you will have to make for each > user, is to make them choose the type of connection they want, and set a > cookie in the visitor's browser with a one year life time which stores > that machine/visitor's connection.

    And then you STILL have to allow users a way to come back and 'unset' their preference later, to deal with folks who have laptops and connect with high speed access at one location and then low speed access at another.

    Others' comments about letting the user choose are wise too... just because I'm on a fat pipe doesn't mean I want to let you use it ;-)

    There are folks who have a limited amount of bandwidth allocated per month and are careful about not exceeding it (yes that limitation would drive me nutes too, but that's beside the point).

    Most people in the world are still on "slow" pipes. I'd either default to sending them to the low version & let them switch if they want or dump the whole idea and just make one version that is a balance.

    Or not... Amazon.com offers (or did at least) a text-version.... but I'd much rather surf their "regular" site with images turned and then just turn images on (by pressing 'g' in Opera thankyouverymuch :-) than have to go through their 'low bandwidth' version.

    I think this is one of those ideas that makes a lot of sense in the abstract until you have to deal with all the other variables of life.

    TjL

    attached mail follows:


    Just an idea, I'll point it out algorithmically coz it would take me a bit of time to sketch the code... Here goes and my appologies if this is not what you want..

    Would it not work if you targeted the next application to open up in window y... The problem is that you said you want it to be in the same domain... If you allowed for a different subdomain, you could have a php script in the file that runs X generating Code that is written to a file that runs Y... using fputs($fileY, $StartASessionForY); Then start spitting out Code for y using a write function or a fputs function... If you wanted to use the same domain name this might (I am still kind of iffy on this), if you stuck in a couple of if statements and left both sessions running... the y session is triggered if a certain logical test is passed...

    I hope this leads you towards the light...

    Spike... "Divyank Turakhia" <divyank.tdirecti.com> wrote in message news:001001c22c8e$46066e80$2601a8c0Divyank... > I have a situation where I have one browser window open for lets say web > application 'x'. Now I want my user to goto application 'y' on the same > domain in a new browser window by passing the authentication information > from application 'x' to application 'y'. I obviously donot want my > session variables to be continued in application 'y'. But at the same > time I donot want to destroy the session of my application 'x' > > Since they r in two COMPLETELY separate browser windows, both sessions > should logically be separate. But for some reason IE & netscape take a > new window in the same Instance. > > Is there any way I can open a new browser instance, such that the same > session is not continued and a new session in created leaving the old > session as it is? > > Or is there any other work around for the same? > > - Divyank > >

    attached mail follows:


    session_name() enables you to refer to a session by name, rather than just referring to *a* session.

    check the manual, but I believe for session "x" you, would call session_name("mysession_y"); BEFORE session_start(), and for session y, you would call session_name("mysession_x");

    there's a good example in the user-contributed notes of the manual

    Justin French

    on 16/07/02 4:01 PM, Divyank Turakhia (divyank.tdirecti.com) wrote:

    > I have a situation where I have one browser window open for lets say web > application 'x'. Now I want my user to goto application 'y' on the same > domain in a new browser window by passing the authentication information > from application 'x' to application 'y'. I obviously donot want my > session variables to be continued in application 'y'. But at the same > time I donot want to destroy the session of my application 'x' > > Since they r in two COMPLETELY separate browser windows, both sessions > should logically be separate. But for some reason IE & netscape take a > new window in the same Instance. > > Is there any way I can open a new browser instance, such that the same > session is not continued and a new session in created leaving the old > session as it is? > > Or is there any other work around for the same? > > - Divyank > >

    attached mail follows:


    Hi,

    i stored some jpegs in an mysql-database (one field for data, one for type) and i'm able to download them and to show them in an <img> tag. But wat i want is to use the stored data to create a thumbnail to show it within the browser without creating a file - how can i pass the mysql-blob directly to a gd-function like imagecreate() or imagejpg() ?? (gd-library is working well)

    thank you for any answer, tommi

    attached mail follows:


    > From: Tommi Trinkaus [mailto:trinkauscomplete-gmbh.com] > Sent: Tuesday, July 16, 2002 1:25 PM > Hi, > > i stored some jpegs in an mysql-database (one field for data, > one for type) > and i'm able to download them and to show them in an <img> tag. > But wat i want is to use the stored data to create a > thumbnail to show it > within the browser without creating a file - how can i pass > the mysql-blob > directly to a gd-function like imagecreate() or imagejpg() ?? > (gd-library is > working well)

    Take a look at imagecreatefromstring()

    > > thank you for any answer, tommi >

    You're welcome!

    Regars Joakim Andersson

    attached mail follows:


    Well, if you're just going to show your image (no resizing or other image operations) you don't need to use gd at all. You could just change the Content-Type and print.

    <snippet> header("Content-Type: $mimetype"); print($imagedata); </snippet>

    /lasso (lassolassoweb.nu)

    Tommi Trinkaus wrote: > Hi, > > i stored some jpegs in an mysql-database (one field for data, one for type) > and i'm able to download them and to show them in an <img> tag. > But wat i want is to use the stored data to create a thumbnail to show it > within the browser without creating a file - how can i pass the mysql-blob > directly to a gd-function like imagecreate() or imagejpg() ?? (gd-library is > working well) > > thank you for any answer, tommi >

    attached mail follows:


    Algorithmically:

    //in php 1) create a counter that will keep count of the # of variables that have been set 2) if all your variables have been set spit out the relevant JavaScript that runs the AutoSubmit function... (There are a couple onLine)... ...

    It can follow the following Skeleton... if((isset($var1))&&(isset($var2))&&.... echo "The JavaScript... Could Taget write it to another file as opposed to spitting out HTML run the function onLoad..."...

    "Mindhunter" <MindHuntermailbox.co.za> wrote in message news:20020716063256.51210.qmailpb1.pair.com... > I am looking for PHP code that will submit (post) a form automaically to a > ANOTHER php page. I do not want to press a submit button. I have found a > class at PHPClasses but it is too complicated for my needs. What is the > simplest way of doing this? What is the theoretical approach? > > The reason I need this is that I have a table output from a database after > one submits 'n list of variables (form inputs). I want to update a graph in > another Iframe automatically without clicking on another submit button. > > Tx > MH > >

    attached mail follows:


    Well, I'm not sure if this is what your looking for but the simplest way might be to use JavaScript. Have the second form that you want to post without a submit button being clicked have an onSubmit event. So on submit of the first form, javascript will submit the second without the user clicking a button. Check this link.

    http://www.devguru.com/Technologies/ecmascript/quickref/evhan_onsubmit.html

    Hope this helps, -Steve.

    -----Original Message----- From: MindHunter [mailto:MindHuntermailbox.co.za] Sent: Tuesday, July 16, 2002 2:33 AM To: php-generallists.php.net Subject: [PHP] Submit code

    I am looking for PHP code that will submit (post) a form automaically to a ANOTHER php page. I do not want to press a submit button. I have found a class at PHPClasses but it is too complicated for my needs. What is the simplest way of doing this? What is the theoretical approach?

    The reason I need this is that I have a table output from a database after one submits 'n list of variables (form inputs). I want to update a graph in another Iframe automatically without clicking on another submit button.

    Tx MH

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

    attached mail follows:


    As you know, PHP can't do the work becuase it is on the server side, not hte client side. Meaning, when the server side is finish, all done, then it go directly to the client side (web browser). If you want PHP to do something then you'll have to do something to the webpage, like a click button or something to send it back to the server side. So, that's where Javascript come into play. Javascript is the client side and it can detect things for you and do the work for you. Hope that help!

    FletchSOD

    "Steve Bradwell" <SteveBcompxnet.com> wrote in message news:57A1618E7109D311A97D0008C7EBB3A1010C81F0KITCHENER... > Well, I'm not sure if this is what your looking for but the simplest way > might be to use JavaScript. Have the second form that you want to post > without a submit button being clicked have an onSubmit event. So on submit > of the first form, javascript will submit the second without the user > clicking a button. Check this link. > > http://www.devguru.com/Technologies/ecmascript/quickref/evhan_onsubmit.html > > Hope this helps, > -Steve. > > > -----Original Message----- > From: MindHunter [mailto:MindHuntermailbox.co.za] > Sent: Tuesday, July 16, 2002 2:33 AM > To: php-generallists.php.net > Subject: [PHP] Submit code > > > I am looking for PHP code that will submit (post) a form automaically to a > ANOTHER php page. I do not want to press a submit button. I have found a > class at PHPClasses but it is too complicated for my needs. What is the > simplest way of doing this? What is the theoretical approach? > > The reason I need this is that I have a table output from a database after > one submits 'n list of variables (form inputs). I want to update a graph in > another Iframe automatically without clicking on another submit button. > > Tx > MH > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    here's an excerpt from a script in which I do something like that:

    $pdArgs= "demo=" . urlencode($argAry['demo']) . "&" . "first_name=" . urlencode($argAry['first_name']) . "&" . "last_name=" . urlencode($argAry['last_name']) . "&" .

    [. . .]

    $URL= "https://HOST.DOMAIN/SCRIPT.php"; exec("/usr/bin/curl -m 120 -d \"$pdArgs\" $URL -L", $httpResponse, $exitCode); if ($exitCode != 0) { header ("Location: error.php?code=" . urlencode("https: failure. Exit code is $exitCode")); exit; }

    --
    When the birdcage is open,   | donate to causes I care about:
    the selfish bird flies away, |    http://svcs.affero.net/rm.php?r=leed_25
    but the virtuous one stays.  |
    

    attached mail follows:


    Hi there,

    I am wondering if it would be possible to activate a php script via cron periodicly.

    Can anybody give me a hint on that or knows a good article?

    Thanx in advance,

    Andy

    attached mail follows:


    On Tuesday 16 July 2002 20:42, Andy wrote: > Hi there, > > I am wondering if it would be possible to activate a php script via cron > periodicly. > > Can anybody give me a hint on that or knows a good article?

    Search archives for "cron OR wget"

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

    /* The use of money is all the advantage there is to having money. -- B. Franklin */

    attached mail follows:


    [snip] I am wondering if it would be possible to activate a php script via cron periodicly.

    Can anybody give me a hint on that or knows a good article? [/snip]

    If you can run PHP from the command line, i.e.

    php thisscript.php

    it means that you have installed PHP as a standalone executable. If so you can include the following bash line in your PHP script (as the first line, just like PERL, or any other shell script);

    #!/path/to/php

    Then you can set up your CRON to call the script directly. You can compile PHP as a standalone quite easily, if you compiled it before it should only take you a few minutes.

    HTH!

    Jay

    "Before you criticize someone, walk a mile in his shoes. That way, if he gets angry, he’ll be a mile away-and barefoot"

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

    attached mail follows:


    Hi Jay:

    > If you can run PHP from the command line, i.e. > > php thisscript.php > > it means that you have installed PHP as a standalone executable. If so you

    What do you mean standalone? If this is in reference to not running it as a module of Apache, then my set up must be weird, because I can run my PHP as a Script from the Command line yet it was installed as a Module of Apache and this is explicitly stated when I fire up Apache...

    Spike...

    attached mail follows:


    You can have both...a standalone executable and an Apache module! They will operate on the same server, independently of each other.

    Jay

    "It's a dessert topping AND a floor wax!" -- Satuday Night Live, circa '76

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

    -----Original Message----- From: Kondwani Spike Mkandawire [mailto:kondwanics.mun.ca] Sent: Tuesday, July 16, 2002 7:54 AM To: php-generallists.php.net Subject: Re: [PHP] activating php scripts via cron

    Hi Jay:

    > If you can run PHP from the command line, i.e. > > php thisscript.php > > it means that you have installed PHP as a standalone executable. If so you

    What do you mean standalone? If this is in reference to not running it as a module of Apache, then my set up must be weird, because I can run my PHP as a Script from the Command line yet it was installed as a Module of Apache and this is explicitly stated when I fire up Apache...

    Spike...

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

    attached mail follows:


    so how do you install a second php version?? If you compile it (besides with what kind of flags) and then do a make and a make install the original version will be replaced, right?

    "Jay Blanchard" <jay.blanchardniicommunications.com> schrieb im Newsbeitrag news:000f01c22cc9$33046590$8102a8c0niigziuo4ohhdt... > You can have both...a standalone executable and an Apache module! They will > operate on the same server, independently of each other. > > Jay > > "It's a dessert topping AND a floor wax!" -- Satuday Night Live, circa '76 > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > > -----Original Message----- > From: Kondwani Spike Mkandawire [mailto:kondwanics.mun.ca] > Sent: Tuesday, July 16, 2002 7:54 AM > To: php-generallists.php.net > Subject: Re: [PHP] activating php scripts via cron > > > Hi Jay: > > > If you can run PHP from the command line, i.e. > > > > php thisscript.php > > > > it means that you have installed PHP as a standalone executable. If so you > > What do you mean standalone? If this is in reference to not running it > as a module of Apache, then my set up must be weird, because > I can run my PHP as a Script from the Command line yet it > was installed as a Module of Apache and this is explicitly > stated when I fire up Apache... > > Spike... > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

    attached mail follows:


    On Tuesday 16 July 2002 23:36, Andy wrote: > so how do you install a second php version?? If you compile it (besides > with what kind of flags) and then do a make and a make install the original > version will be replaced, right?

    Just doing:

    ./configure; make; make install

    will compile and install the standalone php binary by default.

    Add whatever other options you need to the ./configure command. It's all in the manual.

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

    /* THE DAILY PLANET

    SUPERMAN SAVES DESSERT! Plans to "Eat it later" */

    attached mail follows:


    Instead of a second version, you can call your script via lynx:

    TERM=vt100 0 * * * * lynx -dump http://www.domeinnaam.nl/yourscript.php

    attached mail follows:


    sounds logical, but what happens with my other php version, where I need the flags? will it still be working? And where is this standalone php version gonna be installed?

    Andy

    "Jason Wong" <php-generalgremlins.com.hk> schrieb im Newsbeitrag news:200207162348.35817.php-generalgremlins.com.hk... > On Tuesday 16 July 2002 23:36, Andy wrote: > > so how do you install a second php version?? If you compile it (besides > > with what kind of flags) and then do a make and a make install the original > > version will be replaced, right? > > Just doing: > > ./configure; make; make install > > will compile and install the standalone php binary by default. > > Add whatever other options you need to the ./configure command. It's all in > the manual. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > THE DAILY PLANET > > SUPERMAN SAVES DESSERT! > Plans to "Eat it later" > */ >

    attached mail follows:


    Martin, I have downloaded INVISION, installed everything correct, but I cannot (even as administrator/moderator)) see where the posts by members go to? Only posts by administrator appear. Any idea where the new posts by members go to and how an administrator can approve them? Thanks. NOBBY

    ----- Original Message ----- From: "Martin Clifford" <MLC1nrc.gov> To: <php-generallists.php.net>; <richard.mailsofthome.net> Sent: Monday, July 15, 2002 6:41 PM Subject: [PHP] Re: Good Forum...

    Invision Board is the best PHP based BB that I've seen so far. If you're familiar with Ikonboard written in Perl, this is the same thing optimized for PHP. Not to mention that the installation is a BREEZE! You can get a copy FREE at http://www.invisionboard.com, and you can check out a sample of what it can do in the forums link below. Good Luck!

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> <richard.mailsofthome.net> 07/15/02 06:26AM >>> phpbb is a good forum or phorum

    both are free to use :)

    i hope you can use one of those ;)

    JJ Harrison\ writes:

    > What is a good php-based forum? > > I would have used vBulletin but my group a non-profit so we obviously can't > afford it. > > Part of what I require is users to be stored in a db table using md5() or > anouther function. What I would do is expand the table with more user info > for use with my whole site. > > > -- > JJ Harrison > webmastertececo.com > www.tececo.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

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

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

    attached mail follows:


    Martin, I think I have got it. Thanks.

    Best Regards, NORBU (SOLUTION FOR YOUR WEB DESIGN & DEVELOPMENT, SOFTWARE & HARDWARE, NETWORK & INTERNET) -------------------------------------------------- WEBMASTER DrukNet / Bhutan Telecom / BTNIC PO Box 134 Thimphu BHUTAN Phone: Work 326997 Home (on request) Email: webmasterdruknet.bt norbudruknet.bt ----- Original Message ----- From: "Tshering Norbu" <norbudruknet.net.bt> To: <php-generallists.php.net> Sent: Tuesday, July 16, 2002 6:47 PM Subject: Re: [PHP] Re: Good Forum...

    > Martin, > I have downloaded INVISION, installed everything correct, but I cannot (even > as administrator/moderator)) see where the posts by members go to? Only > posts by administrator appear. Any idea where the new posts by members go to > and how an administrator can approve them? > Thanks. > NOBBY > > ----- Original Message ----- > From: "Martin Clifford" <MLC1nrc.gov> > To: <php-generallists.php.net>; <richard.mailsofthome.net> > Sent: Monday, July 15, 2002 6:41 PM > Subject: [PHP] Re: Good Forum... > > > Invision Board is the best PHP based BB that I've seen so far. If you're > familiar with Ikonboard written in Perl, this is the same thing optimized > for PHP. Not to mention that the installation is a BREEZE! You can get a > copy FREE at http://www.invisionboard.com, and you can check out a sample of > what it can do in the forums link below. Good Luck! > > Martin Clifford > Homepage: http://www.completesource.net > Developer's Forums: http://www.completesource.net/forums/ > > > >>> <richard.mailsofthome.net> 07/15/02 06:26AM >>> > phpbb is a good forum or phorum > > both are free to use :) > > i hope you can use one of those ;) > > > JJ Harrison\ writes: > > > What is a good php-based forum? > > > > I would have used vBulletin but my group a non-profit so we obviously > can't > > afford it. > > > > Part of what I require is users to be stored in a db table using md5() or > > anouther function. What I would do is expand the table with more user info > > for use with my whole site. > > > > > > -- > > JJ Harrison > > webmastertececo.com > > www.tececo.com > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    I have a problem running my Scripts from IIS... I test them on my localhost which is running Apache and PHP 4.2.1 and it works perfectly... However I get an undefined variable error running it on an IIS Server running PHP 4.2.1 Apart from these messages that make my "send to" pages look untidy, the Script still runs as expected on IIS... I have tried a couple of approaches:

    Stuck in some if and isset statements... Effect: It affects the running of the whole Script (Some of the variables loose info... and I am using locking quotations \")...

    I have tried sticking in symbols and this has no effect

    I have tried sticking in if empty... This has a similar effect to if isset...

    Does anyone else have any ideas on what I could do?

    Kondwani

    attached mail follows:


    Sounds more like it's to do with the php.ini settings on the IIS box than IIS itself.

    http://www.php.net/manual/en/configuration.php#ini.error-reporting

    HTH,

    Richy ========================================== Richard Black Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 435 3504 Email: rblackdatavisibility.co.uk

    -----Original Message----- From: Kondwani Spike Mkandawire [mailto:kondwanics.mun.ca] Sent: 16 July 2002 13:46 To: php-generallists.php.net Subject: [PHP] Problem Running my Scripts from IIS...

    I have a problem running my Scripts from IIS... I test them on my localhost which is running Apache and PHP 4.2.1 and it works perfectly... However I get an undefined variable error running it on an IIS Server running PHP 4.2.1 Apart from these messages that make my "send to" pages look untidy, the Script still runs as expected on IIS... I have tried a couple of approaches:

    Stuck in some if and isset statements... Effect: It affects the running of the whole Script (Some of the variables loose info... and I am using locking quotations \")...

    I have tried sticking in symbols and this has no effect

    I have tried sticking in if empty... This has a similar effect to if isset...

    Does anyone else have any ideas on what I could do?

    Kondwani

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

    attached mail follows:


    "Richard Black" <rblackdatavisibility.co.uk> wrote in message news:004701c22cc9$880a4be0$16fea8c0DVLAPTOP1... > Sounds more like it's to do with the php.ini settings on the IIS box > than IIS itself. > > http://www.php.net/manual/en/configuration.php#ini.error-reporting > Probably, but I have seen a lot of posts with problems like this on the php forums which is where I got the symbol...

    I did configure the php.ini file well atleast the globals for this (relevant to this particular situation)...I have my info function set so I could view all settings, could someone please suggest any other thing I should be looking at...

    Spike...

    attached mail follows:


    Are you running PHP as CGI or ISAPI?

    I got so much similar trouble with the ISAPI dll on IIS that I use the CGI nowadays.

    MH

    "Kondwani Spike Mkandawire" <kondwanics.mun.ca> wrote in message news:20020716125228.78314.qmailpb1.pair.com... > I have a problem running my Scripts from IIS... > I test them on my localhost which is running > Apache and PHP 4.2.1 and it works perfectly... > However I get an undefined variable error > running it on an IIS Server running PHP 4.2.1 > Apart from these messages that make my > "send to" pages look untidy, the Script still > runs as expected on IIS... I have tried a couple > of approaches: > > Stuck in some if and isset statements... > Effect: It affects the running of the whole > Script (Some of the variables loose info... > and I am using locking quotations \")... > > I have tried sticking in symbols and this > has no effect > > I have tried sticking in if empty... This has > a similar effect to if isset... > > Does anyone else have any ideas on what I > could do? > > Kondwani > >

    attached mail follows:


    I run it as CGI... I have the problem fixed though... It looks real messy but every time I echo out a variable that *appears* to be undefined whilst it actually is, I stick an sign infront of it... Hence I have something like:

    echo $var1;

    If I need to stick extra statements I use concatenation as follows:

    echo $var1."Extra String Fed".var2".....";

    Kind of nasty looking but under IIS it does the trick...

    Spike...

    "Mindhunter" <MindHuntermailbox.co.za> wrote in message news:20020716141130.64731.qmailpb1.pair.com... > Are you running PHP as CGI or ISAPI? > > I got so much similar trouble with the ISAPI dll on IIS that I use the CGI > nowadays. > > MH > > "Kondwani Spike Mkandawire" <kondwanics.mun.ca> wrote in message > news:20020716125228.78314.qmailpb1.pair.com... > > I have a problem running my Scripts from IIS... > > I test them on my localhost which is running > > Apache and PHP 4.2.1 and it works perfectly... > > However I get an undefined variable error > > running it on an IIS Server running PHP 4.2.1 > > Apart from these messages that make my > > "send to" pages look untidy, the Script still > > runs as expected on IIS... I have tried a couple > > of approaches: > > > > Stuck in some if and isset statements... > > Effect: It affects the running of the whole > > Script (Some of the variables loose info... > > and I am using locking quotations \")... > > > > I have tried sticking in symbols and this > > has no effect > > > > I have tried sticking in if empty... This has > > a similar effect to if isset... > > > > Does anyone else have any ideas on what I > > could do? > > > > Kondwani > > > > > >

    attached mail follows:


    Kondwani Spike Mkandawire wrote:

    >"Richard Black" <rblackdatavisibility.co.uk> wrote in message >news:004701c22cc9$880a4be0$16fea8c0DVLAPTOP1... > >>Sounds more like it's to do with the php.ini settings on the IIS box >>than IIS itself. >> >>http://www.php.net/manual/en/configuration.php#ini.error-reporting >> >Probably, but I have seen a lot of posts with problems like >this on the php forums which is where I got the symbol... > I agree with Richard here. It sounds as though error_reporting is set at E_ALL on the windows box and at a different level on the linux box such that you are not getting the error messages. If its not a register_globals problem then it sounds as though you are using variables before assigning them a value.

    Without some code and exact error message its hard to tell.

    HTH Chris

    attached mail follows:


    I was looking for in the news, but i did not encounter any thing.

    Where can I get an example or the way to read a text file into a variable and how identify the carriage return and special characters.

    Thank you

    Edgar

    attached mail follows:


    $contents = implode('',file($filename));

    Regards, Andrey

    "Edgar" <edgarxpress.com.co> wrote in message news:<20020716125542.81289.qmailpb1.pair.com>... > I was looking for in the news, but i did not encounter any thing. > > Where can I get an example or the way to read a text file into a variable > and how identify the carriage return and special characters. > > > Thank you > > > Edgar > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    php.net has little snippets under the documentation for the fread function... That's a start... "Edgar" <edgarxpress.com.co> wrote in message news:20020716125542.81289.qmailpb1.pair.com... > I was looking for in the news, but i did not encounter any thing. > > Where can I get an example or the way to read a text file into a variable > and how identify the carriage return and special characters. > > > Thank you > > > Edgar > >

    attached mail follows:


    on 16/07/02 2:17 PM, Richard Lynch (richphpbootcamp.com) wrote:

    >> Would anyone know of any PHP training or courses in Australia... > > Luke and Laura :-) run a fabulous PHP program through the Royal Mumble Iblle > T-something... > > Royal Melbourne Institute of Technology? > >> Also for the devolopers... >> >> Is there at present, or a future plan for a PHPCE >> A certified engineer :) >> >> Just a thought since everyone else has them.... > > Enh. I mean, to me, an MCSE proves nothing of any value, really. That's > just my opinion, though.

    It provides the developer with a piece of paper, in theory certifying that the developer is somewhat qualified.

    A PHPCE would have the same value -- not a total waste, but not exactly a guarantee of a decent programmer... a proven track record on related projects and skills is a better guarantee.

    The other --although totally superficial-- benefit is a few letters after your name, and a few more things for freelancers to brag about when attempting to prove they're good enough.

    If there was a PHPCE, I'd probably take it just "because".

    Justin French

    attached mail follows:


    The script was working great before PHP 4.2.x and not after that. So, I looked through the code and came upon this variable, "$$var". I have no idea what the purpose of the double "$" is for a variable. Anyone know?

    --clip-- $var = "v".$counter."_high_indiv"; $val3 = $$var; --clip

    Thanks, FletchSOD

    attached mail follows:


    Variable variable. Read the docs.

    $v = 'foo'; $foo = 'bar'; echo $$v;

    Regards, Andrey

    P.S. Sometimes {} are used : ${$v}

    "Scott Fletcher" <scottabcoa.com> wrote in message news:<20020716135017.43862.qmailpb1.pair.com>... > The script was working great before PHP 4.2.x and not after that. So, I > looked through the code and came upon this variable, "$$var". I have no > idea what the purpose of the double "$" is for a variable. Anyone know? > > --clip-- > $var = "v".$counter."_high_indiv"; > $val3 = $$var; > --clip > > Thanks, > FletchSOD > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    Interesting! Look like the 2nd "$" is decomissioned and is reserve for something in the future or something. Just like the "_" is when it come with $_POST as an example. That would explain why it doesn't work with PHP 4.2.x & up.

    "Andrey Hristov" <ahristovicygen.com> wrote in message news:002601c22cd0$b1995170$1601a8c0nik... > Variable variable. Read the docs. > > $v = 'foo'; > $foo = 'bar'; > echo $$v; > > Regards, > Andrey > > P.S. > Sometimes {} are used : ${$v} > > > > > "Scott Fletcher" <scottabcoa.com> wrote in message > news:<20020716135017.43862.qmailpb1.pair.com>... > > The script was working great before PHP 4.2.x and not after that. So, I > > looked through the code and came upon this variable, "$$var". I have no > > idea what the purpose of the double "$" is for a variable. Anyone know? > > > > --clip-- > > $var = "v".$counter."_high_indiv"; > > $val3 = $$var; > > --clip > > > > Thanks, > > FletchSOD > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

    attached mail follows:


    The cause for your problem would be that register_globals defaults to off in PHP 4.2.x and greater. The solution? Start using the new superglobals ($_POST, $_GET, $_SESSION etc) or (not recomended) set register_globals = on in php.ini

    Read more here: http://www.php.net/manual/en/language.variables.predefined.php

    Regards Joakim Andersson

    > -----Original Message----- > From: Scott Fletcher [mailto:scottabcoa.com] > Sent: Tuesday, July 16, 2002 3:54 PM > To: php-generallists.php.net > Subject: [PHP] Purpose of $$var ????? > > > The script was working great before PHP 4.2.x and not after > that. So, I > looked through the code and came upon this variable, "$$var". > I have no > idea what the purpose of the double "$" is for a variable. > Anyone know? > > --clip-- > $var = "v".$counter."_high_indiv"; > $val3 = $$var; > --clip > > Thanks, > FletchSOD > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    variable variable... right up there with array array

    basically what you are saying is resolve $var, then find out what that variable holds

    example; assume your $counter is currently at 5

    $var = "v".$counter."_high_indiv";

    would mean that $var= "v5_high_indiv" assuming that v5_high_indiv is dynamically assigned somewhere as a variable

    $$var is the value of $v5_high_indiv

    make sense?

    variable variables are especially good in loops... for example, if you have variables called $user1, $user2, $user3.... to print out all the variables would require one line per variable (and alot of typing). using variable variables you could print out the value of all users by looping it

    for($i=1;$i<100;$i++){ $user="user".$i; echo $$user; }

    Dave

    >-----Original Message----- >From: Scott Fletcher [mailto:scottabcoa.com] >Sent: Tuesday, July 16, 2002 9:54 AM >To: php-generallists.php.net >Subject: [PHP] Purpose of $$var ????? > > >The script was working great before PHP 4.2.x and not after that. So, I >looked through the code and came upon this variable, "$$var". I have no >idea what the purpose of the double "$" is for a variable. Anyone know? > >--clip-- > $var = "v".$counter."_high_indiv"; > $val3 = $$var; >--clip > >Thanks, > FletchSOD > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    I tried that test script you mentioned and it doesn't work in PHP 4.2.1. I have a very good idea why is that, must have to do with the php.ini. Unfortunately, it doesn't work either. I'll tell you what, I'll just throw out that script and write a different script. This time, no double "$".

    --clip-- for($i=1;$i<100;$i++){ $user="user".$i; echo $$user."*<br>"; } --clip-- "Joakim Andersson" <joakim.anderssoncybercom.se> wrote in message news:791CA4EB1F1AD2119BB900062905C91F02CE8040adam.cybercom.se... > The cause for your problem would be that register_globals defaults to off in > PHP 4.2.x and greater. > The solution? Start using the new superglobals ($_POST, $_GET, $_SESSION > etc) or (not recomended) set register_globals = on in php.ini > > Read more here: > http://www.php.net/manual/en/language.variables.predefined.php > > Regards > Joakim Andersson > > > > -----Original Message----- > > From: Scott Fletcher [mailto:scottabcoa.com] > > Sent: Tuesday, July 16, 2002 3:54 PM > > To: php-generallists.php.net > > Subject: [PHP] Purpose of $$var ????? > > > > > > The script was working great before PHP 4.2.x and not after > > that. So, I > > looked through the code and came upon this variable, "$$var". > > I have no > > idea what the purpose of the double "$" is for a variable. > > Anyone know? > > > > --clip-- > > $var = "v".$counter."_high_indiv"; > > $val3 = $$var; > > --clip > > > > Thanks, > > FletchSOD > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    What docs at php.net? under variable, predefine variable or what?

    "Andrey Hristov" <ahristovicygen.com> wrote in message news:002601c22cd0$b1995170$1601a8c0nik... > Variable variable. Read the docs. > > $v = 'foo'; > $foo = 'bar'; > echo $$v; > > Regards, > Andrey > > P.S. > Sometimes {} are used : ${$v} > > > > > "Scott Fletcher" <scottabcoa.com> wrote in message > news:<20020716135017.43862.qmailpb1.pair.com>... > > The script was working great before PHP 4.2.x and not after that. So, I > > looked through the code and came upon this variable, "$$var". I have no > > idea what the purpose of the double "$" is for a variable. Anyone know? > > > > --clip-- > > $var = "v".$counter."_high_indiv"; > > $val3 = $$var; > > --clip > > > > Thanks, > > FletchSOD > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

    attached mail follows:


    Alright! Found the problem! Faulty script written that come before this script where $$var come into play. At least, it wasn't me, it was the other programmer's error. :-)

    "Scott Fletcher" <scottabcoa.com> wrote in message news:20020716140950.61894.qmailpb1.pair.com... > Interesting! Look like the 2nd "$" is decomissioned and is reserve for > something in the future or something. Just like the "_" is when it come > with $_POST as an example. That would explain why it doesn't work with PHP > 4.2.x & up. > > "Andrey Hristov" <ahristovicygen.com> wrote in message > news:002601c22cd0$b1995170$1601a8c0nik... > > Variable variable. Read the docs. > > > > $v = 'foo'; > > $foo = 'bar'; > > echo $$v; > > > > Regards, > > Andrey > > > > P.S. > > Sometimes {} are used : ${$v} > > > > > > > > > > "Scott Fletcher" <scottabcoa.com> wrote in message > > news:<20020716135017.43862.qmailpb1.pair.com>... > > > The script was working great before PHP 4.2.x and not after that. So, I > > > looked through the code and came upon this variable, "$$var". I have no > > > idea what the purpose of the double "$" is for a variable. Anyone know? > > > > > > --clip-- > > > $var = "v".$counter."_high_indiv"; > > > $val3 = $$var; > > > --clip > > > > > > Thanks, > > > FletchSOD > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > >

    attached mail follows:


    $users=file('.users'); # puts users in the file into an array so we can # check for valid or priv users with if(in_array($HTTP_SERVER_VARS["REMOTE_USER"], $users)){}

    # we add additional users to the .users file with the following $users[]=$newuser; # adds the new user to the end of the above created users array # then write the array to the file $fd = fopen (".users", "w+"); fwrite ($fd, join("\n",$users)); fclose ($fd);

    the problem is after adding users, only the last user returns the user name in the array, all the other users have an additional "/n" at the end of them, which causes the check to barf.

    I want to ensure that the .users file is in;

    user1 user2 user3

    ...format, am I missing something in the reconstruction of the users file that can eliminate the "\n" being placed into the array on the next file() call?

    hope that made sense... thank.

    Dave

    attached mail follows:


    On Tuesday 16 July 2002 21:53, Dave [Hawk-Systems] wrote: > $users=file('.users'); > # puts users in the file into an array so we can > # check for valid or priv users with > if(in_array($HTTP_SERVER_VARS["REMOTE_USER"], $users)){} > > # we add additional users to the .users file with the following > $users[]=$newuser; > # adds the new user to the end of the above created users array > # then write the array to the file > $fd = fopen (".users", "w+"); > fwrite ($fd, join("\n",$users)); > fclose ($fd); > > the problem is after adding users, only the last user returns the user name > in the array, all the other users have an additional "/n" at the end of > them, which causes the check to barf.

    Well, if you RTFM, you'll know that file() "returns the file in an array ... with the newline still attached". So one possible solution is after using file(), loop through $users and remove the trailing "\n".

    > I want to ensure that the .users file is in; > > user1 > user2 > user3 > > ...format, am I missing something in the reconstruction of the users file > that can eliminate the "\n" being placed into the array on the next file() > call?

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

    /* Main's Law: For every action there is an equal and opposite government program. */

    attached mail follows:


    >On Tuesday 16 July 2002 21:53, Dave [Hawk-Systems] wrote: >> $users=file('.users'); >> # puts users in the file into an array so we can >> # check for valid or priv users with >> if(in_array($HTTP_SERVER_VARS["REMOTE_USER"], $users)){} >> >> # we add additional users to the .users file with the following >> $users[]=$newuser; >> # adds the new user to the end of the above created users array >> # then write the array to the file >> $fd = fopen (".users", "w+"); >> fwrite ($fd, join("\n",$users)); >> fclose ($fd); >> >> the problem is after adding users, only the last user returns the user name >> in the array, all the other users have an additional "/n" at the end of >> them, which causes the check to barf. > >Well, if you RTFM, you'll know that file() "returns the file in an array ... >with the newline still attached". So one possible solution is after using >file(), loop through $users and remove the trailing "\n".

    thanks, I am/was looking to avoid looping through the array unnecessarily, and simply have them removed at the time of dumping the file into the array.

    Dave

    attached mail follows:


    On Tuesday 16 July 2002 22:35, Dave [Hawk-Systems] wrote:

    > >> $users[]=$newuser; > >> # adds the new user to the end of the above created users array > >> # then write the array to the file > >> $fd = fopen (".users", "w+"); > >> fwrite ($fd, join("\n",$users)); > >> fclose ($fd); > >> > >> the problem is after adding users, only the last user returns the user > >> name in the array, all the other users have an additional "/n" at the > >> end of them, which causes the check to barf. > > > >Well, if you RTFM, you'll know that file() "returns the file in an array > > ... with the newline still attached". So one possible solution is after > > using file(), loop through $users and remove the trailing "\n". > > thanks, I am/was looking to avoid looping through the array unnecessarily, > and simply have them removed at the time of dumping the file into the > array.

    Then use:

    if(in_array($HTTP_SERVER_VARS["REMOTE_USER"] . "\n", $users)) { ... }

    BTW, it should be:

    fwrite ($fd, join('', $users));

    otherwise each time you write the file out it will have an increasing number of "\n" attached to each user.

    attached mail follows:


    >> >> $users[]=$newuser; >> >> # adds the new user to the end of the above created users array >> >> # then write the array to the file >> >> $fd = fopen (".users", "w+"); >> >> fwrite ($fd, join("\n",$users)); >> >> fclose ($fd); >> >> >> >> the problem is after adding users, only the last user returns the user >> >> name in the array, all the other users have an additional "/n" at the >> >> end of them, which causes the check to barf. >> > >> >Well, if you RTFM, you'll know that file() "returns the file in an array >> > ... with the newline still attached". So one possible solution is after >> > using file(), loop through $users and remove the trailing "\n". >> >> thanks, I am/was looking to avoid looping through the array unnecessarily, >> and simply have them removed at the time of dumping the file into the >> array. > >Then use: > > if(in_array($HTTP_SERVER_VARS["REMOTE_USER"] . "\n", $users)) { ... }

    leaving that last user added to the file not to match since it will not have a \n at the end of it...

    adding one to the user as it is added into the array results in yet another array element after the file() since it reads the additional line as another array element.

    >BTW, it should be: > > fwrite ($fd, join('', $users)); > >otherwise each time you write the file out it will have an increasing number >of "\n" attached to each user.

    thats the crux... fwrite ($fd, join('', $users)); results in a long string of usernames in the, which can't be grabbed back into the array with the file... in short, there is no way to trim as you file() to eliinate this (from what i can see) other than running it through each() or something and rebuilding the array after trimming. Was hoping for something a little more eloquent.

    cheers,

    Dave

    attached mail follows:


    On Wednesday 17 July 2002 00:44, Dave [Hawk-Systems] wrote:

    > > if(in_array($HTTP_SERVER_VARS["REMOTE_USER"] . "\n", $users)) { ... }

    > >BTW, it should be: > > > > fwrite ($fd, join('', $users)); > > > >otherwise each time you write the file out it will have an increasing > > number of "\n" attached to each user. > > thats the crux... > fwrite ($fd, join('', $users)); > results in a long string of usernames in the, which can't be grabbed back > into the array with the file...

    How would it? Each element in $users have a trailing "\n".

    > in short, there is no way to trim as you > file() to eliinate this (from what i can see) other than running it through > each() or something and rebuilding the array after trimming. Was hoping > for something a little more eloquent.

    Start from scratch. You have a file with a single user on each line:

    tom\n dick\n harry\n

    You use file() to read into array $users.

    You compare as in above.

    You add a user by:

    $users[] = "NEW_USER\n";

    You write out the file as above.

    If my logic haven't gone awry somewhere, that's your problem solved!

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

    /* It is better to have loved and lost than just to have lost. */

    attached mail follows:


    >Start from scratch. You have a file with a single user on each line: > >tom\n >dick\n >harry\n > >You use file() to read into array $users. > >You compare as in above. > >You add a user by: > > $users[] = "NEW_USER\n"; > >You write out the file as above.

    curious... when I ran through that (before posting initially) was getting the following from print_r of the file() results... Array ( [0] => admin

    [1] => user1

    [2] => user2

    [3] => user3

    [4] => )

    which lead me to believe that the last \n was parsing as an extra element in the array... (not sure why), thus the dilema of either trimming each element of the array, or pop'ing an element off the end of the array. both seemed annoying, thus the post

    after recoding it with each/trim into new array and use that for checking validity... I redid the original file using the script and got different results;

    Array ( [0] => admin

    [1] => user1

    [2] => user2

    [3] => user3

    )

    which is what I expected in the first place... as such, the original code could now just check for the username with a ."\n" on the end (as you recommended). Futsed up there somewhere... thus the seemingly stupid question.

    cheers,

    Dave

    attached mail follows:


    I have created a table which has a column called cost. How do I add up all the numerical data in the cost column and display that on a webpage?

    -Thanks

    -Jay

    attached mail follows:


    Jay wrote:

    >I have created a table which has a column called cost. How do I add up all >the numerical data in the cost column and display that on a webpage? > Go through each record and add up the value of the cost column. Your question is so general it difficult to give more than a general pointer. What I would do is: 1. Start off an html page upto the point you want to display the data. 2. Do a sql select statement to get all the records. 3. Loop through all the records, adding up the cost column. 4. Display the result on the html page. 5. Finish up of the html page.

    I'm not sure what you are expecting in the way of an answer here but to do this you need knowledge of HTML, SQL, a database and a programming language suitable for generating web pages (e.g. PHP).

    Hope this helps.

    Chris

    attached mail follows:


    Maybe I don't understand what your asking but if you just want one column totalled. Why not just do it in SQL?

    Example:

    $query = mysql_query("SELECT SUM(cost) AS total FROM cart WHERE userid='$_SESSION[userid]';"); $array = mysql_fetch_array($query);

    This would give you the total amount of this user's cost from there shopping cart (just an example). So, you would just print $array[total] and poof. No having to loop or anything.

    Adam Voigt adam.voigtcryptocomm.com

    On Tue, 2002-07-16 at 12:07, Chris Hewitt wrote: > Jay wrote: > > >I have created a table which has a column called cost. How do I add up all > >the numerical data in the cost column and display that on a webpage? > > > Go through each record and add up the value of the cost column. Your > question is so general it difficult to give more than a general pointer. > What I would do is: > 1. Start off an html page upto the point you want to display the data. > 2. Do a sql select statement to get all the records. > 3. Loop through all the records, adding up the cost column. > 4. Display the result on the html page. > 5. Finish up of the html page. > > I'm not sure what you are expecting in the way of an answer here but to > do this you need knowledge of HTML, SQL, a database and a programming > language suitable for generating web pages (e.g. PHP). > > Hope this helps. > > Chris > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Adam Voigt wrote:

    >$query = mysql_query("SELECT SUM(cost) AS total FROM cart WHERE >userid='$_SESSION[userid]';"); > Yes, I'd missed that the OP mentioned mysql in the subject, thus there SUM.

    Chris

    attached mail follows:


    Could someone please explain the difference between classes and functions and how to use a class. I write alot of PHP, but I never understood this at all. I use an include statement in many of my pages and include a file with a bunch of functions. For instance, I might have a function called stock(); In the page I am using I include the file that has this function and I call it like this:

    stock($Sym);

    I am wondering if I am doing it the wrong way. So I need to better understand classes. What is one, and why would you use it?

    Thanks.

    attached mail follows:


    [snip] Could someone please explain the difference between classes and functions and how to use a class. I write alot of PHP, but I never understood this at all. I use an include statement in many of my pages and include a file with a bunch of functions. For instance, I might have a function called stock(); In the page I am using I include the file that has this function and I call it like this:

    stock($Sym);

    I am wondering if I am doing it the wrong way. So I need to better understand classes. What is one, and why would you use it? [/snip]

    A class is the representation of an object, such as a person, place, or thing. A function is a group of commands that can be called for a specific purpose.

    function addNumbers()

    A function can be performed on an object, but an object (the logical extension of class) cannot be performed on a function. Does that help?

    Jay

    "Cleverly disguised as a responsible adult"

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

    attached mail follows:


    To add to the below, object classes, can have their own set of functions, called methods. These methods are specific to the function, and ALL functions within a class treat any properties (variables) within the class as global.

    So if you have a class "Car" with two properties ("Make" and "Model"), then those two properties can be readily accessible to any method within the class. At least I think that's how it works. I'm not all that knowledgeable on the subject :o)

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Jay Blanchard" <jay.blanchardniicommunications.com> 07/16/02 10:51AM >>> [snip] Could someone please explain the difference between classes and functions and how to use a class. I write alot of PHP, but I never understood this at all. I use an include statement in many of my pages and include a file with a bunch of functions. For instance, I might have a function called stock(); In the page I am using I include the file that has this function and I call it like this:

    stock($Sym);

    I am wondering if I am doing it the wrong way. So I need to better understand classes. What is one, and why would you use it? [/snip]

    A class is the representation of an object, such as a person, place, or thing. A function is a group of commands that can be called for a specific purpose.

    function addNumbers()

    A function can be performed on an object, but an object (the logical extension of class) cannot be performed on a function. Does that help?

    Jay

    "Cleverly disguised as a responsible adult"

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

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

    attached mail follows:


    It helps a little bit, thank you. Could you provide some code as to what a Class looks like. I am just trying to understand it better and if I see it, it might help. "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:000401c22cd8$54ce9ce0$8102a8c0niigziuo4ohhdt... > [snip] > Could someone please explain the difference between classes and functions > and how to use a class. I write alot of PHP, but I never understood this at > all. I use an include statement in many of my pages and include a file with > a bunch of functions. For instance, I might have a function called stock(); > In the page I am using I include the file that has this function and I call > it like this: > > stock($Sym); > > I am wondering if I am doing it the wrong way. So I need to better > understand classes. What is one, and why would you use it? > [/snip] > > A class is the representation of an object, such as a person, place, or > thing. > A function is a group of commands that can be called for a specific purpose. > > function addNumbers() > > A function can be performed on an object, but an object (the logical > extension of class) cannot be performed on a function. Does that help? > > Jay > > "Cleverly disguised as a responsible adult" > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

    attached mail follows:


    [snip] example? [/snip]

    http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page1.html

    Good tutorial

    Jay

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

    attached mail follows:


    Here is a sample code (don't take this as gospel... Jay knows more about OOP than I do, I'm sure!):

    class Car { var $make; var $model;

    function setMake($x) { $this->make = $x; } function setModel($y) { $this->model = $y; } }

    $make and $model are the properties of the Car class, and setMake() and setModel() are the methods of the Car class. You don't actually get an object until make a *new* one. Like this:

    $passat = new Car; $passat->setMake("Volkswagen"); $passat->setModel("Passat");

    This assigns the new object, "passat", the properties relating to it's make and model, using the methods setMake and setModel. I'm sure this is right, but I'm sure I'm probably wrong (hehe, confused?). I'm also sure someone will correct me if I am! :o)

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Chris Crane" <ccraneinxdesign.com> 07/16/02 11:06AM >>> It helps a little bit, thank you. Could you provide some code as to what a Class looks like. I am just trying to understand it better and if I see it, it might help. "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:000401c22cd8$54ce9ce0$8102a8c0niigziuo4ohhdt... > [snip] > Could someone please explain the difference between classes and functions > and how to use a class. I write alot of PHP, but I never understood this at > all. I use an include statement in many of my pages and include a file with > a bunch of functions. For instance, I might have a function called stock(); > In the page I am using I include the file that has this function and I call > it like this: > > stock($Sym); > > I am wondering if I am doing it the wrong way. So I need to better > understand classes. What is one, and why would you use it? > [/snip] > > A class is the representation of an object, such as a person, place, or > thing. > A function is a group of commands that can be called for a specific purpose. > > function addNumbers() > > A function can be performed on an object, but an object (the logical > extension of class) cannot be performed on a function. Does that help? > > Jay > > "Cleverly disguised as a responsible adult" > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

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

    attached mail follows:


    This helps quite a bit Thank you. I am just wondering if I should make classes instead of functions? What would be the benefit of that? Do you know?

    "Martin Clifford" <MLC1nrc.gov> wrote in message news:sd340004.066nrcgwia.nrc.gov... Here is a sample code (don't take this as gospel... Jay knows more about OOP than I do, I'm sure!):

    class Car { var $make; var $model;

    function setMake($x) { $this->make = $x; } function setModel($y) { $this->model = $y; } }

    $make and $model are the properties of the Car class, and setMake() and setModel() are the methods of the Car class. You don't actually get an object until make a *new* one. Like this:

    $passat = new Car; $passat->setMake("Volkswagen"); $passat->setModel("Passat");

    This assigns the new object, "passat", the properties relating to it's make and model, using the methods setMake and setModel. I'm sure this is right, but I'm sure I'm probably wrong (hehe, confused?). I'm also sure someone will correct me if I am! :o)

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Chris Crane" <ccraneinxdesign.com> 07/16/02 11:06AM >>> It helps a little bit, thank you. Could you provide some code as to what a Class looks like. I am just trying to understand it better and if I see it, it might help. "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:000401c22cd8$54ce9ce0$8102a8c0niigziuo4ohhdt... > [snip] > Could someone please explain the difference between classes and functions > and how to use a class. I write alot of PHP, but I never understood this at > all. I use an include statement in many of my pages and include a file with > a bunch of functions. For instance, I might have a function called stock(); > In the page I am using I include the file that has this function and I call > it like this: > > stock($Sym); > > I am wondering if I am doing it the wrong way. So I need to better > understand classes. What is one, and why would you use it? > [/snip] > > A class is the representation of an object, such as a person, place, or > thing. > A function is a group of commands that can be called for a specific purpose. > > function addNumbers() > > A function can be performed on an object, but an object (the logical > extension of class) cannot be performed on a function. Does that help? > > Jay > > "Cleverly disguised as a responsible adult" > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

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

    attached mail follows:


    Is there an advantage to Classes vs. Functions? "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:000c01c22cdb$11485c10$8102a8c0niigziuo4ohhdt... > [snip] > example? > [/snip] > > http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page1.html > > Good tutorial > > Jay > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

    attached mail follows:


    Classes are great for code reusability, I heavily use a MySQL object or class to make all my conections to a mysql database now and I have included methods for Transactions.

    Its a long one but its the class I use the most and is a great example of what they are good for.

    <? class mysqldb { //so here define the name of the class.

    //set up the object, these are the variables that are accessible by each instance you create // of an object. var $host; var $db; var $dbuser; var $dbpassword; var $sql; var $numberrows; var $dbopenstatus; var $dbconnection; var $qry; var $result; var $TransactionSwitch; /* Use these functions to get and set the values of this object's variables. This is good OO practice, as it means that datatype checking can be completed and errors raised accordingly.

    */

    // Property Get & Set these methods are used set class vars and to retrieve them.

    function gethost() { return $this->dbhost; }

    function sethost($req_host) { $this->dbhost = $req_host;

    }

    function getdb() { return $this->db; }

    function setdb($req_db) { $this->db = $req_db; }

    function getdbuser() { return $this->dbuser; }

    function setdbuser($req_user) { $this->dbuser = $req_user; }

    function getdbpassword() { return $this->dbpassword; }

    function setdbpassword($req_password) { $this->dbpassword = $req_password; }

    function getsql() { return $this->sql; }

    function setsql($req_sql) { $this->sql = $req_sql; }

    function getnumberrows() { return $this->numberrows; }

    function setnumberrows($req_numberresults) { $this->numberesults = $req_numberresults; }

    function setdbconnection($req_dbconnection) { $this->dbconnection = $req_connection; }

    function getdbconnection() { return $this->dbconnection; }

    function setTransactionSwitch($switch) { $this->TransactionSwitch = $switch; }

    function getTransactionSwitch() { return $this->TransactionSwitch; }

    /* This is the constructor for the object. In this case I have set the initial values of a number of the object properties to those values declared in the global constants.inc. By doing this, I only need to change the values of these properties for specific operations, which we will not need to do throughout this example

    */ function mysqldb() {

    global $HOST, $DB, $WEBUSER, $WEBPASSWORD; global $TRUE, $FALSE;

    $this->sethost($HOST); $this->setdb($DB); $this->setdbuser($WEBUSER); $this->setdbpassword($WEBPASSWORD); $this->setdbconnection($FALSE);

    }

    /* These are the methods for the object. They provide for opening a connection to the database, closing a connection and executing a SELECT query. Of course, these can be expanded upon to allow for INSERT's, UPDATE's and DELETE's etc... */ function opendbconnection() {

    global $TRUE, $FALSE;

    $this->dbconnection = mysql_connect("$this->dbhost", "$this->dbuser", "$this->dbpassword"); if ($this->dbconnection == $TRUE) { $this->db = mysql_select_db("$this->db"); $this->setdbconnection($TRUE); } else { $this->setdbconnection($FALSE); return false; } return true; }

    function closedbconnection() {

    if ($this->dbconnection = $TRUE) { mysql_close($this->dbconnection); }

    }

    function begin( ) { if ($this->dbconnection == $FALSE) { $this->opendbconnection(); } $this->setsql("BEGIN"); $this->qry = mysql_query($this->sql); if (!$this->qry) { return false; } else { return true; } }

    function rollback( ) { if ($this->dbconnection == $FALSE) { $this->opendbconnection(); } $this->setsql("ROLLBACK"); $this->qry = mysql_query($this->sql); if (!$this->qry) { return false; } else { return true; } }

    function commit( ) { if ($this->dbconnection == $FALSE) { $this->opendbconnection(); } $this->setsql("COMMIT"); $this->qry = mysql_query($this->sql); if (!$this->qry) { return false; } else { return true; } }

    function selectquery() {

    global $TRUE, $FALSE;

    if ($this->dbconnection == $FALSE) { $this->opendbconnection(); } $this->qry = mysql_query($this->sql); if (!$this->qry) { return false; } else { $this->numberrows = mysql_num_rows($this->qry); if ($this->numberrows > 0) { for($x = 0; $x < $this->numberrows; $x++) { $this->result[$x] = mysql_fetch_row($this->qry); } } else { // echo("[Error:] Retrieving data"); return false; } return true; } }

    function insertquery() {

    global $TRUE, $FALSE;

    if ($this->dbconnection == $FALSE) { $this->opendbconnection(); }

    $this->qry = mysql_query($this->sql); if (!$this->qry) { return false; } else { return true; } }

    function deletequery() {

    global $TRUE, $FALSE;

    if ($this->dbconnection == $FALSE) { $this->opendbconnection(); }

    $this->qry = mysql_query($this->sql); if (!$this->qry) { return false; } else { return true; } }

    function updatequery() {

    global $TRUE, $FALSE;

    if ($this->dbconnection == $FALSE) { $this->opendbconnection(); }

    $this->qry = mysql_query($this->sql); if (!$this->qry) { return false; } else { return true; } }

    }

    ?>

    And now in any .php file you include this .obj file and use it as follows.

    $db1 = new mysqldb(); // create a new instance of the mysql object. // You can create as many as you want and the great thing is // that each instances vars will contain there own data.

    $sql = "Insert into ..."; $db1->setTransactionSwitch("true"); $db1->begin(); //this will begin a transaction (InnoDb or BDB tables are required for this) $db1->setsql($sql); //set the objects $sql variable. if (!$db1->insertquery()) //now call the method that does all the work so $db1->setTransactionSwitch("false"); //you don't have to recode it. If it fails roolback. if($db1->getTransactionSwitch()=="false");{ $db1->rollback(); }else{ $db1->commit(); }

    Classes allow you to have multple instances of an object containing seperate info, makes it easier to keep track of. Hope this helps, Steve.

    -----Original Message----- From: Chris Crane [mailto:ccraneinxdesign.com] Sent: Tuesday, July 16, 2002 11:07 AM To: php-generallists.php.net Subject: Re: [PHP] Classes vs. Functions

    It helps a little bit, thank you. Could you provide some code as to what a Class looks like. I am just trying to understand it better and if I see it, it might help. "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:000401c22cd8$54ce9ce0$8102a8c0niigziuo4ohhdt... > [snip] > Could someone please explain the difference between classes and functions > and how to use a class. I write alot of PHP, but I never understood this at > all. I use an include statement in many of my pages and include a file with > a bunch of functions. For instance, I might have a function called stock(); > In the page I am using I include the file that has this function and I call > it like this: > > stock($Sym); > > I am wondering if I am doing it the wrong way. So I need to better > understand classes. What is one, and why would you use it? > [/snip] > > A class is the representation of an object, such as a person, place, or > thing. > A function is a group of commands that can be called for a specific purpose. > > function addNumbers() > > A function can be performed on an object, but an object (the logical > extension of class) cannot be performed on a function. Does that help? > > Jay > > "Cleverly disguised as a responsible adult" > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

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

    attached mail follows:


    [snip] This helps quite a bit Thank you. I am just wondering if I should make classes instead of functions? What would be the benefit of that? Do you know? [/snip]

    You should keep classes and functions seperate in your thought process, they are not the same and not meant to do or be the same thing. Here is a good thought process to apply to classes...

    1. Is this an object?

    If the answer is no, you do not need a class.

    2. Do I need to do something (have an action or set of actions performed), perhaps over and over again?

    If the answer is yes, this is a function.

    A method is a function that applies to a specific class of objects. If you created a class and methods for each item you code would be bloated, slow, and hard to maintain.

    Do not think of functions and classes in the same light, you will make yourself more confused. One is definitely not the other.

    Jay

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

    attached mail follows:


    I'm still trying to figure that out, but the fog is clearing slowly but steadily :o)

    From what I've heard on this and other lists, it's all a matter of preference. Obviously those that come from an object-oriented environment (Java, etc), will lean toward this method, while others stay with the procedural side of things (using functions). It's all a matter of preference, and just yet I haven't decided which is more useful :o)

    Good luck!

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Chris Crane" <ccraneinxdesign.com> 07/16/02 11:19AM >>> This helps quite a bit Thank you. I am just wondering if I should make classes instead of functions? What would be the benefit of that? Do you know?

    "Martin Clifford" <MLC1nrc.gov> wrote in message news:sd340004.066nrcgwia.nrc.gov... Here is a sample code (don't take this as gospel... Jay knows more about OOP than I do, I'm sure!):

    class Car { var $make; var $model;

    function setMake($x) { $this->make = $x; } function setModel($y) { $this->model = $y; } }

    $make and $model are the properties of the Car class, and setMake() and setModel() are the methods of the Car class. You don't actually get an object until make a *new* one. Like this:

    $passat = new Car; $passat->setMake("Volkswagen"); $passat->setModel("Passat");

    This assigns the new object, "passat", the properties relating to it's make and model, using the methods setMake and setModel. I'm sure this is right, but I'm sure I'm probably wrong (hehe, confused?). I'm also sure someone will correct me if I am! :o)

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Chris Crane" <ccraneinxdesign.com> 07/16/02 11:06AM >>> It helps a little bit, thank you. Could you provide some code as to what a Class looks like. I am just trying to understand it better and if I see it, it might help. "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:000401c22cd8$54ce9ce0$8102a8c0niigziuo4ohhdt... > [snip] > Could someone please explain the difference between classes and functions > and how to use a class. I write alot of PHP, but I never understood this at > all. I use an include statement in many of my pages and include a file with > a bunch of functions. For instance, I might have a function called stock(); > In the page I am using I include the file that has this function and I call > it like this: > > stock($Sym); > > I am wondering if I am doing it the wrong way. So I need to better > understand classes. What is one, and why would you use it? > [/snip] > > A class is the representation of an object, such as a person, place, or > thing. > A function is a group of commands that can be called for a specific purpose. > > function addNumbers() > > A function can be performed on an object, but an object (the logical > extension of class) cannot be performed on a function. Does that help? > > Jay > > "Cleverly disguised as a responsible adult" > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

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

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

    attached mail follows:


    thanks Jay. "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:000e01c22cdd$0d0c7530$8102a8c0niigziuo4ohhdt... > [snip] > This helps quite a bit Thank you. > I am just wondering if I should make classes instead of functions? What > would be the benefit of that? Do you know? > [/snip] > > You should keep classes and functions seperate in your thought process, they > are not the same and not meant to do or be the same thing. Here is a good > thought process to apply to classes... > > 1. Is this an object? > > If the answer is no, you do not need a class. > > 2. Do I need to do something (have an action or set of actions performed), > perhaps over and over again? > > If the answer is yes, this is a function. > > A method is a function that applies to a specific class of objects. If you > created a class and methods for each item you code would be bloated, slow, > and hard to maintain. > > Do not think of functions and classes in the same light, you will make > yourself more confused. One is definitely not the other. > > Jay > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

    attached mail follows:


    Wow...this is pretty cool. Do you HAVE to declareall your varibles ahead of time? "Steve Bradwell" <SteveBcompxnet.com> wrote in message news:57A1618E7109D311A97D0008C7EBB3A1010C8258KITCHENER... > Classes are great for code reusability, I heavily use a MySQL object or > class to make all my conections to a mysql database now and I have included > methods for Transactions. > > Its a long one but its the class I use the most and is a great example of > what they are good for. > > > <? > class mysqldb { //so here define the name of the class. > > //set up the object, these are the variables that are accessible by each > instance you create > // of an object. > var $host; > var $db; > var $dbuser; > var $dbpassword; > var $sql; > var $numberrows; > var $dbopenstatus; > var $dbconnection; > var $qry; > var $result; > var $TransactionSwitch; > /* > Use these functions to get and set the values of this object's > variables. This is good OO practice, as it means that datatype > checking can be completed and errors raised accordingly. > > */ > > // Property Get & Set these methods are used set class vars and to > retrieve them. > > function gethost() { > return $this->dbhost; > } > > function sethost($req_host) { > $this->dbhost = $req_host; > > } > > function getdb() { > return $this->db; > } > > function setdb($req_db) { > $this->db = $req_db; > } > > function getdbuser() { > return $this->dbuser; > } > > function setdbuser($req_user) { > $this->dbuser = $req_user; > } > > function getdbpassword() { > return $this->dbpassword; > } > > function setdbpassword($req_password) { > $this->dbpassword = $req_password; > } > > function getsql() { > return $this->sql; > } > > function setsql($req_sql) { > $this->sql = $req_sql; > } > > function getnumberrows() { > return $this->numberrows; > } > > function setnumberrows($req_numberresults) { > $this->numberesults = $req_numberresults; > } > > function setdbconnection($req_dbconnection) { > $this->dbconnection = $req_connection; > } > > function getdbconnection() { > return $this->dbconnection; > } > > function setTransactionSwitch($switch) { > $this->TransactionSwitch = $switch; > } > > function getTransactionSwitch() { > return $this->TransactionSwitch; > } > > /* > This is the constructor for the object. In this case I have set > the initial values of a number of the object properties to those > values declared in the global constants.inc. By doing this, I > only need to change the values of these properties for specific > operations, which we will not need to do throughout this example > > */ > function mysqldb() { > > global $HOST, $DB, $WEBUSER, $WEBPASSWORD; > global $TRUE, $FALSE; > > $this->sethost($HOST); > $this->setdb($DB); > $this->setdbuser($WEBUSER); > $this->setdbpassword($WEBPASSWORD); > $this->setdbconnection($FALSE); > > } > > /* > These are the methods for the object. They provide for opening a > connection to the database, closing a connection and executing a > SELECT query. Of course, these can be expanded upon to allow for > INSERT's, UPDATE's and DELETE's etc... > */ > function opendbconnection() { > > global $TRUE, $FALSE; > > $this->dbconnection = mysql_connect("$this->dbhost", > "$this->dbuser", "$this->dbpassword"); > if ($this->dbconnection == $TRUE) { > $this->db = mysql_select_db("$this->db"); > $this->setdbconnection($TRUE); > } else { > $this->setdbconnection($FALSE); > return false; > } > return true; > } > > function closedbconnection() { > > if ($this->dbconnection = $TRUE) { > mysql_close($this->dbconnection); > } > > } > > function begin( ) { > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > $this->setsql("BEGIN"); > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function rollback( ) { > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > $this->setsql("ROLLBACK"); > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function commit( ) { > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > $this->setsql("COMMIT"); > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function selectquery() { > > global $TRUE, $FALSE; > > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > $this->numberrows = mysql_num_rows($this->qry); > if ($this->numberrows > 0) { > for($x = 0; $x < $this->numberrows; $x++) { > $this->result[$x] = mysql_fetch_row($this->qry); > } > } else { > // echo("[Error:] Retrieving data"); > return false; > } > return true; > } > } > > function insertquery() { > > global $TRUE, $FALSE; > > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function deletequery() { > > global $TRUE, $FALSE; > > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function updatequery() { > > global $TRUE, $FALSE; > > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > } > > ?> > > And now in any .php file you include this .obj file and use it as follows. > > $db1 = new mysqldb(); // create a new instance of the mysql object. > // You can create as many as you want and > the great thing is > // that each instances vars will contain > there own data. > > $sql = "Insert into ..."; > $db1->setTransactionSwitch("true"); > $db1->begin(); //this will begin a transaction (InnoDb or BDB tables > are required for this) > $db1->setsql($sql); //set the objects $sql variable. > if (!$db1->insertquery()) //now call the method that does > all the work so > $db1->setTransactionSwitch("false"); //you don't have to recode it. > If it fails roolback. > if($db1->getTransactionSwitch()=="false");{ > $db1->rollback(); > }else{ > $db1->commit(); > } > > Classes allow you to have multple instances of an object containing > seperate info, makes it easier to keep track of. > Hope this helps, > Steve. > > -----Original Message----- > From: Chris Crane [mailto:ccraneinxdesign.com] > Sent: Tuesday, July 16, 2002 11:07 AM > To: php-generallists.php.net > Subject: Re: [PHP] Classes vs. Functions > > > It helps a little bit, thank you. Could you provide some code as to what a > Class looks like. I am just trying to understand it better and if I see it, > it might help. > "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message > news:000401c22cd8$54ce9ce0$8102a8c0niigziuo4ohhdt... > > [snip] > > Could someone please explain the difference between classes and functions > > and how to use a class. I write alot of PHP, but I never understood this > at > > all. I use an include statement in many of my pages and include a file > with > > a bunch of functions. For instance, I might have a function called > stock(); > > In the page I am using I include the file that has this function and I > call > > it like this: > > > > stock($Sym); > > > > I am wondering if I am doing it the wrong way. So I need to better > > understand classes. What is one, and why would you use it? > > [/snip] > > > > A class is the representation of an object, such as a person, place, or > > thing. > > A function is a group of commands that can be called for a specific > purpose. > > > > function addNumbers() > > > > A function can be performed on an object, but an object (the logical > > extension of class) cannot be performed on a function. Does that help? > > > > Jay > > > > "Cleverly disguised as a responsible adult" > > > > ************************************* > > * Want to meet other PHP developers * > > * in your area? Check out: * > > * http://php.meetup.com/ * > > * No developer is an island ... * > > ************************************* > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Yes any vars used in a class have to be defined ahead. Then just write quick set and get mothods to change them.

    And the important thing to remember is $db1->Host; retrieved with $db1->getHost(); for example contains seperate data then $db2->$Host;

    Good luck.

    -----Original Message----- From: Chris Crane [mailto:ccraneinxdesign.com] Sent: Tuesday, July 16, 2002 11:40 AM To: php-generallists.php.net Subject: Re: [PHP] Classes vs. Functions

    Wow...this is pretty cool. Do you HAVE to declareall your varibles ahead of time? "Steve Bradwell" <SteveBcompxnet.com> wrote in message news:57A1618E7109D311A97D0008C7EBB3A1010C8258KITCHENER... > Classes are great for code reusability, I heavily use a MySQL object or > class to make all my conections to a mysql database now and I have included > methods for Transactions. > > Its a long one but its the class I use the most and is a great example of > what they are good for. > > > <? > class mysqldb { //so here define the name of the class. > > //set up the object, these are the variables that are accessible by each > instance you create > // of an object. > var $host; > var $db; > var $dbuser; > var $dbpassword; > var $sql; > var $numberrows; > var $dbopenstatus; > var $dbconnection; > var $qry; > var $result; > var $TransactionSwitch; > /* > Use these functions to get and set the values of this object's > variables. This is good OO practice, as it means that datatype > checking can be completed and errors raised accordingly. > > */ > > // Property Get & Set these methods are used set class vars and to > retrieve them. > > function gethost() { > return $this->dbhost; > } > > function sethost($req_host) { > $this->dbhost = $req_host; > > } > > function getdb() { > return $this->db; > } > > function setdb($req_db) { > $this->db = $req_db; > } > > function getdbuser() { > return $this->dbuser; > } > > function setdbuser($req_user) { > $this->dbuser = $req_user; > } > > function getdbpassword() { > return $this->dbpassword; > } > > function setdbpassword($req_password) { > $this->dbpassword = $req_password; > } > > function getsql() { > return $this->sql; > } > > function setsql($req_sql) { > $this->sql = $req_sql; > } > > function getnumberrows() { > return $this->numberrows; > } > > function setnumberrows($req_numberresults) { > $this->numberesults = $req_numberresults; > } > > function setdbconnection($req_dbconnection) { > $this->dbconnection = $req_connection; > } > > function getdbconnection() { > return $this->dbconnection; > } > > function setTransactionSwitch($switch) { > $this->TransactionSwitch = $switch; > } > > function getTransactionSwitch() { > return $this->TransactionSwitch; > } > > /* > This is the constructor for the object. In this case I have set > the initial values of a number of the object properties to those > values declared in the global constants.inc. By doing this, I > only need to change the values of these properties for specific > operations, which we will not need to do throughout this example > > */ > function mysqldb() { > > global $HOST, $DB, $WEBUSER, $WEBPASSWORD; > global $TRUE, $FALSE; > > $this->sethost($HOST); > $this->setdb($DB); > $this->setdbuser($WEBUSER); > $this->setdbpassword($WEBPASSWORD); > $this->setdbconnection($FALSE); > > } > > /* > These are the methods for the object. They provide for opening a > connection to the database, closing a connection and executing a > SELECT query. Of course, these can be expanded upon to allow for > INSERT's, UPDATE's and DELETE's etc... > */ > function opendbconnection() { > > global $TRUE, $FALSE; > > $this->dbconnection = mysql_connect("$this->dbhost", > "$this->dbuser", "$this->dbpassword"); > if ($this->dbconnection == $TRUE) { > $this->db = mysql_select_db("$this->db"); > $this->setdbconnection($TRUE); > } else { > $this->setdbconnection($FALSE); > return false; > } > return true; > } > > function closedbconnection() { > > if ($this->dbconnection = $TRUE) { > mysql_close($this->dbconnection); > } > > } > > function begin( ) { > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > $this->setsql("BEGIN"); > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function rollback( ) { > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > $this->setsql("ROLLBACK"); > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function commit( ) { > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > $this->setsql("COMMIT"); > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function selectquery() { > > global $TRUE, $FALSE; > > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > $this->numberrows = mysql_num_rows($this->qry); > if ($this->numberrows > 0) { > for($x = 0; $x < $this->numberrows; $x++) { > $this->result[$x] = mysql_fetch_row($this->qry); > } > } else { > // echo("[Error:] Retrieving data"); > return false; > } > return true; > } > } > > function insertquery() { > > global $TRUE, $FALSE; > > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function deletequery() { > > global $TRUE, $FALSE; > > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > function updatequery() { > > global $TRUE, $FALSE; > > if ($this->dbconnection == $FALSE) { > $this->opendbconnection(); > } > > $this->qry = mysql_query($this->sql); > if (!$this->qry) { > return false; > } else { > return true; > } > } > > } > > ?> > > And now in any .php file you include this .obj file and use it as follows. > > $db1 = new mysqldb(); // create a new instance of the mysql object. > // You can create as many as you want and > the great thing is > // that each instances vars will contain > there own data. > > $sql = "Insert into ..."; > $db1->setTransactionSwitch("true"); > $db1->begin(); //this will begin a transaction (InnoDb or BDB tables > are required for this) > $db1->setsql($sql); //set the objects $sql variable. > if (!$db1->insertquery()) //now call the method that does > all the work so > $db1->setTransactionSwitch("false"); //you don't have to recode it. > If it fails roolback. > if($db1->getTransactionSwitch()=="false");{ > $db1->rollback(); > }else{ > $db1->commit(); > } > > Classes allow you to have multple instances of an object containing > seperate info, makes it easier to keep track of. > Hope this helps, > Steve. > > -----Original Message----- > From: Chris Crane [mailto:ccraneinxdesign.com] > Sent: Tuesday, July 16, 2002 11:07 AM > To: php-generallists.php.net > Subject: Re: [PHP] Classes vs. Functions > > > It helps a little bit, thank you. Could you provide some code as to what a > Class looks like. I am just trying to understand it better and if I see it, > it might help. > "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message > news:000401c22cd8$54ce9ce0$8102a8c0niigziuo4ohhdt... > > [snip] > > Could someone please explain the difference between classes and functions > > and how to use a class. I write alot of PHP, but I never understood this > at > > all. I use an include statement in many of my pages and include a file > with > > a bunch of functions. For instance, I might have a function called > stock(); > > In the page I am using I include the file that has this function and I > call > > it like this: > > > > stock($Sym); > > > > I am wondering if I am doing it the wrong way. So I need to better > > understand classes. What is one, and why would you use it? > > [/snip] > > > > A class is the representation of an object, such as a person, place, or > > thing. > > A function is a group of commands that can be called for a specific > purpose. > > > > function addNumbers() > > > > A function can be performed on an object, but an object (the logical > > extension of class) cannot be performed on a function. Does that help? > > > > Jay > > > > "Cleverly disguised as a responsible adult" > > > > ************************************* > > * Want to meet other PHP developers * > > * in your area? Check out: * > > * http://php.meetup.com/ * > > * No developer is an island ... * > > ************************************* > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

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

    attached mail follows:


    Hi,

    Im having the problem bellow when try make PHP source. Im using this configure:

    ./configure --with-apache=/usr/local/src/apache_1.3.23 --with-mysql=/usr/loc al/mysql --with-pgsql --with-zlib --with-gd --with-gettext

    And make error:

    Making all in Zend make[1]: Entering directory `/usr/local/src/php-4.1.1/Zend' /bin/sh ../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../main -I../TSRM -g -O2 -prefer-non-pic -s tatic -c zend_language_parser.c In file included from zend.h:54, from zend_compile.h:24, from zend_language_parser.c:148: /usr/local/include/unix.h:196: parse error before `MAILSTREAM' /usr/local/include/unix.h:196: warning: no semicolon at end of struct or union /usr/local/include/unix.h:203: parse error before `}' /usr/local/include/unix.h:203: warning: data definition has no type or storage class /usr/local/include/unix.h:207: parse error before `*' /usr/local/include/unix.h:207: warning: data definition has no type or storage class /usr/local/include/unix.h:210: parse error before `*' /usr/local/include/unix.h:211: parse error before `*' /usr/local/include/unix.h:212: parse error before `*' /usr/local/include/unix.h:213: parse error before `*' /usr/local/include/unix.h:214: parse error before `*' /usr/local/include/unix.h:215: parse error before `*' /usr/local/include/unix.h:216: parse error before `*' /usr/local/include/unix.h:216: parse error before `*' /usr/local/include/unix.h:216: warning: data definition has no type or storage class /usr/local/include/unix.h:217: parse error before `*' /usr/local/include/unix.h:218: parse error before `*' /usr/local/include/unix.h:220: parse error before `*' /usr/local/include/unix.h:221: parse error before `*' /usr/local/include/unix.h:223: parse error before `*' /usr/local/include/unix.h:224: parse error before `*' /usr/local/include/unix.h:225: parse error before `*' /usr/local/include/unix.h:226: parse error before `*' /usr/local/include/unix.h:227: parse error before `*' /usr/local/include/unix.h:228: parse error before `*' /usr/local/include/unix.h:229: parse error before `*' /usr/local/include/unix.h:233: parse error before `*' /usr/local/include/unix.h:235: parse error before `DOTLOCK' /usr/local/include/unix.h:236: parse error before `MAILSTREAM' /usr/local/include/unix.h:237: parse error before `*' /usr/local/include/unix.h:238: parse error before `*' /usr/local/include/unix.h:239: parse error before `*' /usr/local/include/unix.h:240: parse error before `*' /usr/local/include/unix.h:242: parse error before `*' /usr/local/include/unix.h:243: parse error before `*' /usr/local/include/unix.h:247: parse error before `*' /usr/local/include/unix.h:249: parse error before `*' /usr/local/include/unix.h:250: parse error before `*' /usr/local/include/unix.h:254: parse error before `*' /usr/local/include/unix.h:256: parse error before `MAILSTREAM' make[1]: *** [zend_language_parser.lo] Error 1 make[1]: Leaving directory `/usr/local/src/php-4.1.1/Zend' make: *** [all-recursive] Error 1

    Can anyone help me????? I try move some .h files to another dir but doesnt work!!

    Tnx!

    Best Regards,

    PH

    attached mail follows:


    > -----Original Message----- > From: David D [mailto:ddasi.fr] > Sent: 13 July 2002 16:38 > > I can manage this script to work. > Js warn about listid[], he doesnt like [] in a var name ! > Php needs them to collect an array from form checkboxes. > > > <form name=test action=check.php> > > <input type=button value="partout" > onClick="this.value=check(this.form.listid[])"><br>

    use this.form['listid[]']

    It seems to be a very little known fact that, by definition, the JavaScript construct

    x.y

    is identical to

    x['y']

    so an extended accessor such as

    w.x.y.z

    could also be written equally validly in any of the following ways:

    w.x.y['z'] w.x['y'].z w['x'].y.z w['x'].y['z'] w['x']['y'].z

    and several other similar combinations!

    (And, yes, that means that this['form']['listid[]'] should be valid, too!)

    Cheers!

    Mike

    --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.fordlmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

    attached mail follows:


    Hi, I have an array of elements which are separated with the operator comma(,).

    ================================================== $array = implode(",", $checkb);

    echo $array.'\n';

    $result = mysql_query("DELETE FROM temp WHERE inv_tag IN ($array)") or die('Error in query'.mysql_error()); ====================================================

    PTX526_P_1,SIM_1

    Error in query Unknown column 'PTX526_P_1' in 'where clause'.

    Thanks and Regards Balaji


    attached mail follows:


    On Tuesday 16 July 2002 22:40, Balaji Ankem wrote: > Hi, > I have an array of elements which are separated with the operator > comma(,). > > ================================================== > $array = implode(",", $checkb); > > echo $array.'\n'; > > $result = mysql_query("DELETE FROM temp WHERE inv_tag IN > ($array)") or die('Error in query'.mysql_error()); > ==================================================== > > > PTX526_P_1,SIM_1 > > Error in query Unknown column 'PTX526_P_1' in 'where clause'.

    Well I can't see what this has to do with PHP let alone the implode() function.

    The error quite clearly says "unknown column ..."

    The proper use of IN requires that string values must be enclosed in either single-quotes or double-quotes. Thus you need to make $array look like:

    'PTX526_P_1','SIM_1' or "PTX526_P_1","SIM_1"

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

    /* It is the wisdom of crocodiles, that shed tears when they would devour. -- Francis Bacon */

    attached mail follows:


    Hi Jason, How to make $array look like 'PTX526_P_1','SIM_1' or "PTX526_P_1","SIM_1".

    Thanks and Regards Balaji

    -----Original Message----- From: Jason Wong [mailto:php-generalgremlins.com.hk] Sent: Tuesday, July 16, 2002 8:22 PM To: php-generallists.php.net Subject: Re: [PHP] Problem with implode() function

    On Tuesday 16 July 2002 22:40, Balaji Ankem wrote: > Hi, > I have an array of elements which are separated with the operator > comma(,). > > ================================================== > $array = implode(",", $checkb); > > echo $array.'\n'; > > $result = mysql_query("DELETE FROM temp WHERE inv_tag IN > ($array)") or die('Error in query'.mysql_error()); > ==================================================== > > > PTX526_P_1,SIM_1 > > Error in query Unknown column 'PTX526_P_1' in 'where clause'.

    Well I can't see what this has to do with PHP let alone the implode() function.

    The error quite clearly says "unknown column ..."

    The proper use of IN requires that string values must be enclosed in either single-quotes or double-quotes. Thus you need to make $array look like:

    'PTX526_P_1','SIM_1' or "PTX526_P_1","SIM_1"

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

    /* It is the wisdom of crocodiles, that shed tears when they would devour. -- Francis Bacon */

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


    attached mail follows:


    > I have an array of elements which are separated with the operator > comma(,). > > ================================================== > $array = implode(",", $checkb); > > echo $array.'\n'; > > $result = mysql_query("DELETE FROM temp WHERE inv_tag IN > ($array)") or die('Error in query'.mysql_error()); > ==================================================== > > > PTX526_P_1,SIM_1 > > Error in query Unknown column 'PTX526_P_1' in 'where clause'. >

    Use quotes around string..otherwise MySQL things your telling it a column name.

    $array = "'" . implode("','",$checkb) . "'";

    ---John Holmes...

    attached mail follows:


    Wait, you mean IE sends the full uri (including the anchor #JumpHere) as a GET request? Anchor is interpreted on the client side, this means browser reads trought the document looking for anchor of that name. You cannot get it on server, maybe somehow with javascript.

    Marek

    Martin Thoma wrote:

    >Oh, it seems, that only Netscape 4 is doing this wrong... > > > > >

    attached mail follows:


    I have newbie question.

    I am building a search page that will return any number of records and want to display only 30 at a time say. Then have one of though "Page 1 of 3 [1] [2] [3] Next>" on top of the record list.

    What is the best way to do this.

    I was looking at using the LIMIT feature in MySQL, but the MySQL manual said that if you use ORDER BY with LIMIT in the same SELECT it does the LIMIT before the ORDER BY. Therefore it does the limit then orders the limit list only, not order the entire list then returns the limit from that. Is this true? -OR- This it better to retrieve the entire record list, then jump to a starting position. Say on Page 2 start displaying at record 31.

    If I use the second method, is there a PHP/MySQL function of move to a certain record.

    I know there is probably many different solution to this problem, but what are some of them. I was going to use my last option but if I have a 1000+ records loading each time the performance may be slow.

    Thanks, Mark.

    --
    _________________________________________
    Mark McCulligh, Application Developer / Analyst
    Sykes Canada Corporation www.SykesCanada.com
    mmcculliSykesCanada.com
    

    attached mail follows:


    On 16 Jul 2002 at 10:51, Mark McCulligh wrote:

    > I have newbie question. > > I am building a search page that will return any number of records and > want to display only 30 at a time say. Then have one of though "Page > 1 of 3 [1] [2] [3] Next>" on top of the record list. > > What is the best way to do this. > > I was looking at using the LIMIT feature in MySQL, but the MySQL > manual said that if you use ORDER BY with LIMIT in the same SELECT it > does the LIMIT before the ORDER BY. Therefore it does the limit then > orders the limit list only, not order the entire list then returns the > limit from that. Is this true? -OR- This it better to retrieve the > entire record list, then jump to a starting position. Say on Page 2 > start displaying at record 31. > > If I use the second method, is there a PHP/MySQL function of move to a > certain record. > > I know there is probably many different solution to this problem, but > what are some of them. I was going to use my last option but if I > have a 1000+ records loading each time the performance may be slow.

    As common as this is I should have some template for it at least ... I did try that once. Here is an example I recently used. It's in Perl but since it's primarily SQL it's still a good example I reckon.

    (note, thank god, in Perl we don't have to quote literals in a hash, I hate doing that)

    if($input{next}) { $sql = qq|SELECT * FROM images WHERE location = ? AND image_id < $input{next} ORDER BY born DESC LIMIT $input{spread}|; }elsif($input{previous}) { $sql = qq|SELECT * FROM images WHERE location = ? AND image_id > $input{previous} ORDER BY born LIMIT $input{spread}|; } else { $sql = qq|SELECT * FROM images WHERE location = ? ORDER BY born DESC LIMIT $input{spread}|;# }

    Explanation:

    SELECT * FROM images WHERE location = ? AND image_id < $input{next} ORDER BY born DESC LIMIT $input{spread}

    $input{next} is the ($input{spread} + current position) so if my spread is 5 I will have

    1-5 6-10 11-15 and $input{next} will always be 10,15,20, etc.

    Now from here:

    http://www.mysql.com/doc/L/I/LIMIT_optimisation.html

    > If you use LIMIT # with ORDER BY, MySQL will end the sorting as soon > as it has found the first # lines instead of sorting the whole table.

    Umm ... my system worked. I don't think though that the above line indicates it would. You can see the snippets I show from above here:

    http://www.memphisart.com/superframes/index.cgi

    I set the spread to 2 so you can see it working and I uploaded a few images. The guy who wanted that wanted to sort by last in first up.

    There are probably many more ways of doing this. Hope we see some more responses. I never thought to use the LIMT X,Y option. I will test that later.

    Peter

    attached mail follows:


    I have an interesting question. I am working on a system that I need to run two commands in the shell, but when I use passthru() on the first command then run the second command to get the results from the first command, it doesn't work. Is there any way I can run 2 shell commands in the same execution space so that I can get the results from the first becaus eI think it is running them separately so when I try to pull the results, it has no results to pull. Does this make sense? any suggestions? Thanks, Matt Babineau MCWD / CCFD ----------------------------------------- e: <mailto:mattcriticalcode.com> mattcriticalcode.com p: 603.943.4237 w: <http://www.criticalcode.com/> http://www.criticalcode.com PO BOX 601 Manchester, NH 03105

    attached mail follows:


    Date: Tue, 16 Jul 2002 10:56:35 -0400 From: Analysis & Solutions <danielcanalysisandsolutions.com> To: PHP List <php-generallists.php.net> Message-ID: <20020716145635.GA7524panix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [PHP] Sorting getmxrr()

    Hi Chris:

    On Tue, Jul 16, 2002 at 04:59:33AM +0200, Chris Knipe wrote: > > How can I manage to sort $DomainMX from the lowest $Weight to the highest, > while still preserving the proper $Weight to the $DomainMX?

    While I don't have experience with that function, have you taken a look at the various array sorting functions? They, along with all the other array functions, are listed in the manual at http://www.php.net/manual/en/ref.array.php

    --Dan

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

    attached mail follows:


    hi,

    does anyone know of a yahoo-groups style web-based front end to Majorodomo using PHP?

    cheers, jaxon

    attached mail follows:


    I am trying to do a simple fopen("http://www.weather.com/index.html", "r"); For some reason I cannot Open any URL's after trying several.

    I get the following error

    Warning: stat failed for Resource id #1 (errno=2 - No such file or directory) I checked my php.ini to make sure I set the fopen wrappers and they are set.

    Any help would be appreciated.

    Ryan Conover Rconoveramericanbridge.net rscst25pitt.edu http://www.pitt.edu/~rscst25/

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

    attached mail follows:


    Hello,

    How do i make a page which isn't cached for konqueror/opera browers?

    Now i have:

    $now = gmdate('D, d M Y H:i:s') . ' GMT'; header('Expires: ' . $now); header('Last-Modified: ' . $now); header('Cache-Control: no-store, no-cache, must-revalidate,pre-check=0, post-check=0, max-age=0'); header('Pragma: no-cache'); header('Content-Type: text/html; charset=iso-8859-1');

    works fine for IE and NS, but doesn't for konqueror/opera. Who knows how to fix this, thanks!

    Bas

    attached mail follows:


    Hello,

    I m trying to make a php command line script, and I m looking for a function that can stop the script until a key is pressed.

    I modify some args when these are incorrect and put default values, I d like the user to be informed of that when launching the scripts.

    For the moment I make a sleep(5);

    I have php 4.06 w32.

    Thanks.

    attached mail follows:


    On Tue, Apr 16, 2002 at 05:34:57PM +0200, David D wrote: > > I m trying to make a php command line script, and I m looking for a function > that can stop the script until a key is pressed.

    I don't believe PHP can do this.

    Perl has Term::ReadLine.

    Your computer's clock says it's April. Might I suggest updating it to July? Or are you transmitting from a foreign planet?

    --Dan

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

    attached mail follows:


    Since ' is a string delimiter in MySQL it has to be escaped. Try using mysql_escape_string($string) (http://se.php.net/manual/en/function.mysql-escape-string.php) on all the strings before you try to insert them into MySQL.

    /lasso (lassolassoweb.nu)

    Anil Garg wrote: > Hi, > I am making a faq maintenance system using mysql and php. > To insert a entry in to a faq table i am using the following query: > --------- > INSERT INTO faq_table_netvd (id,question, > answer,netvcr,netdetector,add_date,mod_date,keyword,category,display,attach_ > id) > VALUES ('0','$frm[question]', > '$frm[answer]','$frm[netvcr]','$frm[netdetector]','$frm[add_date]','$frm[mod > _date]','$frm[keyword]','$frm[category]','$frm[display]','$frm[attach_id]') > "); > ----------- > now the problem is when $frm[question] has some string like: "why i can't > eat". > i get the following error: > MySQL Error: You have an error in your SQL syntax near 't eat?' ,answer = > 'Please recheck the power of your specs:)' ' at line 3.Putting a '\' before > ' (e.g. \')solves my problem...but when i open the same quesion to edit it, > again i have to put backslashes where ever i find " ' " in the quesion or > answer. > > Can anyone please suggest a solution to this. > > thanx and regards > > anil > > [please ask if i havent explained the problem fully] > >

    attached mail follows:


    Hello,

    I ve got mysql 4.0.1 I don't understand what happen. I use to make replace other than insert in order to avoid error in php scripts.

    I have a table with on primary key :

    CREATE TABLE `nlconfig` ( `id` tinyint(4) NOT NULL auto_increment, `nomnews` varchar(255) NOT NULL default '', `hebergeur` varchar(255) NOT NULL default '', `fromc` varchar(255) NOT NULL default 'contacttest.fr', `fromonline` varchar(255) NOT NULL default 'contact', `limitconf` tinyint(2) NOT NULL default '7', `host` varchar(255) NOT NULL default 'localhost', `user` varchar(255) NOT NULL default 'root', `passwd` varchar(255) NOT NULL default '', `db` varchar(255) NOT NULL default 'newsfr', `tablenews` varchar(255) NOT NULL default 'news', `tabletemp` varchar(255) NOT NULL default 'temp', `tablelog` varchar(255) NOT NULL default 'log', `tableconfig` varchar(255) NOT NULL default 'nlconfig', `admin_pass` varchar(255) NOT NULL default 'pikatchu', `limitlog` tinyint(2) NOT NULL default '10', `url` varchar(255) NOT NULL default '', `pathtopmn` varchar(255) NOT NULL default 'http://www.test.fr/fr/', `langfile` varchar(255) NOT NULL default 'lang-french.php', `welcome_subj` varchar(255) NOT NULL default 'bienvenue', `welcome_msg` text NOT NULL, `sub_msg` text NOT NULL, `pied` tinytext NOT NULL, `validation` tinyint(1) NOT NULL default '1', `description` text, `newstemplate` varchar(100) default NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM;

    When inserting with mysqlfront windows client :

    replace into nlconfig values (last_insert_id(),'abc', 'nexen', 'a', 'a', '', 'localhost', 'root' , '', 'newsfr', 'news', 'temp', 'log', 'nlconfig', 'lucas', '', '', 'http://www.test.fr/fr/', 'lang-french.php', '','','','', '1','','' );

    1st on row affected 2nd 2rows.

    I get no error. But from a php 4.06 script I get : errno 1062: erromsg : Duplicata du champ '127' pour la clef 1 That means : duplicate value for key 1.

    I didnt have the same result from a php script ?

    That the same error i get with NULL in the id with the windows client ?!

    Could you explain me what happen ?

    I only want to insert a new row when values are different from what is on the table, and to replace the row that there is when there is the same id or when all the data in query is the same ! Is it for that, that replace is for ?

    Thanks.

    attached mail follows:


    If you only want to update the row if it exists, then you need to use a WHERE clause to make sure it does exist.

    "Blah blah blah WHERE row_id='$id' LIMIT 1" might work. I'm lazy and didn't want to retype what you had. :o)

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "David D" <ddasi.fr> 04/16/02 11:57AM >>> Hello,

    I ve got mysql 4.0.1 I don't understand what happen. I use to make replace other than insert in order to avoid error in php scripts.

    I have a table with on primary key :

    CREATE TABLE `nlconfig` ( `id` tinyint(4) NOT NULL auto_increment, `nomnews` varchar(255) NOT NULL default '', `hebergeur` varchar(255) NOT NULL default '', `fromc` varchar(255) NOT NULL default 'contacttest.fr', `fromonline` varchar(255) NOT NULL default 'contact', `limitconf` tinyint(2) NOT NULL default '7', `host` varchar(255) NOT NULL default 'localhost', `user` varchar(255) NOT NULL default 'root', `passwd` varchar(255) NOT NULL default '', `db` varchar(255) NOT NULL default 'newsfr', `tablenews` varchar(255) NOT NULL default 'news', `tabletemp` varchar(255) NOT NULL default 'temp', `tablelog` varchar(255) NOT NULL default 'log', `tableconfig` varchar(255) NOT NULL default 'nlconfig', `admin_pass` varchar(255) NOT NULL default 'pikatchu', `limitlog` tinyint(2) NOT NULL default '10', `url` varchar(255) NOT NULL default '', `pathtopmn` varchar(255) NOT NULL default 'http://www.test.fr/fr/', `langfile` varchar(255) NOT NULL default 'lang-french.php', `welcome_subj` varchar(255) NOT NULL default 'bienvenue', `welcome_msg` text NOT NULL, `sub_msg` text NOT NULL, `pied` tinytext NOT NULL, `validation` tinyint(1) NOT NULL default '1', `description` text, `newstemplate` varchar(100) default NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM;

    When inserting with mysqlfront windows client :

    replace into nlconfig values (last_insert_id(),'abc', 'nexen', 'a', 'a', '', 'localhost', 'root' , '', 'newsfr', 'news', 'temp', 'log', 'nlconfig', 'lucas', '', '', 'http://www.test.fr/fr/', 'lang-french.php', '','','','', '1','','' );

    1st on row affected 2nd 2rows.

    I get no error. But from a php 4.06 script I get : errno 1062: erromsg : Duplicata du champ '127' pour la clef 1 That means : duplicate value for key 1.

    I didnt have the same result from a php script ?

    That the same error i get with NULL in the id with the windows client ?!

    Could you explain me what happen ?

    I only want to insert a new row when values are different from what is on the table, and to replace the row that there is when there is the same id or when all the data in query is the same ! Is it for that, that replace is for ?

    Thanks.

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

    attached mail follows:


    Hello, I am a novice on PHP and web programming. Can any one suggest me if I can use index.php in place of index.html? I really need to concern about security issue too.

    Thanks

    attached mail follows:


    He who calles himself "Sailom" (from <amorndetcolorado.edu>) wrote on 7/16/02 12:13 PM:

    > Hello, > I am a novice on PHP and web programming. Can any one suggest me if I can > use index.php in place of index.html? I really need to concern about > security issue too.

    Are you using Apache? If so, just edit your httpd.conf file. The line that reads DirectoryIndex index.html and change it. Mine reads: DirectoryIndex index.html index.shtml index.html.var index.php index.phtml If you're using IIS, I'm sure it's available somewhere in the configs...

    -- 
    Chris Garaffa
    #!/usr/local/lib/php
    $contact_info["Name"]   = "Chris Garaffa";
    $contact_info["Email"]  = "aquaxoptonline.net";
    $contact_info["Work"]   = "cgaraffacreativeaim.com";
    $contact_info["cell"]   = "203.803.9066";
    

    attached mail follows:


    Thank you so much. :)

    Sailom

    attached mail follows:


    Alternatively code a redirection page on the HTML page to redirect to the PHP page in 0 seconds... (Some simple online Code)...

    <META HTTP-EQUIV="REFRESH" CONTENT = "0; URL=http://www.mynewIndexPage.php"> if page is not redirected in 1 second click <a href="http://www.mynewIndexPage.php>HERE</a>

    "Sailom" <amorndetcolorado.edu> wrote in message news:20020716161327.18171.qmailpb1.pair.com... > Hello, > I am a novice on PHP and web programming. Can any one suggest me if I can > use index.php in place of index.html? I really need to concern about > security issue too. > > Thanks > >

    attached mail follows:


    I asked something similar a little while ago, but didn't do a good job clarifying.

    What I'm looking to do is when a user logs in, I start up the session.. I then have the registered session var to verify they are authenticated as they move throughout the site.

    Now, when they close the browser and come back, I want them to still be authenticated. Obviously, I have to set a cookie. But what do I set? Do I set just their user ID? The MD5 of their password? What's the most secure way, that's not easily spoofed? I don't know that much about cookies, but if I just use a user ID, couldn't someone just change that ID value and 'become' another user?

    Thanks for any advice, Chad

    attached mail follows:


    Anyone? Can someone at least point me to some web article for recommendations? I saw some examples where a password variable was stored, but is that really safe (as long as I MD5 it first?)

    Chad

    -----Original Message----- From: Chad Day [mailto:cdayatpco.com] Sent: Tuesday, July 16, 2002 12:30 PM To: php-generallists.php.net Subject: [PHP] Sessions / logins / cookies / security

    I asked something similar a little while ago, but didn't do a good job clarifying.

    What I'm looking to do is when a user logs in, I start up the session.. I then have the registered session var to verify they are authenticated as they move throughout the site.

    Now, when they close the browser and come back, I want them to still be authenticated. Obviously, I have to set a cookie. But what do I set? Do I set just their user ID? The MD5 of their password? What's the most secure way, that's not easily spoofed? I don't know that much about cookies, but if I just use a user ID, couldn't someone just change that ID value and 'become' another user?

    Thanks for any advice, Chad

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

    attached mail follows:


    > What I'm looking to do is when a user logs in, I start up the > session.. I > then have the registered session var to verify they are > authenticated as > they move throughout the site. > > Now, when they close the browser and come back, I want them > to still be authenticated.

    I don't think this can be a "secure" authentication. By relying on a cookie for the authentication, the computer is being authenticated, not the user. So anyone using the machine will be seen as "authenticated". Anyone who finds the cookie on a particular machine can place it on their own machine, then their machine becomes authenticated.

    If you need secure, real authentication, proof of the user's identity, the user has to be asked to login each visit, IMO. In theory, only they know their username and password.

    Am I understanding the goal?

    Kirk

    attached mail follows:


    There really isn't a good way to do this, I think.

    Any time you're taking just a cookie, and using that data to assume who the user is, it's open to hijacking. I can sniff the cookie or maybe find a cross-site scripting bug to steal it, create the same cookie on my machine, and poof, i'm that user.

    Now, if it's just for a forum, or something simple, then just do it. It's not worth worrying about someone hijacking my forum user.

    Anyway, the best way to create the unique id is to use uniqid() in combo with md5(). That'll give you a 32 character string that's hard to predict and isn't based on any of the user data.

    www.php.net/uniqid

    ---John Holmes...

    ----- Original Message ----- From: "Chad Day" <cdayatpco.com> To: <php-generallists.php.net> Sent: Tuesday, July 16, 2002 3:30 PM Subject: RE: [PHP] Sessions / logins / cookies / security

    > Anyone? Can someone at least point me to some web article for > recommendations? I saw some examples where a password variable was stored, > but is that really safe (as long as I MD5 it first?) > > Chad > > -----Original Message----- > From: Chad Day [mailto:cdayatpco.com] > Sent: Tuesday, July 16, 2002 12:30 PM > To: php-generallists.php.net > Subject: [PHP] Sessions / logins / cookies / security > > > I asked something similar a little while ago, but didn't do a good job > clarifying. > > What I'm looking to do is when a user logs in, I start up the session.. I > then have the registered session var to verify they are authenticated as > they move throughout the site. > > Now, when they close the browser and come back, I want them to still be > authenticated. Obviously, I have to set a cookie. But what do I set? Do I > set just their user ID? The MD5 of their password? What's the most secure > way, that's not easily spoofed? I don't know that much about cookies, but > if I just use a user ID, couldn't someone just change that ID value and > 'become' another user? > > Thanks for any advice, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Ok,

    So I'm creating a details.php page where I'm expecting the url to be something like:

    /details.php?id=12345

    Thus in my php I have the following:

    if (!isset($id)) { // if no id exsits

    // Create a page saying ID not found, goto index writeHTMLTag(); writeHeader("Error", "never"); writeBodyTag(); writeLogoNav(); echo "<h1>Error: A hospital ID was not found.</h1> <p>Goto: <a href=\"index.php\">Nursing Career Match</a> "; writeFooter(); writeHTMLTagCloser(); // what command can I use to end the script right here? } else { // Run MySQL stuff and display page }

    My question is "what command can I use to end the script [inside the top part of that if statement]?"

    ~ Mike

    -- 
    Mike Zornek | Project Leader
    Apple Student Developers
    The Insanely Great Site with the Insanely Long URL
    http://www.applestudentdevelopers.org
    

    Personal Site: http://www.mikezornek.com

    attached mail follows:


    exit;

    =)

    Adam Voigt adam.voigtcryptocomm.com

    On Tue, 2002-07-16 at 13:08, Michael Zornek wrote: > Ok, > > So I'm creating a details.php page where I'm expecting the url to be > something like: > > /details.php?id=12345 > > Thus in my php I have the following: > > if (!isset($id)) > { // if no id exsits > > // Create a page saying ID not found, goto index > writeHTMLTag(); > writeHeader("Error", "never"); > writeBodyTag(); > writeLogoNav(); > > echo "<h1>Error: A hospital ID was not found.</h1> > <p>Goto: <a href=\"index.php\">Nursing Career Match</a> > "; > > writeFooter(); > writeHTMLTagCloser(); > > // what command can I use to end the script right here? > } > else > { // Run MySQL stuff and display page > > } > > My question is "what command can I use to end the script [inside the top > part of that if statement]?" > > ~ Mike > -- > Mike Zornek | Project Leader > Apple Student Developers > The Insanely Great Site with the Insanely Long URL > http://www.applestudentdevelopers.org > > Personal Site: > http://www.mikezornek.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    > So I'm creating a details.php page where I'm expecting the url to be > something like: > My question is "what command can I use to end the script [inside the > top part of that if statement]?"

    Ironically enough, exit();

    Chris

    attached mail follows:


    RTFM re: Exit and Continue.

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> Michael Zornek <mikezornekmikezornek.com> 07/16/02 01:08PM >>> Ok,

    So I'm creating a details.php page where I'm expecting the url to be something like:

    /details.php?id=12345

    Thus in my php I have the following:

    if (!isset($id)) { // if no id exsits

    // Create a page saying ID not found, goto index writeHTMLTag(); writeHeader("Error", "never"); writeBodyTag(); writeLogoNav(); echo "<h1>Error: A hospital ID was not found.</h1> <p>Goto: <a href=\"index.php\">Nursing Career Match</a> "; writeFooter(); writeHTMLTagCloser(); // what command can I use to end the script right here? } else { // Run MySQL stuff and display page }

    My question is "what command can I use to end the script [inside the top part of that if statement]?"

    ~ Mike

    -- 
    Mike Zornek | Project Leader
    Apple Student Developers
    The Insanely Great Site with the Insanely Long URL
    http://www.applestudentdevelopers.org 
    

    Personal Site: http://www.mikezornek.com

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

    attached mail follows:


    Why do you need to exit? If your code is layed out correctly, you shouldn't have to.

    if($something) { //part 1 } else { //part 2 }

    If $something evaluates to true, only Part 1 is executed...part 2 is never seen. vice versa if $something is negative.

    ---John Holmes...

    ----- Original Message ----- From: "Michael Zornek" <mikezornekmikezornek.com> To: <php-generallists.php.net> Sent: Tuesday, July 16, 2002 1:08 PM Subject: [PHP] Exit script early

    > Ok, > > So I'm creating a details.php page where I'm expecting the url to be > something like: > > /details.php?id=12345 > > Thus in my php I have the following: > > if (!isset($id)) > { // if no id exsits > > // Create a page saying ID not found, goto index > writeHTMLTag(); > writeHeader("Error", "never"); > writeBodyTag(); > writeLogoNav(); > > echo "<h1>Error: A hospital ID was not found.</h1> > <p>Goto: <a href=\"index.php\">Nursing Career Match</a> > "; > > writeFooter(); > writeHTMLTagCloser(); > > // what command can I use to end the script right here? > } > else > { // Run MySQL stuff and display page > > } > > My question is "what command can I use to end the script [inside the top > part of that if statement]?" > > ~ Mike > -- > Mike Zornek | Project Leader > Apple Student Developers > The Insanely Great Site with the Insanely Long URL > http://www.applestudentdevelopers.org > > Personal Site: > http://www.mikezornek.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Is this possible:

    Im making a bot in PHP and i need a timer. Lets say noone ses anything for 2mins in the channel after that the bot ses something. And if the bot recieves an msg the timer clears. Is this possible 2 be done?

    Thomas "omega" Henning

    attached mail follows:


    Store a timestamp in a file. When the bot is activated retrieve the old timestamp and calculate the difference between then and how. Store that value in another file or database. Update the file with a fresh timestamp. -Kevin

    ----- Original Message ----- From: "Thomas "omega" Henning" <tomimediasoft.ro> To: <php-generallists.php.net> Sent: Tuesday, July 16, 2002 11:22 AM Subject: [PHP] Timer

    > Is this possible: > > Im making a bot in PHP and i need a timer. Lets say noone ses anything for > 2mins in the channel after that the bot ses something. And if the bot > recieves an msg the timer clears. Is this possible 2 be done? > > Thomas "omega" Henning > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    How i know when 2 mins ellapsed? "Kevin Stone" <kevinhelpelf.com> wrote in message news:013f01c22cee$b3e17110$6501a8c0kevin... > Store a timestamp in a file. When the bot is activated retrieve the old > timestamp and calculate the difference between then and how. Store that > value in another file or database. Update the file with a fresh timestamp. > -Kevin > > ----- Original Message ----- > From: "Thomas "omega" Henning" <tomimediasoft.ro> > To: <php-generallists.php.net> > Sent: Tuesday, July 16, 2002 11:22 AM > Subject: [PHP] Timer > > > > Is this possible: > > > > Im making a bot in PHP and i need a timer. Lets say noone ses anything for > > 2mins in the channel after that the bot ses something. And if the bot > > recieves an msg the timer clears. Is this possible 2 be done? > > > > Thomas "omega" Henning > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Just out of curiosity, before I get elbows-deep in this, has anyone does this already, before I start rewriting the wheel? Using PHP to POST a file and a few variables to another server's catcher script that is.

    > > fputs($fp, "Content-Type: multipart/form-data; boundary=AaB03x\n"); > > fputs($fp, "--AaB03x\n");

    > That looks quite reasonable

    Thanks Richard.

    Reasonable. I'll take that. It's better than "WHAT ARE YOU SMOKING YOU FREAKING MORON?"

    > EXCEPT: > > It's *POSSIBLE* that "Aa03x" will be *IN* the document...

    Well yes, the only reason I happened to use that particular sentinel was that I cut-n-pasted the header information. But you're right, a longer, more complex sentinel would help.

    > $myfile = file('/full/path/to/myFile.xml') or die("Could not open > myFile.xml"); > $myfile = implode('', $myfile); > $boundary = md5(uniqid('')); > # Hey, the odds are one in a zillion, but why not? > while (strstr($myfile, $boundary)){ > $boundary = md5(uniqid('')); > }

    Ok, had to look that one up :)

    uniqid is a new one on me. I've been naming files according to the session id to prevent overwrites.

    > And I think you need a different boundary for *EACH* part of > the multipart stuff... But maybe that's just me thinking > wrongly...

    If I understand HTTP 1.0, and I probably don't, you only need to use seperate identifiers if you're appending more than one file, then you need a new identifier to delineate the parts of the "FILES" section.

    <HTTP Headers> <boundary> <variables> <boundary> <file header> <boundary 2> <file 1> <boundary 2> <file 2> <boundary>

    Not 100% accurate because I just wrote that off the top of my head, but that's pretty much how I understand it. Anyone who knows better is free to slap me with a trout.

    > Other than that, I'm guessing that you *MIGHT* need to > somehow "escape" the contents of the data...

    I was thinking about that. I'm wondering if I can fake CRLF by sending the ASCII equivalents.

    > I dunno if browsers and web-servers expect that data to be > uuencoded, or base64 encoded

    Well, browsers don't matter, since this will all be entirely handled by the servers. But it's definitely something to consider while I'm dorking around.

    > But you're definitely on the right track, and you're down to > minutia at this point.

    Well, considering I didn't get pushed around by the big kids and have my lunch money taken, I'll assume that I'm not totally dum. I'm guessing what I should do now is write an upload script and try to simulate the pass and see how close I am.

    Still, I can't imagine I'm the first person trying to do a text file server-to-server POST. It'd be nice if I could find someone who's already done something like this. I've been Googling for it the last two days and have found several people on Usenet and the mailing lists asking about POSTing XML files to scripts, but nobody who said, "I did it, here's how it's done."

    Thanks again Richard.

    ~Steve-o

    attached mail follows:


    We all know this works:

    echo "<p>$someVar";

    However this does not:

    echo "<p>$db->field('name_long')";

    I know this slight variation will make it work:

    echo "<p>" . $db->field('name_long');

    But it's cumbersome .. Anyway to get the first way to work?

    ~ Mike

    -- 
    Mike Zornek | Project Leader
    Apple Student Developers
    The Insanely Great Site with the Insanely Long URL
    http://www.applestudentdevelopers.org
    

    Personal Site: http://www.mikezornek.com

    attached mail follows:


    Try enclosing it in curly braces.

    echo "<p>${db->field('name_long')}";

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> Michael Zornek <mikezornekmikezornek.com> 07/16/02 01:45PM >>> We all know this works:

    echo "<p>$someVar";

    However this does not:

    echo "<p>$db->field('name_long')";

    I know this slight variation will make it work:

    echo "<p>" . $db->field('name_long');

    But it's cumbersome .. Anyway to get the first way to work?

    ~ Mike

    -- 
    Mike Zornek | Project Leader
    Apple Student Developers
    The Insanely Great Site with the Insanely Long URL
    http://www.applestudentdevelopers.org 
    

    Personal Site: http://www.mikezornek.com

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

    attached mail follows:


    Twas 7/16/02 1:47 PM, when "Martin Clifford" <MLC1nrc.gov> said:

    > Try enclosing it in curly braces. > > echo "<p>${db->field('name_long')}";

    Parse error :-(

    ~ Mike

    -- 
    Mike Zornek | Project Leader
    Apple Student Developers
    The Insanely Great Site with the Insanely Long URL
    http://www.applestudentdevelopers.org
    

    Personal Site: http://www.mikezornek.com

    attached mail follows:


    ðÒÉ×ÅÔ!

    Michael Zornek wrote: > We all know this works: > > echo "<p>$someVar"; > > However this does not: > > echo "<p>$db->field('name_long')"; > > I know this slight variation will make it work: > > echo "<p>" . $db->field('name_long'); > > But it's cumbersome .. Anyway to get the first way to work? > > ~ Mike

    In your example you try and execute a "method" within a quoted string. That would not work even with a traditional function call, AFAIK.

    ðÏËÁ áÌØÂÅÒÔÏ ëÉÅ×

    -_=}{=_--_=}{=_--_=}{=_--_=}{=_--_=}{=_--_=}{=_--_=}{=_-

    LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is.......

    attached mail follows:


    Is there a standard method in PHP for preventing multiple people from using the same log-in username/password simultaneously on a membership site? Any suggestions are greatly appreciated.

    Thanks!

    Monty

    attached mail follows:


    [snip] Is there a standard method in PHP for preventing multiple people from using the same log-in username/password simultaneously on a membership site? Any suggestions are greatly appreciated. [/snip]

    One way is to set a non-expiring cookie, which works if they don't delete cookies from time-to-time.

    HTH!

    Jay

    "Growing old is mandatory, growing up is optional"

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

    attached mail follows:


    create cookie and at the end of the Script/page destroy cookies Use if statements: setcookie('cookie', $value, $expire, $path $domain); if(isset($cookie)) echo "Access Denied, Multiple Login Attempted!"; else run the page/script

    or

    Stick an fetch I.P Stick it in String array, if duplicate exist die... else run script.... "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:001401c22cf2$db192080$8102a8c0niigziuo4ohhdt... > [snip] > Is there a standard method in PHP for preventing multiple people from using > the same log-in username/password simultaneously on a membership site? Any > suggestions are greatly appreciated. > [/snip] > > One way is to set a non-expiring cookie, which works if they don't delete > cookies from time-to-time. > > HTH! > > Jay > > "Growing old is mandatory, growing up is optional" > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

    attached mail follows:


    You'll have to assign each user a unique id each time they log on. If they attempt to log on again, check and see if they already have a unique id and if they do, don't let them log on again.

    the problems you'll run into with this is, though, is that if someone doesn't log out, they'll still have a session and will have to wait for your cron job to clear it out... It goes back to the old question of how do you know if someone is really online. what if they are viewing a page, accidently close the browser, and then try to log in again. your script will probably think it's someone else trying to log on...

    Not sure if there is a truly effective way to do this...

    ---John Holmes...

    ----- Original Message ----- From: "Monty" <monty3hotmail.com> To: <php-generallists.php.net> Sent: Tuesday, July 16, 2002 1:57 PM Subject: [PHP] Preventing Multiple Log-Ins after Authentication

    > Is there a standard method in PHP for preventing multiple people from using > the same log-in username/password simultaneously on a membership site? Any > suggestions are greatly appreciated. > > Thanks! > > Monty > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    If you do not want to use cookes and use SID or trans SID; Another method is to track your logins via a database. This can be resource intensive though. You need to update the database upon each click or have an empty window refresh every 1-5 minutes. If there is no activity for 15 or 30 minutes automatically log the person off in the database. This requires a process to run in cron or a separate background program. The advantage of this is that is very easy to add time based accounting to the session management system.

    ----- Original Message ----- From: "Monty" <monty3hotmail.com> To: <php-generallists.php.net> Sent: Tuesday, July 16, 2002 1:57 PM Subject: [PHP] Preventing Multiple Log-Ins after Authentication

    > Is there a standard method in PHP for preventing multiple people from using > the same log-in username/password simultaneously on a membership site? Any > suggestions are greatly appreciated. > > Thanks! > > Monty > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    I forgot to mention that you can use Javascript to manage the open windows. We the user closes the main window, you can direct the empty window to log the user out and close its window as well.

    ----- Original Message ----- From: "Dennis Moore" <dmooreravens-nest.com> To: <php-generallists.php.net>; "Monty" <monty3hotmail.com> Sent: Tuesday, July 16, 2002 3:22 PM Subject: Re: [PHP] Preventing Multiple Log-Ins after Authentication

    > If you do not want to use cookes and use SID or trans SID; Another method is > to track your logins via a database. This can be resource intensive > though. You need to update the database upon each click or have an empty > window refresh every 1-5 minutes. If there is no activity for 15 or 30 > minutes automatically log the person off in the database. This requires a > process to run in cron or a separate background program. The advantage of > this is that is very easy to add time based accounting to the session > management system. > > > ----- Original Message ----- > From: "Monty" <monty3hotmail.com> > To: <php-generallists.php.net> > Sent: Tuesday, July 16, 2002 1:57 PM > Subject: [PHP] Preventing Multiple Log-Ins after Authentication > > > > Is there a standard method in PHP for preventing multiple people from > using > > the same log-in username/password simultaneously on a membership site? Any > > suggestions are greatly appreciated. > > > > Thanks! > > > > Monty > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    In Perl you could print a block of information as it was written like this; print <<HTML_END;

    This a whole bunch of HTML code!!!

    HTML_END

    The best part about this, was that you did not have to escape your " and you could mix in your variables making it easy to design and layout the HTML. Is there a similiar way to do this in PHP?

    attached mail follows:


    Good day,

    > In Perl you could print a block of information as it was > written like this; > print <<HTML_END; > > This a whole bunch of HTML code!!! > > HTML_END > > The best part about this, was that you did not have to escape > your " and you > could mix in your variables making it easy to design and > layout the HTML. Is > there a similiar way to do this in PHP?

    Yeppers. It's aaaalmost the same.

    echo <<<MULTILINE

    ...

    MULTILINE;

    ============================ Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948

    attached mail follows:


    [snip] In Perl you could print a block of information as it was written like this; print <<HTML_END;

    This a whole bunch of HTML code!!!

    HTML_END

    The best part about this, was that you did not have to escape your " and you could mix in your variables making it easy to design and layout the HTML. Is there a similiar way to do this in PHP? [/snip]

    $variable = <<< HERE

    all kinds of stuff

    HERE;

    print("$variable");

    HTH!

    Jay

    "Two wrongs are only the beginning"

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

    attached mail follows:


    It's called "here doc" formatting, and follows the pattern below:

    $chunk = <<< EOF; // stuff here EOF;

    Hmm. For some reason that just doesn't look right. I'm sure someone will correct it if I'm wrong though :o)

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Chris Crane" <ccraneinxdesign.com> 07/16/02 02:03PM >>> In Perl you could print a block of information as it was written like this; print <<HTML_END;

    This a whole bunch of HTML code!!!

    HTML_END

    The best part about this, was that you did not have to escape your " and you could mix in your variables making it easy to design and layout the HTML. Is there a similiar way to do this in PHP?

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

    attached mail follows:


    Ok so let me ask one last question...... Which it faster, to run my function and part of the function would be to get data from a website and break it into variables then make all the html and variables one new variable for printing

    or

    Get my data put into variables made global and then in my HTML page use tags like <?PHP print $CurrentAmount; ?>.

    The last one is easier to design with, but may slow things down each time it has to parse out the PHP tag, no?

    "Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message news:001a01c22cf3$ef2e01c0$8102a8c0niigziuo4ohhdt... > [snip] > In Perl you could print a block of information as it was written like this; > print <<HTML_END; > > This a whole bunch of HTML code!!! > > HTML_END > > The best part about this, was that you did not have to escape your " and you > could mix in your variables making it easy to design and layout the HTML. Is > there a similiar way to do this in PHP? > [/snip] > > $variable = <<< HERE > > all kinds of stuff > > HERE; > > print("$variable"); > > HTH! > > Jay > > "Two wrongs are only the beginning" > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > >

    attached mail follows:


    On Mon, 2002-07-15 at 18:30, Gerard Samuel wrote: > I dont think Apache 2 or php 4.3.x are meant for production boxes.. > My opinion, the latest verion of apache 1.3.x and php 4.1.2 (my test > box > is 4.2.1 but thats ok)

    Apache2 is meant for production. Php 4.2.1 is meant for production.

    With most distros, this should not be a problem whatsoever, but people using gcc3 may have no luck until they use php 4.3. This has been my experience with it to date.

    > Michael Hall wrote: > > >I've had a hunt through the mail archives but can't find a definite > >answer: > > > >Is Apache 2.0.x and PHP 4.2.x/4.3.x on Linux a viable proposition yet > in a > >production environment? > > > >I guess the diversity of experiences described in the archives > probably > >means no, but what is the current opinion? Some of the archive > messages > >I read are quite old now. > > > > > >-------------------------------- > >Michael Hall nintininti.com > >-------------------------------- > > > > > > > > > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    -- 
    Austin Gonyou <austincoremetrics.com>
    Coremetrics, Inc.
    

    -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org

    iD8DBQA9NGfV94g6ZVmFMoIRAiIHAKDAkhfLiRWMECnxE+Ro5qH6CzNH2wCfZG4S hQQ/L/wHV0iZlstowsHeKvc= =nEBx -----END PGP SIGNATURE-----

    attached mail follows:


    I have set output_buffering = On in my php.ini file, since I need this for my application.

    When the user logins I want to destroy any current session and start a new session. I have included the below in my code for the same. But for some reason all my old data is available in the session.

    session_start(); session_unset(); session_destroy();

    session_start(); session_register("somevariable");

    Can anyone figure out where I may be going wrong.

    Warm Regards, Divyank Turakhia ---------------------- http://www.directi.com ----------------------

    attached mail follows:


    You have to give the variable value before registering it, from my experience.

    $var = "123 Sesame Street"; session_register($var);

    Also, I don't believe you need to use session_unset(), since you are already destroying the session information. If you are getting errors, it would be helpful if you include those in your message so that we might be able to deduce the error from it's cryptic nature :o)

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Divyank Turakhia" <divyank.tdirecti.com> 07/16/02 02:46PM >>> I have set output_buffering = On in my php.ini file, since I need this for my application.

    When the user logins I want to destroy any current session and start a new session. I have included the below in my code for the same. But for some reason all my old data is available in the session.

    session_start(); session_unset(); session_destroy();

    session_start(); session_register("somevariable");

    Can anyone figure out where I may be going wrong.

    Warm Regards, Divyank Turakhia ---------------------- http://www.directi.com ----------------------

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

    attached mail follows:


    does anyone have a copy of the electronic version (free, i believe?) of the book "PHP Functions Essential Reference" ? the website http://www.php-er.com has been down and i am trying to locate it...

    cheers, jaxon

    attached mail follows:


    Does anybody know where I can get the libmcal dll's precompiled for win32?

    attached mail follows:


    From: "Onaje Johnston" <ojohnstonnyc.rr.com> To: "PHP List" <php-generallists.php.net> Date: Tue, 16 Jul 2002 16:25:25 -0400 Message-ID: <BAEJIGEEILHIOACLOPGKAEFOEBAA.ojohnstonnyc.rr.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: RE: [PHP] Re: Editing files by line

    -----Original Message----- >From: Analysis & Solutions

    >Without seeing the script, it'd be hard for us to say. So, post the >_relevant parts_ of the script to the list.

    Here's the code:

    <? // Saving edited data to the file // Data File : This file need to be writeable $file_name = "data.txt";

    // check to see if submit was pressed if ($insert && $linenumber) {

    // check existence of file $try = touch($file_name); if (!$try) { echo "<p>I'm sorry, but I couldn't open a file!"; exit; }

    $array = file($file_name);

    // this is the stuff we get from the form, we insert it into an array $input = array ($id, $name, $creator, $myreview, $prefix, $directory, $sort, $comments);

    // note that we add a \n (line break) to the end of the string. $output_line = implode ($input, "|")."\n";

    // Now open the file (get a file pointer) $output_stream = fopen($file_name, "w+");

    $counter = 0; foreach($array as $key => $line) { if($counter = $linenumber) { $line = $output_line; } $out[] = chop($line); $counter++; }

    foreach($out as $key => $line) { $resultuts($output_stream, $line."\n"); }

    // close the file pointer fclose($output_stream);

    // give feedback if ($result) { echo "<p>Data has been sucessfully added.\n"; echo "<a href=".$PHP_SELF."?line_num=".$linenumber.">View updated record</a>"; } else { echo "<p>Uhoh. . . the database didn't like that."; }

    }else{ // Viewing data from file in a form //to read the file use: $fp2= fopen("data.txt", "r");

    $line_cnt

    while ($servinfoets($fp2,1024)){

    if ($line_cnt = $line_num){ $right_line = $servinfo; list($id, $name, $creator, $myreview, $prefix, $directory, $sort, $comments)= explode("|",$right_line); break; } $line_cnt++; } fclose($fp2); ?> <Form name="" method="post" action="<?=$PHP_SELF?>"> <CENTER> <TABLE cellspacing="0" bgcolor="#FFCC99"> <TR bgcolor="#cc0000"><TD>Racestyle data settings</TD><TD>:)</TD></TR> <TR><TD align=right>Race ID:</TD> <TD><input type="text" name="id" size="50" maxlength="50" value="<? echo $id; ?>"></TD></TR> <TR><TD align=right height="28" nowrap>Racestyle Name:</TD> <TD height="28"><input type="text" name="name" size="50" maxlength="50" value="<? echo $name; ?>"></TD></TR> <TR><TD align=right>Creator:</TD> <TD><input type="text" name="creator" size="50" maxlength="50" value="<? echo $creator; ?>"></TD></TR> <TR><TD align=right valign="top">MyReview:</TD> <TD><input type="text" name="myreview" size="50" maxlength="400" value="<? echo $myreview; ?>"></TD></TR> <TR><TD align=right>Race Prefix</TD> <TD><input type="text" name="prefix" size="50" maxlength="50" value="<? echo $prefix; ?>"></TD></TR> <TR><TD align=right>Race Directory:</TD> <TD><input type="text" name="directory" size="50" maxlength="50" value="<? echo $directory; ?>"></TD></TR> <TR><TD align=right>Sort:</TD> <TD><select name="sort"> <option value="ship_names" <? if ($sort="ship_names") { print(" selected");} ?>>small case</option> <option value="ship_names_2L" <? if ($sort="ship_names_2L") print(" selected");} ?>>Upper Case</option> </select></TD></TR> <TR><TD align=right valign="top">Comments:</TD> <TD><input type="text" name="comments" size="50" maxlength="400" value="<? echo $comments; ?>"></TD></TR> </TABLE> </CENTER>

    <P align="center"> <input type="hidden" name="linenumber" value="<? if !isset($line_num)){ $line_num <input type=submit value ="Submit" name="insert"> <input type=reset value ="Reset"> </P> </FORM> <? } ?>

    The data.txt file has this format: 5|8|4|2|7|2|ship_names| 2|3|7|2|1|9|ship_names_2L|7 4|3|2|7|5|6|ship_names|3

    The default line_num is 0. The other entries - database3.php?line_num database3.php?line_numetc.

    attached mail follows:


    On Tue, Jul 16, 2002 at 04:25:25PM -0400, Onaje Johnston wrote: > > if ($insert && $linenumber) {

    But, if $linenumber is 0, this process won't happen. And, that was the complaint you mentioned up front.

    So, you should do an "isset($linenumber)" instead.

    --Dan

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

    attached mail follows:


    Forgive the long post here, but I'll give as much info up-front and see if anyone can help me out here...

    I've searched the PHP docs for some help, but I am still running into a strange problem. Let me explain: I'm working on an internal site that stores information into a database, but it can be retrieved at a later date. The data initially is entered over many pages ( ~10 forms), so I've used sessions to store that data across those pages so that if they decide to move out of order, their data is still there. Once they're done, they can save the data, etc... we've all heard this story.

    Now, on retrieval, I'm pulling all the information from the database and storing them in session variables, which all happen to be arrays. There is a lot of data to retrieved and put into variables. I have one PHP script perform all this and then re-direct the user to the start page. Unfortunately, the script isn't storing all the session variables, only the first 5 of 7 variable arrays.

    The page looks similar to this:

    <?php session_start(); require "include_file.inc"; mysql_pconnect(...); mysql_select_db(...);

    $result1 = mysql_fetch_object(mysql_query(...));

    $sess_var1[formVar1] = $result1->data_field; . session_register("sess_var1"); ...// (and so on)

    // and then the re-direct Header("Location:next_page.php"); ?>

    Unfortunately when I place the Header() call at the end of the file, it just sits there and doesn't re-direct. If I place it after session_start(), it will re-direct, but only the first five session variables are registered. Is there something I'm missing here or trying to do too much?

    - Greg

    attached mail follows:


    Well, perhaps stepping away from the problem for a few minutes actually helps clear the mind. Found that one of my mysql_query() statements wasn't completing and everything after that didn't finish. Once I fixed that, all the session variables work. Go fig. Let that be a lesson to me :-)

    Greg Macek wrote: > Forgive the long post here, but I'll give as much info up-front and see > if anyone can help me out here... > > I've searched the PHP docs for some help, but I am still running into a > strange problem. Let me explain: I'm working on an internal site that > stores information into a database, but it can be retrieved at a later > date. The data initially is entered over many pages ( ~10 forms), so > I've used sessions to store that data across those pages so that if they > decide to move out of order, their data is still there. Once they're > done, they can save the data, etc... we've all heard this story. > > Now, on retrieval, I'm pulling all the information from the database and > storing them in session variables, which all happen to be arrays. There > is a lot of data to retrieved and put into variables. I have one PHP > script perform all this and then re-direct the user to the start page. > Unfortunately, the script isn't storing all the session variables, only > the first 5 of 7 variable arrays. > > > The page looks similar to this: > > <?php > session_start(); > require "include_file.inc"; > mysql_pconnect(...); > mysql_select_db(...); > > $result1 = mysql_fetch_object(mysql_query(...)); > > $sess_var1[formVar1] = $result1->data_field; > . > session_register("sess_var1"); > ...// (and so on) > > // and then the re-direct > Header("Location:next_page.php"); > ?> > > Unfortunately when I place the Header() call at the end of the file, it > just sits there and doesn't re-direct. If I place it after > session_start(), it will re-direct, but only the first five session > variables are registered. Is there something I'm missing here or trying > to do too much? > > - Greg > >

    attached mail follows:


    Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy

    attached mail follows:


    Message-Id: <sd345149.022nrcgwia.nrc.gov> Date: Tue, 16 Jul 2002 17:00:54 -0400 From: "Martin Clifford" <MLC1nrc.gov> To: <mek2600charter.net>, <php-generallists.php.net>, <mek2600realitycodec.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP] Newbie Question on Efficiency

    Unless the file is getting retartedly big (10-20K), then I wouldn't = separate them. Though if you have enough functions, you could justify = making separate files for your database functions, output functions, = backend functions, etc.

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> mek2600realitycodec.net 07/16/02 04:59PM >>> Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. =20 Thanks in advance. Michael Kennedy

    attached mail follows:


    Yeah, that's what I was thinking. Mostly I was curious if the procedure I mentioned was a good one or if there was something better to be doing. Thanks for the super quick reply. :)

    Michael

    -----Original Message----- From: Martin Clifford [mailto:MLC1nrc.gov] Sent: Tuesday, July 16, 2002 4:01 PM To: mek2600charter.net; php-generallists.php.net; mek2600realitycodec.net Subject: Re: [PHP] Newbie Question on Efficiency

    Unless the file is getting retartedly big (10-20K), then I wouldn't separate them. Though if you have enough functions, you could justify making separate files for your database functions, output functions, backend functions, etc.

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> mek2600realitycodec.net 07/16/02 04:59PM >>> Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy

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

    attached mail follows:


    I'm pretty used to installing OpenSSL, Mod_SSL, Mcrypt, cURL, PHP and Apache with all of them in tar.gz files. Now I'm experiementing it on the Linux and mySQL. Never tried it on both Linux and mySQL before.

    The tricky part I found is that some come in RPM. I am familar with installing using RPM. But from my understanding, I would have to uninstall the existing RPM software. The tricky part is to knit together RPMs and tar.gz(s) for those software because they all depend on each other. For example in order of installation ....

    1) IBM DB2 (or mySQL) 2) Mcrypt 3) OpenSSL 2) cURL --> (depend on OpenSSL) 3) Mod_SSL --> (it depend on OpenSSL) 4) PHP --> (depend on Mod_SSL, cURL, OpenSSL, Mcrypt & DB2) 5) Apache --> 5th (it depend on Mod_SSL, OpenSSL, PHP)

    So, anyone know of good instruction on the website somewhere? It does not have to be a complete instruction or a perfect instruction. Just something that can give me some understanding before I start working it. Or should I just use all tar.gz files instead? Like forget about the RPM stuffs. The reason I'm posting this is becuase I realize that PHP can easily not work with some softwares if it is not installed correctly. You know!

    Thanks, FletchSOD