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 Jan 21 2003 - 12:52:46 CST

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

    php-general Digest 21 Jan 2003 18:52:46 -0000 Issue 1836

    Topics (messages 132357 through 132486):

    Re: Can php works as a scheduler?
            132357 by: Jason k Larson
            132358 by: John W. Holmes

    Re: Freshmeat question
            132359 by: Martin Thoma
            132382 by: David T-G

    How to make id/name table into array?
            132360 by: Daevid Vincent
            132362 by: John W. Holmes

    PHP Sessions
            132361 by: Tim Thorburn
            132363 by: Timothy Hitchens \(HiTCHO\)
            132364 by: Jason Wong
            132365 by: Foong
            132368 by: Tim Thorburn
            132370 by: Timothy Hitchens \(HiTCHO\)
            132371 by: Jason Wong
            132373 by: Tim Thorburn
            132376 by: John W. Holmes
            132377 by: Tim Thorburn
            132378 by: Jason Wong
            132379 by: Justin French
            132380 by: Ford, Mike [LSS]
            132381 by: Rich Gray

    Session Question
            132366 by: Sancar Saran

    DOWNLOAD
            132367 by: Shaun van den Berg
            132369 by: Timothy Hitchens \(HiTCHO\)
            132384 by: Timothy Hitchens \(HiTCHO\)
            132389 by: Rick Emery
            132455 by: Jim Lucas

    $header = "Location:........" being ignored!
            132372 by: Shams
            132374 by: Stain
            132375 by: Tom Rogers
            132385 by: Neil Freeman
            132424 by: Chris Shiflett

    serious problem with mbstring functions
            132383 by: Simon Dedeyne

    Re: Help with Error, I am Trying!!
            132386 by: Chris Hewitt

    Re: Select multiple boxes
            132387 by: Chris Hewitt

    ADV SQL Help Needed.
            132388 by: [-^-!-%-
            132392 by: Tim Ward
            132449 by: [-^-!-%-

    Help with e-mail
            132390 by: Dankshit
            132391 by: Jason Wong

    Adding a variable to oracle that contains quotation marks??
            132393 by: Rea_David.emc.com
            132394 by: Rick Emery
            132395 by: Henry
            132420 by: Rea_David.emc.com
            132443 by: Ford, Mike [LSS]

    Multi-Byte String Functions
            132396 by: Naqashzade, Sadeq

    changing a key in an array
            132397 by: David T-G
            132402 by: Jason k Larson
            132404 by: David T-G

    odbc..
            132398 by: Edward Peloke

    re-ordering keys in an array
            132399 by: David T-G
            132401 by: Jason k Larson
            132406 by: David T-G

    Form Validating Class (OOP misunderstandings...)
            132400 by: Nicholas Wieland
            132403 by: Rich Gray
            132409 by: Joseph W. Goff
            132458 by: Nicholas Wieland
            132459 by: . Nilaab
            132481 by: Nicholas Wieland

    Page Rendering
            132405 by: Bill Arbuckle, Jr.
            132411 by: Rick Emery
            132414 by: Jason Wong
            132417 by: David T-G
            132421 by: Chris Shiflett
            132467 by: Sean Burlington

    Input field array ends up as "Array" string
            132407 by: Dan Delaney
            132408 by: Rick Emery
            132413 by: Leon Mergen
            132416 by: Jason Wong
            132422 by: Jason Wong
            132434 by: Dan Delaney

    No data being found
            132410 by: Roddie Grant

    download script
            132412 by: Martin
            132418 by: Timothy Hitchens \(HiTCHO\)
            132469 by: Matt Vos

    str_replace an include
            132415 by: jesse
            132419 by: J Smith
            132423 by: Timothy Hitchens \(HiTCHO\)
            132426 by: jesse
            132428 by: Timothy Hitchens \(HiTCHO\)
            132444 by: jesse
            132447 by: Timothy Hitchens \(HiTCHO\)
            132448 by: jesse
            132483 by: Fernando Lemes

    dreading OOP
            132425 by: Larry Brown
            132429 by: Johnson, Kirk
            132430 by: Peter Hutnick
            132432 by: Chris Boget
            132453 by: Peter Hutnick
            132462 by: Larry Brown
            132470 by: Jay Paulson

    array_sum, multidimensional arrays?
            132427 by: Chad Day

    Newbie Questions
            132431 by: Bryan Cassidy
            132435 by: Neil Freeman
            132436 by: Edward Peloke
            132437 by: David T-G
            132442 by: Bryan Cassidy
            132450 by: [-^-!-%-

    Can't get HTTPS -- driving me mad -- please help
            132433 by: Jonathan Boles
            132440 by: Stephan Seidt
            132452 by: Jonathan Boles
            132454 by: Jonathan Boles
            132457 by: Stephan Seidt

    encrypt data with pgp
            132438 by: ermelir
            132439 by: ermelir
            132446 by: David T-G

    security question regarding including files..
            132441 by: Chad Day
            132445 by: Stephan Seidt
            132451 by: Chris Shiflett
            132468 by: Sean Burlington
            132475 by: Jason Wong
            132479 by: Sean Burlington
            132486 by: Chris Shiflett

    Finding out if a table exists
            132456 by: Mako Shark
            132474 by: Kevin Stone
            132476 by: John W. Holmes
            132478 by: Don Read

    Detecting resolution
            132460 by: Liam.Gibbs.dfait-maeci.gc.ca
            132472 by: Jay Paulson

    forking scripts
            132461 by: Senn
            132485 by: J Smith

    Detecting posts from outside site
            132463 by: Liam.Gibbs.dfait-maeci.gc.ca
            132471 by: Sean Burlington
            132484 by: Chris Shiflett

    build menu with mysql data
            132464 by: Marc Bleuler
            132465 by: Gibbs, Liam - SXIA
            132482 by: Edward Peloke

    Re:[PHP] dreading OOP
            132466 by: Sukrit
            132473 by: Larry Brown

    mysql_connect problem..update
            132477 by: Tom Ray
            132480 by: Tracy Finifter Rotton

    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:


    Unix/Linux use: cron (crontab)
    Windows use: at

    HTH,
    Jason k Larson

    Jack wrote:

    > Dear all
    > I built a page which will import data from csv files to database, i want
    > this task to be done automatically at the midnight of each date.
    >
    > so does anyone know if there is any function work as similar as
    > Scheduler in
    > php? so php will run the script at specific time!
    >
    > Thx a lot
    > Jack
    > jackchannedcor.com.hk

    attached mail follows:


    > I built a page which will import data from csv files to database, i
    want
    > this task to be done automatically at the midnight of each date.
    >
    > so does anyone know if there is any function work as similar as
    Scheduler
    > in
    > php? so php will run the script at specific time!

    You can do what you want, but the method is to use Scheduler to run a
    PHP script through php.exe or the php-cli.exe (command line interface)
    file.

    So, the program you'd type in for Scheduler to run would be something
    like:

    C:\php\php.exe -q c:\path\to\php\file.php

    -q will suppress the headers. Your file.php should not output anything,
    as it'll be a machine running it and no one can see the output anyhow.

    ---John W. Holmes...

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

    attached mail follows:


    > I am not new to programming, just to scripting languages. I have seen that Perl has some high advanced sintaxes for string processing, for example, but I don't know if the same level can also be achieved in PHP...?

    Sorry, I don't know that. I know that Perl has some regular-expressions, but php has this, too.

    > As for the script below, could I run it inside a (my) browser? This could be in any browser?

    Well, it depends ;-) Generally: Yes. But you have to let a web-browser (like apache) process the php-script.

    Martin

    attached mail follows:


    Deco --

    ...and then De deco said...
    %
    % I am not new to programming, just to scripting languages. I have seen that Perl has some high advanced sintaxes for string processing, for example, but I don't know if the same level can also be achieved in PHP...?

    PHP is quite perl-ish, and supports some extended functions borrowed
    straight from Perl.

    %
    % As for the script below, could I run it inside a (my) browser? This could be in any browser?

    A browser won't run a php script; in a web surfing context it's the
    server that runs it, just like a mod_perl script.

    Just like Perl, though, you can

      php /path/to/myscript.php

    from the command line (if you built php to not only install a web server
    module but also generate a standalone executable) and away you go. You
    might want to use -q to turn off the http header output.

    So the short answer is "no", but don't let it throw you.

    HTH & HAND

    :-D

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

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

    iD8DBQE+LSfEGb7uCXufRwARAr5VAKCE1wJivfaOJr3PZo/DFbpsf/L0CgCgxCF7 BHZDwQDaPd1+HjGasvIEMEo= =QvXv -----END PGP SIGNATURE-----

    attached mail follows:


    Is there a better way to do this in PHP? It seems that a single number (key) and single name (value) would lend itself perfectly to an (indexed or associative) array. I would think there is some PHP API call that I'm unaware of that will just take the whole result set and stuff it into an array for me no? If not, there should be. Perfect for things like ListBoxes, or table lookups so you don't have to hit the database constantly with joins et. al.

    $sql = "SELECT id, name FROM mytable ORDER BY id"; if ( !($result = mysql_query($sql,$link)) ) { echo "failed\n"; } while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) $myarray[$row['id']] = $row['name'];

    attached mail follows:


    > Is there a better way to do this in PHP? It seems that a single number > (key) and single name (value) would lend itself perfectly to an (indexed > or associative) array. I would think there is some PHP API call that I'm > unaware of that will just take the whole result set and stuff it into an > array for me no? If not, there should be. Perfect for things like > ListBoxes, or table lookups so you don't have to hit the database > constantly with joins et. al. > > $sql = "SELECT id, name FROM mytable ORDER BY id"; > if ( !($result = mysql_query($sql,$link)) ) { echo "failed\n"; } > while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) > $myarray[$row['id']] = $row['name'];

    That's the way to do it.

    ---John W. Holmes...

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

    attached mail follows:


    Hi,

    After a day and a half of pounding my head against the wall I believe I've identified the source of the problem. When I create and register the session in my login page - it does not carry forward to any other pages. I've found this by going through several different tutorials for making password protected areas using PHP and Sessions that I've found both online and in books - all produce the same result on the server with attitude - yet all work on all other servers I'm currently using for my hosting.

    So, since this is an eCommerce site for my client and they're getting increasingly impatient with the progress made I'm left with little choice in this matter - as moving the site now would be unthinkable, and tech support at the hosting company is less than stellar, and generally not in English. Are there any obvious PHP settings that I'd need to adjust to ensure that Sessions can be carried forward to additional pages? My only other option now is to force my client to login to each screen in the admin area (conceivably this could mean the client would need to log in to a minimum of 8 different pages to observe their records and make changes to the site).

    I'm at the point of desperation and sleep deprivation ... If there are no obvious PHP settings that need to be altered - what else could be producing this problem?

    Thanks -Tim

    attached mail follows:


    What version of PHP are you using and do you have globals turned on?

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

    > -----Original Message----- > From: Tim Thorburn [mailto:immortalnwconx.net] > Sent: Tuesday, 21 January 2003 6:59 PM > To: php-generallists.php.net > Subject: [PHP] PHP Sessions > > > Hi, > > After a day and a half of pounding my head against the wall I > believe I've > identified the source of the problem. When I create and register the > session in my login page - it does not carry forward to any other > pages. I've found this by going through several different > tutorials for > making password protected areas using PHP and Sessions that > I've found both > online and in books - all produce the same result on the server with > attitude - yet all work on all other servers I'm currently > using for my > hosting. > > So, since this is an eCommerce site for my client and they're getting > increasingly impatient with the progress made I'm left with > little choice > in this matter - as moving the site now would be unthinkable, > and tech > support at the hosting company is less than stellar, and > generally not in > English. Are there any obvious PHP settings that I'd need to > adjust to > ensure that Sessions can be carried forward to additional > pages? My only > other option now is to force my client to login to each > screen in the admin > area (conceivably this could mean the client would need to > log in to a > minimum of 8 different pages to observe their records and > make changes to > the site). > > I'm at the point of desperation and sleep deprivation ... If > there are no > obvious PHP settings that need to be altered - what else > could be producing > this problem? > > Thanks > -Tim > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On Tuesday 21 January 2003 16:58, Tim Thorburn wrote: > Hi, > > After a day and a half of pounding my head against the wall I believe I've > identified the source of the problem. When I create and register the > session in my login page - it does not carry forward to any other > pages. I've found this by going through several different tutorials for > making password protected areas using PHP and Sessions that I've found both > online and in books - all produce the same result on the server with > attitude - yet all work on all other servers I'm currently using for my > hosting.

    Does the simple example from the manual work? If not, what does the php.log say? If it does work then what does your code look like?

    What is the config of the "server with an attitude"? phpinfo()? Did you check for any differences between that and the servers that do work?

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

    /* lisp, v.: To call a spade a thpade. */

    attached mail follows:


    I used to have the same problem(sort of) I am not sure if my solution applies to you.

    Here is what i did,

    to pass session to one page to another you must call session_start(); ON EVERY PAGE

    to access registered session variables use the session super global array like: $_SESSION['userid'];

    Sorry if it's not relevant.

    Foong

    "Tim Thorburn" <immortalnwconx.net> wrote in message news:5.2.0.9.0.20030121035005.01620d18mail.nwconx.net... > Hi, > > After a day and a half of pounding my head against the wall I believe I've > identified the source of the problem. When I create and register the > session in my login page - it does not carry forward to any other > pages. I've found this by going through several different tutorials for > making password protected areas using PHP and Sessions that I've found both > online and in books - all produce the same result on the server with > attitude - yet all work on all other servers I'm currently using for my > hosting. > > So, since this is an eCommerce site for my client and they're getting > increasingly impatient with the progress made I'm left with little choice > in this matter - as moving the site now would be unthinkable, and tech > support at the hosting company is less than stellar, and generally not in > English. Are there any obvious PHP settings that I'd need to adjust to > ensure that Sessions can be carried forward to additional pages? My only > other option now is to force my client to login to each screen in the admin > area (conceivably this could mean the client would need to log in to a > minimum of 8 different pages to observe their records and make changes to > the site). > > I'm at the point of desperation and sleep deprivation ... If there are no > obvious PHP settings that need to be altered - what else could be producing > this problem? > > Thanks > -Tim > >

    attached mail follows:


    Hi,

    I'm using PHP 4.1.2 on the server with problems - it's hosted on a shared server and thus I have no direct access to much of anything. I have had this script running on versions 4.0.6 thru 4.2.2 with no problems until now.

    Here are the settings attained from phpinfo(); for the server that does not work - 4.1.2 ... and from the server that does work 4.2.2

    After the Configure Command of each is a list of settings that differ.

    Much thanks for responding so quickly and at such a late hour!!

    Thanks -Tim

    PHP 4.2.2 (works fine)

    './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-mcrypt' '--enable-bcmath' '--enable-calendar' '--with-xml' '--with-swf=/usr/local/flash' '--with-gd=../gd-1.8.4' '--with-jpeg-dir=/usr/local' '--with-imap=../imap-2001.BETA.SNAP-0107112053' '--with-ming=../ming-0.1.1' '--enable-magic-quotes' '--with-mysql' '--enable-safe-mode' '--enable-track-vars' '--with-ttf' '--enable-versioning' '--with-curl' '--with-zlib'

    Settings: allow_call_time_pass_reference ON extension_dir ./ magic_quotes_gpc ON register_argc_argv ON sendmail_from no value unserialize_callback_func no value variables_order EGPCS

    PHP 4.1.2 (doesn't work)

    './configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs' '--with-gd' '--with-gettext=/usr' '--enable-safe-mode' '--with-config-file-path=/etc/httpd' '--with-exec-dir=/usr/bin' '--with-zlib' '--enable-magic-quotes' '--with-regex=system' '--with-ttf' '--with-db' '--with-gdbm' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-track-vars' '--enable-wddx=shared' '--enable-mm=shared' '--enable-xml' '--enable-ftp' '--disable-debug' '--with-libdir=/usr/lib' '--with-db3' '--with-interbase=shared' '--with-pgsql=shared' '--with-ldap' '--with-imap' '--with-curl=shared' '--with-pdflib=shared'

    Settings: allow_call_time_pass_reference OFF extension_dir /usr/lib/apache/php magic_quotes_gpc OFF register_argc_argv OFF sendmail_from melocalhost.com variables_order GPCS

    At 07:11 PM 1/21/2003 +1000, Timothy Hitchens \(HiTCHO\) wrote: >What version of PHP are you using and do you have globals turned on? > > >Timothy Hitchens (HiTCHO) >Open Source Consulting >e-mail: timhitcho.com.au > > > -----Original Message----- > > From: Tim Thorburn [mailto:immortalnwconx.net] > > Sent: Tuesday, 21 January 2003 6:59 PM > > To: php-generallists.php.net > > Subject: [PHP] PHP Sessions > > > > > > Hi, > > > > After a day and a half of pounding my head against the wall I > > believe I've > > identified the source of the problem. When I create and register the > > session in my login page - it does not carry forward to any other > > pages. I've found this by going through several different > > tutorials for > > making password protected areas using PHP and Sessions that > > I've found both > > online and in books - all produce the same result on the server with > > attitude - yet all work on all other servers I'm currently > > using for my > > hosting. > > > > So, since this is an eCommerce site for my client and they're getting > > increasingly impatient with the progress made I'm left with > > little choice > > in this matter - as moving the site now would be unthinkable, > > and tech > > support at the hosting company is less than stellar, and > > generally not in > > English. Are there any obvious PHP settings that I'd need to > > adjust to > > ensure that Sessions can be carried forward to additional > > pages? My only > > other option now is to force my client to login to each > > screen in the admin > > area (conceivably this could mean the client would need to > > log in to a > > minimum of 8 different pages to observe their records and > > make changes to > > the site). > > > > I'm at the point of desperation and sleep deprivation ... If > > there are no > > obvious PHP settings that need to be altered - what else > > could be producing > > this problem? > > > > Thanks > > -Tim > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    Are globals turned on or off.. I don't see that setting in your copy and paste.

    Are you trying to access the session vars as $name or $_SESSION['name']??

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

    > -----Original Message----- > From: Tim Thorburn [mailto:immortalnwconx.net] > Sent: Tuesday, 21 January 2003 7:39 PM > To: hitchophp.net; php-generallists.php.net; > php-generalgremlins.biz > Subject: RE: [PHP] PHP Sessions > > > Hi, > > I'm using PHP 4.1.2 on the server with problems - it's hosted > on a shared > server and thus I have no direct access to much of anything. > I have had > this script running on versions 4.0.6 thru 4.2.2 with no > problems until now. > > Here are the settings attained from phpinfo(); for the server > that does not > work - 4.1.2 ... and from the server that does work 4.2.2 > > After the Configure Command of each is a list of settings that differ. > > Much thanks for responding so quickly and at such a late hour!! > > Thanks > -Tim > > PHP 4.2.2 (works fine) > > './configure' '--with-apxs=/usr/local/apache/bin/apxs' > '--with-mcrypt' > '--enable-bcmath' '--enable-calendar' '--with-xml' > '--with-swf=/usr/local/flash' '--with-gd=../gd-1.8.4' > '--with-jpeg-dir=/usr/local' > '--with-imap=../imap-2001.BETA.SNAP-0107112053' > '--with-ming=../ming-0.1.1' > '--enable-magic-quotes' '--with-mysql' '--enable-safe-mode' > '--enable-track-vars' '--with-ttf' '--enable-versioning' > '--with-curl' > '--with-zlib' > > Settings: > allow_call_time_pass_reference ON > extension_dir ./ > magic_quotes_gpc ON > register_argc_argv ON > sendmail_from no value > unserialize_callback_func no value > variables_order EGPCS > > PHP 4.1.2 (doesn't work) > > './configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs' > '--with-gd' > '--with-gettext=/usr' '--enable-safe-mode' > '--with-config-file-path=/etc/httpd' '--with-exec-dir=/usr/bin' > '--with-zlib' '--enable-magic-quotes' '--with-regex=system' > '--with-ttf' > '--with-db' '--with-gdbm' '--enable-mbstring' > '--enable-mbstr-enc-trans' > '--enable-track-vars' '--enable-wddx=shared' '--enable-mm=shared' > '--enable-xml' '--enable-ftp' '--disable-debug' > '--with-libdir=/usr/lib' > '--with-db3' '--with-interbase=shared' '--with-pgsql=shared' > '--with-ldap' > '--with-imap' '--with-curl=shared' '--with-pdflib=shared' > > Settings: > allow_call_time_pass_reference OFF > extension_dir /usr/lib/apache/php > magic_quotes_gpc OFF > register_argc_argv OFF > sendmail_from melocalhost.com > variables_order GPCS > > > At 07:11 PM 1/21/2003 +1000, Timothy Hitchens \(HiTCHO\) wrote: > >What version of PHP are you using and do you have als turned on? > > > > > >Timothy Hitchens (HiTCHO) > >Open Source Consulting > >e-mail: timhitcho.com.au > > > > > -----Original Message----- > > > From: Tim Thorburn [mailto:immortalnwconx.net] > > > Sent: Tuesday, 21 January 2003 6:59 PM > > > To: php-generallists.php.net > > > Subject: [PHP] PHP Sessions > > > > > > > > > Hi, > > > > > > After a day and a half of pounding my head against the wall I > > > believe I've identified the source of the problem. When I create > > > and register the session in my login page - it does not carry > > > forward to any other pages. I've found this by going through > > > several different tutorials for > > > making password protected areas using PHP and Sessions that > > > I've found both > > > online and in books - all produce the same result on the > server with > > > attitude - yet all work on all other servers I'm currently > > > using for my > > > hosting. > > > > > > So, since this is an eCommerce site for my client and they're > > > getting increasingly impatient with the progress made I'm > left with > > > little choice in this matter - as moving the site now would be > > > unthinkable, and tech > > > support at the hosting company is less than stellar, and > > > generally not in > > > English. Are there any obvious PHP settings that I'd need to > > > adjust to > > > ensure that Sessions can be carried forward to additional > > > pages? My only > > > other option now is to force my client to login to each > > > screen in the admin > > > area (conceivably this could mean the client would need to > > > log in to a > > > minimum of 8 different pages to observe their records and > > > make changes to > > > the site). > > > > > > I'm at the point of desperation and sleep deprivation ... > If there > > > are no obvious PHP settings that need to be altered - what else > > > could be producing > > > this problem? > > > > > > Thanks > > > -Tim > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

    attached mail follows:


    On Tuesday 21 January 2003 17:39, Tim Thorburn wrote: > Hi, > > I'm using PHP 4.1.2 on the server with problems - it's hosted on a shared > server and thus I have no direct access to much of anything. I have had > this script running on versions 4.0.6 thru 4.2.2 with no problems until > now. > > Here are the settings attained from phpinfo(); for the server that does not > work - 4.1.2 ... and from the server that does work 4.2.2 > > After the Configure Command of each is a list of settings that differ.

    Again, does the simple example from the manual work? If it works we can eliminate config settings and concentrate on your code.

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

    /* Endless the world's turn, endless the sun's spinning Endless the quest; I turn again, back to my own beginning, And here, find rest. */

    attached mail follows:


    Yes, the examples from the manual do work on the server using PHP 4.2.2 - however they do not work on the server using PHP 4.1.2.

    I've been using this same script for many sites with PHP versions 4.0.6 thru 4.2.2 with no problems until now which leads me to believe that I must attempt to change a PHP setting through .htaccess since it is hosted on a shared server.

    I've tried the example from the manual on several other sites - works everywhere but on this problem server.

    Thanks -Tim

    At 05:56 PM 1/21/2003 +0800, you wrote: >On Tuesday 21 January 2003 17:39, Tim Thorburn wrote: > > Hi, > > > > I'm using PHP 4.1.2 on the server with problems - it's hosted on a shared > > server and thus I have no direct access to much of anything. I have had > > this script running on versions 4.0.6 thru 4.2.2 with no problems until > > now. > > > > Here are the settings attained from phpinfo(); for the server that does not > > work - 4.1.2 ... and from the server that does work 4.2.2 > > > > After the Configure Command of each is a list of settings that differ. > >Again, does the simple example from the manual work? If it works we can >eliminate config settings and concentrate on your code. > >-- >Jason Wong -> Gremlins Associates -> www.gremlins.biz >Open Source Software Systems Integrators >* Web Design & Hosting * Internet & Intranet Applications Development * > >/* >Endless the world's turn, endless the sun's spinning >Endless the quest; >I turn again, back to my own beginning, >And here, find rest. >*/ > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    > Yes, the examples from the manual do work on the server using PHP 4.2.2 - > however they do not work on the server using PHP 4.1.2. > > I've been using this same script for many sites with PHP versions 4.0.6 > thru 4.2.2 with no problems until now which leads me to believe that I > must > attempt to change a PHP setting through .htaccess since it is hosted on a > shared server. > > I've tried the example from the manual on several other sites - works > everywhere but on this problem server.

    Wasn't it 4.1.2 that had broken sessions? I remember one version that came out that was just broke and you had to do a bunch of workarounds to get things to work normally. Was that it?

    Are you using the $_SESSION array or relying on register_globals?

    ---John W. Holmes...

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

    attached mail follows:


    There is some discussion as to whether my globals are on or not ... I am using session_register to name my sessions, and then the global command later on on the individual pages to remember which session it is we're looking for.

    It would be simply priceless if sessions were broken in 4.1.2 - and make much sense in the long run.

    Thanks -Tim

    At 05:19 AM 1/21/2003 -0500, you wrote: > > Yes, the examples from the manual do work on the server using PHP >4.2.2 - > > however they do not work on the server using PHP 4.1.2. > > > > I've been using this same script for many sites with PHP versions >4.0.6 > > thru 4.2.2 with no problems until now which leads me to believe that I > > must > > attempt to change a PHP setting through .htaccess since it is hosted >on a > > shared server. > > > > I've tried the example from the manual on several other sites - works > > everywhere but on this problem server. > >Wasn't it 4.1.2 that had broken sessions? I remember one version that >came out that was just broke and you had to do a bunch of workarounds to >get things to work normally. Was that it? > >Are you using the $_SESSION array or relying on register_globals? > >---John W. Holmes... > >PHP Architect - A monthly magazine for PHP Professionals. Get your copy >today. http://www.phparch.com/ > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    On Tuesday 21 January 2003 17:59, Tim Thorburn wrote: > Yes, the examples from the manual do work on the server using PHP 4.2.2 - > however they do not work on the server using PHP 4.1.2. > > I've been using this same script for many sites with PHP versions 4.0.6 > thru 4.2.2 with no problems until now which leads me to believe that I must > attempt to change a PHP setting through .htaccess since it is hosted on a > shared server. > > I've tried the example from the manual on several other sites - works > everywhere but on this problem server.

    It's time to see some code :)

    Does sessions work at all for the other people on your shared server? Ask your host whether anybody else has complained.

    > PHP 4.1.2 (doesn't work) > '--enable-mm=shared'

    Would this have anything to do with it? Apparently there could be problems with storing sessions in mm:

    http://marc.theaimsgroup.com/?l=php-general&m=104311365417871&w=2

    Check in php.ini whether sessions are file based or using mm.

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

    /* Goals... Plans... they're fantasies, they're part of a dream world... -- Wally Shawn */

    attached mail follows:


    on 21/01/03 9:25 PM, Tim Thorburn (immortalnwconx.net) wrote:

    > There is some discussion as to whether my globals are on or not ... I am > using session_register to name my sessions, and then the global command > later on on the individual pages to remember which session it is we're > looking for.

    No no no... check the output of phpinfo(), or check your php.ini file to see if the directive "register_globals" has a value of ON or OFF.

    This is more than likely the problem I think.

    Also check the same value on your local machine.

    Justin

    attached mail follows:


    > -----Original Message----- > From: John W. Holmes [mailto:holmes072000charter.net] > Sent: 21 January 2003 10:20 > > Wasn't it 4.1.2 that had broken sessions? I remember one version that > came out that was just broke and you had to do a bunch of > workarounds to > get things to work normally. Was that it?

    Yes, I believe you're right -- but on Windows only. Sessions in that specific version of PHP were accidentally read-only -- so you could appear to set values in the session, but they'd never show up in subsequent pages...!

    Bug reports http://bugs.php.net/bug.php?id=16043, http://bugs.php.net/bug.php?id=16102 and http://bugs.php.net/bug.php?id=16202 are relevant.

    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:


    Sorry I'm a bit late in on this thread but I know there is a problem with sessions with 4.1.2 with IIS 5 over Win2K... is that your platform? I encountered it a while back and there is a hack/workaround which I can dig up if you need it...

    HTH Rich -----Original Message----- From: Tim Thorburn [mailto:immortalnwconx.net] Sent: 21 January 2003 10:26 To: holmes072000charter.net; php-generallists.php.net Subject: RE: [PHP] PHP Sessions

    There is some discussion as to whether my globals are on or not ... I am using session_register to name my sessions, and then the global command later on on the individual pages to remember which session it is we're looking for.

    It would be simply priceless if sessions were broken in 4.1.2 - and make much sense in the long run.

    Thanks -Tim

    attached mail follows:


    Hi, I'm working on a project. It uses large sql data to create pages. Last week I create some kind of cache info to create faster execution. It really works (system runs more than 10 times faster)

    But stroring cache data is problem. I use the session to store cache info. With using cache data session files growing 60K, I think it can be 100K or more.

    I need advice about using large session data. Or is there any way to store large array (10 or more dimestion) into memory or someting.

    Thanks.

    Sancar "Delifisek" Saran.

    attached mail follows:


    Hi ,

    Im not sure if this can be done in PHP , i know PHP has upload features ! Does it have download features , wat i mean is the following : i want a link - click here to download - when you click on it , the download dialog box must appear - how do i do this ?

    Thanks Shaun van den Berg

    --
    Novtel Consulting
    Tel: +27 21 9822373
    Fax: +27 21 9815846
    Please visit our website:
    www.novtel.co.za
    

    attached mail follows:


    Create a script that reads the contents of a file after sending headers eg:

    header("Content-type: text/plain"); header("Content-Disposition: attachment; filename=downloaded.txt"); readfile("downloaded.txt"); exit();

    The downloaded.txt can be any file subject to sending the correct headers and IE and other browsers will pop up a download (save) window.

    See your mime.types file for headers for each file type.

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

    > -----Original Message----- > From: Shaun van den Berg [mailto:shaunnovtel.co.za] > Sent: Tuesday, 21 January 2003 4:39 PM > To: php-generallists.php.net > Subject: [PHP] DOWNLOAD > > > Hi , > > Im not sure if this can be done in PHP , i know PHP has > upload features ! Does it have download features , wat i mean > is the following : i want a link - click here to download - > when you click on it , the download dialog box must appear - > how do i do this ? > > Thanks > Shaun van den Berg > > -- > Novtel Consulting > Tel: +27 21 9822373 > Fax: +27 21 9815846 > Please visit our website: > www.novtel.co.za > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Change the link to form_download.php then create a file called form_download.php and do this:

    <?php

    header("Content-type: application/msword"); header("Content-Disposition: attachment; filename=form.doc"); readfile("form.doc"); exit();

    ?>

    That will do it for you.

    Also you should reply to all and include the list when replying so all get to see how to do these things.

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

    > -----Original Message----- > From: Shaun van den Berg [mailto:shaunnovtel.co.za] > Sent: Tuesday, 21 January 2003 8:19 PM > To: hitchophp.net > Subject: Re: [PHP] DOWNLOAD > > > Hi Timothy, > > I dont understand , im a rookie so go easy on me. I have a > form.doc file ! My code looks like this <a > href="form.doc">click to download</a>, this was wat somebody > else told me to do , but when i click on the link it opens > the document in word rather than downloading it ? I dont > under stand these headers yet , do i need to configure the > ini file , can i do this with doc containing pics ect. > > Thanks > Shaun > > ----- Original Message ----- > From: "Timothy Hitchens (HiTCHO)" <hitchophp.net> > To: "'Shaun van den Berg'" <shaunnovtel.co.za>; > <php-generallists.php.net> > Sent: Tuesday, January 21, 2003 11:44 AM > Subject: RE: [PHP] DOWNLOAD > > > > Create a script that reads the contents of a file after sending > > headers > > eg: > > > > header("Content-type: text/plain"); > > header("Content-Disposition: attachment; filename=downloaded.txt"); > > readfile("downloaded.txt"); exit(); > > > > The downloaded.txt can be any file subject to sending the correct > > headers and IE and other browsers will pop up a download (save) > > window. > > > > See your mime.types file for headers for each file type. > > > > > > Timothy Hitchens (HiTCHO) > > Open Source Consulting > > e-mail: timhitcho.com.au > > > > > -----Original Message----- > > > From: Shaun van den Berg [mailto:shaunnovtel.co.za] > > > Sent: Tuesday, 21 January 2003 4:39 PM > > > To: php-generallists.php.net > > > Subject: [PHP] DOWNLOAD > > > > > > > > > Hi , > > > > > > Im not sure if this can be done in PHP , i know PHP has upload > > > features ! Does it have download features , wat i mean is the > > > following : i want a link - click here to download - when > you click > > > on it , the download dialog box must appear - how do i do this ? > > > > > > Thanks > > > Shaun van den Berg > > > > > > -- > > > Novtel Consulting > > > Tel: +27 21 9822373 > > > Fax: +27 21 9815846 > > > Please visit our website: > > > www.novtel.co.za > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

    attached mail follows:


    Neither HTML nor PHP open the "download" (Save/Save As) dialog. This is a function of the browser upon clicking any file link, other than an HTML file.

    ----- Original Message ----- From: "Shaun van den Berg" <shaunnovtel.co.za> To: <> Sent: Tuesday, January 21, 2003 12:39 AM Subject: [PHP] DOWNLOAD

    Hi ,

    Im not sure if this can be done in PHP , i know PHP has upload features ! Does it have download features , wat i mean is the following : i want a link - click here to download - when you click on it , the download dialog box must appear - how do i do this ?

    Thanks Shaun van den Berg

    --
    Novtel Consulting
    Tel: +27 21 9822373
    Fax: +27 21 9815846
    Please visit our website:
    www.novtel.co.za
    

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

    attached mail follows:


    People often for get about a little problem that happens with the

    <?

    $name_the_file = "the name you want the file to be called when prompted to download"; $file_to_download = "/path/to/file/filename.scp";

    // test for internet explorer in the conditional for the following if..then..else if (msie) { $attachment=""; } else { $attachment=" attachment;"; }

    header("Content-Type: application/download\n"); header("Content-Disposition:$attachment filename=\"$name_the_file\""); readfile("$file_to_download"); exit(); ?>

    I found a bug when developing a download script a year or so ago.

    You can't have the 'attachment;' part in IE. It did some funky stuff

    and netscape 4 would die without it.

    Jim

    ----- Original Message ----- From: "Timothy Hitchens (HiTCHO)" <hitchophp.net> To: "'Shaun van den Berg'" <shaunnovtel.co.za>; <php-generallists.php.net> Sent: Tuesday, January 21, 2003 1:44 AM Subject: RE: [PHP] DOWNLOAD

    > Create a script that reads the contents of a file after sending headers > eg: > > header("Content-type: text/plain"); > header("Content-Disposition: attachment; filename=downloaded.txt"); > readfile("downloaded.txt"); > exit(); > > The downloaded.txt can be any file subject to sending the correct > headers and IE > and other browsers will pop up a download (save) window. > > See your mime.types file for headers for each file type. > > > Timothy Hitchens (HiTCHO) > Open Source Consulting > e-mail: timhitcho.com.au > > > -----Original Message----- > > From: Shaun van den Berg [mailto:shaunnovtel.co.za] > > Sent: Tuesday, 21 January 2003 4:39 PM > > To: php-generallists.php.net > > Subject: [PHP] DOWNLOAD > > > > > > Hi , > > > > Im not sure if this can be done in PHP , i know PHP has > > upload features ! Does it have download features , wat i mean > > is the following : i want a link - click here to download - > > when you click on it , the download dialog box must appear - > > how do i do this ? > > > > Thanks > > Shaun van den Berg > > > > -- > > Novtel Consulting > > Tel: +27 21 9822373 > > Fax: +27 21 9815846 > > Please visit our website: > > www.novtel.co.za > > > > > > > > -- > > 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 Group,

    I basically have some simple code such as:

    ==================================================

    if ( $_POST['passwd'] != $db['password'] { header("Location: loginfailed.html"); }

    //else

    $header = "Location: success.html";

    ==================================================

    however, when I run this code, using a <FORM> to submit password, username, etc...... if the passwords do not match, the page is forwarded to success.html !

    Is there anything obvious that I am doing wrong?

    Thanks, Shams

    p.s. I don't want to use else{} because I have lots of if() checks!

    attached mail follows:


    try with exit() after header().

    bye, stain.

    Il 10:48, martedì 21 gennaio 2003, Shams ha scritto: > Hi Group, > > I basically have some simple code such as: > > ================================================== > > if ( $_POST['passwd'] != $db['password'] > { header("Location: loginfailed.html"); > } > > //else > > $header = "Location: success.html"; > > ================================================== > > however, when I run this code, using a <FORM> to submit password, username, > etc...... if the passwords do not match, the page is forwarded to > success.html ! > > Is there anything obvious that I am doing wrong? > > Thanks, > Shams > > p.s. I don't want to use else{} because I have lots of if() checks!

    -- 
    "If there is any, error is human"
    

    attached mail follows:


    Hi,

    Tuesday, January 21, 2003, 7:48:04 PM, you wrote: S> Hi Group,

    S> I basically have some simple code such as:

    S> ==================================================

    S> if ( $_POST['passwd'] != $db['password'] S> { header("Location: loginfailed.html"); S> }

    S> //else

    S> $header = "Location: success.html";

    S> ==================================================

    S> however, when I run this code, using a <FORM> to submit password, username, S> etc...... if the passwords do not match, the page is forwarded to S> success.html !

    S> Is there anything obvious that I am doing wrong?

    S> Thanks, S> Shams

    S> p.s. I don't want to use else{} because I have lots of if() checks!

    put exit(); after the failed header.

    -- 
    regards,
    Tom
    

    attached mail follows:


    Looks like you're missing a closing bracket on the IF statement as well.

    Neil

    Shams wrote: > ************************************************************************** > This Message Was Virus Checked With : SAVI 3.61 September 2002 > Last Updated 17th January 2003 > ************************************************************************** > > Hi Group, > > I basically have some simple code such as: > > ================================================== > > if ( $_POST['passwd'] != $db['password'] > { header("Location: loginfailed.html"); > } > > //else > > $header = "Location: success.html"; > > ================================================== > > however, when I run this code, using a <FORM> to submit password, username, > etc...... if the passwords do not match, the page is forwarded to > success.html ! > > Is there anything obvious that I am doing wrong? > > Thanks, > Shams > > p.s. I don't want to use else{} because I have lots of if() checks! > > >

    -- 
    ----------------------
      www.curvedvision.com
    ----------------------
    

    attached mail follows:


    --- Shams <shamskhanmalikhotmail.com> wrote: > if ( $_POST['passwd'] != $db['password'] > { header("Location: loginfailed.html"); > }

    You never add the closing parenthesis to your if statement.

    Chris

    attached mail follows:


    When trying to do a search in a mbstring, I sometimes(!) get the following error: " Warning: mb_ereg_search()[function.mb-ereg-search]:mbregex compile err: premature end of regular expression in c:\myfile.php on line 12. " It's only the case for some strings. Why is this? I assume it must something related to the word itself interacting with the mbfunctions I'm using PHP 4.3.0. Thanks a lot!!!!! Simon Maybe this little file helps to see what i'm talking about: Copy & paste away <html> <head> <meta http-equiv="Content-Type" content="Text/Html; Charset=UTF-8"> <title>coding-problem</title> </head> <body> <?php $examplesnt="ã‚ÂãŸã—ã‚Â"; $word="愛犬"; //**************************FUNCTIONS******************************************* function find_word($word,$sentence) { mb_ereg_search_init ($sentence); $result=mb_ereg_search($word); if($result==1){ echo "$sentence contains $word<br>"; } return $result; } //************************MAIN************************************************** /* Set internal character encoding to UTF-8 */ mb_internal_encoding("UTF-8"); /* Display current internal character encoding */ echo mb_internal_encoding()."<br>"; echo $examplesnt." is the example sentence<br>"; echo $word." is the word we're looking for in the sentence<br>";// i know the word is not in it, but that doesn't matter find_word($word,$examplesnt); ?> </body> </html>

    attached mail follows:


    Karl James wrote:

    >Parse error: parse error, unexpected '}' in >/home/virtual/site12/fst/var/www/html/Create_Account.php on line 5 > >http://www.ultimatefootballleague.com/Create_Account.phps > >I'm Trying to get the values of the form to echo out and to insert into my >managers table. > If you don't see where the unexpected bracket is around line 5, then I suggest you post a few lines of code starting before line 5 here, and we will see if we can spot it.

    Others may do differently, but on a dial-up line, I'm not going on-line to look at a URL often, so code pasted into you email would be likely to get more people looking at it. I'm afraid that there are just too many posts to do that.

    Regards

    Chris

    attached mail follows:


    John W. Holmes wrote:

    > >How does php know what "suitable form data" is? > >I guess it could look for multiple names in the GET or POST data. But >then that would mean for every variable it goes to create, it would have >to go and look if it's already created one by that name. If it did, >erase the old one and make these two an array now. > I guess this is what Oracle 8i must do since if there is more than one element of the same name then an array is automatically made. Seems fine except that the special case of when you are expecting more than one but only one exists. It is no longer an array. Either extra code to handle it, or what I often do is add a hidden dummy element of the same name to force an array.

    >Rather than doing that, it can just look for [] in the name and it knows >to make that an array. > All in all, I think the [] syntax ends up with less work for me to do. So IMHO I feel PHP has it right.

    Regards

    Chris

    attached mail follows:


    Hello everyone,

    I need help with the following query.

    I have a table with a column named 'RISK_LEVEL'. RISK_LEVEL can hold three values: Low, Moderate, and High.

    I need a query that counts the number of occurences of each option. Now, I know I can do

    'select count(risk_level) as levelCount where risk_level=low'

    for each level (low, moderate, and high). But, I was wondering if there's anyway to merge the queries into one.

    I'm looking for something like

    "select count(risk_level='low') as lowCount, count(risk_level='moderate')as modCount, count(risk_level='high') as highCount "

    Which will return, lowCount = 1 , modCount=3, and highCount=1, for table with

    id | risk_level 1 | low 2 | moderate 3 | moderate 4 | high 5 | moderate

    How do you do it? Can tha be done?

    When I run the code above, I get the same number for each record. i.e. lowCount, modCount, and highCount all come out to 5--which is the number of records in the table.

    Is this possible, or should I just run multiple queries? Please help.

    =P e p i e D e s i g n s www.pepiedesigns.com Providing Solutions That Increase Productivity

    Web Developement. Database. Hosting. Multimedia.

    attached mail follows:


    off the top of my head SELECT risk_level, COUNT(risk_level) AS rl_count GROUP BY risk_level should do it, though I'd have to experiment with what's inside the COUNT().

    Tim Ward http://www.chessish.com mailto:timwardchessish.com ----- Original Message ----- From: [-^-!-%- <monfortengineering.sdsu.edu> To: <php-generallists.php.net> Sent: Tuesday, January 21, 2003 12:06 PM Subject: [PHP] ADV SQL Help Needed.

    > > Hello everyone, > > I need help with the following query. > > I have a table with a column named 'RISK_LEVEL'. > RISK_LEVEL can hold three values: Low, Moderate, and High. > > I need a query that counts the number of occurences of each option. > Now, I know I can do > > 'select count(risk_level) as levelCount where risk_level=low' > > for each level (low, moderate, and high). But, I was wondering if there's > anyway to merge the queries into one. > > I'm looking for something like > > "select count(risk_level='low') as lowCount, count(risk_level='moderate')as > modCount, count(risk_level='high') as highCount " > > Which will return, lowCount = 1 , modCount=3, and highCount=1, for table > with > > id | risk_level > 1 | low > 2 | moderate > 3 | moderate > 4 | high > 5 | moderate > > How do you do it? Can tha be done? > > When I run the code above, I get the same number for each record. i.e. > lowCount, modCount, and highCount all come out to 5--which is the number > of records in the table. > > Is this possible, or should I just run multiple queries? > Please help. > > > =P e p i e D e s i g n s > www.pepiedesigns.com > Providing Solutions That Increase Productivity > > Web Developement. Database. Hosting. Multimedia. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    This sample also work in PhpMyAdmin, but not from the php code. Please advise.

    **see previous post, for sample code**

    Thanks Rick.

    -john

    =P e p i e D e s i g n s www.pepiedesigns.com Providing Solutions That Increase Productivity

    Web Developement. Database. Hosting. Multimedia.

    On Tue, 21 Jan 2003, Rick Emery wrote:

    > SELECT risk_level, COUNT(*) FROM mytable GROUP BY risk_level; > > ----- Original Message ----- > From: "[-^-!-%-" <monfortengineering.sdsu.edu> > To: <php-generallists.php.net> > Sent: Tuesday, January 21, 2003 6:06 AM > Subject: [PHP] ADV SQL Help Needed. > > > > Hello everyone, > > I need help with the following query. > > I have a table with a column named 'RISK_LEVEL'. > RISK_LEVEL can hold three values: Low, Moderate, and High. > > I need a query that counts the number of occurences of each option. > Now, I know I can do > > 'select count(risk_level) as levelCount where risk_level=low' > > for each level (low, moderate, and high). But, I was wondering if there's > anyway to merge the queries into one. > > I'm looking for something like > > "select count(risk_level='low') as lowCount, count(risk_level='moderate')as > modCount, count(risk_level='high') as highCount " > > Which will return, lowCount = 1 , modCount=3, and highCount=1, for table > with > > id | risk_level > 1 | low > 2 | moderate > 3 | moderate > 4 | high > 5 | moderate > > How do you do it? Can tha be done? > > When I run the code above, I get the same number for each record. i.e. > lowCount, modCount, and highCount all come out to 5--which is the number > of records in the table. > > Is this possible, or should I just run multiple queries? > Please help. > > > =P e p i e D e s i g n s > www.pepiedesigns.com > Providing Solutions That Increase Productivity > > Web Developement. Database. Hosting. Multimedia. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Is there a way to autenticate an SMTP server in my PHP.ini???

    In my development site, i need to autenticate a SMTP, but in the PHP.INI does not have an option to autenticate..does anybody has any solution for this??

    Thanks, Rodrigo

    -------------------------------------------------------------------------------- Equipe Pratic Sistemas Rodrigo Corrêa Fone: (14) 441-1700 suportepraticsistemas.com.br rodrigopraticsistemas.com.br

    attached mail follows:


    On Tuesday 21 January 2003 20:13, Dankshit wrote: > Is there a way to autenticate an SMTP server in my PHP.ini??? > > In my development site, i need to autenticate a SMTP, but in the PHP.INI > does not have an option to autenticate..does anybody has any solution for > this??

    There is at least one class at www.phpclasses.org which allows you to use SMTP-AUTH.

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

    /* You buttered your bread, now lie in it. */

    attached mail follows:


    Hi All,

    I'm trying to add a variable to an oracle database but it fails due to the fact that it contains quotation marks. These have to be present for the end user. My Script is as follows: =========================================================== if ($conn == true) {

    $query = "UPDATE ACTIVITY SET COMMENTS = '$updatecomments' WHERE ACTIVITY_ID = '$actcode'"; $cursor = Ora_Open ($conn); $result = Ora_Parse ($cursor, $query); $result = Ora_Exec ($cursor);

    ora_close($cursor); Ora_Logoff($conn); } ===========================================================

    Can anyone tell me what to do!

    Thank you Dave

    attached mail follows:


    $query = "UPDATE ACTIVITY SET COMMENTS = \'$updatecomments\' WHERE ACTIVITY_ID =\'$actcode\'";

    ----- Original Message ----- From: <Rea_Davidemc.com> To: <php-generallists.php.net> Sent: Tuesday, January 21, 2003 6:53 AM Subject: [PHP] Adding a variable to oracle that contains quotation marks??

    Hi All,

    I'm trying to add a variable to an oracle database but it fails due to the fact that it contains quotation marks. These have to be present for the end user. My Script is as follows: =========================================================== if ($conn == true) {

    $query = "UPDATE ACTIVITY SET COMMENTS = '$updatecomments' WHERE ACTIVITY_ID = '$actcode'"; $cursor = Ora_Open ($conn); $result = Ora_Parse ($cursor, $query); $result = Ora_Exec ($cursor);

    ora_close($cursor); Ora_Logoff($conn); } ===========================================================

    Can anyone tell me what to do!

    Thank you Dave

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

    attached mail follows:


    Once you use double quota mark the character BackSlash doesn't need anymore that's my experience ^_^

    ----- Original Message ----- From: "Rick Emery" <remeryemeryloftus.com> To: <Rea_Davidemc.com>; <php-generallists.php.net> Sent: Tuesday, January 21, 2003 8:56 PM Subject: Re: [PHP] Adding a variable to oracle that contains quotation marks??

    > $query = "UPDATE ACTIVITY SET COMMENTS = \'$updatecomments\' WHERE ACTIVITY_ID =\'$actcode\'"; > > ----- Original Message ----- > From: <Rea_Davidemc.com> > To: <php-generallists.php.net> > Sent: Tuesday, January 21, 2003 6:53 AM > Subject: [PHP] Adding a variable to oracle that contains quotation marks?? > > > Hi All, > > I'm trying to add a variable to an oracle database but it fails due > to the fact that it contains quotation marks. These have to be present for > the end user. My Script is as follows: > =========================================================== > if ($conn == true) > { > > $query = "UPDATE ACTIVITY > SET COMMENTS = '$updatecomments' WHERE ACTIVITY_ID = > '$actcode'"; > $cursor = Ora_Open ($conn); > $result = Ora_Parse ($cursor, $query); > $result = Ora_Exec ($cursor); > > ora_close($cursor); > Ora_Logoff($conn); > } > =========================================================== > > Can anyone tell me what to do! > > Thank you > Dave > > -- > 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 Rick & Henry, but I am still unable to add single quotation marks '. When I added the \' to the variable as given below (thanks again Rick) I get the following error when trying to add anything, regardless of ':

    Warning: Ora_Parse failed (ORA-00911: invalid character -- while processing OCI function OPARSE) in /services/apache_1.3.22/www-dev/isg/isg_tools/activitytracker/admin/selectac tivity.php on line 28

    Perhaps I'm missing something very small? I have done a stripslash on the variable also, but with no extra success!

    Any ideas? Dave

    P.S. Henry, the double quotation is ok.

    -----Original Message----- From: Henry [mailto:henrycafelab.com] Sent: 21 January 2003 13:12 To: Rick Emery; Rea_Davidemc.com; php-generallists.php.net Subject: Re: [PHP] Adding a variable to oracle that contains quotation marks??

    Once you use double quota mark the character BackSlash doesn't need anymore that's my experience ^_^

    ----- Original Message ----- From: "Rick Emery" <remeryemeryloftus.com> To: <Rea_Davidemc.com>; <php-generallists.php.net> Sent: Tuesday, January 21, 2003 8:56 PM Subject: Re: [PHP] Adding a variable to oracle that contains quotation marks??

    > $query = "UPDATE ACTIVITY SET COMMENTS = \'$updatecomments\' WHERE ACTIVITY_ID =\'$actcode\'"; > > ----- Original Message ----- > From: <Rea_Davidemc.com> > To: <php-generallists.php.net> > Sent: Tuesday, January 21, 2003 6:53 AM > Subject: [PHP] Adding a variable to oracle that contains quotation marks?? > > > Hi All, > > I'm trying to add a variable to an oracle database but it fails due > to the fact that it contains quotation marks. These have to be present for > the end user. My Script is as follows: > =========================================================== > if ($conn == true) > { > > $query = "UPDATE ACTIVITY > SET COMMENTS = '$updatecomments' WHERE ACTIVITY_ID = > '$actcode'"; > $cursor = Ora_Open ($conn); > $result = Ora_Parse ($cursor, $query); > $result = Ora_Exec ($cursor); > > ora_close($cursor); > Ora_Logoff($conn); > } > =========================================================== > > Can anyone tell me what to do! > > Thank you > Dave > > -- > 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:


    > -----Original Message----- > From: Rea_Davidemc.com [mailto:Rea_Davidemc.com] > Sent: 21 January 2003 15:05 > > Thanks Rick & Henry, but I am still unable to add single > quotation marks '. > When I added the \' to the variable as given below (thanks > again Rick) I get > the following error when trying to add anything, regardless of ':

    Oracle does its quote-escaping different! To insert a single-quote within a single-quoted value, you have to double it, so:

    $query = "UPDATE ACTIVITY SET COMMENTS = 'That''s right' WHERE ...";

    So, you either have to run a str_replace("'", "''", $updatecomments) before constructing the query, or you can use addslashes() and turn on the magic_quotes_sybase option -- if you do the latter, and also have magic_quotes_gpc and/or magic_quotes_runtime turned on, "magic" quoting will also escape with a second quote rather than a backslash.

    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 all, I'm newbie of PHP. Can any one help me and explain how can use Multi-Byte String Functions? My national language is Farsi and I force to use UTF-8 for my works. but I have several problem when I need use it in PHP. I think Multi-Byte String Functions are designed for some ones like me. but I can not use it :-(

    I'm using Windows 2000 and Apache 1.3 plus PHP installed as module on my PC.

    -Sadeq

    attached mail follows:


    Hi, all --

    If I have an associative array

    Array ( [t] => Array ( [t1] => temp1 [t2] => temp2 ) [f] => Array ( [f1] => foo1 [f2] => foo2 ) )

    and I want to change the key 't' to, say, 'tmp', is there a way to change it or do I have to use the brute force

    $a[tmp] = $a[t] ; unset $a[t] ;

    approach?

    I expect that, however it's done, it works the same way on just a 1-d assoc array like

    Array ( [t1] => temp1 [t2] => temp2 )

    but in particular I have the 2-d array case that I need to play with today.

    TIA & HAND

    :-D

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

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

    iD8DBQE+LU96Gb7uCXufRwARAognAJ4hW4qewiSs+1hjXJvTZhevl5N8YQCg0JKs rqJ9M+0W6iVtrKCruL//hCA= =wDYC -----END PGP SIGNATURE-----

    attached mail follows:


    My first question back would be why you create on array with keys you know you want to change, or why in that case it became necessary to dereference the original key.

    $a['tmp'] =& $a['t']; // exact same values by reference (no copy)

    Only other way I can think of at the moment is to create a copy and unset the original as you described as brute force.

    HTH, Jason k Larson

    David T-G wrote: > Hi, all -- > > If I have an associative array > > Array > ( > [t] => Array > ( > [t1] => temp1 > [t2] => temp2 > ) > > [f] => Array > ( > [f1] => foo1 > [f2] => foo2 > ) > > ) > > and I want to change the key 't' to, say, 'tmp', is there a way to change > it or do I have to use the brute force > > $a[tmp] = $a[t] ; > unset $a[t] ; > > approach? > > I expect that, however it's done, it works the same way on just a 1-d > assoc array like > > Array > ( > [t1] => temp1 > [t2] => temp2 > ) > > but in particular I have the 2-d array case that I need to play with > today. > > > TIA & HAND > > :-D

    attached mail follows:


    Jason --

    ...and then Jason k Larson said... % % My first question back would be why you create on array with keys you % know you want to change, or why in that case it became necessary to % dereference the original key.

    A fair question :-)

    I'm writing a picture gallery add-on which will allow users to create "favorite pictures" baskets. For each basket, the user throws in a bunch of pictures in an array. Then I make an array of baskets, where the name of the basket is the key and the array that is the basket is the value.

    When a user wants to rename a basket, the new version of that basket appaers at the bottom of the list instead of in its original place -- wherever that was.

    % % $a['tmp'] =& $a['t']; // exact same values by reference (no copy)

    I don't think I can do this, since I eventually save the array of arrays to a file for the user to reload on another visit. Thanks, though.

    % % Only other way I can think of at the moment is to create a copy and % unset the original as you described as brute force.

    Ah. Well, that's what they get, then :-)

    % % HTH, % Jason k Larson

    Thanks & HAND

    :-D

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

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

    iD8DBQE+LVl/Gb7uCXufRwARApynAKCwgyvmA3z3ws4GSVgMM2+r7kKxZwCgpj4J FMQe2GVEjn/7NSWdpdgbkec= =ev3r -----END PGP SIGNATURE-----

    attached mail follows:


    Hello all,

    I know I can connect to another db through an odbc connection in php. Can I use php to create the connection initially? I will be uploading an access db from the users and then moving the data over into my mysql db. Since this will all be done automatically, I will need php to upload the file,create the odbc connection, connect, pump over the data, then delete the connection.

    Thanks, Eddie

    attached mail follows:


    Hi, all --

    If I have an associative array $a like

    Array ( [t] => temp1 [u] => ugh [m] => moo )

    is there any way to re-order the keys so that

    foreach (array_keys($a) as $k) { print "$k\n" ; }

    will print

    t m u

    for me? At the moment it seems my only option is

    sort(array_keys($a))

    and that's a start but finding another order spec would be lovely...

    TIA & HAND

    :-D

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

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

    iD8DBQE+LVB0Gb7uCXufRwARAubvAJ0UiofWLmL9i7AAINwncBaAUc7PwwCdGlWR uuUpRDOKX+7hfLhG6fYDdMw= =dQh8 -----END PGP SIGNATURE-----

    attached mail follows:


    There are many pre-defined functions to manipulate the sort order of arrays and it's keys. However sometimes, to fit special needs, you just have to do it manually. Here's the useful PHP reference manual links to better understand what's available.

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

    http://www.php.net/manual/en/function.asort.php http://www.php.net/manual/en/function.arsort.php

    http://www.php.net/manual/en/function.ksort.php http://www.php.net/manual/en/function.krsort.php

    http://www.php.net/manual/en/function.usort.php http://www.php.net/manual/en/function.uksort.php

    HTH, Jason k Larson

    David T-G wrote: > Hi, all -- > > If I have an associative array $a like > > Array > ( > [t] => temp1 > [u] => ugh > [m] => moo > ) > > is there any way to re-order the keys so that > > foreach (array_keys($a) as $k) > { print "$k\n" ; } > > will print > > t > m > u > > for me? At the moment it seems my only option is > > sort(array_keys($a)) > > and that's a start but finding another order spec would be lovely... > > > TIA & HAND > > :-D

    attached mail follows:


    Jason, et al --

    ...and then Jason k Larson said... % % There are many pre-defined functions to manipulate the sort order of % arrays and it's keys. However sometimes, to fit special needs, you just % have to do it manually. Here's the useful PHP reference manual links to % better understand what's available. % % http://www.php.net/manual/en/ref.array.php % % http://www.php.net/manual/en/function.asort.php % http://www.php.net/manual/en/function.arsort.php % % http://www.php.net/manual/en/function.ksort.php % http://www.php.net/manual/en/function.krsort.php % % http://www.php.net/manual/en/function.usort.php % http://www.php.net/manual/en/function.uksort.php

    Thanks for the pointers. All of those are great (I hadn't read up on asort yet; quite nice, and I may offer a "sort these pictures by name" option based on that or a nat sort) but don't help me with the problem of reordering keys based on a position, and I don't think I want to try writing the sort function that will take arbitrary input and spit it back out with the purpose of moving a single key around :-)

    % % % HTH, % Jason k Larson

    Thanks & HAND

    :-D

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

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

    iD8DBQE+LVoKGb7uCXufRwARAkTDAJ9OqzcsRWbHA7wW6t9tFVhacXMfcgCgiQfH +pyHdRgECmw8A932MqCnnx4= =z5TJ -----END PGP SIGNATURE-----

    attached mail follows:


    Hello everybody, I'm working on a class but having a lot of problems... probably my understanding of PhP-OOP is not so good ... Here's the class: I found it on the web and I've tried to personalize it to fit my needs...

    <?php

    class FormV { var $errorList; function FormV() { $this->reset_errorList(); } function getValue( $field ) { $value = $HTTP_POST_VARS[ $field ]; return $value; } function isEmpty( $field, $msg ) { $value = $this->getValue( $field ); if( trim( $value ) == "" ) { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return true; } else return false; } function isString( $field, $msg ) { $value = $this->getValue( $field ); if( is_string( $value ) ) return true; else { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return false; } } function isEmail( $field, $msg ) { $value = $this->getValue( $field ); $pattern = "/^([a-zA-Z0-9])*([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/"; if( preg_match( $pattern, $value ) ) return true; else { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return false; } } function isError() { if( sizeof( $this->errorList ) > 0 ) return true; else return false; } function get_errorList() { return $this->errorList; } function reset_errorList() { $this->errorList = array(); } function stringConvert( $field ) { $value = $this->getValue( $field ); $value = html_special_chars( $value ); $value = stripslashes( $value ); $value = strtolower( $value ); return $value; } };

    ?>

    Ok. I think that the getter is *totally* wrong but I'm not able to debug it, because it's private (I think...). Also the stringConvert() method sucks, maybe I'll split it in some others accessor methods, for a better design. Now I'm totally lost, I don't have a clue how to continue, I've tried for hours and hours to make it work, but didn't succeed :( Any suggestion on improving and other enhancment for a good form validating class is really really appreciated.

    TIA, Nicholas

    attached mail follows:


    PHP does not yet support private methods ... your problem with getValue() is most probably because register_globals is off in your php.ini try substituting $_POST[] for $HTTP_POST_VARS[] and it may start to work... HTH Rich

    -----Original Message----- From: Nicholas Wieland [mailto:nicholas_wielandyahoo.it] Sent: 21 January 2003 14:13 To: php-generallists.php.net Subject: [PHP] Form Validating Class (OOP misunderstandings...)

    Hello everybody, I'm working on a class but having a lot of problems... probably my understanding of PhP-OOP is not so good ... Here's the class: I found it on the web and I've tried to personalize it to fit my needs...

    <?php

    class FormV { var $errorList;

    function FormV() { $this->reset_errorList(); }

    function getValue( $field ) { $value = $HTTP_POST_VARS[ $field ]; return $value; }

    function isEmpty( $field, $msg ) { $value = $this->getValue( $field );

    if( trim( $value ) == "" ) { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return true; } else return false;

    }

    function isString( $field, $msg ) { $value = $this->getValue( $field );

    if( is_string( $value ) ) return true;

    else { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return false; } }

    function isEmail( $field, $msg ) { $value = $this->getValue( $field ); $pattern = "/^([a-zA-Z0-9])*([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/";

    if( preg_match( $pattern, $value ) ) return true;

    else { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return false; } }

    function isError() { if( sizeof( $this->errorList ) > 0 ) return true;

    else return false; }

    function get_errorList() { return $this->errorList; }

    function reset_errorList() { $this->errorList = array(); }

    function stringConvert( $field ) { $value = $this->getValue( $field );

    $value = html_special_chars( $value );

    $value = stripslashes( $value );

    $value = strtolower( $value );

    return $value; }

    };

    ?>

    Ok. I think that the getter is *totally* wrong but I'm not able to debug it, because it's private (I think...). Also the stringConvert() method sucks, maybe I'll split it in some others accessor methods, for a better design. Now I'm totally lost, I don't have a clue how to continue, I've tried for hours and hours to make it work, but didn't succeed :( Any suggestion on improving and other enhancment for a good form validating class is really really appreciated.

    TIA, Nicholas

    attached mail follows:


    For the most part I found two errors The first was a scope problem. $HTTP_*_VARS hashes are not accessible inside functions unless you source them in. i.e. global The other was an extra line in an if statement that did not contain braces. I did a little formating while I checked the code. Try this to see if it works as you expected it to. <?php class FormV { var $errorList;

    function FormV() { $this->reset_errorList(); }

    function getValue($field) { global $HTTP_POST_VARS; return $HTTP_POST_VARS[$field]; }

    function isEmpty($field, $msg) { $value = $this->getValue($field); if(!trim($value)) { $this->errorList[] = array('field'=>$field, 'value'=>$value, 'msg'=>$msg); return true; } else return false; }

    function isString($field, $msg) { $value = $this->getValue($field); if(is_string($value)) return true; else { $this->errorList[] = array('field'=>$field, 'value'=>$value,'msg'=>$msg); return false; } }

    function isEmail($field, $msg) { $value = $this->getValue($field); $pattern = '/^([a-zA-Z0-9])*([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/'; if(preg_match($pattern, $value)) return true; else { $this->errorList[] = array('field'=>$field, 'value'=>$value, 'msg'=>$msg); return false; } }

    function isError() { if(sizeof($this->errorList) > 0) return true; else return false; }

    function get_errorList() { return $this->errorList; }

    function reset_errorList() { $this->errorList = array(); }

    function stringConvert($field) { $value = $this->getValue($field); $value = html_special_chars($value); $value = stripslashes($value); $value = strtolower($value);

    return $value; } } ?>

    ----- Original Message ----- From: "Nicholas Wieland" <nicholas_wielandyahoo.it> To: <php-generallists.php.net> Sent: Tuesday, January 21, 2003 8:12 AM Subject: [PHP] Form Validating Class (OOP misunderstandings...)

    > Hello everybody, > I'm working on a class but having a lot of problems... probably my > understanding of PhP-OOP is not so good ... > Here's the class: I found it on the web and I've tried to personalize > it to fit my needs... > > <?php > > class FormV > { > var $errorList; > > function FormV() > { > $this->reset_errorList(); > } > > function getValue( $field ) > { > $value = $HTTP_POST_VARS[ $field ]; > return $value; > } > > function isEmpty( $field, $msg ) > { > $value = $this->getValue( $field ); > > if( trim( $value ) == "" ) > { > $this->errorList[] = array( "field" => $field, > "value" => $value, "msg" => $msg ); > return true; > } > else > return false; > > } > > function isString( $field, $msg ) > { > $value = $this->getValue( $field ); > > if( is_string( $value ) ) > return true; > > else > { > $this->errorList[] = array( "field" => $field, > "value" => $value, "msg" => $msg ); > return false; > } > } > > function isEmail( $field, $msg ) > { > $value = $this->getValue( $field ); > $pattern = > "/^([a-zA-Z0-9])*([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/"; > > if( preg_match( $pattern, $value ) ) > return true; > > else > { > $this->errorList[] = array( "field" => $field, > "value" => $value, "msg" => $msg ); > return false; > } > } > > function isError() > { > if( sizeof( $this->errorList ) > 0 ) > return true; > > else > return false; > } > > function get_errorList() > { > return $this->errorList; > } > > function reset_errorList() > { > $this->errorList = array(); > } > > function stringConvert( $field ) > { > $value = $this->getValue( $field ); > > $value = html_special_chars( $value ); > > $value = stripslashes( $value ); > > $value = strtolower( $value ); > > return $value; > } > > }; > > ?> > > Ok. > I think that the getter is *totally* wrong but I'm not able to debug > it, because it's private (I think...). Also the stringConvert() method > sucks, maybe I'll split it in some others accessor methods, for a > better design. > Now I'm totally lost, I don't have a clue how to continue, I've tried > for hours and hours to make it work, but didn't succeed :( > Any suggestion on improving and other enhancment for a good form > validating class is really really appreciated. > > TIA, > Nicholas > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On 2003.01.21 15:42 Joseph W. Goff wrote: > For the most part I found two errors > The first was a scope problem. $HTTP_*_VARS hashes are not accessible > inside functions unless you source them in. i.e. global > The other was an extra line in an if statement that did not contain > braces. > I did a little formating while I checked the code. Try this to see if > it > works as you expected it to.

    > snip, it's perfect >

    Yes, it works. I misunderstood the visibility of $HTTP_POST_VARS. Thank you Joseph ! I really appreciate your help :)

    I've read the paper from OWASP and now I'm a little paranoid about form validating and user input... does someone have other suggestions about improving the class ?

    TIA, Nicholas

    attached mail follows:


    Nicholas,

    I think I know where you found this code. I have the same code, except I modified it a little to work for me. You may need to change it for your needs. When I first used it, it didn't work. I had to modify it to make it work. My code is usually kind of sloppy, but maybe you would get better use of the following class:

    <?php

    class FormValidator {

    var $_errorList;

    function FormValidator() { $this->resetErrorList(); }

    function isEmpty($field, $msg) { if (trim($field) == "") { $this->_errorList[] = array("value" => $field, "msg" => $msg); return true; } else { return false; } }

    function isZero($field, $msg) { if($field == 0) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return true; } else { return false; } }

    function isUploadedFile($img, $img_type, $img_size, $msg) { $pattern = "/(pjpeg)$/"; if (is_uploaded_file($img) && preg_match($pattern, $img_type) && $img_size <= 1000000) { return true; } else { $this->_errorList[] = array("value" => $img, "msg" => $msg); return false; } }

    function isString($field, $msg) { if(!is_string($field)) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } }

    function isNumber($field, $msg) { if(!is_numeric($field)) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } }

    function isInteger($field, $msg) { if(!is_integer($field)) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } }

    function isFloat($field, $msg) { if(!is_float($field)) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } }

    function isWithinRange($field, $msg, $min, $max) { if(!is_numeric($field) || $field < $min || $field > $max) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } }

    function isStringWithinRange($field, $msg, $min, $max) { if(strlen($field) < $min || strlen($field) > $max) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } }

    function isAlpha($field, $msg, $special_chars="") { $pattern = "/^[a-zA-Z\s" . $special_chars . "]+$/"; if(preg_match($pattern, $field)) { return true; } else { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } }

    function isAlphaNum($field, $msg, $special_chars="") { $pattern = "/^[a-zA-Z0-9\s" . $special_chars . "]+$/"; if(preg_match($pattern, $field)) { return true; } else { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } }

    function isEmailAddress($field, $msg) { $pattern = "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/"; if(preg_match($pattern, $field)) { return true; } else { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } }

    function isError() { if (sizeof($this->_errorList) > 0) { return true; } else { return false; } }

    function getErrorList() { return $this->_errorList; }

    function resetErrorList() { $this->_errorList = array(); }

    }

    ?>

    >

    attached mail follows:


    On 2003.01.21 15:21 Rich Gray wrote: > PHP does not yet support private methods ... your problem with > getValue() is > most probably because register_globals is off in your php.ini try > substituting $_POST[] for $HTTP_POST_VARS[] and it may start to > work...

    Sorry... I forgot to mention that I use PhP 4.2.2 on my GNU/Linux Box but I have PhP 4.0.6 on the production machine, AFAIK $_POST is a 'feature' of PhP 4.1.x ... Thanks for your help, I'll try to be more accurate next time...

    Nicholas

    attached mail follows:


    Hi all. I am having some problems with a script which reads information from a database and creates a table. It works in IE but not Netscape. I call myself going through the tags to make sure all that were open were closed because Netscape doesn't like unfinished business. What I have is a script that outputs the previous page, 1, 2, ..., next page link (if there are more than x table items per page). It has worked in both browsers but now I have broke something. :o) Any ideas are appreciated. The code is like this ...

    <?php

    function pagelinks($prev_page, $num_pages, $next_page, $page) {

    // This displays the "Previous" link if ($prev_page) { echo "<a href=\"$PHP_SELF?page=$prev_page\">&lt;&nbsp;Prev</a>&nbsp;|&nbsp;"; }

    // No need to output the page number if there is only one page if ($num_pages>1) { for ($i = 1; $i <= $num_pages; $i++) { if ($i != $page) { echo " <a href=$PHP_SELF?page=$i>$i</a>"; } else { echo " $i "; } } }

    // Display the "Next" link. if ($page != $num_pages) { echo "&nbsp;|&nbsp;<a href=\"$PHP_SELF?page=$next_page\">&nbsp;Next&nbsp;&gt;</a>" ; } }

    ?>

    This code is at the top of an include file which is included in pics.php. It seems that $PHP_SELF is interpreted differently in *some* instances between the two browsers. I can't figure it out because PHP_SELF is a server side evaluation. The links are output correctly in IE ... http://www.xyz.com/pics.php?page=2 ... but in Netscape I get ... http://www.xyz.com/?page=2 I had this problem once before and inadvertently fixed it with something else that I was doing. Any hints are appreciated.

    TIA,

    Bill

    attached mail follows:


    $PHP_SELF is not interpreted by the browser. The browser shows only what is sent to it; PHP variables are not sent to the browser.

    Take the simple solution: don't use PHP_SELF; just use the file name

    ----- Original Message ----- From: "Bill Arbuckle, Jr." <billwingshooter.net> To: <php-generallists.php.net> Sent: Tuesday, January 21, 2003 8:26 AM Subject: [PHP] Page Rendering

    Hi all. I am having some problems with a script which reads information from a database and creates a table. It works in IE but not Netscape. I call myself going through the tags to make sure all that were open were closed because Netscape doesn't like unfinished business. What I have is a script that outputs the previous page, 1, 2, ..., next page link (if there are more than x table items per page). It has worked in both browsers but now I have broke something. :o) Any ideas are appreciated. The code is like this ...

    <?php

    function pagelinks($prev_page, $num_pages, $next_page, $page) {

    // This displays the "Previous" link if ($prev_page) { echo "<a href=\"$PHP_SELF?page=$prev_page\">&lt;&nbsp;Prev</a>&nbsp;|&nbsp;"; }

    // No need to output the page number if there is only one page if ($num_pages>1) { for ($i = 1; $i <= $num_pages; $i++) { if ($i != $page) { echo " <a href=$PHP_SELF?page=$i>$i</a>"; } else { echo " $i "; } } }

    // Display the "Next" link. if ($page != $num_pages) { echo "&nbsp;|&nbsp;<a href=\"$PHP_SELF?page=$next_page\">&nbsp;Next&nbsp;&gt;</a>" ; } }

    ?>

    This code is at the top of an include file which is included in pics.php. It seems that $PHP_SELF is interpreted differently in *some* instances between the two browsers. I can't figure it out because PHP_SELF is a server side evaluation. The links are output correctly in IE ... http://www.xyz.com/pics.php?page=2 ... but in Netscape I get ... http://www.xyz.com/?page=2 I had this problem once before and inadvertently fixed it with something else that I was doing. Any hints are appreciated.

    TIA,

    Bill

    attached mail follows:


    On Tuesday 21 January 2003 22:26, Bill Arbuckle, Jr. wrote:

    > This code is at the top of an include file which is included in pics.php. > It seems that $PHP_SELF is interpreted differently in *some* instances > between the two browsers. I can't figure it out because PHP_SELF is a > server side evaluation. The links are output correctly in IE ... > http://www.xyz.com/pics.php?page=2 ... but in Netscape I get ... > http://www.xyz.com/?page=2 I had this problem once before and > inadvertently fixed it with something else that I was doing. Any hints are > appreciated.

    Most likely $PHP_SELF is in fact blank. If you're using a relatively new version of PHP use $_SERVER['PHP_SELF'] instead.

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

    /* On the road, ZIPPY is a pinhead without a purpose, but never without a POINT. */

    attached mail follows:


    Bill --

    ...and then Bill Arbuckle, Jr. said... % ... % This code is at the top of an include file which is included in pics.php. % It seems that $PHP_SELF is interpreted differently in *some* instances % between the two browsers. I can't figure it out because PHP_SELF is a

    Dunno much about your code (I haven't taken the time to really read it), but you could be missing pics.php under NS if the server will hand that up as a default index name (or if you have an index.php as a copy). That is,

    http://www.xyz.com/

    might be a perfectly valid link to your script. Meanwhile, you're right that PHP_SELF (in either form) is a server-side variable and the browser won't ever see it.

    Worth checking out just to be sure...

    HTH & HAND

    :-D

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

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

    iD8DBQE+LWIqGb7uCXufRwARAlX7AKCKc0yVjzaOZJ5/hswSI7TmNiP8fwCgwNM9 nUJO5RET4RUqWDCkzcGIGMo= =gIWp -----END PGP SIGNATURE-----

    attached mail follows:


    --- "Bill Arbuckle, Jr." <billwingshooter.net> wrote: > It works in IE but not Netscape.

    Nearly every time this happens, you have invalid HTML.

    Try stripping out all of the HTML, leaving only the plain text content of the page in question. Then, slowly add back the markup, testing each change.

    Also, never test in IE unless you have a restricted user base that is only going to use IE. It is one of the most lenient browsers with regard to standards, so it will just give you a false positive.

    Chris

    attached mail follows:


    Bill Arbuckle, Jr. wrote: > Hi all. I am having some problems with a script which reads information > from a database and creates a table. It works in IE but not Netscape.

    it can be usefull to test the resulting html

    http://validator.w3.org/

    valid html is much more likely to appear consistent across browsers

    -- 
    

    Sean

    attached mail follows:


    Hi every body. I have a form that was originally working just fine. It had a series of input checkboxes with the same name ("interests[]"). These values then ended up in an array ($_POST['interests']), which I then imploded into a comma separated list ($interests = implode(', ', $_POST['interests']); ). Well, that was working just fine until yesterday when I started getting an error on that implode function ("Bad arguments to implode()"). So I did a "gettype" on $_POST['interests'] and it revealed that it is now ending up as a "string" variable. So I printed it and it contains the string "Array"!

    Anyone know what's going on here?

    Thanks --Dan

    attached mail follows:


    show us code ----- Original Message ----- From: "Dan Delaney" <ddelaneypowercreative.com> To: <> Sent: Tuesday, January 21, 2003 8:33 AM Subject: [PHP] Input field array ends up as "Array" string

    Hi every body. I have a form that was originally working just fine. It had a series of input checkboxes with the same name ("interests[]"). These values then ended up in an array ($_POST['interests']), which I then imploded into a comma separated list ($interests = implode(', ', $_POST['interests']); ). Well, that was working just fine until yesterday when I started getting an error on that implode function ("Bad arguments to implode()"). So I did a "gettype" on $_POST['interests'] and it revealed that it is now ending up as a "string" variable. So I printed it and it contains the string "Array"!

    Anyone know what's going on here?

    Thanks --Dan

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

    attached mail follows:


    "Rick Emery" <remeryemeryloftus.com> wrote in message news:024801c2c15b$1a770e70$0500a8c0honeybee... > show us code

    Learn how to quote. :)

    attached mail follows:


    On Tuesday 21 January 2003 22:33, Dan Delaney wrote: > Hi every body. I have a form that was originally working just fine. It > had a series of input checkboxes with the same name ("interests[]"). > These values then ended up in an array ($_POST['interests']), which I > then imploded into a comma separated list ($interests = implode(', ', > $_POST['interests']); ). Well, that was working just fine until > yesterday when I started getting an error on that implode function > ("Bad arguments to implode()"). So I did a "gettype" on > $_POST['interests'] and it revealed that it is now ending up as a > "string" variable. So I printed it and it contains the string "Array"! > > Anyone know what's going on here?

    Undo any configuration changes made recently, downgrade any recent upgrades etc. To paraphrase Newtown's First Law of Motion:

    "Any working system tends to remain in that state unless external force is applied to it."

    So what was it that you did yesterday to cause it stop working?

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

    /* Isn't it nice that people who prefer Los Angeles to San Francisco live there? -- Herb Caen */

    attached mail follows:


    On Tuesday 21 January 2003 23:03, Jason Wong wrote: > Undo any configuration changes made recently, downgrade any recent upgrades > etc. To paraphrase Newtown's First Law of Motion:

    Sorry, "Newton's First Law of Motion" :)

    > "Any working system tends to remain in that state unless external force is > applied to it." > > So what was it that you did yesterday to cause it stop working?

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

    /* Loud burping while walking around the airport is prohibited in Halstead, Kansas. */

    attached mail follows:


    Well, in the process of pulling out some code into a sample page to send to the list I found the problem. It was yesterday when someone who was testing it told me about the problem, but the problem must have been going on for a week, because a week ago I added code to a global include script that checked to see if magic quotes was on and then did a stripslashes on all the values in $_POST if they were. So that ended up doing a stripslashes on the string "Array" and replacing $_POST['interests']. So I expanded the routine that striped the slashes so that it checks first to see if the element is an array.

    Cheers --Dan

    attached mail follows:


    I have a small site in development which takes details of coming church services from a MySQL database. This bit is at the bottom of http://www.rugbyurc.org.uk/spirit/spirit_intro.php (hosted by an ISP) and works fine.

    I've just got OSX working on my Mac and want to get the site running on that so that I can develop it further. I am using the code below (this is a much reduced version of what's on the live site), but getting no data. Nor am I getting any error message.

    I can access and use the database from Terminal. I can also get the data from the same query using Lasso (a middleware program similar to php), so I know the data is there to be found.

    Any suggestions about why the data is not showing up in the browser with php will be much appreciated.

    <table border="0">

    <?php $userName='xxx'; $pswd='yyy'; error_reporting(E_ALL); require_once('DB.php'); $db = DB::connect("Mysql://$userName:$pswd127.0.0.1/rurcdb"); if (DB::iserror($db)) { die($db->getMessage()); } $sql = "SELECT speaker FROM rurcdb.diary"; $q = $db->query($sql); if (DB::iserror($q)){ die($q->getMessage()); } while ($q->fetchInto($row)){ echo "<tr><td>".($row[0])."</td></tr>"; } ?> </table>

    Roddie Grant roddiemyword.co.uk

    attached mail follows:


    i need a script that make downloads from files but it must support resuming for getright and download acelerator pro. Thanks... I have this classic download script , but does not support resuming error_reporting(0); header("Last-Modified: " . gmdate("D, d M Y H:i:s T", filemtime($filename))); header("Accept-Ranges: bytes"); header("Content-Length: " . filesize($filename)); header("Content-Disposition: attachment; filename=" . $download); // header("Content-Type: application/octet-stream"); readfile($filename); header("Connection: close");

    attached mail follows:


    I have never done a script that supports resume but this is the logic you need to follow to work out the protocol behaviour.

    - Create a download script as per below start downloading then stop the web server. - Change the script to e-mail you the headers from the script request. - Restart the web server and tell Get Right to resume.

    You should now know what it sends and you simply need to read in the file to that point in the data and start the stream again.

    I hope this helps. (Trial and Error)

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

    > -----Original Message----- > From: Martin [mailto:martinacevedoarnet.com.ar] > Sent: Wednesday, 22 January 2003 12:50 AM > To: php-generallists.php.net > Subject: [PHP] download script > > > i need a script that make downloads from files but it must > support resuming for getright and download acelerator pro. > Thanks... I have this classic download script , but does not > support resuming > error_reporting(0); > header("Last-Modified: " . gmdate("D, d M Y H:i:s T", > filemtime($filename))); > header("Accept-Ranges: bytes"); > header("Content-Length: " . filesize($filename)); > header("Content-Disposition: attachment; filename=" . > $download); > // header("Content-Type: application/octet-stream"); > readfile($filename); > header("Connection: close"); > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Instead, find out exactly what headers it is that Getright sends. Store the resume point in $resume_bytecount Then, have your script do something like this:

    /** Send the appropriate HTML headers **/ /** Do this instead of the fpassthru **/ $filesize = size($filename); $fp = fopen('$filename','r'); while ($byte_count < $resume_bytecount) { fread($fp,1); $byte_count = $byte_count + 1; } while(!feof($fp)) { print(read($fp, 8192)); flush(); }

    Simple, read the file until resume point Then, send the file with an 8k blocksize (standard I believe, change as necessary)

    Matt

    ----- Original Message ----- From: Timothy Hitchens (HiTCHO) <hitchophp.net> To: 'Martin' <martinacevedoarnet.com.ar>; <php-generallists.php.net> Sent: Tuesday, January 21, 2003 10:08 AM Subject: RE: [PHP] download script

    > I have never done a script that supports resume but this is the logic > you need to follow to work out the protocol behaviour. > > - Create a download script as per below start downloading then stop the > web server. > - Change the script to e-mail you the headers from the script request. > - Restart the web server and tell Get Right to resume. > > You should now know what it sends and you simply need to read in the > file to that point > in the data and start the stream again. > > I hope this helps. (Trial and Error) > > > Timothy Hitchens (HiTCHO) > Open Source Consulting > e-mail: timhitcho.com.au > > > -----Original Message----- > > From: Martin [mailto:martinacevedoarnet.com.ar] > > Sent: Wednesday, 22 January 2003 12:50 AM > > To: php-generallists.php.net > > Subject: [PHP] download script > > > > > > i need a script that make downloads from files but it must > > support resuming for getright and download acelerator pro. > > Thanks... I have this classic download script , but does not > > support resuming > > error_reporting(0); > > header("Last-Modified: " . gmdate("D, d M Y H:i:s T", > > filemtime($filename))); > > header("Accept-Ranges: bytes"); > > header("Content-Length: " . filesize($filename)); > > header("Content-Disposition: attachment; filename=" . > > $download); > > // header("Content-Type: application/octet-stream"); > > readfile($filename); > > header("Connection: close"); > > > > > > > > -- > > 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:


    Hello all,

    I'm trying to replace a tag with an include in a template scenario. For example:

    str_replace("<!--linkTag--!>", include "links.php", $string);

    This obviously doesn't work, but I'm wondering if anybody knows of a good way to do this.

    Thanks a bunch,

    Jesse Lawrence

    attached mail follows:


    I'd recommend looking at the output buffering functions. Something like this would probably work...

    ob_start(); include("links.php"); $file = ob_get_contents(); ob_end_clean();

    The result of parsing and executing links.php will be in $file. Do with it what you will.

    J

    Jesse wrote:

    > Hello all, > > I'm trying to replace a tag with an include in a template scenario. For > example: > > str_replace("<!--linkTag--!>", include "links.php", $string); > > This obviously doesn't work, but I'm wondering if anybody knows of a > good way to do this. > > Thanks a bunch, > > Jesse Lawrence

    attached mail follows:


    There a few ways of doing this but the following is one of the easier and quickest off the top of my head.

    If you know the name of the tag and the include this will work if you don't or want it to be dynamic you will need to have some reg for the following. (how are you getting the $string)?

    // $string holds your html page you wish to replace

    ob_start();

    include('links.php');

    $links = ob_get_contents();

    ob_end_clean();

    str_replace('<!--linkTag--!>', $links, $string);

    echo $string;

    I hope this gives you a direction.

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

    > -----Original Message----- > From: jesse [mailto:lawrence_jesseyahoo.ca] > Sent: Wednesday, 22 January 2003 1:05 AM > To: php-generallists.php.net > Subject: [PHP] str_replace an include > > > Hello all, > > I'm trying to replace a tag with an include in a template > scenario. For > example: > > str_replace("<!--linkTag--!>", include "links.php", $string); > > This obviously doesn't work, but I'm wondering if anybody knows of a > good way to do this. > > Thanks a bunch, > > Jesse Lawrence > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Thanks a lot, I think that will be the trick, but I'm still having a bit of a problem.

    Here's my scenario:

    class mainReplace{

    function feedLinks(){ ob_start(); include('links.php'); $file = ob_get_contents(); ob_end_clean(); return $file; } }

    $replace = new mainReplace;

    $read = str_replace('<!--feedLinks--!>', $replace->feedLinks(), $read); print $read;

    Unfortunately, this is not printing the results of the file include where is should have been replaced. If, however, I say: print $replace->feedLinks() it prints out the results.

    Any suggestions?

    Thanks again,

    Jesse Lawrence

    J Smith wrote: > I'd recommend looking at the output buffering functions. Something like this > would probably work... > > ob_start(); > include("links.php"); > $file = ob_get_contents(); > ob_end_clean(); > > The result of parsing and executing links.php will be in $file. Do with it > what you will. > > J > > > Jesse wrote: > > >>Hello all, >> >>I'm trying to replace a tag with an include in a template scenario. For >> example: >> >>str_replace("<!--linkTag--!>", include "links.php", $string); >> >>This obviously doesn't work, but I'm wondering if anybody knows of a >>good way to do this. >> >>Thanks a bunch, >> >>Jesse Lawrence > >

    attached mail follows:


    Where are you getting $read from??

    That should be $replace = new mainReplace(); // notice the brackets

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

    > -----Original Message----- > From: jesse [mailto:lawrence_jesseyahoo.ca] > Sent: Wednesday, 22 January 2003 1:38 AM > To: php-generallists.php.net > Subject: [PHP] Re: str_replace an include > > > Thanks a lot, I think that will be the trick, but I'm still > having a bit > of a problem. > > Here's my scenario: > > class mainReplace{ > > function feedLinks(){ > ob_start(); > include('links.php'); > $file = ob_get_contents(); > ob_end_clean(); > return $file; > } > } > > $replace = new mainReplace; > > $read = str_replace('<!--feedLinks--!>', > $replace->feedLinks(), $read); print $read; > > > Unfortunately, this is not printing the results of the file include > where is should have been replaced. If, however, I say: > print $replace->feedLinks() > it prints out the results. > > Any suggestions? > > Thanks again, > > Jesse Lawrence > > > > > J Smith wrote: > > I'd recommend looking at the output buffering functions. Something > > like this > > would probably work... > > > > ob_start(); > > include("links.php"); > > $file = ob_get_contents(); > > ob_end_clean(); > > > > The result of parsing and executing links.php will be in $file. Do > > with it > > what you will. > > > > J > > > > > > Jesse wrote: > > > > > >>Hello all, > >> > >>I'm trying to replace a tag with an include in a template > scenario. > >>For > >> example: > >> > >>str_replace("<!--linkTag--!>", include "links.php", $string); > >> > >>This obviously doesn't work, but I'm wondering if anybody > knows of a > >>good way to do this. > >> > >>Thanks a bunch, > >> > >>Jesse Lawrence > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Timothy Hitchens ) wrote: > Where are you getting $read from?? > > That should be $replace = new mainReplace(); // notice the brackets

    $read is the contents of the file that I'm reading. I actually do have $replace = new mainReplace(); in my code, I just forgot the brackets in my last message;)

    > > > Timothy Hitchens (HiTCHO) > Open Source Consulting > e-mail: timhitcho.com.au > > >>-----Original Message----- >>From: jesse [mailto:lawrence_jesseyahoo.ca] >>Sent: Wednesday, 22 January 2003 1:38 AM >>To: php-generallists.php.net >>Subject: [PHP] Re: str_replace an include >> >> >>Thanks a lot, I think that will be the trick, but I'm still >>having a bit >>of a problem. >> >>Here's my scenario: >> >>class mainReplace{ >> >> function feedLinks(){ >> ob_start(); >> include('links.php'); >> $file = ob_get_contents(); >> ob_end_clean(); >> return $file; >> } >>} >> >>$replace = new mainReplace; >> >>$read = str_replace('<!--feedLinks--!>', >>$replace->feedLinks(), $read); print $read; >> >> >>Unfortunately, this is not printing the results of the file include >>where is should have been replaced. If, however, I say: >> print $replace->feedLinks() >>it prints out the results. >> >>Any suggestions? >> >>Thanks again, >> >>Jesse Lawrence >> >> >> >> >>J Smith wrote: >> >>>I'd recommend looking at the output buffering functions. Something >>>like this >>>would probably work... >>> >>>ob_start(); >>>include("links.php"); >>>$file = ob_get_contents(); >>>ob_end_clean(); >>> >>>The result of parsing and executing links.php will be in $file. Do >>>with it >>>what you will. >>> >>>J >>> >>> >>>Jesse wrote: >>> >>> >>> >>>>Hello all, >>>> >>>>I'm trying to replace a tag with an include in a template >>> >>scenario. >> >>>>For >>>> example: >>>> >>>>str_replace("<!--linkTag--!>", include "links.php", $string); >>>> >>>>This obviously doesn't work, but I'm wondering if anybody >>> >>knows of a >> >>>>good way to do this. >>>> >>>>Thanks a bunch, >>>> >>>>Jesse Lawrence >>> >>> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> > >

    attached mail follows:


    I can't see what else to suggest just quickly.

    - what about just as a function not a class??

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

    > -----Original Message----- > From: jesse [mailto:lawrence_jesseyahoo.ca] > Sent: Wednesday, 22 January 2003 2:12 AM > To: php-generallists.php.net > Subject: Re: [PHP] Re: str_replace an include > > > > > Timothy Hitchens ) wrote: > > Where are you getting $read from?? > > > > That should be $replace = new mainReplace(); // notice the brackets > > $read is the contents of the file that I'm reading. I > actually do have $replace = new mainReplace(); in my code, I > just forgot the brackets in > my last message;) > > > > > > > > > > > > > > > > > > > > Timothy Hitchens (HiTCHO) > > Open Source Consulting > > e-mail: timhitcho.com.au > > > > > >>-----Original Message----- > >>From: jesse [mailto:lawrence_jesseyahoo.ca] > >>Sent: Wednesday, 22 January 2003 1:38 AM > >>To: php-generallists.php.net > >>Subject: [PHP] Re: str_replace an include > >> > >> > >>Thanks a lot, I think that will be the trick, but I'm still > >>having a bit > >>of a problem. > >> > >>Here's my scenario: > >> > >>class mainReplace{ > >> > >> function feedLinks(){ > >> ob_start(); > >> include('links.php'); > >> $file = ob_get_contents(); > >> ob_end_clean(); > >> return $file; > >> } > >>} > >> > >>$replace = new mainReplace; > >> > >>$read = str_replace('<!--feedLinks--!>', > >>$replace->feedLinks(), $read); print $read; > >> > >> > >>Unfortunately, this is not printing the results of the file include > >>where is should have been replaced. If, however, I say: > >> print $replace->feedLinks() > >>it prints out the results. > >> > >>Any suggestions? > >> > >>Thanks again, > >> > >>Jesse Lawrence > >> > >> > >> > >> > >>J Smith wrote: > >> > >>>I'd recommend looking at the output buffering functions. Something > >>>like this > >>>would probably work... > >>> > >>>ob_start(); > >>>include("links.php"); > >>>$file = ob_get_contents(); > >>>ob_end_clean(); > >>> > >>>The result of parsing and executing links.php will be in $file. Do > >>>with it > >>>what you will. > >>> > >>>J > >>> > >>> > >>>Jesse wrote: > >>> > >>> > >>> > >>>>Hello all, > >>>> > >>>>I'm trying to replace a tag with an include in a template > >>> > >>scenario. > >> > >>>>For > >>>> example: > >>>> > >>>>str_replace("<!--linkTag--!>", include "links.php", $string); > >>>> > >>>>This obviously doesn't work, but I'm wondering if anybody > >>> > >>knows of a > >> > >>>>good way to do this. > >>>> > >>>>Thanks a bunch, > >>>> > >>>>Jesse Lawrence > >>> > >>> > >> > >>-- > >>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'll give it a try. I might just put the contents of the include file into the main file, and approach it like that.

    Thanks a lot for your help.

    Timothy Hitchens ) wrote: > I can't see what else to suggest just quickly. > > - what about just as a function not a class?? > > > > Timothy Hitchens (HiTCHO) > Open Source Consulting > e-mail: timhitcho.com.au > > >>-----Original Message----- >>From: jesse [mailto:lawrence_jesseyahoo.ca] >>Sent: Wednesday, 22 January 2003 2:12 AM >>To: php-generallists.php.net >>Subject: Re: [PHP] Re: str_replace an include >> >> >> >> >>Timothy Hitchens ) wrote: >> >>>Where are you getting $read from?? >>> >>>That should be $replace = new mainReplace(); // notice the brackets >> >>$read is the contents of the file that I'm reading. I >>actually do have $replace = new mainReplace(); in my code, I >>just forgot the brackets in >>my last message;) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>> >>>Timothy Hitchens (HiTCHO) >>>Open Source Consulting >>>e-mail: timhitcho.com.au >>> >>> >>> >>>>-----Original Message----- >>>>From: jesse [mailto:lawrence_jesseyahoo.ca] >>>>Sent: Wednesday, 22 January 2003 1:38 AM >>>>To: php-generallists.php.net >>>>Subject: [PHP] Re: str_replace an include >>>> >>>> >>>>Thanks a lot, I think that will be the trick, but I'm still >>>>having a bit >>>>of a problem. >>>> >>>>Here's my scenario: >>>> >>>>class mainReplace{ >>>> >>>> function feedLinks(){ >>>> ob_start(); >>>> include('links.php'); >>>> $file = ob_get_contents(); >>>> ob_end_clean(); >>>> return $file; >>>> } >>>>} >>>> >>>>$replace = new mainReplace; >>>> >>>>$read = str_replace('<!--feedLinks--!>', >>>>$replace->feedLinks(), $read); print $read; >>>> >>>> >>>>Unfortunately, this is not printing the results of the file include >>>>where is should have been replaced. If, however, I say: >>>> print $replace->feedLinks() >>>>it prints out the results. >>>> >>>>Any suggestions? >>>> >>>>Thanks again, >>>> >>>>Jesse Lawrence >>>> >>>> >>>> >>>> >>>>J Smith wrote: >>>> >>>> >>>>>I'd recommend looking at the output buffering functions. Something >>>>>like this >>>>>would probably work... >>>>> >>>>>ob_start(); >>>>>include("links.php"); >>>>>$file = ob_get_contents(); >>>>>ob_end_clean(); >>>>> >>>>>The result of parsing and executing links.php will be in $file. Do >>>>>with it >>>>>what you will. >>>>> >>>>>J >>>>> >>>>> >>>>>Jesse wrote: >>>>> >>>>> >>>>> >>>>> >>>>>>Hello all, >>>>>> >>>>>>I'm trying to replace a tag with an include in a template >>>>> >>>>scenario. >>>> >>>> >>>>>>For >>>>>>example: >>>>>> >>>>>>str_replace("<!--linkTag--!>", include "links.php", $string); >>>>>> >>>>>>This obviously doesn't work, but I'm wondering if anybody >>>>> >>>>knows of a >>>> >>>> >>>>>>good way to do this. >>>>>> >>>>>>Thanks a bunch, >>>>>> >>>>>>Jesse Lawrence >>>>> >>>>> >>>>-- >>>>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:


    try: $aux = $replace->feedLinks(); $read = str_replace('<!--feedLinks--!>', $aux, $read);

    attached mail follows:


    I hope this is not too far OT, however, you are the best resource I have for PHP and if anyone would know, it would be you guys. I have been writing scripts off and on for the past year and have an application written in PHP for a business' internal use. I have used snippets of Object oriented code from other people here and there to get by and I have read information on OOP in a couple of different places. However, my mind apparently works different and I keep trying to relate the OOP structure to what I already know which equates an object to a function. I am resolving to purchase a book dedicated to instruction in the inns and outs of OOP. Specifically at it relates to PHP would be great but my emphasis is towards something that teaches someone that is stubborn in his reliance on previously learned methods. I hope this makes sense and I'm not alone on this. :) Any suggestions would be greatly appreciated!

    Larry S. Brown Dimension Networks, Inc. (727) 723-8388

    attached mail follows:


    > -----Original Message----- > >However, my mind apparently works different and I keep trying to relate the OOP structure to > what I already know which equates an object to a function. I am resolving

    > to purchase a book dedicated to instruction in the inns and outs of OOP. > Specifically at it relates to PHP would be great but my emphasis is towards > something that teaches someone that is stubborn in his reliance on previously learned > methods. I hope this makes sense and I'm not alone on this. :)

    My only suggestion is that you re-consider why you want to take up OOP. If a procedural approach works for you, go with it. It's not like we're building air traffic control systems here ;)

    Kirk

    attached mail follows:


    Larry Brown said: > equates an object to a function

    You'd be better off trying to equate an object to a data type.

    -Peter

    attached mail follows:


    > > equates an object to a function > You'd be better off trying to equate an object to a data type.

    Why is that? Please explain? I do not mean to sound trite. I do not know and am very curious to hear more.

    Chris

    attached mail follows:


    Chris Boget said: >> > equates an object to a function >> You'd be better off trying to equate an object to a data type. > > Why is that? Please explain? > I do not mean to sound trite. I do not know and am very curious > to hear more.

    Consider two approaches to extending your procedural programming knowledge to OOP.

    Think of an object as a user-defined data type (that also includes functions).

    Think of an object as a bunch of functions (and some variables).

    The second is awkward and doesn't capture the purpose of OO.

    The real beauty of OO is that it is "data centric" and it allows the member functions of an object to be easily testable black-boxes.

    Good luck!

    -Peter

    attached mail follows:


    The only reason I feel the need to expand my understanding is that I have to learn other concepts to produce my client's solutions. For instance I am now being asked to use SOAP to communicate with a vendor of his. Now I am reading about SOAP and frequently the descriptions rely on the reader's understanding of OOP. I can individually scrutinize a description and break it down to its elements. Then I can picture what is being said, but without having used those methods in my code, it is frustrating reading. I don't know that SOAP is in and of itself OOP but people that write about it use OOP based consepts to exlain what is happening. And this is one example. Don't let me go into the Java and Javascript world!

    Larry S. Brown Dimension Networks, Inc. (727) 723-8388

    -----Original Message----- From: Johnson, Kirk [mailto:kjohnsonzootweb.com] Sent: Tuesday, January 21, 2003 10:40 AM To: PHP List Subject: RE: [PHP] dreading OOP

    > -----Original Message----- > >However, my mind apparently works different and I keep trying to relate the OOP structure to > what I already know which equates an object to a function. I am resolving

    > to purchase a book dedicated to instruction in the inns and outs of OOP. > Specifically at it relates to PHP would be great but my emphasis is towards > something that teaches someone that is stubborn in his reliance on previously learned > methods. I hope this makes sense and I'm not alone on this. :)

    My only suggestion is that you re-consider why you want to take up OOP. If a procedural approach works for you, go with it. It's not like we're building air traffic control systems here ;)

    Kirk

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

    attached mail follows:


    The easiest way for me to explain and understand OOP was to think of it this way.

    You have an object and in that object contains functions that only pertain to that one object. See diagram below.

    Object1 | |_____ function1 | |_____ function2 . . .... etc

    Object2 | |_____ function1 | |_____ function2 . . .... etc

    Note: Inside an object you can have functions that have the same name as other functions inside another object. This makes life really easy if you have to share code with someone because if you are totally procedural/functions you might have some functions with the same name and then your code won't work. However, if you place your functions inside an object you can avoid this problem all together.. kind of nice isn't it? :)

    Anyway, that's how I explain OOP in a nutshell to people that don't understand. Just don't forget there are a TON of other things about OOP but once you get the basic idea of how it works down (like this) then the rest is pretty easy to pick up and understand.

    Hope this helps!

    ----- Original Message ----- From: "Larry Brown" <larry.browndimensionnetworks.com> To: "PHP List" <php-generallists.php.net> Sent: Tuesday, January 21, 2003 11:31 AM Subject: RE: [PHP] dreading OOP

    > The only reason I feel the need to expand my understanding is that I have to > learn other concepts to produce my client's solutions. For instance I am > now being asked to use SOAP to communicate with a vendor of his. Now I am > reading about SOAP and frequently the descriptions rely on the reader's > understanding of OOP. I can individually scrutinize a description and break > it down to its elements. Then I can picture what is being said, but without > having used those methods in my code, it is frustrating reading. I don't > know that SOAP is in and of itself OOP but people that write about it use > OOP based consepts to exlain what is happening. And this is one example. > Don't let me go into the Java and Javascript world! > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > -----Original Message----- > From: Johnson, Kirk [mailto:kjohnsonzootweb.com] > Sent: Tuesday, January 21, 2003 10:40 AM > To: PHP List > Subject: RE: [PHP] dreading OOP > > > > -----Original Message----- > > > >However, my mind apparently works different and I keep trying to relate the > OOP structure to > > what I already know which equates an object to a function. I am resolving > > > to purchase a book dedicated to instruction in the inns and outs of OOP. > > Specifically at it relates to PHP would be great but my emphasis is > towards > > something that teaches someone that is stubborn in his reliance on > previously learned > > methods. I hope this makes sense and I'm not alone on this. :) > > My only suggestion is that you re-consider why you want to take up OOP. If a > procedural approach works for you, go with it. It's not like we're building > air traffic control systems here ;) > > Kirk > > -- > 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:


    Is it possible to use array_sum to add up values in multidimensional arrays? I have an array like:

    $array[0]["VALUE"] = 10; $array[1]["VALUE"] = 8; $array[2]["VALUE"] = 5;

    $array[0]["OTHERVALUE"] = 20; $array[1]["OTHERVALUE"] = 15; $array[2]["OTHERVALUE"] = 9;

    Thanks, Chad

    attached mail follows:


    Could someone point me to a VERY good doc for learning PHP for a NEWBIE!!! Something I can understand from the beginning to the end. YES I am willing to put my time into learning and reading docs as long as they are clear and made for what they say they are made for. I wont waste my time with something for a second if it isn't clear to me and easy to understand. Thanks in advance.

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

    iD8DBQE+LWu2Gxvk+IMbNvARAgMGAKC67pdUcB5ziA5CmA1eFqgd5QOZ4gCfZObu pvuIJmRuOQpf46P7RK9gZdg= =NJzw -----END PGP SIGNATURE-----

    attached mail follows:


    Have a look on devshed.com

    Bryan Cassidy wrote: > Could someone point me to a VERY good doc for learning PHP for a > NEWBIE!!! Something I can understand from the beginning to the end. YES > I am willing to put my time into learning and reading docs as long as > they are clear and made for what they say they are made for. I wont > waste my time with something for a second if it isn't clear to me and > easy to understand. Thanks in advance.

    -- 
    ----------------------
      www.curvedvision.com
    ----------------------
    

    attached mail follows:


    This is geared to php and mysql but I started by downloading the first four chapters of this book, which are free.

    http://sitepoint.com/books/?bookid=kevinyank

    Eddie -----Original Message----- From: Neil Freeman [mailto:neil.freemanasa.co.uk] Sent: Tuesday, January 21, 2003 10:52 AM To: Bryan Cassidy Cc: php-generallists.php.net Subject: Re: [PHP] Newbie Questions

    Have a look on devshed.com

    Bryan Cassidy wrote: > Could someone point me to a VERY good doc for learning PHP for a > NEWBIE!!! Something I can understand from the beginning to the end. YES > I am willing to put my time into learning and reading docs as long as > they are clear and made for what they say they are made for. I wont > waste my time with something for a second if it isn't clear to me and > easy to understand. Thanks in advance.

    --
    ----------------------
      www.curvedvision.com
    ----------------------
    

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

    attached mail follows:


    Bryan --

    [BTW, I could not find your key on us.php.net or eu.php.net; is it on a keyserver?]

    ...and then Bryan Cassidy said... % % Could someone point me to a VERY good doc for learning PHP for a % NEWBIE!!! Something I can understand from the beginning to the end. YES

    Do you have any programming or scripting experience? If you know even a bit of something it's generally helpful when you want to pick up something else.

    I speak perl and shell well, do a lot of scripting, and can read some C (plus other things that have faded into memory :-) When I hadn't yet met php at all, a buddy bought me the PHP Developer's Cookbook from SAMS and it was easy to understand and presented some useful examples, and I was able to get started and do the work he wanted me to do (when I tried twice to thank him for the book he told me to shut up because "it's a self-serving gift" :-) It's no "Learning Perl", but then again it isn't supposed to be.

    Having worked my way through that, currently my only reference is the php manual from the web site; a quick search will take me to any function that I want to use, and only rarely am I stumped with a "how would I even approach this task?" problem -- and then this mailing list is wonderfully helpful.

    HTH & HAND

    :-D

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

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

    iD8DBQE+LW6dGb7uCXufRwARAm78AJ9cctXvlYL8yEgkImPkY6Cg8iTAQQCg360o 6qh6cKH7zEPPb0oCHIApqpI= =0zRI -----END PGP SIGNATURE-----

    attached mail follows:


    I just know some very basic html. lol. ya i know i know. I just havent had time to set down and learn the things I want to learn until now.

    On Tue, 21 Jan 2003 11:00:29 -0500 David T-G <davidtg-phpjustpickone.org> wrote:

    > Bryan -- > > [BTW, I could not find your key on us.php.net or eu.php.net; is it on > a keyserver?] > > ...and then Bryan Cassidy said... > % > % Could someone point me to a VERY good doc for learning PHP for a > % NEWBIE!!! Something I can understand from the beginning to the end. > YES > > Do you have any programming or scripting experience? If you know even > a bit of something it's generally helpful when you want to pick up > something else. > > I speak perl and shell well, do a lot of scripting, and can read some > C(plus other things that have faded into memory :-) When I hadn't yet > met php at all, a buddy bought me the PHP Developer's Cookbook from > SAMS and it was easy to understand and presented some useful examples, > and I was able to get started and do the work he wanted me to do (when > I tried twice to thank him for the book he told me to shut up because > "it's a self-serving gift" :-) It's no "Learning Perl", but then > again it isn't supposed to be. > > Having worked my way through that, currently my only reference is the > php manual from the web site; a quick search will take me to any > function that I want to use, and only rarely am I stumped with a "how > would I even approach this task?" problem -- and then this mailing > list is wonderfully helpful. > > > HTH & HAND > > :-D > -- > David T-G * There is too much animal courage in > (play) davidtgjustpickone.org * society and not sufficient moral > courage.(work) davidtgworkjustpickone.org -- Mary Baker Eddy, > "Science and Health" http://justpickone.org/davidtg/ Shpx gur > Pbzzhavpngvbaf Qrprapl Npg! > >

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

    iD8DBQE+LXCXGxvk+IMbNvARAhfPAJ9BDz1Ys+DnqrKWRDeWBTWUI/UClgCgxi2I LGJBwA0rlhJGcg8cKyFWIJM= =hiE/ -----END PGP SIGNATURE-----

    attached mail follows:


    Also checkout webmonkey.com and devarticles.com

    =P e p i e D e s i g n s www.pepiedesigns.com Providing Solutions That Increase Productivity

    Web Developement. Database. Hosting. Multimedia.

    On Tue, 21 Jan 2003, Neil Freeman wrote:

    > Have a look on devshed.com > > Bryan Cassidy wrote: > > Could someone point me to a VERY good doc for learning PHP for a > > NEWBIE!!! Something I can understand from the beginning to the end. YES > > I am willing to put my time into learning and reading docs as long as > > they are clear and made for what they say they are made for. I wont > > waste my time with something for a second if it isn't clear to me and > > easy to understand. Thanks in advance. > > -- > ---------------------- > www.curvedvision.com > ---------------------- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    PHP 4.3.0, Apache, Win32.

    I'm driving myself mad trying to work out why I can't get HTTPS pages. I understand there are two options, using fopen() with openssl installed, and using curl. I've installed openssl extension, but using fopen STILL won't work. Don't have a clue why. Using curl, I can get the page easily enough, but I can't put it into the file. If I try to set a file resource to save it to, Apache crashes.

    Here's the error message I get using fopen("https://[securewebsite]", "r");

    Warning: fopen(https://blahblahblah) [function.fopen]: failed to create stream: No such file or directory in blah\blah\blah.php on line 50

    And when I try to use Curl to save the https file, I get this:

    APACHE caused an invalid page fault in module KERNEL32.DLL at 0187:bff7b9a6. Registers: EAX=00000000 CS=0187 EIP=bff7b9a6 EFLGS=00000246 EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0 ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7 EDX=7803b710 ES=018f EDI=100be740 GS=0000 Bytes at CS:EIP: ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24 Stack dump: 00000032 00fd5131 7803b730 00fd523b 7803b710 00000032 00000001 00fc1ee8 00ff48ac 00000001 00000032 7803b710 00000032 00ff4240 00ff48ac 00ff4801

    Here is the code I'm using at that section:

    $ch = curl_init ("https://blahblahblah"); $fp = fopen ("output.txt", "w"); curl_setopt ($ch, CURLOPT_FILE, $fp); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_exec ($ch); $ce = curl_error($ch); curl_close ($ch); fclose ($fp);

    This is really driving me mad, someone please help :-(

    attached mail follows:


    Is fopen_wrapper in php.ini set to yes ?

    Jonathan Boles wrote: > PHP 4.3.0, Apache, Win32. > > I'm driving myself mad trying to work out why I can't get HTTPS pages. I > understand there are two options, using fopen() with openssl installed, and > using curl. I've installed openssl extension, but using fopen STILL won't > work. Don't have a clue why. Using curl, I can get the page easily enough, > but I can't put it into the file. If I try to set a file resource to save it > to, Apache crashes. > > Here's the error message I get using fopen("https://[securewebsite]", "r"); > > Warning: fopen(https://blahblahblah) [function.fopen]: failed to create > stream: No such file or directory in blah\blah\blah.php on line 50 > > > > And when I try to use Curl to save the https file, I get this: > > APACHE caused an invalid page fault in > module KERNEL32.DLL at 0187:bff7b9a6. > Registers: > EAX=00000000 CS=0187 EIP=bff7b9a6 EFLGS=00000246 > EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0 > ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7 > EDX=7803b710 ES=018f EDI=100be740 GS=0000 > Bytes at CS:EIP: > ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24 > Stack dump: > 00000032 00fd5131 7803b730 00fd523b 7803b710 00000032 00000001 00fc1ee8 > 00ff48ac 00000001 00000032 7803b710 00000032 00ff4240 00ff48ac 00ff4801 > > > Here is the code I'm using at that section: > > $ch = curl_init ("https://blahblahblah"); > $fp = fopen ("output.txt", "w"); > curl_setopt ($ch, CURLOPT_FILE, $fp); > curl_setopt ($ch, CURLOPT_HEADER, 0); > curl_exec ($ch); > $ce = curl_error($ch); > curl_close ($ch); > fclose ($fp); > > > > This is really driving me mad, someone please help :-( > > > > >

    -- 
    IPv6 + TCPA + wrecked Palladium server = NO COFFE!
    

    attached mail follows:


    Do you mean allow_url_fopen? It is set to 'on'. There's no fopen_wrapper setting

    Reading from http:// using fopen works fine. It's the https:// that doesn't work.

    ----- Original Message ----- From: "Stephan Seidt" <blizz0x03.net> To: "Jonathan Boles" <jabolesihug.com.au> Cc: <php-generallists.php.net> Sent: Wednesday, January 22, 2003 3:02 AM Subject: Re: [PHP] Can't get HTTPS -- driving me mad -- please help

    > Is fopen_wrapper in php.ini set to yes ? > > Jonathan Boles wrote: > > PHP 4.3.0, Apache, Win32. > > > > I'm driving myself mad trying to work out why I can't get HTTPS pages. I > > understand there are two options, using fopen() with openssl installed, and > > using curl. I've installed openssl extension, but using fopen STILL won't > > work. Don't have a clue why. Using curl, I can get the page easily enough, > > but I can't put it into the file. If I try to set a file resource to save it > > to, Apache crashes. > > > > Here's the error message I get using fopen("https://[securewebsite]", "r"); > > > > Warning: fopen(https://blahblahblah) [function.fopen]: failed to create > > stream: No such file or directory in blah\blah\blah.php on line 50 > > > > > > > > And when I try to use Curl to save the https file, I get this: > > > > APACHE caused an invalid page fault in > > module KERNEL32.DLL at 0187:bff7b9a6. > > Registers: > > EAX=00000000 CS=0187 EIP=bff7b9a6 EFLGS=00000246 > > EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0 > > ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7 > > EDX=7803b710 ES=018f EDI=100be740 GS=0000 > > Bytes at CS:EIP: > > ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24 > > Stack dump: > > 00000032 00fd5131 7803b730 00fd523b 7803b710 00000032 00000001 00fc1ee8 > > 00ff48ac 00000001 00000032 7803b710 00000032 00ff4240 00ff48ac 00ff4801 > > > > > > Here is the code I'm using at that section: > > > > $ch = curl_init ("https://blahblahblah"); > > $fp = fopen ("output.txt", "w"); > > curl_setopt ($ch, CURLOPT_FILE, $fp); > > curl_setopt ($ch, CURLOPT_HEADER, 0); > > curl_exec ($ch); > > $ce = curl_error($ch); > > curl_close ($ch); > > fclose ($fp); > > > > > > > > This is really driving me mad, someone please help :-( > > > > > > > > > > > > > -- > IPv6 + TCPA + wrecked Palladium server = NO COFFE! > >

    attached mail follows:


    This seems to have fixed the problem :-) But there's another error. fopen works now, but fgets won't. I'm getting this error:

    Warning: fgets() [function.fgets]: SSL: fatal protocol error in blah\blah\blah.php on line 51

    Does anyone know what could be causing this?

    > PHP 4.3.0, Apache, Win32. > > Here's the error message I get using fopen("https://[securewebsite]", "r"); > > Warning: fopen(https://blahblahblah) [function.fopen]: failed to create > stream: No such file or directory in blah\blah\blah.php on line 50

    Hi Jonathan,

    Don't know what the problem is, but other people seem to have the same problem. Read the user note on the bottom of this page: http://uk.php.net/manual/en/wrappers.php

    Hope this helps; JOn

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    "Jonathan Boles" <jabolesihug.com.au> wrote in message news:000f01c2c16a$ea4b6920$5c8dadcbgrayw... > Do you mean allow_url_fopen? It is set to 'on'. There's no fopen_wrapper > setting > > Reading from http:// using fopen works fine. It's the https:// that doesn't > work. > > ----- Original Message ----- > From: "Stephan Seidt" <blizz0x03.net> > To: "Jonathan Boles" <jabolesihug.com.au> > Cc: <php-generallists.php.net> > Sent: Wednesday, January 22, 2003 3:02 AM > Subject: Re: [PHP] Can't get HTTPS -- driving me mad -- please help > > > > Is fopen_wrapper in php.ini set to yes ? > > > > Jonathan Boles wrote: > > > PHP 4.3.0, Apache, Win32. > > > > > > I'm driving myself mad trying to work out why I can't get HTTPS pages. I > > > understand there are two options, using fopen() with openssl installed, > and > > > using curl. I've installed openssl extension, but using fopen STILL > won't > > > work. Don't have a clue why. Using curl, I can get the page easily > enough, > > > but I can't put it into the file. If I try to set a file resource to > save it > > > to, Apache crashes. > > > > > > Here's the error message I get using fopen("https://[securewebsite]", > "r"); > > > > > > Warning: fopen(https://blahblahblah) [function.fopen]: failed to create > > > stream: No such file or directory in blah\blah\blah.php on line 50 > > > > > > > > > > > > And when I try to use Curl to save the https file, I get this: > > > > > > APACHE caused an invalid page fault in > > > module KERNEL32.DLL at 0187:bff7b9a6. > > > Registers: > > > EAX=00000000 CS=0187 EIP=bff7b9a6 EFLGS=00000246 > > > EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0 > > > ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7 > > > EDX=7803b710 ES=018f EDI=100be740 GS=0000 > > > Bytes at CS:EIP: > > > ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24 > > > Stack dump: > > > 00000032 00fd5131 7803b730 00fd523b 7803b710 00000032 00000001 00fc1ee8 > > > 00ff48ac 00000001 00000032 7803b710 00000032 00ff4240 00ff48ac 00ff4801 > > > > > > > > > Here is the code I'm using at that section: > > > > > > $ch = curl_init ("https://blahblahblah"); > > > $fp = fopen ("output.txt", "w"); > > > curl_setopt ($ch, CURLOPT_FILE, $fp); > > > curl_setopt ($ch, CURLOPT_HEADER, 0); > > > curl_exec ($ch); > > > $ce = curl_error($ch); > > > curl_close ($ch); > > > fclose ($fp); > > > > > > > > > > > > This is really driving me mad, someone please help :-( > > > > > > > > > > > > > > > > > > > > > -- > > IPv6 + TCPA + wrecked Palladium server = NO COFFE! > > > > >

    attached mail follows:


    ah sorry, mixed some configuration files ;)

    Jonathan Boles wrote: > Do you mean allow_url_fopen? It is set to 'on'. There's no fopen_wrapper > setting > > Reading from http:// using fopen works fine. It's the https:// that doesn't > work. > > ----- Original Message ----- > From: "Stephan Seidt" <blizz0x03.net> > To: "Jonathan Boles" <jabolesihug.com.au> > Cc: <php-generallists.php.net> > Sent: Wednesday, January 22, 2003 3:02 AM > Subject: Re: [PHP] Can't get HTTPS -- driving me mad -- please help > > > >>Is fopen_wrapper in php.ini set to yes ? >> >>Jonathan Boles wrote: >> >>>PHP 4.3.0, Apache, Win32. >>> >>>I'm driving myself mad trying to work out why I can't get HTTPS pages. I >>>understand there are two options, using fopen() with openssl installed, > > and > >>>using curl. I've installed openssl extension, but using fopen STILL > > won't > >>>work. Don't have a clue why. Using curl, I can get the page easily > > enough, > >>>but I can't put it into the file. If I try to set a file resource to > > save it > >>>to, Apache crashes. >>> >>>Here's the error message I get using fopen("https://[securewebsite]", > > "r"); > >>>Warning: fopen(https://blahblahblah) [function.fopen]: failed to create >>>stream: No such file or directory in blah\blah\blah.php on line 50 >>> >>> >>> >>>And when I try to use Curl to save the https file, I get this: >>> >>>APACHE caused an invalid page fault in >>>module KERNEL32.DLL at 0187:bff7b9a6. >>>Registers: >>>EAX=00000000 CS=0187 EIP=bff7b9a6 EFLGS=00000246 >>>EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0 >>>ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7 >>>EDX=7803b710 ES=018f EDI=100be740 GS=0000 >>>Bytes at CS:EIP: >>>ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24 >>>Stack dump: >>>00000032 00fd5131 7803b730 00fd523b 7803b710 00000032 00000001 00fc1ee8 >>>00ff48ac 00000001 00000032 7803b710 00000032 00ff4240 00ff48ac 00ff4801 >>> >>> >>>Here is the code I'm using at that section: >>> >>> $ch = curl_init ("https://blahblahblah"); >>> $fp = fopen ("output.txt", "w"); >>> curl_setopt ($ch, CURLOPT_FILE, $fp); >>> curl_setopt ($ch, CURLOPT_HEADER, 0); >>> curl_exec ($ch); >>> $ce = curl_error($ch); >>> curl_close ($ch); >>> fclose ($fp); >>> >>> >>> >>>This is really driving me mad, someone please help :-( >>> >>> >>> >>> >>> >> >> >>-- >>IPv6 + TCPA + wrecked Palladium server = NO COFFE! >> >> > > >

    -- 
    IPv6 + TCPA + wrecked Palladium server = NO COFFE!
    

    attached mail follows:


    Hello everyody,

    I search to encode a string with a strong alogrythm. I choose pgp my desktop is a windows computer; I have found a function but I can't use it because on windows, pgp can"t encrypt on commandline. have you found something for windows station? your help will be helpfull.

    greetings

    _____________________________________________________________________ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné. Règlement : http://www.ifrance.com/_reloc/sign.sms

    attached mail follows:


    Hello everyody,

    I search to encode a string with a strong alogrythm. I choose pgp my desktop is a windows computer; I have found a function but I can't use it because on windows, pgp can"t encrypt on commandline. have you found something for windows station? your help will be helpfull.

    greetings

    _____________________________________________________________________ Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France

    attached mail follows:


    ermelir --

    [You know, this message really has nothing to do with converting ASP to PHP...]

    ...and then ermelir said... % % Hello everyody,

    Hi!

    % % I search to encode a string with a strong alogrythm. I choose pgp my % desktop is a windows computer; I have found a function but I can't use it % because on windows, pgp can"t encrypt on commandline. % have you found something for windows station? % your help will be helpfull.

    I don't use pgp at all or windows much, but IIRC gnupg will work from the command line with no problem. You might try that instead. Check out

    http://gnupg.org/

    for info and downloads.

    % % greetings

    HTH & HAND

    :-D

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

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

    iD8DBQE+LXKtGb7uCXufRwARAs5JAJ4yKHaQqAmgaN9i5no5VIJGjOxPhwCgnlmI z+A+YctGOfnIsaonrT+aDP8= =h6Fg -----END PGP SIGNATURE-----

    attached mail follows:


    I want to give my users the ability to submit a URL to a database, then when they pull up their page, their photo is included .. what I'm worried about is them pointing the link to some malicious code or something..

    Obviously I can validate the file extension (.gif or .jpg) .. and I'm going to force the files to be stored offsite - they dont get to upload anything to the server. I'm just a bit paranoid about this, so I'm hoping someone more security-minded can tell me what to watch out for, what to check, if I'm missing anything..

    Thanks, Chad

    attached mail follows:


    I guess you use some webserver, let's take apache. Apache's mime.conf has set several extensions, also php extensions. So only .php, .php3, .php4 files will be parsed by php.

    Chad Day wrote: > I want to give my users the ability to submit a URL to a database, then when > they pull up their page, their photo is included .. what I'm worried about > is them pointing the link to some malicious code or something.. > > Obviously I can validate the file extension (.gif or .jpg) .. and I'm going > to force the files to be stored offsite - they dont get to upload anything > to the server. I'm just a bit paranoid about this, so I'm hoping someone > more security-minded can tell me what to watch out for, what to check, if > I'm missing anything.. > > Thanks, > Chad > >

    -- 
    IPv6 + TCPA + wrecked Palladium server = NO COFFE!
    

    attached mail follows:


    --- Chad Day <cdayatpco.com> wrote: > I want to give my users the ability to submit a URL > to a database, then when they pull up their page, > their photo is included .. what I'm worried about > is them pointing the link to some malicious code or > something..

    Your instincts serve you well.

    There are two types of attacks to worry about in this situation, depending on who can see this "image". If only the user who submitted the URL can see it, then your users only risk CSRF attacks, which are not very common (yet) but are very dangerous.

    If everyone can see the "image", then your application is also at risk of XSS.

    If you realize that an embedded image is requested separately by a Web client, you can see that this basically allows an attacker the opportunity of forcing another user to visit a URL of the attacker's choice. For example, consider an image that looks like this:

    <img src="http://bookstore.xxx/buy.php?book=httphandbook">

    A browser will try to load that image by sending a request for that URL to bookstore.xxx. So, every user who happens to have a prior relationship with bookstore.xxx (maybe they have one-click ordering) will unknowingly purchase HTTP Developer's Handbook. All the victim will see is a broken image.

    Even if you check for file extensions, the attacker can have a URL that looks legitimate but is really a PHP script in disguise (their Apache treates .jpg as PHP, for example) and uses header("Location: ...") to redirect to the URL mentioned above.

    Also, this same attack can be used against one of your users to make them unknowingly submit such a URL to your site. Thus, even if you only show the image to the user who submitted it, that user may still be a victim.

    For more information on CSRF, check out http://www.tux.org/~peterw/csrf.txt.

    For more information on XSS, check out http://httpd.apache.org/info/css-security/ and http://www.cert.org/advisories/CA-2000-02.html.

    My advice would be to require human intervention in the way of a moderation system. Even with this, a URL that returns an image today may not tomorrow. A safer alternative might be to host the images yourself, so that you can check that they are in fact images.

    Good luck.

    Chris

    attached mail follows:


    Chris Shiflett wrote: > --- Chad Day <cdayatpco.com> wrote: > >>I want to give my users the ability to submit a URL >>to a database, then when they pull up their page, >>their photo is included .. what I'm worried about >>is them pointing the link to some malicious code or >>something.. > > > Your instincts serve you well. > > There are two types of attacks to worry about in this > situation, depending on who can see this "image". If only > the user who submitted the URL can see it, then your users > only risk CSRF attacks, which are not very common (yet) but > are very dangerous. > > If everyone can see the "image", then your application is > also at risk of XSS. > > If you realize that an embedded image is requested > separately by a Web client, you can see that this basically > allows an attacker the opportunity of forcing another user > to visit a URL of the attacker's choice. For example, > consider an image that looks like this: > > <img src="http://bookstore.xxx/buy.php?book=httphandbook"> >

    I agree that there are risks - but I do think this can be done safely

    if you make sure the user cannot insert javascript into the page, there isn't much cross site scripting that can be done.

    and make sure they can't insert quotes which would end the quoted string in the html page.

    is there really any site which will accept a book order based an a sigle GET ?

    I guess stripping the query string would be safest... but its a balance betwwen security and functionality ...

    -- 
    

    Sean

    attached mail follows:


    On Wednesday 22 January 2003 01:40, Sean Burlington wrote:

    > is there really any site which will accept a book order based an a sigle > GET ?

    Amazon makes a big deal of their "one-click" shopping feature. It's so good they've even patented it.

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

    /* We are drowning in information but starved for knowledge. -- John Naisbitt, Megatrends */

    attached mail follows:


    Gibbs, Liam - SXIA wrote: >>I agree that there are risks - but I do think this can be done safely > > > Couldn't you just check the submitted URL and find out if it's a gif or > jpeg? I don't think even PHP-enabled servers will run a gif or jpeg. > >

    please send replies to the list ...

    and you cant tell what type of file will be returned by the url

    it is easy to set up a server to treat a file named foo.gif as a php file (or whatever)

    even if you tested the url by attemting to download the file it would be easy to write a script that would return an innocent gif to requests originating for the webservers ip address - and anything else to the rest of the world.

    I'm not sure what harm could be done by this though.

    if a broswer attempts to load an image reference by an <img tag - but finds an unsuitable type of data - I would expect it simply to ignore it...

    but this would be worth testing.

    -- 
    

    Sean

    attached mail follows:


    --- Sean Burlington <seanuncertainty.org.uk> wrote: > I'm not sure what harm could be done by this though. > > if a broswer attempts to load an image reference by > an <img tag - but finds an unsuitable type of data - > I would expect it simply to ignore it...

    I sent a response about this earlier, but you should research CSRF and XSS.

    It does not matter that the browser shows a broken image if it has already sent the HTTP request. There is no special HTTP request for checking whether the Content-Type is really an image without the receiving Web server taking any action. A GET is a GET.

    Chris

    attached mail follows:


    Is there a way of finding if a table exists with only one command in MySQL? I've looked through the MySQL functions, and the closest I've gotten to what I need is mysql_list_tables or mysql_tablename (I'll have to check into these a little more), but I was hopefully looking for something that returns a boolean value, and to be able to use it like:

    if(mysql_table_exists("tablename")) { ... }

    Any ideas, short of creating my own function?

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

    attached mail follows:


    Okay what the hell I'm bored anyway...

    function mysql_table_exists($table) { global $db; // <- database resource handle $result = mysql_list_tables($db); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_row($result)) { if (strtolower($row[0]) == strtolower($table))) { return true; } } } return false; }

    Untested but it's pretty basic stuff so I'm certain it works. Enjoy!

    -Kevin

    ----- Original Message ----- From: "Mako Shark" <phpman2000yahoo.com> To: <php-generallists.php.net> Sent: Tuesday, January 21, 2003 10:05 AM Subject: [PHP] Finding out if a table exists

    > Is there a way of finding if a table exists with only > one command in MySQL? I've looked through the MySQL > functions, and the closest I've gotten to what I need > is mysql_list_tables or mysql_tablename (I'll have to > check into these a little more), but I was hopefully > looking for something that returns a boolean value, > and to be able to use it like: > > if(mysql_table_exists("tablename")) { > ... > } > > Any ideas, short of creating my own function? > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    Or...

    function mysql_table_exists($table) { mysql_query("use $table"); if(mysql_error()) { return false; } else { return true; } }

    ---John Holmes...

    ----- Original Message ----- From: "Kevin Stone" <kevinhelpelf.com> To: "Mako Shark" <phpman2000yahoo.com>; <php-generallists.php.net> Sent: Tuesday, January 21, 2003 1:05 PM Subject: Re: [PHP] Finding out if a table exists

    > Okay what the hell I'm bored anyway... > > function mysql_table_exists($table) > { > global $db; // <- database resource handle > $result = mysql_list_tables($db); > if (mysql_num_rows($result) > 0) > { > while ($row = mysql_fetch_row($result)) > { > if (strtolower($row[0]) == strtolower($table))) > { > return true; > } > } > } > return false; > } > > Untested but it's pretty basic stuff so I'm certain it works. Enjoy! > > -Kevin > > ----- Original Message ----- > From: "Mako Shark" <phpman2000yahoo.com> > To: <php-generallists.php.net> > Sent: Tuesday, January 21, 2003 10:05 AM > Subject: [PHP] Finding out if a table exists > > > > Is there a way of finding if a table exists with only > > one command in MySQL? I've looked through the MySQL > > functions, and the closest I've gotten to what I need > > is mysql_list_tables or mysql_tablename (I'll have to > > check into these a little more), but I was hopefully > > looking for something that returns a boolean value, > > and to be able to use it like: > > > > if(mysql_table_exists("tablename")) { > > ... > > } > > > > Any ideas, short of creating my own function? > > > > __________________________________________________ > > Do you Yahoo!? > > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > > http://mailplus.yahoo.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On 21-Jan-2003 Mako Shark wrote: > Is there a way of finding if a table exists with only > one command in MySQL? I've looked through the MySQL > functions, and the closest I've gotten to what I need > is mysql_list_tables or mysql_tablename (I'll have to > check into these a little more), but I was hopefully > looking for something that returns a boolean value, > and to be able to use it like: > > if(mysql_table_exists("tablename")) { > ... > } > > Any ideas, short of creating my own function? >

    Create your own, or borrow mine:

    function tableexists($tbl) { $res = mysql_query("SELECT 1 FROM $tbl LIMIT 1"); return ($res ? true : false); }

    Regards,

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

    attached mail follows:


    Does anyone know how to detect the resolution of someone's computer? Or is this possible through 'browscapping'?

    attached mail follows:


    You have to use JavaScript for this.

    Sorry! but i've asked the same question on here a long time ago :)

    ----- Original Message ----- From: <Liam.Gibbsdfait-maeci.gc.ca> To: <php-generallists.php.net> Sent: Tuesday, January 21, 2003 11:22 AM Subject: [PHP] Detecting resolution

    > Does anyone know how to detect the resolution of someone's computer? Or is > this possible through 'browscapping'? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Hi,

    Since php does not have child -> parent forking methods, can anybody suggest a method to achieve this.

    Thanks.

    Senn

    attached mail follows:


    PHP can fork scripts. Refer to the pcntl extension.

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

    You'll be wanting to use pcntl_fork()...

    J

    Senn wrote:

    > Hi, > > Since php does not have child -> parent forking methods, can anybody > suggest a method to achieve this. > > Thanks. > > Senn

    attached mail follows:


    Also, speaking of detection, I made a small script that can protect against people downloading your site's forms, modifying their new local copy (and putting an absolute URL in the form's ACTION attribute), and then posting data using the botched form. If it's bulletproof, then I figured this could help some of you out. If not, I welcome comments (I'm a little bit hesitant of calling things 'bulletproof'). $http_referer (lowercase) is the parse_url() of $_SERVER["HTTP_REFERER"]. Some local mucking up can give you the format you want for it.

    if((count($_POST) > 0) && (!stristr($_SERVER["HTTP_REFERER"], $http_referer))) { unset($_POST); $evil = "postedfromoutsidepage"; }

    Then, you can test for $evil when you need to print an error message or decide whether or not the data is proper.

    attached mail follows:


    Liam.Gibbsdfait-maeci.gc.ca wrote: > Also, speaking of detection, I made a small script that can protect against > people downloading your site's forms, modifying their new local copy (and > putting an absolute URL in the form's ACTION attribute), and then posting > data using the botched form. If it's bulletproof, then I figured this could > help some of you out. If not, I welcome comments (I'm a little bit hesitant > of calling things 'bulletproof'). $http_referer (lowercase) is the > parse_url() of $_SERVER["HTTP_REFERER"]. Some local mucking up can give you > the format you want for it. > > if((count($_POST) > 0) && (!stristr($_SERVER["HTTP_REFERER"], > $http_referer))) { > unset($_POST); > $evil = "postedfromoutsidepage"; > } > > Then, you can test for $evil when you need to print an error message or > decide whether or not the data is proper. >

    HTTP_REFFERER is sent by the client and is not a secure value

    it is easy to write a script in eg PHP that will fetch a web page with a completely bogus referrer url...

    some people argue that cheching the referrer url 'raises the bar' security wise - personnaly I think this sort of illusory security leads to complacency in data checking.

    I think it is better to always remeber that data can be posted to your server by many means - treat all data as suspect until proven otherwise.

    In addition this method can make code less portable between servers.

    -- 
    

    Sean

    attached mail follows:


    --- Liam.Gibbsdfait-maeci.gc.ca wrote: > If it's bulletproof, then I figured this could help > some of you out. If not, I welcome comments (I'm a > little bit hesitant of calling things 'bulletproof').

    It's not bulletproof. :-)

    > if((count($_POST) > 0) && > (!stristr($_SERVER["HTTP_REFERER"], > $http_referer))) { > unset($_POST); > $evil = "postedfromoutsidepage"; > }

    If this page is located at http://www.example.org/foo.php, and you are trying to ensure that the data is being posted from http://www.example.org/bar.php consider the following:

    -------------------- # telnet www.example.org 80 Trying 192.0.34.166... Connected to www.example.org (192.0.34.166). Escape character is '^]'. POST /foobar.php HTTP/1.1 Host: www.example.org Referer: http://www.example.org/bar.php Content-Type: application/x-www-form-urlencoded Content-Length: 26

    varname=any_value_i_choose --------------------

    Someone can use this method to bypass your Referer header check and post any data they choose.

    Chris

    attached mail follows:


    Hi,

    I would like to bild a tree menu with mySQL data. where I have the collapsed main menue and when I click the link the specific submenue expands (as follow).

    (collapsed Main Menu) + Home + Downloads + About me + Search

    ....and for example if I click the "Download" section it will look as follow....

    (expanded Main-Sub Menu) + Home + Downloads - Music - Programm + About me + Search

    ....and the SQL Tables...

    MAINMENUE_TABLE ID NAME ----------------------------- | 1 | Home | | 2 | Downloads | | 3 | About me | | 4 | Search |

    ....and....

    SUBMENUE_TABLE ID MAIN_ID NAME URL ------------------------------------------------------------------- | 1 | 2 | Music | ./somefile.php?action=music | 2 | 2 | Programm | ./somefile.php?action=programm | 3 | 3 | Pictures | ./somefile.php?action=pictures | 4 | 3 | Address | ./somefile.php?action=address | 5 | 4 | My Page | ./somefile.php?action=mypage | 6 | 4 | The Web | ./somefile.php?action=theweb | 7 | 4 | Google | ./somefile.php?action=google

    If I'm using a while loop it won't work, so I realy don't have and more ideas... Please consider in your explanations I'm a PHP beginner... :-)

    thanks Marc

    attached mail follows:


    <<If I'm using a while loop it won't work, so I realy don't have and more ideas... Please consider in your explanations I'm a PHP beginner... :-)>>

    What doesn't work about it? Does it not fetch the submenus? Does it exceed its number of rows somehow?

    attached mail follows:


    Marc,

    I did something sort of along these lines with an 'auction' site I worked on. I displayed rows from a db. If the row had bid information in the db (or your case submenu info) then a + sign icon was displayed next to it. IF the plus sign was clicked, the page would reload and the bid or submenu info would be displayed and the + sign would change to a - sign to give the appearence of a tree menu. Can you post some of your code?

    Eddie

    -----Original Message----- From: Marc Bleuler [mailto:marcbleuler.net] Sent: Tuesday, January 21, 2003 12:31 PM To: php-dblists.php.net; php-generallists.php.net Subject: [PHP] build menu with mysql data

    Hi,

    I would like to bild a tree menu with mySQL data. where I have the collapsed main menue and when I click the link the specific submenue expands (as follow).

    (collapsed Main Menu) + Home + Downloads + About me + Search

    ....and for example if I click the "Download" section it will look as follow....

    (expanded Main-Sub Menu) + Home + Downloads - Music - Programm + About me + Search

    ....and the SQL Tables...

    MAINMENUE_TABLE ID NAME ----------------------------- | 1 | Home | | 2 | Downloads | | 3 | About me | | 4 | Search |

    ....and....

    SUBMENUE_TABLE ID MAIN_ID NAME URL ------------------------------------------------------------------- | 1 | 2 | Music | ./somefile.php?action=music | 2 | 2 | Programm | ./somefile.php?action=programm | 3 | 3 | Pictures | ./somefile.php?action=pictures | 4 | 3 | Address | ./somefile.php?action=address | 5 | 4 | My Page | ./somefile.php?action=mypage | 6 | 4 | The Web | ./somefile.php?action=theweb | 7 | 4 | Google | ./somefile.php?action=google

    If I'm using a while loop it won't work, so I realy don't have and more ideas... Please consider in your explanations I'm a PHP beginner... :-)

    thanks Marc

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

    attached mail follows:


    >>>>> "Larry" == Larry Brown <larry.browndimensionnetworks.com> writes:

    Larry> places. However, my mind apparently works different and I Larry> keep trying to relate the OOP structure to what I already Larry> know which equates an object to a function. I am resolving

    This happens a lot with me too :)

    Larry> to purchase a book dedicated to instruction in the inns and Larry> outs of OOP. Specifically at it relates to PHP would be Larry> great but my emphasis is towards something that teaches Larry> someone that is stubborn in his reliance on previously Larry> learned methods. I hope this makes sense and I'm not alone Larry> on this. :) Any suggestions would be greatly appreciated!

    i am having a hard time with OOP too. i did buy a book Object Oriented Analysis and Design Andrew Haigh. Well, it doesn't have PHP but it's otherwise very lucid and clear. It also covers UML. Haven't read much of it till now but i think it might help you.

    Learning to think in terms of object is really diffucult imho, for someone who is still stuck in the older procedural paradigm like us. It'll take time.

    Wishing us all OO enlightenment :) regards sukrit

    attached mail follows:


    Thank you, I'll check this book out.

    Larry S. Brown Dimension Networks, Inc. (727) 723-8388

    -----Original Message----- From: Sukrit [mailto:holysmokeskycable.net] Sent: Tuesday, January 21, 2003 12:39 PM To: php-generallists.php.net Subject: [PHP] Re:[PHP] dreading OOP

    >>>>> "Larry" == Larry Brown <larry.browndimensionnetworks.com> writes:

    Larry> places. However, my mind apparently works different and I Larry> keep trying to relate the OOP structure to what I already Larry> know which equates an object to a function. I am resolving

    This happens a lot with me too :)

    Larry> to purchase a book dedicated to instruction in the inns and Larry> outs of OOP. Specifically at it relates to PHP would be Larry> great but my emphasis is towards something that teaches Larry> someone that is stubborn in his reliance on previously Larry> learned methods. I hope this makes sense and I'm not alone Larry> on this. :) Any suggestions would be greatly appreciated!

    i am having a hard time with OOP too. i did buy a book Object Oriented Analysis and Design Andrew Haigh. Well, it doesn't have PHP but it's otherwise very lucid and clear. It also covers UML. Haven't read much of it till now but i think it might help you.

    Learning to think in terms of object is really diffucult imho, for someone who is still stuck in the older procedural paradigm like us. It'll take time.

    Wishing us all OO enlightenment :) regards sukrit

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

    attached mail follows:


    It turns out after some checking, the other admin on the machine ran a kernel update last week. I hadn't been testing any scripts over the last week myself so I didn't notice the issue until the other day.

    When I run a function_exists() for mysql_connect it comes back false. When I run phpinfo() there is no reference to mysql at all.

    I'm still kind of new to all this, and I'm just wondering what I need to do to get php and mysql talking again. Is there a service or command I can run to get things going again?

    attached mail follows:


    Talk to the other admin. If you're using RPMs, you just need to install the php_mysql RPM, restart apache, and you should be up and running again.

    If you're compiling PHP from scratch, you'll have to do so again with --with-mysql in the configure command. But, as this is the default when compiling PHP from scratch, my hunch is the first option is what you really need.

    -- t

    On 1/21/03 10:01 AM, "Tom Ray" <tomblazestudios.com> wrote:

    > It turns out after some checking, the other admin on the machine ran a > kernel update last week. I hadn't been testing any scripts over the last > week myself so I didn't notice the issue until the other day. > > When I run a function_exists() for mysql_connect it comes back false. When > I run phpinfo() there is no reference to mysql at all. > > I'm still kind of new to all this, and I'm just wondering what I need to > do to get php and mysql talking again. Is there a service or command I can > run to get things going again? >

    -- 
    Tracy F. Rotton
    tracytaupecat.com
    http://www.taupecat.com/
    

    "... I like the 49ers because they're pure of heart, Seattle because they've got something to prove, and the Raiders because they always cheat." -- Lisa Simpson, "Lisa the Greek"