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 Nov 05 2002 - 18:40:30 CST

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

    php-general Digest 6 Nov 2002 00:40:30 -0000 Issue 1687

    Topics (messages 122767 through 122899):

    Re: MYSQL and PHP Storing and retrieving images getting corrupted
            122767 by: Marek Kilimajer
            122861 by: rija

    Re: Bizzare mime-type header() problem
            122768 by: Chris Boget

    special print function
            122769 by: Ines
            122773 by: Martin Lucas
            122774 by: Maxim Maletsky
            122884 by: Justin French

    Re: randomly select file
            122770 by: ROBERT MCPEAK

    Re: PHP driven frame
            122771 by: Craig
            122798 by: Chris Rehm
            122844 by: Chris Rehm
            122892 by: Justin French

    creating and ftp text file
            122772 by: Petre Agenbag
            122780 by: Erwin
            122795 by: Petre Agenbag
            122846 by: Petre Agenbag
            122875 by: Erwin Bovendeur

    Re: Spawning a background process
            122775 by: Maxim Maletsky

    Help me learn! with an explanation of these two functions.
            122776 by: Steve Jackson
            122777 by: Rick Emery
            122778 by: 1LT John W. Holmes

    $a=1.2; // $a is rounded to 1 Why?
            122779 by: Jean-Pierre Arneodo

    Trouble maintaining a session
            122781 by: Joshua E Minnie

    PHP/MySql Array problem (newbie)
            122782 by: alex koppie
            122786 by: Rick Emery
            122797 by: Maxim Maletsky
            122842 by: Paul Nicholson

    addslashes/stripslashes
            122783 by: Paul Dionne
            122785 by: Rudolf Visagie
            122787 by: Rick Emery
            122789 by: Erwin
            122841 by: 1LT John W. Holmes

    Problem unsolve! :-(
            122784 by: Cyclone Médias

    function()
            122788 by: Francisco Vaucher
            122790 by: Joshua E Minnie
            122794 by: Jason Wong
            122886 by: Justin French
            122888 by: Justin French
            122890 by: Rasmus Lerdorf
            122891 by: Martin Towell

    Please Help: PHP Cookies Problem on localhost
            122791 by: Mark Brown

    *.PHP "save-as" dialog
            122792 by: Lee Philip Reilly
            122808 by: Geoff Hankerson
            122810 by: Lee Philip Reilly

    Re: Problem with is_dir function
            122793 by: Roger Lewis
            122864 by: rija

    search and callback with preg
            122796 by: Bas Kamer
            122799 by: Stuart

    Finding HTML
            122800 by: Stephen
            122802 by: Adam Voigt

    Display only so many characters
            122801 by: Stephen
            122803 by: Jon Haworth
            122809 by: Tom Rogers

    Creating SSL Connection to Accept Credit Cards
            122804 by: benc.cox.net
            122806 by: Adam Voigt
            122813 by: benc.cox.net
            122814 by: Jonathan Rosenberg \(Tabby's Place\)
            122816 by: Adam Voigt
            122822 by: Jaime Bozza
            122823 by: Adam Voigt
            122827 by: benc.cox.net
            122857 by: Jaime Bozza
            122882 by: Jonathan Rosenberg \(Tabby's Place\)

    Get Entire URL for Current Page
            122805 by: Phillip Erskine
            122807 by: Jason Wong
            122811 by: Maxim Maletsky
            122812 by: Phillip Erskine
            122830 by: Jason Wong

    array()
            122815 by: Francisco Vaucher
            122817 by: .: B i g D o g :.
            122818 by: Khalid El-Kary
            122819 by: John Nichel
            122821 by: Khalid El-Kary
            122824 by: John Nichel
            122829 by: Francisco Vaucher
            122831 by: John Nichel

    uploading an image in binary
            122820 by: drparker

    how to do check boxes correclty?
            122825 by: Karl James

    Re: uploading an image in binar
            122826 by: .: B i g D o g :.

    arrays
            122828 by: Edward Peloke
            122832 by: Rick Emery
            122835 by: Khalid El-Kary

    Re: 4.2.3 compile problem on OSX
            122833 by: Charles Wiltgen

    LIKE condition in query
            122834 by: Don Hicks
            122836 by: .: B i g D o g :.
            122837 by: Jay Blanchard
            122840 by: Don Hicks

    Re: Variables
            122838 by: Martín Marqués

    Re: Global Variables Off
            122839 by: Martín Marqués

    why does this happen?
            122843 by: Karl James
            122845 by: Jay Blanchard
            122848 by: Jay Blanchard
            122851 by: Jay Blanchard
            122853 by: Jay Blanchard
            122854 by: Jay Blanchard

    File download + HTTP auth problem.
            122847 by: Rodolfo Gonzalez
            122865 by: rija

    session cache limiter
            122849 by: ROBERT MCPEAK
            122855 by: .: B i g D o g :.
            122866 by: rija

    uploading
            122850 by: Edward Peloke
            122872 by: rija

    Information Retrieval.. help
            122852 by: Kevin Stone
            122856 by: Matt Schroebel
            122858 by: Kevin Stone

    Sessions and Arrays
            122859 by: . Darwin
            122876 by: 1LT John W. Holmes
            122878 by: . Darwin

    Database creating from XML file
            122860 by: Bernardo de Barros Franco
            122862 by: Manuel Lemos

    Firewall Question
            122863 by: Stephen
            122867 by: Brad Bonkoski
            122868 by: Stephen
            122869 by: incoming
            122871 by: incoming
            122874 by: Paul Marinas
            122883 by: Stephen
            122885 by: PHP List
            122893 by: PHP List
            122894 by: David Freeman
            122895 by: Stephen
            122897 by: Stephen

    PHP + MySQL, how to get total rows matched when using LIMIT 0, 10?
            122870 by: SED
            122873 by: Jeroen Geusebroek
            122879 by: 1LT John W. Holmes

    Need Help With SESSIONS and ARRAYS
            122877 by: . Darwin
            122880 by: Kevin Stone
            122881 by: Kevin Stone

    xml
            122887 by: Karl James

    Grammar/how toes?
            122889 by: Karl James

    undefined symbol: curl-global-init
            122896 by: Ernest E Vogelsinger

    generically accessing member variables problem
            122898 by: John Kenyon

    Re: Mysql not functioning after upgrade to 4.2.3
            122899 by: ceo.l-i-e.com

    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:


    Try adding header('Content-length: ' .strlen($data)); header

    Darren McPhee wrote:

    >I have written 2 programs (which are very common PHP
    >programs) that A) Allows me to upload image files into a MYSQL database
    >using a simple form. And B) Allows me to retrieve and display the image
    >using a PHP script. This is my problem:-
    >
    >I can upload the images ok. I store the binary code, image type, name, and
    >size within the MYSQL database. On checking the database directly using
    >DBTools, I can see that the files have uploaded. The file sizes reflect
    >exactly what was originally on the hard disk of my PC (not sure if this is a
    >correct gauge).
    >
    >When I run my PHP program to display the images, maybe only 1 out of 10
    >actually displays correctly. The rest are broken up or non displayable
    >images. One image even made a prompt window appear and somehow now causes
    >Windows paint to load the image instead of the browser. God only knows how
    >that occurred !!
    >
    >Below are my (designed by others) 2 programs. The first program is the
    >upload form. This seems to work ok.
    >
    >
    >
    ><HTML>
    ><HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
    ><BODY>
    >
    ><?php
    >// code that will be executed if the form has been submitted:
    >
    >if ($submit) {
    >
    > // connect to the database
    >
    > require_once('../../Connections/TestServer.php');
    > mysql_select_db($database_TestServer, $TestServer);
    >
    > $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
    >
    > $result=MYSQL_QUERY("INSERT INTO master_products
    >(image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
    >ype) ".
    > "VALUES
    >('$data','$form_data_name','$form_data_size','$form_data_type')");
    >
    > $id= mysql_insert_id();
    > print "<p>This file has the following Database ID: <b>$id</b>";
    >
    > MYSQL_CLOSE();
    >
    >} else {
    >
    > // else show the form to submit new data:
    >?>
    >
    > <form method="post" action="<?php echo $PHP_SELF; ?>"
    >enctype="multipart/form-data">
    > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
    > <br>File to upload/store in database:<br>
    > <input type="file" name="form_data" size="40">
    > <p><input type="submit" name="submit" value="submit">
    > </form>
    >
    ><?php
    >
    >}
    >
    >?>
    >
    ></BODY>
    ></HTML>
    >
    >Here is the code to display the image:-
    >
    ><?php
    >if($id) {
    > require_once('../Connections/TestServer.php');
    > mysql_select_db($database_TestServer, $TestServer);
    > $query = "select image_thumbnail,image_thumbnail_type from
    >master_products where item_id=$id";
    > $result = MYSQL_QUERY($query);
    > $data = MYSQL_RESULT($result,0,"image_thumbnail");
    > $type = MYSQL_RESULT($result,0,"image_thumbnail_type");
    > Header( "Content-type: $type");
    > echo $data;
    >};
    >?>
    >
    >I run the above program in the following way:
    >http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id
    >primary key field for whichever record I want to display.
    >
    >I have tried these programs on a test server here in my room to a test
    >Apache server and MYSQL test database, and also from my ISP to a MYSQL
    >database at a server at my ISP. I get exactly the same problem. When I run
    >the display image program, the images being displayed are always being
    >displayed the same. Which points the problem towards the upload process
    >(maybe). If anybody can tell me what the heck is wrong here, I'll give them
    >a medal !! There is basically some kind of binary corruption going on (it
    >looks like)
    >
    >For added information, below is my database table structure. At the moment,
    >the only part I am actually using relates to the image_thumbnail sections.
    >
    >Darren.
    >
    >
    >
    >CREATE TABLE master_products (
    > item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
    > item_code VARCHAR (10) UNIQUE,
    > item_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > item_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    >
    > category ENUM ("none","single herbs","general
    >vitality","ageing","arthritis","eyesite","prostate","ahlzheimers",
    > "weight
    >loss","menopause","depression","fatigue","headaches","insomnia","colds and
    >flues","allergies",
    > "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for
    >women","for men","books"),
    >
    > name VARCHAR (30),
    > name_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > name_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    > INDEX idx_name (name),
    >
    > desc_brief VARCHAR (255),
    > desc_brief_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > desc_brief_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    > INDEX idx_desc_brief (desc_brief),
    >
    > desc_long TEXT,
    > desc_long_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > desc_long_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    >
    > price DECIMAL (7,2),
    > price_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > price_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    >
    > image LONGBLOB,
    > image_name VARCHAR (50),
    > image_size INT UNSIGNED,
    > image_type VARCHAR (50),
    > image_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > image_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    >
    > image_thumbnail LONGBLOB,
    > image_thumbnail_name VARCHAR (50),
    > image_thumbnail_size INT UNSIGNED,
    > image_thumbnail_type VARCHAR (50),
    > image_thumbnail_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > image_thumbnail_datemodified DATETIME DEFAULT '0000-00-00 00:00:00'
    > );
    >
    >
    >
    >
    >
    >
    >

    attached mail follows:


    Have you tried out mysql function load_file() to upload directly your file
    into the database without passing through php variable ?

    Like this:

    $result=MYSQL_QUERY("INSERT INTO master_products
    (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
    ype) VALUES

    (load_file('$form_data'),'$form_data_name','$form_data_size','$form_data_typ
    e')");

    If you are not allowed to upload directly $form_data using mysql
    load_file(), move first the file $form_data into another allowed directory
    with valid filename and try again.

    Finally, storing image or binary file into database is not good, put them
    into directory instead.

    ----- Original Message -----
    From: "Darren McPhee" <dsmcpheehotmail.com>
    To: <php-generallists.php.net>
    Sent: Tuesday, November 05, 2002 11:24 PM
    Subject: [PHP] MYSQL and PHP Storing and retrieving images getting corrupted

    > I have written 2 programs (which are very common PHP
    > programs) that A) Allows me to upload image files into a MYSQL database
    > using a simple form. And B) Allows me to retrieve and display the image
    > using a PHP script. This is my problem:-
    >
    > I can upload the images ok. I store the binary code, image type, name,
    and
    > size within the MYSQL database. On checking the database directly using
    > DBTools, I can see that the files have uploaded. The file sizes reflect
    > exactly what was originally on the hard disk of my PC (not sure if this is
    a
    > correct gauge).
    >
    > When I run my PHP program to display the images, maybe only 1 out of 10
    > actually displays correctly. The rest are broken up or non displayable
    > images. One image even made a prompt window appear and somehow now causes
    > Windows paint to load the image instead of the browser. God only knows
    how
    > that occurred !!
    >
    > Below are my (designed by others) 2 programs. The first program is the
    > upload form. This seems to work ok.
    >
    >
    >
    > <HTML>
    > <HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
    > <BODY>
    >
    > <?php
    > // code that will be executed if the form has been submitted:
    >
    > if ($submit) {
    >
    > // connect to the database
    >
    > require_once('../../Connections/TestServer.php');
    > mysql_select_db($database_TestServer, $TestServer);
    >
    > $data = addslashes(fread(fopen($form_data, "r"),
    filesize($form_data)));
    >
    > $result=MYSQL_QUERY("INSERT INTO master_products
    >
    (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
    > ype) ".
    > "VALUES
    > ('$data','$form_data_name','$form_data_size','$form_data_type')");
    >
    > $id= mysql_insert_id();
    > print "<p>This file has the following Database ID: <b>$id</b>";
    >
    > MYSQL_CLOSE();
    >
    > } else {
    >
    > // else show the form to submit new data:
    > ?>
    >
    > <form method="post" action="<?php echo $PHP_SELF; ?>"
    > enctype="multipart/form-data">
    > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
    > <br>File to upload/store in database:<br>
    > <input type="file" name="form_data" size="40">
    > <p><input type="submit" name="submit" value="submit">
    > </form>
    >
    > <?php
    >
    > }
    >
    > ?>
    >
    > </BODY>
    > </HTML>
    >
    > Here is the code to display the image:-
    >
    > <?php
    > if($id) {
    > require_once('../Connections/TestServer.php');
    > mysql_select_db($database_TestServer, $TestServer);
    > $query = "select image_thumbnail,image_thumbnail_type from
    > master_products where item_id=$id";
    > $result = MYSQL_QUERY($query);
    > $data = MYSQL_RESULT($result,0,"image_thumbnail");
    > $type = MYSQL_RESULT($result,0,"image_thumbnail_type");
    > Header( "Content-type: $type");
    > echo $data;
    > };
    > ?>
    >
    > I run the above program in the following way:
    > http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id
    > primary key field for whichever record I want to display.
    >
    > I have tried these programs on a test server here in my room to a test
    > Apache server and MYSQL test database, and also from my ISP to a MYSQL
    > database at a server at my ISP. I get exactly the same problem. When I
    run
    > the display image program, the images being displayed are always being
    > displayed the same. Which points the problem towards the upload process
    > (maybe). If anybody can tell me what the heck is wrong here, I'll give
    them
    > a medal !! There is basically some kind of binary corruption going on (it
    > looks like)
    >
    > For added information, below is my database table structure. At the
    moment,
    > the only part I am actually using relates to the image_thumbnail sections.
    >
    > Darren.
    >
    >
    >
    > CREATE TABLE master_products (
    > item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
    > item_code VARCHAR (10) UNIQUE,
    > item_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > item_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    >
    > category ENUM ("none","single herbs","general
    > vitality","ageing","arthritis","eyesite","prostate","ahlzheimers",
    > "weight
    > loss","menopause","depression","fatigue","headaches","insomnia","colds and
    > flues","allergies",
    > "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for
    > women","for men","books"),
    >
    > name VARCHAR (30),
    > name_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > name_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    > INDEX idx_name (name),
    >
    > desc_brief VARCHAR (255),
    > desc_brief_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > desc_brief_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    > INDEX idx_desc_brief (desc_brief),
    >
    > desc_long TEXT,
    > desc_long_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > desc_long_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    >
    > price DECIMAL (7,2),
    > price_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > price_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    >
    > image LONGBLOB,
    > image_name VARCHAR (50),
    > image_size INT UNSIGNED,
    > image_type VARCHAR (50),
    > image_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > image_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
    >
    > image_thumbnail LONGBLOB,
    > image_thumbnail_name VARCHAR (50),
    > image_thumbnail_size INT UNSIGNED,
    > image_thumbnail_type VARCHAR (50),
    > image_thumbnail_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
    > image_thumbnail_datemodified DATETIME DEFAULT '0000-00-00 00:00:00'
    > );
    >
    >
    >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >

    attached mail follows:


    > Your pseudocode is incomplete, because you do not show us where you call
    > this mysterious function that "validates using $PHPSESSID."

    The call is in the location where I have it defined.

    > Also, if that is really all your switch consists of, you're not really
    > gaining anything over using a simple if construct:

    No, it consists of a few others but none that are related to the problem.
    Also, it provides for future functionality (actions) so that I don't have to
    rewrite that section of the code.

    In any case, I figured out what the problem was and posted a follow up
    that posed it's own questions.

    Chris

    attached mail follows:


    Hello there!

    I am really new to PHP and in good old copy/paste tradition i was looking
    for a script that would serve my needs - unfortunately without success.
    Perhaps some of you could help me?

    I am looking for a special print function:

    I have three coloumns on the page. Under each there is a printer icon. When
    i press the printer icon underneath the left coloumn i only want a print
    version of that left coloumn. same goes for the middle and right coloumn.

    Has anyone ever seen a script that can do that?

    Many thanks for your help!

    Ines

    attached mail follows:


    hi ines,

    surely ther are several possibilities to solve this problem.

    i would do it like this:
    put your values in three arrays
    suggesting your icons represents links, put a variable after each link.
    with the 'switch; case' command you can evaluate the get variables, and
    generate the pages with the content you wish.
    the rest is a little javascript, that calls the system print dialog.

    hope that helps a little

    regards

    martin

    > -----Ursprüngliche Nachricht-----
    > Von: Ines [mailto:inescomprehend.de]
    > Gesendet: Dienstag, 5. November 2002 14:33
    > An: php-generallists.php.net
    > Betreff: [PHP] special print function
    >
    >
    > Hello there!
    >
    > I am really new to PHP and in good old copy/paste tradition i
    > was looking
    > for a script that would serve my needs - unfortunately
    > without success.
    > Perhaps some of you could help me?
    >
    > I am looking for a special print function:
    >
    > I have three coloumns on the page. Under each there is a
    > printer icon. When
    > i press the printer icon underneath the left coloumn i only
    > want a print
    > version of that left coloumn. same goes for the middle and
    > right coloumn.
    >
    > Has anyone ever seen a script that can do that?
    >
    > Many thanks for your help!
    >
    > Ines
    >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >

    attached mail follows:


    There is nothing "special" about such function...

    Simply pass a different GET variable
    (site.com/page.php?getvariable=value) value for each column and have an
    if/else logic in your PHP code.

    --
    Maxim Maletsky
    maximphp.net
    

    www.PHPBeginner.com // PHP for Beginners www.maxim.cx // my Home

    // my Wish List: ( Get me something! ) http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3

    "Ines" <inescomprehend.de> wrote... :

    > Hello there! > > I am really new to PHP and in good old copy/paste tradition i was looking > for a script that would serve my needs - unfortunately without success. > Perhaps some of you could help me? > > I am looking for a special print function: > > I have three coloumns on the page. Under each there is a printer icon. When > i press the printer icon underneath the left coloumn i only want a print > version of that left coloumn. same goes for the middle and right coloumn. > > Has anyone ever seen a script that can do that? > > Many thanks for your help! > > Ines > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    I believe the OP wanted to achieve some sort of printing of SOME of the content from within the original page, which isn't possible to my knowledge.

    BTW calling print dialogues, etc etc will be a headache too.

    Instead of a printer icon, what about a "printer friendly" icon, which they can click which gives them the column they want on a simple page.... then all they have to do is CNTRL-P.

    Justin

    on 06/11/02 12:30 AM, Maxim Maletsky (maximphp.net) wrote:

    > There is nothing "special" about such function... > > Simply pass a different GET variable > (site.com/page.php?getvariable=value) value for each column and have an > if/else logic in your PHP code. > > > -- > Maxim Maletsky > maximphp.net > > > www.PHPBeginner.com // PHP for Beginners > www.maxim.cx // my Home > > // my Wish List: ( Get me something! ) > http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3 > > > > "Ines" <inescomprehend.de> wrote... : > >> Hello there! >> >> I am really new to PHP and in good old copy/paste tradition i was looking >> for a script that would serve my needs - unfortunately without success. >> Perhaps some of you could help me? >> >> I am looking for a special print function: >> >> I have three coloumns on the page. Under each there is a printer icon. When >> i press the printer icon underneath the left coloumn i only want a print >> version of that left coloumn. same goes for the middle and right coloumn. >> >> Has anyone ever seen a script that can do that? >> >> Many thanks for your help! >> >> Ines >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >

    attached mail follows:


    Thanks guys & gals, for clueing me in.

    >>> "rija" <rijavatu.com> 11/04/02 05:31PM >>> Why don't you cope with opendir / readdir () and array_rand () I tried it and I look ok-

    But, I wonder if there are noble another way to do it?

    ----- Original Message ----- From: "ROBERT MCPEAK" <RMCPEAKjhuccp.org> To: <php-generallists.php.net> Sent: Tuesday, November 05, 2002 8:40 AM Subject: [PHP] randomly select file

    Could someone suggest some php for randomly selecting a file from a directory and then displaying the contents of the file?

    Thanks in advance!

    --
    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:


    Why do you nee to use frames?

    Wouldn't it be asier to set hidden fields in the second form and submit the values of the first form to these hidden fields. Personally I would submit the form into the same page

    "Chris Rehm" <chrisjavadisciple.com> wrote in message news:3DC770B4.9060502javadisciple.com... > I'd just like to see if I can get some feedback from PHP pros to see if > anyone is doing anything like this. > > I've got a request to build a two part form, I was thinking it would be > a page built with frames, when the top portion is filled out, the > selections there would determine what page would fill the bottom > portion. But since the bottom would also be a form for submission, I > just thought I'd build it with PHP so that hidden fields on it would > store the data from the top portion. Then, a submit gets all the data on > one form. > > Is anyone doing this? Any problems I'm overlooking? I was thinking of a > simple javascript action on the upper form to kick off the php for the > lower frame. > > I'd appreciate any feedback regarding this. Is this something I should > be using PHP for? > > -- > Chris Rehm > chrisjavadisciple.com > > For all the law is fulfilled in one word, even in this; Thou shalt love > thy neighbour as thyself. > Gal. 5: 14 > > >

    attached mail follows:


    Good point, lack of javascript is a consideration.

    The request is for a form where the second half format is dependent on the first half. In other words, they make some choices on the top that determine what the form on the bottom will be. But the guy who wants this, wants it to be one screen.

    Marek Kilimajer wrote: > Did you get a request for a two part form, or for a form on 2 pages? The > problem I see is with browsers > without javascript (either turned of or not implemented) >

    -- 
    Chris Rehm
    chrisjavadisciple.com
    

    For all the law is fulfilled in one word, even in this; Thou shalt love thy neighbour as thyself. Gal. 5: 14

    attached mail follows:


    Craig, I don't understand what you mean, "submit the form into the same page"? I'm only using the frames so I can keep the appearance, to the user, as though they are simply continuing to work on the same form since the header stuff will stay the same, but allow for the detail stuff to change based on selections.

    I sure don't need frames if I can do this without.

    Craig wrote: > Why do you nee to use frames? > > Wouldn't it be asier to set hidden fields in the second form and submit the > values of the first form to these hidden fields. > Personally I would submit the form into the same page

    -- 
    Chris Rehm
    chrisjavadisciple.com
    

    For all the law is fulfilled in one word, even in this; Thou shalt love thy neighbour as thyself. Gal. 5: 14

    attached mail follows:


    Well, he's asking you to do something that goes against what the web is good at. The simple solution is a two page form.

    I've also had some luck with hiding/showing parts of the form with css/javascipt... it worked really well, but needed (of course) a modern browser with good JS and CSS support. For that particular case, it was for an intranet, so there were no problems... but I'd *NEVER* rely on JS in a "public" form.

    Justin French

    on 06/11/02 3:04 AM, Chris Rehm (chrisjavadisciple.com) wrote:

    > Good point, lack of javascript is a consideration. > > The request is for a form where the second half format is dependent on > the first half. In other words, they make some choices on the top that > determine what the form on the bottom will be. But the guy who wants > this, wants it to be one screen. > > Marek Kilimajer wrote: >> Did you get a request for a two part form, or for a form on 2 pages? The >> problem I see is with browsers >> without javascript (either turned of or not implemented) >>

    attached mail follows:


    HI I need to create a text file that is in a specific format from a mysql query, and then ftp that file to another server.

    The format will be something like this: Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Cellphone: xxxxxxxxxx Reference: 123456 Notify: 0 Validity: 2h

    text message

    As you can probably deduct, this is for sending SMS message.

    The xxxxxxxxx are the numbers that I will be getting from a mysql query,

    I am pretty up to standard with getting stuff into and out of mysql, so I am basically just in need of pointers with generating the text file and ftp'ing automatically. It would be an even greater plus if it wasn't actually necessary to create a physical text file on the hard drive, but to simply ftp the "memory" file via the ftp functions, but I don't think that is possible?

    My routine will already have connections to the db, and the query will have already been run (something like select number from table where group=1) and I would then have a while to step through the result set. This is where I need help, how to "create" the file and add the numbers and "static" text to the file, and once completed with the loop, to ftp to a server with username and password.

    Thanks

    attached mail follows:


    > I am pretty up to standard with getting stuff into and out of mysql, > so I am basically just in need of pointers with generating the text > file and ftp'ing automatically. > It would be an even greater plus if it wasn't actually necessary to > create a physical text file on the hard drive, but to simply ftp the > "memory" file via the ftp functions, but I don't think that is > possible?

    In fact, it is...just open the file on the ftp directly

    <? $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); ?>

    You can then write directly to that filepointer:

    <? fwrite( $fp, 'some text' ); ?>

    Don't forget to close the file (I think PHP does that anyway, but it's nicer if you do that)

    <? fclose( $fp ); ?>

    > > My routine will already have connections to the db, and the query will > have already been run > (something like select number from table where group=1) > and I would then have a while to step through the result set. > This is where I need help, how to "create" the file and add the > numbers and "static" text to the file, and once completed with the > loop, to ftp to a server with username and password.

    You'll have to loop trough the resultset

    <? $query = 'select number from table where group=1'; $result = mysql_query( $query );

    $content = ''; while ( $res = mysql_fetch_array( $result ) ) // This piece of code will add all the Cellphone-numbers to the $content variable { $content .= 'Cellphone: ' . $res['number'] . "\n"; } $content .= 'Reference: ' . $reference . "\n"; $content .= 'Notify: ' . $notify . "\n";

    // And add everything else to the $content variable which needs to be written

    $fp = fopen('ftp://ftp.domain.com', 'w' ); fwrite( $fp, $content ); fclose( $fp ); ?>

    HTH Erwin

    attached mail follows:


    Erwin Thanks a million. That's actually much simpler than I thought it would be...

    I'm gonna give it a go just now, but I'm sure it will work!

    Thanks again!

    On Tue, 2002-11-05 at 17:09, Erwin wrote: > > I am pretty up to standard with getting stuff into and out of mysql, > > so I am basically just in need of pointers with generating the text > > file and ftp'ing automatically. > > It would be an even greater plus if it wasn't actually necessary to > > create a physical text file on the hard drive, but to simply ftp the > > "memory" file via the ftp functions, but I don't think that is > > possible? > > In fact, it is...just open the file on the ftp directly > > <? > $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); > ?> > > You can then write directly to that filepointer: > > <? > fwrite( $fp, 'some text' ); > ?> > > Don't forget to close the file (I think PHP does that anyway, but it's nicer > if you do that) > > <? > fclose( $fp ); > ?> > > > > > My routine will already have connections to the db, and the query will > > have already been run > > (something like select number from table where group=1) > > and I would then have a while to step through the result set. > > This is where I need help, how to "create" the file and add the > > numbers and "static" text to the file, and once completed with the > > loop, to ftp to a server with username and password. > > You'll have to loop trough the resultset > > <? > $query = 'select number from table where group=1'; > $result = mysql_query( $query ); > > $content = ''; > while ( $res = mysql_fetch_array( $result ) ) // This piece of code will > add all the Cellphone-numbers to the $content variable > { > $content .= 'Cellphone: ' . $res['number'] . "\n"; > } > $content .= 'Reference: ' . $reference . "\n"; > $content .= 'Notify: ' . $notify . "\n"; > > // And add everything else to the $content variable which needs to be > written > > $fp = fopen('ftp://ftp.domain.com', 'w' ); > fwrite( $fp, $content ); > fclose( $fp ); > ?> > > HTH > Erwin > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hi Erwin

    OK, my first problem:

    your code genrates errors, it says fwrite and fclose are invalid file descriptors.

    I gathered thatit is possibly because thos are for "normal" files, so I looked in the manual and found the FTP-functions, but it takes a $local_file variable, and that must be the name of the local file on disk, so I cannot simply put $content in there... Any ideas on how to directly stream the variable to the ftp site?

    Thanks On Tue, 2002-11-05 at 17:09, Erwin wrote: > > I am pretty up to standard with getting stuff into and out of mysql, > > so I am basically just in need of pointers with generating the text > > file and ftp'ing automatically. > > It would be an even greater plus if it wasn't actually necessary to > > create a physical text file on the hard drive, but to simply ftp the > > "memory" file via the ftp functions, but I don't think that is > > possible? > > In fact, it is...just open the file on the ftp directly > > <? > $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); > ?> > > You can then write directly to that filepointer: > > <? > fwrite( $fp, 'some text' ); > ?> > > Don't forget to close the file (I think PHP does that anyway, but it's nicer > if you do that) > > <? > fclose( $fp ); > ?> > > > > > My routine will already have connections to the db, and the query will > > have already been run > > (something like select number from table where group=1) > > and I would then have a while to step through the result set. > > This is where I need help, how to "create" the file and add the > > numbers and "static" text to the file, and once completed with the > > loop, to ftp to a server with username and password. > > You'll have to loop trough the resultset > > <? > $query = 'select number from table where group=1'; > $result = mysql_query( $query ); > > $content = ''; > while ( $res = mysql_fetch_array( $result ) ) // This piece of code will > add all the Cellphone-numbers to the $content variable > { > $content .= 'Cellphone: ' . $res['number'] . "\n"; > } > $content .= 'Reference: ' . $reference . "\n"; > $content .= 'Notify: ' . $notify . "\n"; > > // And add everything else to the $content variable which needs to be > written > > $fp = fopen('ftp://ftp.domain.com', 'w' ); > fwrite( $fp, $content ); > fclose( $fp ); > ?> > > HTH > Erwin > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    ----- Original Message ----- From: "Petre Agenbag" <internetvsa.co.za> To: "Erwin" <erwinisiz.com> Cc: <php-generallists.php.net> Sent: Tuesday, November 05, 2002 8:24 PM Subject: Re: [PHP] Re: creating and ftp text file

    > Hi Erwin > > OK, my first problem: > > your code genrates errors, > it says fwrite and fclose are invalid file descriptors.

    Errors or warnings? Probably the fopen function failes...

    Add the following code:

    <? $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); if ( !$fp ) die( "Cannot open file\n" ); ?>

    You can then see if the fopen failes. If it does, then check the rights for this user at the FTP Server.

    > I gathered thatit is possibly because thos are for "normal" files, so I > looked in the manual and found the FTP-functions, but it takes a > $local_file variable, and that must be the name of the local file on > disk, so I cannot simply put $content in there...

    That's true for the FTP functions indeed, but you CAN use the normal file function to...take a look at fopen in the manual. You can take a look at example 1.

    > Any ideas on how to directly stream the variable to the ftp site?

    The only possibility to do this, is using fopen. If you can't use fopen for some reason (i.e. don't give anonymous users write access to your FTP Server), then you have to use the FTP functions:

    <? $query = 'select number from table where group=1'; $result = mysql_query( $query );

    $content = ''; while ( $res = mysql_fetch_array( $result ) ) { $content .= 'Cellphone: ' . $res['number'] . "\n"; } $content .= 'Reference: ' . $reference . "\n"; $content .= 'Notify: ' . $notify . "\n";

    $name = tempnam( "/tmp", "" ); $fp = fopen( $name, "w" ); fwrite( $fp, $content ); fclose( $fp );

    $ftp = ftp_connect( "ftp.domain.com" ); ftp_login( $ftp, "username", "password" ); ftp_put( $ftp, "filename", $name, FTP_ASCII );

    unlink( $name ); ?>

    For this to work, you'll have to compile PHP with the --with-ftp directive!!!

    But again, I'm pretty sure the first possibility should work also.

    Regards, Erwin

    attached mail follows:


    Try learning about PHP CLI, it can solve some of your problems.

    --
    Maxim Maletsky
    maximphp.net
    

    www.PHPBeginner.com // PHP for Beginners www.maxim.cx // my Home

    // my Wish List: ( Get me something! ) http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3

    kevin <kevintheconfused.co.uk> wrote... :

    > Allo, > > Basically, my question is.. how do I do this? I am actually (for various .. > and probably stupid... reasons) trying to spawn a php process to run in the > background. This process I know will take a couple of hours to run (mailing > list stuff). I have been playing around with system to try to get it to run > in the background but I can't seem to work out how to do it. > > Any pointers would be a great help > > Thanks > > Kevin > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Can someone run over these functions I have written to explain if my logic is correct. I'm still new to PHP and am trying to get my head round it! This first function is to collect a list of order numbers from my database where checked = no. Am I correct in assuming that the variable $orderid will be an array of results returned? How can I check this?

    function get_live_orders() { $conn = db_connect(); $query = "select orderid from email where checked='no'"; $result = mysql_query($query); if(mysql_numrows($result)>0) $orderid = mysql_fetch_array($result); return $orderid; }

    This second function is to take these order numbers and compare them to order numbers in a second table and return the result of that. So if order number 100001 is in the first array from the above function and there is a number 100001 in the second query result I want to take all the data in that row and return it.

    function get_order_details() { $orderid = get_live_orders(); $conn = db_connect(); $query = "select * from orders where orderid='$orderid'"; $result = mysql_query($query); if (!$result) return false; $result = mysql_result($result, 0, "orderid"); return $result; }

    I haven't actually run this yet but I'd like someone to explain to me what these functions will do so I am not just copy pasting code and hoping to get it right eventually! Probably I have written this wrong anyway and would like help before I actually attempt to do what I am after. I'll look back on this tomorrow so any help will be greatly appreciated. Kind regards, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com stephen.jacksonviolasystems.com Mobile +358 50 343 5159

    attached mail follows:


    $orderid WILL NOT contain all the rows. mysql_fetch_array() returns only one row each time it is called. Upon fetching last row, it returns NULL/FALSE/0. Therefore, as you fetch each row, you will then execute your second function to pull all the data for that particular order number. Finally, when executing mysql_query(), ALWAYS execute it in conjuction with die(mysql_error()) in order to get error messages concerning failures. Execute mysql_connect() and mysql_db_connect() only ONCE per script.

    function get_live_orders() {

    $query = "select orderid from email where checked='no'"; $result = mysql_query($query) or die("Error: cannot select orderid<BR>$query<BR>".mysql_error()); while( $row = mysql_fetch_array($result)) { extract($row); $query2 = "SELECT * FROM orders WHERE orderid=\"$orderid\""; $result2 = mysql_query()) or die("Error: cannot fetch order<BR>$query2<BR>".mysql_error()); extract(mysql_fetch_array($result2)); }

    ----- Original Message ----- From: "Steve Jackson" <stephen.jacksonviolasystems.com> To: "PHP General" <php-generallists.php.net> Sent: Tuesday, November 05, 2002 8:50 AM Subject: [PHP] Help me learn! with an explanation of these two functions.

    Can someone run over these functions I have written to explain if my logic is correct. I'm still new to PHP and am trying to get my head round it! This first function is to collect a list of order numbers from my database where checked = no. Am I correct in assuming that the variable $orderid will be an array of results returned? How can I check this?

    function get_live_orders() { $conn = db_connect(); $query = "select orderid from email where checked='no'"; $result = mysql_query($query); if(mysql_numrows($result)>0) $orderid = mysql_fetch_array($result); return $orderid; }

    This second function is to take these order numbers and compare them to order numbers in a second table and return the result of that. So if order number 100001 is in the first array from the above function and there is a number 100001 in the second query result I want to take all the data in that row and return it.

    function get_order_details() { $orderid = get_live_orders(); $conn = db_connect(); $query = "select * from orders where orderid='$orderid'"; $result = mysql_query($query); if (!$result) return false; $result = mysql_result($result, 0, "orderid"); return $result; }

    I haven't actually run this yet but I'd like someone to explain to me what these functions will do so I am not just copy pasting code and hoping to get it right eventually! Probably I have written this wrong anyway and would like help before I actually attempt to do what I am after. I'll look back on this tomorrow so any help will be greatly appreciated. Kind regards, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com stephen.jacksonviolasystems.com Mobile +358 50 343 5159

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

    attached mail follows:


    Your first function is only going to return one row of 'checked=no' records. The second function will only return one column of the result.

    What you want is a JOIN. You can do all of this with a single query. Without knowing the format of your tables exactly, I can't give you the syntax, though.

    Check the MySQL manual and read the chapter on JOINs.

    ---John Holmes...

    ----- Original Message ----- From: "Steve Jackson" <stephen.jacksonviolasystems.com> To: "PHP General" <php-generallists.php.net> Sent: Tuesday, November 05, 2002 9:50 AM Subject: [PHP] Help me learn! with an explanation of these two functions.

    > Can someone run over these functions I have written to explain if my > logic is correct. > I'm still new to PHP and am trying to get my head round it! > This first function is to collect a list of order numbers from my > database where checked = no. > Am I correct in assuming that the variable $orderid will be an array of > results returned? How can I check this? > > function get_live_orders() > { > $conn = db_connect(); > $query = "select orderid from email where checked='no'"; > $result = mysql_query($query); > if(mysql_numrows($result)>0) > $orderid = mysql_fetch_array($result); > return $orderid; > } > > This second function is to take these order numbers and compare them to > order numbers in a second table and return the result of that. So if > order number 100001 is in the first array from the above function and > there is a number 100001 in the second query result I want to take all > the data in that row and return it. > > function get_order_details() > { > $orderid = get_live_orders(); > $conn = db_connect(); > $query = "select * from orders where orderid='$orderid'"; > $result = mysql_query($query); > if (!$result) > return false; > $result = mysql_result($result, 0, "orderid"); > return $result; > } > > I haven't actually run this yet but I'd like someone to explain to me > what these functions will do so I am not just copy pasting code and > hoping to get it right eventually! Probably I have written this wrong > anyway and would like help before I actually attempt to do what I am > after. > I'll look back on this tomorrow so any help will be greatly appreciated. > Kind regards, > Steve Jackson > Web Developer > Viola Systems Ltd. > http://www.violasystems.com > stephen.jacksonviolasystems.com > Mobile +358 50 343 5159 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hi,

    double variables are rounded as integer but GetType is 'double'

    $a=10.2; echo get_cfg_var('precision'); // print 14 echo ini_get('precision'); // print 14 echo GetType($a); // print double echo $a; // print 10

    I use php 4.1.2 / apache 1.3.24 but I have tried to upgrade to 4.2.3 without success some weeks ago.

    Jean-Pierre

    ___________________________________________________________ Do You Yahoo!? -- Une adresse yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com

    attached mail follows:


    Hey all, I was wondering if anyone could explain to me why I can't seem to maintain a session using PHP 4.1.2 on my NT4 server. I am don't have any problems on my W2K/IIS5 or Linux machine. What I am doing is allowing my users to log on to the site at any time, and then being returned to the page that they logged in from. This isn't the problem. The problem is on the NT4/PHP4.1.2 machine when I click on a link to go to another page their login information is lost, almost as if they logged out. Here is the validation code that I am currently using:

    [auth.inc] <?php function validateUser() { $users = file("includes/users.txt");

    if(!isset($_SESSION['logged_in'])) $_SESSION['logged_in'] = FALSE; if(!isset($_SESSION['log_attempt'])) $_SESSION['log_attempt'] = FALSE; if(!isset($_SESSION['valid_user'])) $_SESSION['valid_user'] = ""; if(!isset($_SESSION['email'])) $_SESSION['email'] = ""; if(!isset($_REQUEST['phpsessid'])) { if(empty($_POST['email']) || empty($_POST['passwd'])) { $email = ""; $pass = ""; } else { $email = $_POST['email']; $pass = $_POST['passwd']; $_SESSION['log_attempt'] = TRUE; }

    // replace with SQL query when db is instated foreach($users as $login) { list($user,$passwd,$fname,$lname) = explode("|",$login); if($user==$email && $passwd==md5($pass)) { $_SESSION['logged_in'] = TRUE; $_SESSION['valid_user'] = $fname." ".trim($lname); $_SESSION['email'] = $email; } } } return($_SESSION['logged_in']); } ?>

    Once again, it works fine on the W2K/IIS5 and Linux box, so that is why I am having problems isolating the problem. Maybe it's just my logic and a fresh pair of eyes would help looking at this.

    Thanks for all your help,

    _________________ / Joshua Minnie \ + +-------------------------------+ | Wild Web Technology | | Independent Web Consultant/Developer | | joshwildwebtech.com | | | | Tel : 616.890.1566 | +----------------------------------------------------+

    attached mail follows:


    Hi there,

    I am trying to send an array to a database and visualize it again. Alltough this sounds simple, for me.... hours! I create the arry from a form, serialize it, urlencode it and send it to a row in mysql. So far all ok, However, in mysqlfront (I suppose in every prog.) the cell in the table that contains the array, does not give the contents, it only displays "Array". I dont know if I go wrong here allready?

    Well, if that sounds right, the problem is on getting it out. I unserialize, urldecode, but the only output I can create is "Array()".

    How can I get the information (ordered) from the database. I would realy apreciate some help!

    Tnx

    Alex

    attached mail follows:


    show us your code...we can't read your mind

    ----- Original Message ----- From: "alex koppie" <koppe122airtel.net> To: <> Sent: Monday, November 04, 2002 4:58 AM Subject: [PHP] PHP/MySql Array problem (newbie)

    Hi there,

    I am trying to send an array to a database and visualize it again. Alltough this sounds simple, for me.... hours! I create the arry from a form, serialize it, urlencode it and send it to a row in mysql. So far all ok, However, in mysqlfront (I suppose in every prog.) the cell in the table that contains the array, does not give the contents, it only displays "Array". I dont know if I go wrong here allready?

    Well, if that sounds right, the problem is on getting it out. I unserialize, urldecode, but the only output I can create is "Array()".

    How can I get the information (ordered) from the database. I would realy apreciate some help!

    Tnx

    Alex

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

    attached mail follows:


    You can't send the whole array into on "cell". Try doing:

    echo $array;

    and you'll see what I mean.

    You will need to insert each element individually.

    --
    Maxim Maletsky
    maximphp.net
    

    www.maxim.cx

    "alex koppie" <koppe122airtel.net> wrote... :

    > Hi there, > > I am trying to send an array to a database and visualize it again. Alltough > this sounds simple, for me.... hours! > I create the arry from a form, serialize it, urlencode it and send it to a > row in mysql. So far all ok, However, in mysqlfront (I suppose in every > prog.) the cell in the table that contains the array, does not give the > contents, it only displays "Array". I dont know if I go wrong here allready? > > Well, if that sounds right, the problem is on getting it out. I unserialize, > urldecode, but the only output I can create is "Array()". > > How can I get the information (ordered) from the database. I would realy > apreciate some help! > > Tnx > > Alex > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

    He isn't....."I create the arry from a form, serialize it, urlencode it and send it to a row in mysql." Alex: Can you send me some of the code you're using? ~Pauly

    On Tuesday 05 November 2002 12:09 pm, Maxim Maletsky wrote: > You can't send the whole array into on "cell". Try doing: > > echo $array; > > and you'll see what I mean. > > You will need to insert each element individually.

    - -- ~Paul Nicholson Design Specialist WebPower Design "The web....the way you want it!" paulwebpowerdesign.net

    "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org

    iD8DBQE9yBFnDyXNIUN3+UQRAr49AJsHK5rJwUSoaCMe/wgv/0xCZ95RXwCfXCfO /nBS95XhfPyELZcT1wrVKzE= =nd3N -----END PGP SIGNATURE-----

    attached mail follows:


    Hey,

    I am trying to develop a search for my database.

    I used addslashes when entering the data, and then use addslashes with the search but nothing comes up:

    Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' )

    I check in the database and o'mallies is indeed there as o\'mallies. And a search for just mallies works fine.

    What gives?

    Thanks Paul

    attached mail follows:


    Don't know which database you're using but in Oracle you would use:

    Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o''mallies%' )

    Escape(\) is only used in PHP syntax, not SQL.

    Regards

    -----Original Message----- From: Paul Dionne [mailto:PDionneSpeakeasy.net] Sent: Tuesday, November 05, 2002 5:26 PM To: php-generallists.php.net Subject: [PHP] addslashes/stripslashes

    Hey,

    I am trying to develop a search for my database.

    I used addslashes when entering the data, and then use addslashes with the search but nothing comes up:

    Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' )

    I check in the database and o'mallies is indeed there as o\'mallies. And a search for just mallies works fine.

    What gives?

    Thanks Paul

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

    attached mail follows:


    what happens when you type: Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' )

    at the mysql command line? ----- Original Message ----- From: "Paul Dionne" <PDionneSpeakeasy.net> To: <php-generallists.php.net> Sent: Tuesday, November 05, 2002 9:25 AM Subject: [PHP] addslashes/stripslashes

    Hey,

    I am trying to develop a search for my database.

    I used addslashes when entering the data, and then use addslashes with the search but nothing comes up:

    Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' )

    I check in the database and o'mallies is indeed there as o\'mallies. And a search for just mallies works fine.

    What gives?

    Thanks Paul

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

    attached mail follows:


    Paul Dionne wrote: > Hey, > > I am trying to develop a search for my database. > > I used addslashes when entering the data, and then use addslashes > with the search but nothing comes up:

    > Select * from tblContacts, tblCountries WHERE > (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization > LIKE '%o\'mallies%' )

    I think your query goes wrong, because MySQL uses two single quotes instead of backslash quote. So, try using Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE "%o\'mallies%" ).

    > > I check in the database and o'mallies is indeed there as o\'mallies. > And a search for just mallies works fine.

    Because the data is save with the \ and with the ', you'll probably have to change your search to LIKE "%o\\''mallies%" ).

    Try using mysql_escape_string instead of addslashes to store the o'mallies as is, without the \.

    HTH Erwin

    attached mail follows:


    > I am trying to develop a search for my database. > > I used addslashes when entering the data, and then use addslashes with the > search but nothing comes up: > > Select * from tblContacts, tblCountries WHERE > (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE > '%o\'mallies%' ) > > I check in the database and o'mallies is indeed there as o\'mallies. And a > search for just mallies works fine.

    If you see it in the database as o\'mallies, then you are running addslashes() twice on the data you are inserting. If you insert o\'mallies into the database, the \ is only there to tell the database that the following character is escaped. In this case, the ' is not the end of the string, but something that should be included in the data that's put into the database. The actual \ isn't put in the database.

    So, with that said, you can fix your code and find out where you are addslashes() twice. You can run some queries to replace \' in your database with ', too.

    Or you can just search for o\\\'mallies in your database, which will search for a literal \ and a literal ' in the data.

    ---John Holmes...

    attached mail follows:


    Here I'm trying to explain my problem with better details...

    I have a web server that I'm using to share file with my clients. So my client are not using a ftp client software. Client have their own web_user directory on my server example: ip. 202.202.020.1/adq is muy client adq...

    Clients are login from their own browser, ie most of the time... With my old server people was able to upload file from the ie windows with a simple upload field. I think it's a question of upload permission but, When I'm trying to set my upload permission that bring me an error...like: server response: SITE_umask not supported

    So im in trouble! :-)

    If you can help me thanks,

    I was looking for an alternative in php but, dont know if it's usefull like the other way... Because user must upload in any folder of his own directory...

    Thanks

    Ben

    attached mail follows:


    Hi to all, I have a problem with function() and some variables. The issue is this I declare the function, suppose: function test_func($param1) { echo $param1; } when I call the function like; <?php test_func(123)?> works OK! But if I try something like this: <?php test_func(123); echo $param; ?> This doesn't work. I need to get some variables values out of the function. Is there a way to make te variables defined in the function 'global' ? So I can use them after the function call. Thanks in advance!! regards, f.

    attached mail follows:


    First of all, you can't echo that variable in the manner you are trying.

    Try this instead:

    [lib.inc] function test_func($param1) { return $param1; }

    [main.php] <?php

    // option 1 $num = test_func(123); echo $num;

    // option 2 echo test_func(123); ?>

    HTH

    _________________ / Joshua Minnie \ + +-------------------------------+ | Wild Web Technology | | Independent Web Consultant/Developer | | joshwildwebtech.com | | | | Tel : 616.890.1566 | +----------------------------------------------------+

    "Francisco Vaucher" <fvauchertycoint.com> wrote: | Hi to all, | | I have a problem with function() and some variables. | | The issue is this | | I declare the function, suppose: | | function test_func($param1) { | echo $param1; | } | | when I call the function like; | | <?php test_func(123)?> | | works OK! | | But if I try something like this: | | <?php | | test_func(123); | echo $param; | | ?> | | This doesn't work. I need to get some variables values out of the function. | Is there a way to make te variables defined in the function 'global' ? So I | can use them after the function call. | | Thanks in advance!! | | regards, | | f. |

    attached mail follows:


    On Tuesday 05 November 2002 23:56, Francisco Vaucher wrote:

    > This doesn't work. I need to get some variables values out of the function. > Is there a way to make te variables defined in the function 'global' ? So I > can use them after the function call.

    Declare them as global:

    <? doo(123); echo $dah;

    function doo($param) { global $dah;

    $dah = $param * $param; } ?>

    attached mail follows:


    Hi, this is the common way to do things:

    <?

    // declare function function test($param) { $param = $param + 4; return $param; }

    // option 1 -- prints 48 $param = test(44); echo $param;

    // option 2 -- prints 59 echo test(55);

    ?>

    I *think* you can also make param part of the global array, but this is totally UNTESTED code -- infact, I've never had the need to use the global array in this way.

    <?

    // declare function function test($param) { $_GLOBAL['param'] = $param + 4; }

    // option 1 echo $_GLOBAL['param'];

    // option 2 echo $param;

    ?>

    Good luck.

    Justin

    on 06/11/02 1:56 AM, Francisco Vaucher (fvauchertycoint.com) wrote:

    > Hi to all, > > I have a problem with function() and some variables. > > The issue is this > > I declare the function, suppose: > > function test_func($param1) { > echo $param1; > } > > when I call the function like; > > <?php test_func(123)?> > > works OK! > > But if I try something like this: > > <?php > > test_func(123); > echo $param; > > ?> > > This doesn't work. I need to get some variables values out of the function. > Is there a way to make te variables defined in the function 'global' ? So I > can use them after the function call. > > Thanks in advance!! > > regards, > > f. >

    attached mail follows:


    Doesn't 'global' only get variables from outside the function into it???? OP (I think) wanted the variables within the function to work outside it.

    Justin

    on 06/11/02 2:44 AM, Jason Wong (php-generalgremlins.com.hk) wrote:

    > On Tuesday 05 November 2002 23:56, Francisco Vaucher wrote: > >> This doesn't work. I need to get some variables values out of the function. >> Is there a way to make te variables defined in the function 'global' ? So I >> can use them after the function call. > > Declare them as global: > > <? > doo(123); > echo $dah; > > function doo($param) { > global $dah; > > $dah = $param * $param; > } > ?> > >

    attached mail follows:


    > Is there a way to make te variables defined in the function 'global' ? So I > can use them after the function call.

    Just make them global inside the function. They don't need to exist in the global symbol table before the call for this.

    try this little test:

    <?php function foo() { global $a; $a=1; } foo(); echo $a; ?>

    -Rasmus

    attached mail follows:


    FYI: 'global' is two way eg:

    <? function test() { global $foobar; $foobar = "Hello World"; } test(); echo $foobar; ?>

    will work.

    -----Original Message----- From: Justin French [mailto:justinindent.com.au] Sent: Wednesday, November 06, 2002 11:49 AM To: php-generallists.php.net Subject: Re: [PHP] function()

    Doesn't 'global' only get variables from outside the function into it???? OP (I think) wanted the variables within the function to work outside it.

    Justin

    on 06/11/02 2:44 AM, Jason Wong (php-generalgremlins.com.hk) wrote:

    > On Tuesday 05 November 2002 23:56, Francisco Vaucher wrote: > >> This doesn't work. I need to get some variables values out of the function. >> Is there a way to make te variables defined in the function 'global' ? So I >> can use them after the function call. > > Declare them as global: > > <? > doo(123); > echo $dah; > > function doo($param) { > global $dah; > > $dah = $param * $param; > } > ?> > >

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

    attached mail follows:


    Hi there, the php.net site said I should email you with problems. The basic issue is that I have a user logon screen which works on a remote server but not when developing on the same machine that is a local server. I hold the username and passwords on mysql and ask the user for their username and password which gets sent to another .php page which first of all sets the following cookies

    setcookie("email",$email,time()+1800); setcookie ("password",$password,time()+1800);

    Then verifies this against the database and if succesfull redirects to the 'members area' where the cookies are set again otherwise it redirects to a logout page. [Which is where i get sent on the local machine]

    I have tried the following formats for the setcookie and all combinations including setting the expiry time to 8000.

    setcookie("email",$_POST["email"],time()+1800); setcookie ("password",$_POST["password"],time()+1800);

    setcookie("email",$email,"time()+1800"); setcookie ("password",$password,"time()+1800");

    The database authentication is being succeful, it is just that the cookies are not being set on the local machine, as when I hit the members area I set the email value to another variable, set the cooies as before, then alert() the old value [before the $email was reset by the new setcookie() command.

    I have the following lines set in my php.ini

    register_globals = On variables_order = "EGPCS"

    Do you have any idea why my local machine is not setting the cookies???

    Please help

    _________________________________________________________________ Choose an Internet access plan right for you -- try MSN! http://resourcecenter.msn.com/access/plans/default.asp

    attached mail follows:


    Hi there,

    I posted this message yesterday: ------ I recently upgraded from PHP version 4.0-ish to 4.2.3 on my Linux/Apache

    machine. AFAIK, Apache is setup correctly (it serves HTML) and PHP works, but only from the command line. If I type "php -q php.php > test.html" the output of phpinfo() is stored in test.html. When I try and look at test.html running on localhost it displays fine, but when I try and view php.php, as "save as" window pops up. I am not too familiar

    with Linux. If it was a Windows installation then I would make sure the Action application (path to php.exe) line was correct, but I can't find this in the Linux httpd.conf. Does this issue sound familiar to anyone. Could anyone point me in the right direction? -----

    I am still having the same problem. It is obviously a problem with my httpd.conf file. PHP is installed as a CGI, and the AddHandler application/x-httpd-php .php is present. Can anyone offer any other suggestions?

    Below is my httpd.conf file. My apologies for inserting so many lines, but this is an extremely niggling problem, and I... just... can't... figure... it... out </shatner>. If anyone could have a quick look to try and identify the problem, I would really appreciate it!

    Thanks.

    - Best regards, Lee Reilly

    -------------------------- ## httpd.conf - configuration for the Apache web server # # Generated automatically... if you edit manually, the changes will be lost # the next time you run "apacheconfig". # # What we listen to # ServerType StandAlone ServerRoot /etc/httpd/

    # We don't handle this yet...

    # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the

    # directives contained in it are actually available _before_ they are used. # Please read the file README.DSO in the Apache 1.3 distribution for more # details about the DSO mechanism and run `httpd -l' for the list of already # built-in (statically linked and thus always available) modules in your httpd # binary. # # Note: The order is which modules are loaded is important. Don't change # the order below without expert advice. # # Example: # LoadModule foo_module modules/mod_foo.so

    #LoadModule mmap_static_module modules/mod_mmap_static.so LoadModule vhost_alias_module modules/mod_vhost_alias.so LoadModule env_module modules/mod_env.so LoadModule config_log_module modules/mod_log_config.so LoadModule agent_log_module modules/mod_log_agent.so LoadModule referer_log_module modules/mod_log_referer.so #LoadModule mime_magic_module modules/mod_mime_magic.so LoadModule mime_module modules/mod_mime.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule status_module modules/mod_status.so LoadModule info_module modules/mod_info.so LoadModule includes_module modules/mod_include.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule dir_module modules/mod_dir.so LoadModule cgi_module modules/mod_cgi.so LoadModule asis_module modules/mod_asis.so LoadModule imap_module modules/mod_imap.so LoadModule action_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule access_module modules/mod_access.so LoadModule auth_module modules/mod_auth.so LoadModule anon_auth_module modules/mod_auth_anon.so LoadModule db_auth_module modules/mod_auth_db.so #LoadModule digest_module modules/mod_digest.so #LoadModule proxy_module modules/libproxy.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so #LoadModule usertrack_module modules/mod_usertrack.so #LoadModule example_module modules/mod_example.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_module modules/mod_setenvif.so #LoadModule bandwidth_module modules/mod_bandwidth.so #LoadModule put_module modules/mod_put.so <IfDefine HAVE_PERL> LoadModule perl_module modules/libperl.so </IfDefine> <IfDefine HAVE_PHP> LoadModule php_module modules/mod_php.so </IfDefine> <IfDefine HAVE_PHP3> LoadModule php3_module modules/libphp3.so </IfDefine> <IfDefine HAVE_PHP4> LoadModule php4_module modules/libphp4.so </IfDefine> <IfDefine HAVE_DAV> LoadModule dav_module modules/libdav.so </IfDefine> <IfDefine HAVE_ROAMING> LoadModule roaming_module modules/mod_roaming.so </IfDefine> <IfDefine HAVE_SSL> LoadModule ssl_module modules/libssl.so </IfDefine>

    # Reconstruction of the complete module list from all available modules

    # (static and shared ones) to achieve correct module execution order. # [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO] ClearModuleList #AddModule mod_mmap_static.c AddModule mod_vhost_alias.c AddModule mod_env.c AddModule mod_log_config.c AddModule mod_log_agent.c AddModule mod_log_referer.c #AddModule mod_mime_magic.c AddModule mod_mime.c AddModule mod_negotiation.c AddModule mod_status.c AddModule mod_info.c AddModule mod_include.c AddModule mod_autoindex.c AddModule mod_dir.c AddModule mod_cgi.c AddModule mod_asis.c AddModule mod_imap.c AddModule mod_actions.c #AddModule mod_speling.c AddModule mod_userdir.c AddModule mod_alias.c AddModule mod_rewrite.c AddModule mod_access.c AddModule mod_auth.c AddModule mod_auth_anon.c AddModule mod_auth_db.c #AddModule mod_digest.c #AddModule mod_proxy.c #AddModule mod_cern_meta.c AddModule mod_expires.c AddModule mod_headers.c #AddModule mod_usertrack.c #AddModule mod_example.c #AddModule mod_unique_id.c AddModule mod_so.c AddModule mod_setenvif.c #AddModule mod_bandwidth.c #AddModule mod_put.c <IfDefine HAVE_PERL> AddModule mod_perl.c </IfDefine> <IfDefine HAVE_PHP> AddModule mod_php.c </IfDefine> <IfDefine HAVE_PHP3> AddModule mod_php3.c </IfDefine> <IfDefine HAVE_PHP4> AddModule mod_php4.c </IfDefine> <IfDefine HAVE_DAV> AddModule mod_dav.c </IfDefine> <IfDefine HAVE_ROAMING> AddModule mod_roaming.c </IfDefine> <IfDefine HAVE_SSL> AddModule mod_ssl.c </IfDefine>

    ServerName LeeDual

    ServerAdmin rootlocalhost

    Listen 128.165.242.8:80

    Port 80

    ScoreBoardFile /var/run/httpd.scoreboard

    # Where do we put the lock and pif files? LockFile /var/lock/httpd.lock PidFile /var/run/httpd.pid CoreDumpDirectory "/data/web"

    # Documents DocumentRoot /data/web/ UserDir public_html IndexOptions FancyIndexing

    # Who runs the server? User apache Group apache

    # Performance parameters MaxClients 150 TimeOut 300 KeepAlive false MaxKeepAliveRequests 100 MaxRequestsPerChild 100 KeepAliveTimeout 15 MinSpareServers 5 MaxSpareServers 20 StartServers 8

    # Error documents

    # Misc

    AccessFileName .htaccess UseCanonicalName on TypesConfig /etc/mime.types DefaultType "text/plain"

    # Defaults for virtual hosts ServerSignature on

    # Logs

    ErrorLog /var/log/httpd/error_log

    LogLevel warn

    HostNameLookups Off

    # Need to fix this LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent CustomLog /var/log/httpd/access_log common

    Alias /icons/ "/var/www/icons/" ScriptAlias /cgi-bin/ "/data/web/cgi-bin/"

    # # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the realname directory are treated as applications and # run by the server when requested rather than as documents sent to the client. # The same rules about trailing "/" apply to ScriptAlias directives as to # Alias. # ScriptAlias /cgi-bin/ "/data/web/cgi-bin/"

    # # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/data/web/cgi-bin"> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory>

    # # Redirect allows you to tell clients about documents which used to exist in # your server's namespace, but do not anymore. This allows you to tell the # clients where to look for the relocated document. # Format: Redirect old-URI new-URL #

    # # Directives controlling the display of server-generated directory listings. #

    # # FancyIndexing: whether you want fancy directory indexing or standard # IndexOptions FancyIndexing

    # # AddIcon* directives tell the server which icon to show for different # files or filename extensions. These are only displayed for # FancyIndexed directories. # AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/* AddIconByType (IMG,/icons/image2.gif) image/* AddIconByType (SND,/icons/sound2.gif) audio/* AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe AddIcon /icons/binhex.gif .hqx AddIcon /icons/tar.gif .tar AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip AddIcon /icons/a.gif .ps .ai .eps AddIcon /icons/layout.gif .html .shtml .htm .pdf AddIcon /icons/text.gif .txt AddIcon /icons/c.gif .c AddIcon /icons/p.gif .pl .py AddIcon /icons/f.gif .for AddIcon /icons/dvi.gif .dvi AddIcon /icons/uuencoded.gif .uu AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl AddIcon /icons/tex.gif .tex AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif .. AddIcon /icons/hand.right.gif README AddIcon /icons/folder.gif ^^DIRECTORY^^ AddIcon /icons/blank.gif ^^BLANKICON^^

    # # DefaultIcon: which icon to show for files which do not have an icon # explicitly set. # DefaultIcon /icons/unknown.gif

    # # AddDescription: allows you to place a short description after a file in # server-generated indexes. These are only displayed for FancyIndexed # directories. # Format: AddDescription "description" filename # #AddDescription "GZIP compressed document" .gz #AddDescription "tar archive" .tar #AddDescription "GZIP compressed tar archive" .tgz

    # # ReadmeName: the name of the README file the server will look for by # default, and append to directory listings. # # HeaderName: the name of a file which should be prepended to # directory indexes. # # The server will first look for name.html and include it if found. # If name.html doesn't exist, the server will then look for name.txt # and include it as plaintext if found. # ReadmeName README HeaderName HEADER

    # # IndexIgnore: a set of filenames which directory indexing should ignore

    # and not include in the listing. Shell-style wildcarding is permitted.

    # IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

    # # AddEncoding: allows you to have certain browsers (Mosaic/X 2.1+) uncompress # information on the fly. Note: Not all browsers support this. # Despite the name similarity, the following Add* directives have nothing # to do with the FancyIndexing customization directives above. # AddEncoding x-compress Z AddEncoding x-gzip gz tgz

    # # AddLanguage: allows you to specify the language of a document. You can

    # then use content negotiation to give a browser a file in a language # it can understand. Note that the suffix does not have to be the same # as the language keyword --- those with documents in Polish (whose # net-standard language code is pl) may wish to use "AddLanguage pl .po"

    # to avoid the ambiguity with the common suffix for perl scripts. # AddLanguage en .en AddLanguage fr .fr AddLanguage de .de AddLanguage da .da AddLanguage el .el AddLanguage it .it

    # # LanguagePriority: allows you to give precedence to some languages # in case of a tie during content negotiation. # Just list the languages in decreasing order of preference. # LanguagePriority en fr de

    # # AddType: allows you to tweak mime.types without actually editing it, or to # make certain files to be certain types. # # The following is for PHP4 (conficts with PHP/FI, below): #<IfModule mod_php4.c> AddType application/x-httpd-php .phtml .php AddType application/x-httpd-php-source .phps #</IfModule>

    # The following is for PHP3: #<IfModule mod_php3.c> # AddType application/x-httpd-php3 .php3 # AddType application/x-httpd-php3-source .phps #</IfModule>

    # The following is for PHP/FI (PHP2): #<IfModule mod_php.c> # AddType application/x-httpd-php .phtml #</IfModule>

    AddType application/x-tar .tgz

    # # AddHandler: allows you to map certain file extensions to "handlers", # actions unrelated to filetype. These can be either built into the server # or added with the Action command (see below) # # If you want to use server side includes, or CGI outside # ScriptAliased directories, uncomment the following lines. # # To use CGI scripts: # AddHandler cgi-script .cgi AddHandler application/x-httpd-php .php AddType application/x-httpd-php .php # # To use server-parsed HTML files # AddType text/html .shtml AddHandler server-parsed .shtml

    # # Uncomment the following line to enable Apache's send-asis HTTP file # feature # #AddHandler send-as-is asis

    # # If you wish to use server-parsed imagemap files, use # AddHandler imap-file map

    # # The following directives modify normal HTTP response behavior. # The first directive disables keepalive for Netscape 2.x and browsers that # spoof it. There are known problems with these browser implementations.

    # The second directive is for Microsoft Internet Explorer 4.0b2 # which has a broken HTTP/1.1 implementation and does not properly # support keepalive when it is used on 301 or 302 (redirect) responses. # BrowserMatch "Mozilla/2" nokeepalive BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

    # # The following directive disables HTTP/1.1 responses to browsers which # are in violation of the HTTP/1.0 spec by not being able to grok a # basic 1.1 response. # BrowserMatch "RealPlayer 4\.0" force-response-1.0 BrowserMatch "Java/1\.0" force-response-1.0AddHandler application/x-httpd-php .php BrowserMatch "JDK/1\.0" force-response-1.0

    # If the perl module is installed, this will be enabled. <IfModule mod_perl.c> Alias /perl/ /var/www/perl/ <Location /perl> SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI </Location> </IfModule>

    # # Allow http put (such as Netscape Gold's publish feature) # Use htpasswd to generate /etc/httpd/conf/passwd. # You must unremark these two lines at the top of this file as well: #LoadModule put_module modules/mod_put.so #AddModule mod_put.c # #Alias /upload /tmp #<Location /upload> # EnablePut On # AuthType Basic # AuthName Temporary # AuthUserFile /etc/httpd/conf/passwd # EnableDelete Off # umask 007 # <Limit PUT> # require valid-user # </Limit> #</Location>

    # # Allow server status reports, with the URL of http://servername/server-status # Change the ".your_domain.com" to match your domain to enable. # #<Location /server-status> # SetHandler server-status # Order deny,allow # Deny from all # Allow from .your_domain.com #</Location>

    # # Allow remote server configuration reports, with the URL of # http://servername/server-info (requires that mod_info.c be loaded). # Change the ".your_domain.com" to match your domain to enable. # #<Location /server-info> # SetHandler server-info # Order deny,allow # Deny from all # Allow from .your_domain.com #</Location>

    # Allow access to local system documentation from localhost Alias /doc/ /usr/share/doc/ <Location /doc> order deny,allow deny from all allow from localhost Options Indexes FollowSymLinks </Location>

    # <IfDefine HAVE_SSL> ## ## SSL Virtual Host Context ##

    # Apache will only listen on port 80 by default. Defining the virtual server # (below) won't make it automatically listen on the virtual server's port. Listen 443

    <VirtualHost _default_:443>

    # General setup for the virtual host DocumentRoot "/var/www/html"

    # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on

    # SSL Cipher Suite: # List the ciphers that the client is permitted to negotiate. # See the mod_ssl documentation for a complete list. #SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

    # Server Certificate: # Point SSLCertificateFile at a PEM encoded certificate. If # the certificate is encrypted, then you will be prompted for a # pass phrase. Note that a kill -HUP will prompt again. A test # certificate can be generated with `make certificate' under # built time. Keep in mind that if you've both a RSA and a DSA # certificate you can configure both in parallel (to also allow # the use of DSA ciphers, etc.) SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt #SSLCertificateFile /etc/httpd/conf/ssl.crt/server-dsa.crt

    # Server Private Key: # If the key is not combined with the certificate, use this # directive to point at the key file. Keep in mind that if # you've both a RSA and a DSA private key you can configure # both in parallel (to also allow the use of DSA ciphers, etc.) SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key #SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server-dsa.key

    # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/httpd/conf/ssl.crt/ca.crt

    # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/httpd/conf/ssl.crt #SSLCACertificateFile /etc/httpd/conf/ssl.crt/ca-bundle.crt

    # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/httpd/conf/ssl.crl #SSLCARevocationFile /etc/httpd/conf/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10

    # Access Control: # With SSLRequire you can do per-directory access control based # on arbitrary complex boolean expressions containing server # variable checks and other lookup directives. The syntax is a # mixture between C and Perl. See the mod_ssl documentation # for more details. #<Location /> #SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \ # and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \ # and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \ # and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \ # and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \ # or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/ #</Location> # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the

    # server (always existing) and the client (only existing when client

    # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o CompatEnvVars: # This exports obsolete environment variables for backward compatibility # to Apache-SSL 1.x, mod_ssl 2.0.x, Sioux 1.0 and Stronghold 2.x. Use this # to provide compatibility to existing CGI scripts. # o StrictRequire: # This denies access when "SSLRequireSSL" or "SSLRequire" applied even # under a "Satisfy any" situation, i.e. when it applies access is denied # and no other module can change it. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire

    <Files ~ "\.(cgi|shtml)$"> SSLOptions +StdEnvVars </Files> <Directory "/data/web/cgi-bin"> SSLOptions +StdEnvVars </Directory>

    # Notice: Most problems of broken clients are also related to the HTTP

    # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

    # Per-Server Logging: # The home of a custom SSL log file. Use this when you want a # compact non-error SSL logfile on a virtual host basis. CustomLog /var/log/httpd/ssl_request_log \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

    </VirtualHost>

    </IfDefine>

    # Virtual hosts

    # Virtual host Default Virtual Host <VirtualHost _default_:*>

    ServerName _default_

    DirectoryIndex index.php index.html index.htm index.shtml

    ServerSignature email

    LogLevel warn HostNameLookups off

    </VirtualHost>

    # Directories...

    <Directory "/"> Options FollowSymLinks

    AllowOverride None

    </Directory>

    <Directory "/var/www/html"> Options Indexes Includes FollowSymLinks

    AllowOverride None Allow from from all

    Order Deny,Allow </Directory>

    <Directory "/var/www/icons"> Options Indexes MultiViews

    AllowOverride None Allow from from all

    Order allow,deny </Directory>

    <Directory "/data/web/cgi-bin"> Options ExecCGI

    AllowOverride None Allow from from all

    Order allow,deny </Directory> --------------------------

    attached mail follows:


    Did you try getting rid of the

    <IfDefine HAVE_PHP4>

    stuff?

    Lee Philip Reilly wrote:

    >Hi there, > >I posted this message yesterday: >------ >I recently upgraded from PHP version 4.0-ish to 4.2.3 on my Linux/Apache > >machine. AFAIK, Apache is setup correctly (it serves HTML) and PHP >works, but only from the command line. If I type "php -q php.php > >test.html" the output of phpinfo() is stored in test.html. When I try >and look at test.html running on localhost it displays fine, but when I >try and view php.php, as "save as" window pops up. I am not too familiar > >with Linux. If it was a Windows installation then I would make sure the >Action application (path to php.exe) line was correct, but I can't find >this in the Linux httpd.conf. Does this issue sound familiar to anyone. >Could anyone point me in the right direction? >----- > >I am still having the same problem. It is obviously a problem with my >httpd.conf file. PHP is installed as a CGI, and the AddHandler >application/x-httpd-php .php is present. Can anyone offer any other >suggestions? > >Below is my httpd.conf file. My apologies for inserting so many lines, >but this is an extremely niggling problem, and I... just... can't... >figure... it... out </shatner>. If anyone could have a quick look to try >and identify the problem, I would really appreciate it! > >Thanks. > >- Best regards, >Lee Reilly > >-------------------------- >## httpd.conf - configuration for the Apache web server ># ># Generated automatically... if you edit manually, the changes will be >lost ># the next time you run "apacheconfig". ># ># What we listen to ># >ServerType StandAlone >ServerRoot /etc/httpd/ > ># We don't handle this yet... > ># ># Dynamic Shared Object (DSO) Support ># ># To be able to use the functionality of a module which was built as a >DSO you ># have to place corresponding `LoadModule' lines at this location so the > ># directives contained in it are actually available _before_ they are >used. ># Please read the file README.DSO in the Apache 1.3 distribution for >more ># details about the DSO mechanism and run `httpd -l' for the list of >already ># built-in (statically linked and thus always available) modules in your >httpd ># binary. ># ># Note: The order is which modules are loaded is important. Don't >change ># the order below without expert advice. ># ># Example: ># LoadModule foo_module modules/mod_foo.so > >#LoadModule mmap_static_module modules/mod_mmap_static.so >LoadModule vhost_alias_module modules/mod_vhost_alias.so >LoadModule env_module modules/mod_env.so >LoadModule config_log_module modules/mod_log_config.so >LoadModule agent_log_module modules/mod_log_agent.so >LoadModule referer_log_module modules/mod_log_referer.so >#LoadModule mime_magic_module modules/mod_mime_magic.so >LoadModule mime_module modules/mod_mime.so >LoadModule negotiation_module modules/mod_negotiation.so >LoadModule status_module modules/mod_status.so >LoadModule info_module modules/mod_info.so >LoadModule includes_module modules/mod_include.so >LoadModule autoindex_module modules/mod_autoindex.so >LoadModule dir_module modules/mod_dir.so >LoadModule cgi_module modules/mod_cgi.so >LoadModule asis_module modules/mod_asis.so >LoadModule imap_module modules/mod_imap.so >LoadModule action_module modules/mod_actions.so >#LoadModule speling_module modules/mod_speling.so >LoadModule userdir_module modules/mod_userdir.so >LoadModule alias_module modules/mod_alias.so >LoadModule rewrite_module modules/mod_rewrite.so >LoadModule access_module modules/mod_access.so >LoadModule auth_module modules/mod_auth.so >LoadModule anon_auth_module modules/mod_auth_anon.so >LoadModule db_auth_module modules/mod_auth_db.so >#LoadModule digest_module modules/mod_digest.so >#LoadModule proxy_module modules/libproxy.so >#LoadModule cern_meta_module modules/mod_cern_meta.so >LoadModule expires_module modules/mod_expires.so >LoadModule headers_module modules/mod_headers.so >#LoadModule usertrack_module modules/mod_usertrack.so >#LoadModule example_module modules/mod_example.so >#LoadModule unique_id_module modules/mod_unique_id.so >LoadModule setenvif_module modules/mod_setenvif.so >#LoadModule bandwidth_module modules/mod_bandwidth.so >#LoadModule put_module modules/mod_put.so ><IfDefine HAVE_PERL> >LoadModule perl_module modules/libperl.so ></IfDefine> ><IfDefine HAVE_PHP> >LoadModule php_module modules/mod_php.so ></IfDefine> ><IfDefine HAVE_PHP3> >LoadModule php3_module modules/libphp3.so ></IfDefine> ><IfDefine HAVE_PHP4> >LoadModule php4_module modules/libphp4.so ></IfDefine> ><IfDefine HAVE_DAV> >LoadModule dav_module modules/libdav.so ></IfDefine> ><IfDefine HAVE_ROAMING> >LoadModule roaming_module modules/mod_roaming.so ></IfDefine> ><IfDefine HAVE_SSL> >LoadModule ssl_module modules/libssl.so ></IfDefine> > ># Reconstruction of the complete module list from all available modules > ># (static and shared ones) to achieve correct module execution order. ># [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO] >ClearModuleList >#AddModule mod_mmap_static.c >AddModule mod_vhost_alias.c >AddModule mod_env.c >AddModule mod_log_config.c >AddModule mod_log_agent.c >AddModule mod_log_referer.c >#AddModule mod_mime_magic.c >AddModule mod_mime.c >AddModule mod_negotiation.c >AddModule mod_status.c >AddModule mod_info.c >AddModule mod_include.c >AddModule mod_autoindex.c >AddModule mod_dir.c >AddModule mod_cgi.c >AddModule mod_asis.c >AddModule mod_imap.c >AddModule mod_actions.c >#AddModule mod_speling.c >AddModule mod_userdir.c >AddModule mod_alias.c >AddModule mod_rewrite.c >AddModule mod_access.c >AddModule mod_auth.c >AddModule mod_auth_anon.c >AddModule mod_auth_db.c >#AddModule mod_digest.c >#AddModule mod_proxy.c >#AddModule mod_cern_meta.c >AddModule mod_expires.c >AddModule mod_headers.c >#AddModule mod_usertrack.c >#AddModule mod_example.c >#AddModule mod_unique_id.c >AddModule mod_so.c >AddModule mod_setenvif.c >#AddModule mod_bandwidth.c >#AddModule mod_put.c ><IfDefine HAVE_PERL> >AddModule mod_perl.c ></IfDefine> ><IfDefine HAVE_PHP> >AddModule mod_php.c ></IfDefine> ><IfDefine HAVE_PHP3> >AddModule mod_php3.c ></IfDefine> ><IfDefine HAVE_PHP4> >AddModule mod_php4.c ></IfDefine> ><IfDefine HAVE_DAV> >AddModule mod_dav.c ></IfDefine> ><IfDefine HAVE_ROAMING> >AddModule mod_roaming.c ></IfDefine> ><IfDefine HAVE_SSL> >AddModule mod_ssl.c ></IfDefine> > >ServerName LeeDual > >ServerAdmin rootlocalhost > >Listen 128.165.242.8:80 > >Port 80 > >ScoreBoardFile /var/run/httpd.scoreboard > ># Where do we put the lock and pif files? >LockFile /var/lock/httpd.lock >PidFile /var/run/httpd.pid >CoreDumpDirectory "/data/web" > ># Documents >DocumentRoot /data/web/ >UserDir public_html >IndexOptions FancyIndexing > ># Who runs the server? >User apache >Group apache > ># Performance parameters >MaxClients 150 >TimeOut 300 >KeepAlive false >MaxKeepAliveRequests 100 >MaxRequestsPerChild 100 >KeepAliveTimeout 15 >MinSpareServers 5 >MaxSpareServers 20 >StartServers 8 > ># Error documents > ># Misc > >AccessFileName .htaccess >UseCanonicalName on >TypesConfig /etc/mime.types >DefaultType "text/plain" > ># Defaults for virtual hosts >ServerSignature on > ># Logs > >ErrorLog /var/log/httpd/error_log > >LogLevel warn > >HostNameLookups Off > ># Need to fix this >LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" >combined >LogFormat "%h %l %u %t \"%r\" %>s %b" common >LogFormat "%{Referer}i -> %U" referer >LogFormat "%{User-agent}i" agent >CustomLog /var/log/httpd/access_log common > >Alias /icons/ "/var/www/icons/" >ScriptAlias /cgi-bin/ "/data/web/cgi-bin/" > ># ># ScriptAlias: This controls which directories contain server scripts. ># ScriptAliases are essentially the same as Aliases, except that ># documents in the realname directory are treated as applications and ># run by the server when requested rather than as documents sent to the >client. ># The same rules about trailing "/" apply to ScriptAlias directives as >to ># Alias. ># >ScriptAlias /cgi-bin/ "/data/web/cgi-bin/" > ># ># "/var/www/cgi-bin" should be changed to whatever your ScriptAliased ># CGI directory exists, if you have that configured. ># ><Directory "/data/web/cgi-bin"> > AllowOverride None > Options ExecCGI > Order allow,deny > Allow from all ></Directory> > ># ># Redirect allows you to tell clients about documents which used to >exist in ># your server's namespace, but do not anymore. This allows you to tell >the ># clients where to look for the relocated document. ># Format: Redirect old-URI new-URL ># > ># ># Directives controlling the display of server-generated directory >listings. ># > ># ># FancyIndexing: whether you want fancy directory indexing or standard ># >IndexOptions FancyIndexing > ># ># AddIcon* directives tell the server which icon to show for different ># files or filename extensions. These are only displayed for ># FancyIndexed directories. ># >AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip > >AddIconByType (TXT,/icons/text.gif) text/* >AddIconByType (IMG,/icons/image2.gif) image/* >AddIconByType (SND,/icons/sound2.gif) audio/* >AddIconByType (VID,/icons/movie.gif) video/* > >AddIcon /icons/binary.gif .bin .exe >AddIcon /icons/binhex.gif .hqx >AddIcon /icons/tar.gif .tar >AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv >AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip >AddIcon /icons/a.gif .ps .ai .eps >AddIcon /icons/layout.gif .html .shtml .htm .pdf >AddIcon /icons/text.gif .txt >AddIcon /icons/c.gif .c >AddIcon /icons/p.gif .pl .py >AddIcon /icons/f.gif .for >AddIcon /icons/dvi.gif .dvi >AddIcon /icons/uuencoded.gif .uu >AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl >AddIcon /icons/tex.gif .tex >AddIcon /icons/bomb.gif core > >AddIcon /icons/back.gif .. >AddIcon /icons/hand.right.gif README >AddIcon /icons/folder.gif ^^DIRECTORY^^ >AddIcon /icons/blank.gif ^^BLANKICON^^ > ># ># DefaultIcon: which icon to show for files which do not have an icon ># explicitly set. ># >DefaultIcon /icons/unknown.gif > ># ># AddDescription: allows you to place a short description after a file >in ># server-generated indexes. These are only displayed for FancyIndexed ># directories. ># Format: AddDescription "description" filename ># >#AddDescription "GZIP compressed document" .gz >#AddDescription "tar archive" .tar >#AddDescription "GZIP compressed tar archive" .tgz > ># ># ReadmeName: the name of the README file the server will look for by ># default, and append to directory listings. ># ># HeaderName: the name of a file which should be prepended to ># directory indexes. ># ># The server will first look for name.html and include it if found. ># If name.html doesn't exist, the server will then look for name.txt ># and include it as plaintext if found. ># >ReadmeName README >HeaderName HEADER > ># ># IndexIgnore: a set