OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: php-general-digest-helplists.php.net
Date: Fri Apr 05 2002 - 14:00:39 CST

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

    php-general Digest 5 Apr 2002 20:00:39 -0000 Issue 1269

    Topics (messages 91666 through 91788):

    Re: PHP and mySQL...
            91666 by: Miguel Cruz
            91719 by: cyberskydive
            91724 by: Anthony Ritter
            91766 by: Miguel Cruz

    Re: Reliability of sessions
            91667 by: Meitiner
            91672 by: Michael Virnstein
            91688 by: Bob Klotz

    PHP and DOM XML
            91668 by: rarmin
            91676 by: Peter Clarke

    Session with or not cookies
            91669 by: Philippe
            91677 by: Philippe

    Re: strip spaces from inside string
            91670 by: Michael Virnstein

    FTP upload
            91671 by: Ľubomír Závodský

    mysql_fetch_array()
            91673 by: Phil Ewington
            91681 by: Ben Edwards
            91692 by: Phil Ewington
            91706 by: heinisch.creaction.de
            91773 by: Miguel Cruz

    Includes
            91674 by: Sebastian A.
            91680 by: Christoph Starkmann
            91686 by: Maxim Maletsky
            91694 by: Christoph Starkmann
            91709 by: Rick Emery

    getting lines from the highest ID in a database?
            91675 by: Hawk
            91679 by: Jason Wong
            91685 by: Maxim Maletsky
            91687 by: Michael Virnstein

    Re: strip_tags() problem
            91678 by: Michael Virnstein
            91683 by: Michael Virnstein

    Re: New-line characters
            91682 by: Jamie Watt
            91689 by: Maxim Maletsky

    Re: [PHP-GENERAL] animated gif
            91684 by: Jamie Watt

    Re: script-controlled tablewidthchange, for diff. screen resolutions
            91690 by: Jamie Watt

    Cannot compile my extension as a shared .so library
            91691 by: Martin Wickman

    multiple php.ini files
            91693 by: zoltan.arpadffy.essnet.se

    PHP and MS Access
            91695 by: ronan cleary
            91707 by: Andrew Hill

    PHP stops execution without error message
            91696 by: Ando
            91705 by: Rick Emery

    Re: preventing "back" button usage?
            91697 by: Michael Virnstein

    Return-Path
            91698 by: Anthony Rodriguez
            91699 by: Jason Wong

    Can I use php to " Print " a document?
            91700 by: Simonk
            91701 by: heinisch.creaction.de

    Session Freakiness. Losing Session.
            91702 by: Hans Petersson

    WIKI - CMS scripts
            91703 by: Miles Thompson

    Miguel...
            91704 by: Anthony Ritter
            91759 by: Miguel Cruz

    Re: Explode and Trim
            91708 by: Joshua E Minnie
            91727 by: Joshua E Minnie

    Re: Read and Escape file
            91710 by: Erik Price

    1024X760 or 800x600
            91711 by: Ron Allen
            91716 by: Justin French
            91723 by: Maxim Maletsky

    how to process URL parameers
            91712 by: Wo Chang
            91713 by: Rick Emery
            91715 by: Andrey Hristov
            91717 by: Erik Price
            91718 by: Nicolas Costes
            91721 by: Wo Chang
            91731 by: Erik Price
            91738 by: Wo Chang
            91765 by: Lee Doolan

    using new AUTOGLOBALS
            91714 by: cyberskydive
            91720 by: Erik Price
            91747 by: cyberskydive
            91749 by: Erik Price
            91761 by: Miguel Cruz
            91788 by: Philip Olson

    Directory to array to select box...
            91722 by: Jas
            91725 by: Michael Virnstein
            91726 by: Rick Emery
            91729 by: Jas
            91730 by: Jas
            91732 by: Rick Emery
            91733 by: Jas
            91734 by: Rick Emery
            91739 by: Jas
            91742 by: Michael Virnstein
            91743 by: Rick Emery
            91762 by: Miguel Cruz

    Notice: recent FAQ discussions
            91728 by: Hugh Bothwell

    conditionaly including classes/functions
            91735 by: Andrew Warner
            91741 by: Erik Price
            91771 by: CC Zona

    Re: conditionally including classes/functions
            91736 by: Rick Emery
            91758 by: Hugh Bothwell

    refresh
            91737 by: Kris Vose
            91753 by: Rick Emery
            91768 by: Rick Emery

    Writing to Files
            91740 by: Sebastian A.
            91746 by: R'twick Niceorgaw
            91755 by: Rick Emery

    regexp for ' replacement
            91744 by: Thalis A. Kalfigopoulos
            91754 by: Rick Emery
            91757 by: Thalis A. Kalfigopoulos
            91767 by: Rick Emery
            91769 by: CC Zona

    Re: Javascript and PHP??
            91745 by: Michael Virnstein

    PHP books
            91748 by: cyberskydive
            91751 by: Erik Price

    Re: Any ideas on combining arrays????
            91750 by: Michael Virnstein

    Re: What's wrong with the Array? I"m baffled!
            91752 by: Michael Virnstein

    Re: php+myslq+IDE
            91756 by: eric.coleman.zaireweb.com

    Making sure a post request came from your site
            91760 by: Chris Boget
            91764 by: Miguel Cruz
            91770 by: Chris Boget
            91772 by: Erik Price
            91775 by: Jason Wong
            91777 by: Miguel Cruz
            91778 by: Julio Nobrega Trabalhando
            91780 by: Johnson, Kirk

    PHP Authorize.net interface
            91763 by: David Johansen

    Re: New Server, Bad Attitude
            91774 by: Liam Gibbs

    Headers not working
            91776 by: Sheridan Saint-Michel

    MySQL - UPDATE & INSERT
            91779 by: Phil Schwarzmann
            91781 by: Julie Meloni
            91783 by: Rick Emery
            91784 by: Erik Price

    Arrays within classes
            91782 by: Brian McLaughlin
            91785 by: Erik Price
            91786 by: Rick Emery
            91787 by: Rick Emery

    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:


    On Thu, 4 Apr 2002, Anthony Ritter wrote:
    > Sorry if my original question was confusing.
    >
    > This is what I would like to accomplish:
    >
    > I am currently developing a database on my website using mysql which is on
    > my harddrive.
    > I have installed Apache as well and I am using PHP.
    >
    > My database is functioning fine on localhost.
    >
    > I would like to find out the steps one takes in going from the process of
    > having this reside on my harddrive - localhost - in development - to my
    > ISP's server when it goes live.

    MySQL has a command-line tool called 'mysqldump' which will output a text
    file containing all the table creates and inserts necessary to recreate
    the database.

    As others have suggested, you can use phpmyadmin to import this file, or
    you can just pipe it into the mysql command-line tool on the server once
    you've created your database. Look inside the file created by mysqldump
    and all will be much clearer.

    miguel

    attached mail follows:


    Since you didnt make it clear, do you even have MySql and php on your
    server? Are you looking to just move your data or looking to get php & mysql
    installed on the server as well? (SERVER = production site, not localhost)

    if you just wanna move data, like everyone else said phpmyadmin rocks, but I
    do have a recommendation for ya before you jump to the ease of a GUI.

    Learn how to work in the command line, for the type of situation you are
    trying to resolve, after you learn that THEN work with a GUI like
    phpmyadmin.

    this will both give you a better understanding of mysql commands and also
    help you to fully appreciate the usefullness of phpmyadmin. -lol

    if you dont already have mysql php installed on your prodution site, see
    what it will cost you to have it installed etc, if anyhting, and if its
    already suppossed to be there, make sure they have set it up for your use,
    some times ISP's wont create you a database till you ask, or even have the
    latest version of php intalled for that matter. Even though it's suppossed
    to be included in your server "option".

    hope it helps.

    "Miguel Cruz" <mncstoic.net> wrote in message
    news:Pine.LNX.4.44.0204050154190.21385-100000stoic.net...
    > On Thu, 4 Apr 2002, Anthony Ritter wrote:
    > > Sorry if my original question was confusing.
    > >
    > > This is what I would like to accomplish:
    > >
    > > I am currently developing a database on my website using mysql which is
    on
    > > my harddrive.
    > > I have installed Apache as well and I am using PHP.
    > >
    > > My database is functioning fine on localhost.
    > >
    > > I would like to find out the steps one takes in going from the process
    of
    > > having this reside on my harddrive - localhost - in development - to my
    > > ISP's server when it goes live.
    >
    > MySQL has a command-line tool called 'mysqldump' which will output a text
    > file containing all the table creates and inserts necessary to recreate
    > the database.
    >
    > As others have suggested, you can use phpmyadmin to import this file, or
    > you can just pipe it into the mysql command-line tool on the server once
    > you've created your database. Look inside the file created by mysqldump
    > and all will be much clearer.
    >
    > miguel
    >

    attached mail follows:


    Cyberskydive wrote in message:
    > Since you didnt make it clear, do you even have MySql and php on your
    > server? Are you looking to just move your data or looking to get php &
    mysql
    > installed on the server as well? (SERVER = production site, not localhost)
    .......................

    Yes. I have mySQL and PHP on my end - localhost - for development.

    I spoke with my ISP and they do not have mySQL installed on their end.

    They use MS SQL Server.

    Any idea what the cost is for the ISP to install mySQL on their end so that
    I can utilize my database that I've set up on localhost?

    Thank you.
    Tony Ritter

    attached mail follows:


    On Fri, 5 Apr 2002, Anthony Ritter wrote:
    > Any idea what the cost is for the ISP to install mySQL on their end so that
    > I can utilize my database that I've set up on localhost?

    MySQL is free for that sort of usage, so it only costs their time. If
    they've done it before, it takes about 5 minutes from beginning the
    download to standing up and clapping yourself on the back for a job well
    done - in a unix environment, anyway. Not sure what's involved on the
    Windows side but I expect it's slightly more complicated.

    miguel

    attached mail follows:


    I hope you don't live in Bethlehem

    Erik Price wrote:

    > On Thursday, April 4, 2002, at 04:40 PM, Thomas Deliduka wrote:
    >
    > > I have a quick question for a veteren of sessions out there.
    >
    > I'd trust sessions with my life.
    >
    > ----
    >
    > Erik Price
    > Web Developer Temp
    > Media Lab, H.H. Brown
    > priceehhbrown.com

    attached mail follows:


    On the page you start the session,
    ${session_name()} isn't set. so if you need that on the first page too, you
    should do the following

    <?php

    session_start();
    if (!isset(${session_name()})) {
        ${session_name()} = session_id();
    }

    ?>

    "Thomas Deliduka" <thomasneweve.com> schrieb im Newsbeitrag
    news:B8D23D74.7064%thomasneweve.com...
    I use them because 'sid' isn't always populated and, who knows, some browser
    may not handle cookies right and then lose a session. I do it to make sure,
    to be absolutely sure that it will work.

    On 4/4/02 5:19 PM this was written:

    > If you made your link like this: <a href="filename.php?<?=sid?>"> it
    tacks
    > on the name plus the session id. If cookies are enabled you will only see
    > the session id passed through the url on the first page.. After that you
    > wont, thus the little script I wrote so the '?' doesnšt show up. Now if
    > cookies arent enabled you will see the session name and id passed through
    > the url every single time. There is absolutely no reason to use those
    > functions since php takes care of that stuff for you.

    --
    

    Thomas Deliduka IT Manager ------------------------- New Eve Media The Solution To Your Internet Angst http://www.neweve.com/

    attached mail follows:


    Hi Thomas,

    > What is the opinion, are sessions reliable enough to go through the step > process?

    We are runnig some online shops for our clients based on PHP. The checkout process is always based on sessions and we never had trouble with the session management. If you are in doubt with the standard implementation of PHP session management (based on files to persist variables) you are able to overwrite the functionality of the session management by your own implementations (e.g. based on a database to persist variables).

    Bob

    attached mail follows:


    I have one question about operations that can be done with XML. What I need to do is build a web site which stores some data in XML files and retrieve that data. It's basically the system that allows users to register, login and upload and download some files. It needs to use XML.

    The question is: If there are simultaneos approaches to register or upload (registration and upload data are all stored in the single XML file), using DOM will make me problems. DOM loads the whole document into memory, and writes it whole to disk. The question is how to avoid this? Since if, for example, two users register at the same time, they both get their copy of document, and the later that writes itself to the file will overwrite the changes made by the first one. How to avoid this and still use DOM? I am using PHP 4.1.2 and libxml 2.4.19.

    Any advice is wellcome. Tnx in advance.

    Armin

    attached mail follows:


    "Rarmin" <rarminyahoo.com> wrote in message news:3CAD6CCC.4020101yahoo.com... > I have one question about operations that can be done with XML. > What I need to do is build a web site which stores some data in XML > files and retrieve that data. It's basically the system that allows > users to register, login and upload and download some files. It needs to > use XML. > > The question is: > If there are simultaneos approaches to register or upload (registration > and upload data are all stored in the single XML file), using DOM will > make me problems. DOM loads the whole document into memory, and writes > it whole to disk. The question is how to avoid this? Since if, for > example, two users register at the same time, they both get their copy > of document, and the later that writes itself to the file will overwrite > the changes made by the first one. How to avoid this and still use DOM? > I am using PHP 4.1.2 and libxml 2.4.19. > > Any advice is wellcome. > Tnx in advance. > > Armin >

    You could lock the xml file while a user registers: http://www.php.net/manual/en/function.flock.php

    if ($fp = fopen($file, "r")) { if (flock ($fp, LOCK_EX + LOCK_NB )) { // process registration here flock ($fp,LOCK_UN); fclose($fp); } }

    however only one user will be able to register at a time.

    It would be better to store this in a database because then you can have multiple simultaneous registrations. Then when whatever application needs to see the info as xml, have php generate the xml from the data in the database.

    Peter

    attached mail follows:


    Hello,

    I'm working with sessions. It's work fine with PHP 4.0.6 and when I update to 4.1.2. I've seen a strange thing, I canno't explain:

    Before when a client consult our webserver with no cookies enabled, the PHPSESSID was been add in the URL automatly and when the cookies are enable, the PHPSESSID was save in the cookie. This work fine

    But now, with no cookie enabled, the PHPSESSID was not add in the end of the URL. So I loose the session and the session variable.

    It is a change in this new version ? Do I make a change in my program ?

    I'm working on MacOs X.1.3 with PHP 4.1.2.

    Thanks for your answer.

    Best regards,

    Philippe B. http://www.allovac.com France

    attached mail follows:


    Hello,

    I 've found where the problem is. It is with the last update of PHP 4.1.2 of Apple (Apple security Update of 5th April). This library seems light. Also there isn't the GD Library. When I go back to a version 4.1.2 by entropy.ch, All is OK. Session works fine and GD Library is present.

    Excuse me for the noise.

    Best regards,

    >Hello, > >I'm working with sessions. It's work fine with PHP 4.0.6 and when I update to 4.1.2. I've seen a strange thing, I canno't explain: > >Before when a client consult our webserver with no cookies enabled, the PHPSESSID was been add in the URL automatly and when the cookies are enable, >the PHPSESSID was save in the cookie. This work fine > >But now, with no cookie enabled, the PHPSESSID was not add in the end of the URL. So I loose the session and the session variable. > >It is a change in this new version ? Do I make a change in my program ? > >I'm working on MacOs X.1.3 with PHP 4.1.2.

    Philippe B.

    attached mail follows:


    the easiest way would be:

    <? // -------------

    // init var $str = "";

    $str = "abc def ghi";

    $str = str_replace (" ", "", $str);

    echo $str."<br>"; // ---------------------------- // output: // abcdefghi // ---------------------------- // // or a regex: $str = "abc def ghi"; $str = ereg_replace(" ", "", $str); echo $str."<br>";

    //if you want to strip any whitespace character: $str = "abc def ghi"; $str = preg_replace("/\s/", "", $str); echo $str."<br>";

    // ------------- ?>

    preg_replace is quite powerful, so if you only want to strip some spaces, you should prefer str_replace. Always think about how many power you need. str_replace -> ereg_replace -> preg_replace.

    Michael

    "Chris Boget" <chriswild.net> schrieb im Newsbeitrag news:007f01c1d502$b70b3360$8c01a8c0wild.net... > > Say I have a string "xyz abc def" and I want to remove all of the spaces > > withing the string to create a new one. What's the best way? > > <? > > $string = "xyz abc def"; > > $stringWithOutSpaces = implode( "", explode( " ", $string )); > > ?> > > Or you can use eregi_replace(), but I don't know what the regex would be. > I *think* you can do: > > <? > > $string = "xyz abc def"; > > $stringWithOutSpaces = eregi_replace( " ", "", $string ); > > ?> > > > Chris >

    attached mail follows:


    Hello ,is it possible to upload file that is bigger than 8MB thrue FTP upload programmed in PHP? I need send attachments up to 50MB by FTP. It's for a graphic studio which works with big files. If yes how? Thank you Zavodsky zavodskydigitalmaster.cz

    ---
    Odchozí zpráva neobsahuje viry.
    Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz).
    Verze: 6.0.338 / Virová báze: 189 - datum vydání: 14.3.2002
     
    

    attached mail follows:


    Hi All,

    I am new to PHP and am having a bit of trouble. I have a recordset using...

    $events = mysql_fetch_array($recordset);

    this drags in 3 columns from my table...

    event_id, event_title, event_date

    I want to search the recordset for a given date, if found I want to be able to reference event_id & event_title from the row. I am using PHP 4.01.

    TIA

    Phil Ewington.

    ---
    P.S. If there are any ColdFusion developers on this list, what is the PHP
    equivalent of a structure?
    

    attached mail follows:


    $db = mysql_open();

    $results = mysql_query( "select * from something", $db );

    while( $row = mysql_fetch_array( $results ) ) { ....processing using $row["column"] as reference }

    Ben

    At 11:21 05/04/2002, Phil Ewington wrote:

    >Hi All, > >I am new to PHP and am having a bit of trouble. I have a recordset using... > >$events = mysql_fetch_array($recordset); > >this drags in 3 columns from my table... > >event_id, event_title, event_date > >I want to search the recordset for a given date, if found I want to be able >to reference event_id & event_title from the row. I am using PHP 4.01. > >TIA > >Phil Ewington. > >--- >P.S. If there are any ColdFusion developers on this list, what is the PHP >equivalent of a structure? > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    **************************************************************** * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builder http://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * ****************************************************************

    attached mail follows:


    Jason,

    This is for an events calendar, I want all the dates form the db but when I am generating the individual days for the calendar I need to know whether there is an event for that day, hence pulling out all the dates from the db. As I am looping through all the days in a month to dynamically create the calendar, I do not want to loop through the entire recordset to look for a date for that day in each iteration. Does your method find any row in the recordset with a given date?

    I am at present exploring the possibility of creating individual arrays for each row in the recordset using the date as the name of the array, then testing to see if it exists. That way I can check for the existence of a given date at any point in my code and reference the associated values without looping through the recordset each time. My code is as follows...

    while ($row = mysql_fetch_assoc($events)) { $a = "date_" . $row["event_date"]; $$a = array($row["event_id"], $row["event_title"]); }

    if ($date_2002-04-15) { do_something(); }

    Any comments will be greatfully received.

    Phil.

    > -----Original Message----- > From: Jason Wong [mailto:php-generalgremlins.com.hk] > Sent: 05 April 2002 11:31 > To: philn-igma.net > Subject: Re: [PHP] mysql_fetch_array() > > > On Friday 05 April 2002 18:21, you wrote: > > Hi All, > > > > I am new to PHP and am having a bit of trouble. I have a > recordset using... > > > > $events = mysql_fetch_array($recordset); > > > > this drags in 3 columns from my table... > > > > event_id, event_title, event_date > > > > I want to search the recordset for a given date, if found I > want to be able > > to reference event_id & event_title from the row. I am using PHP 4.01. > > Shouldn't you be doing your searching and selecting from within > your mysql > query? > > But if you insist on doing it in PHP then: > > > if ($events['event_date'] == whatever) { > do_something(); > } > > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > You will engage in a profitable business activity. > */ >

    attached mail follows:


    At 05.04.2002 12:31, you wrote: > >Jason, > >This is for an events calendar, I want all the dates form the db but when I >am generating the individual days for the calendar I need to know whether >there is an event for that day, hence pulling out all the dates from the db. >As I am looping through all the days in a month to dynamically create the >calendar, I do not want to loop through the entire recordset to look for a >date for that day in each iteration. Does your method find any row in the >recordset with a given date?

    As I understand your problem, I would suggest, that you just select the days in the month, where there are events f.e. select count(ref#) from DB where date 'inside your scope' and events 'are there events' this gives you the number of lines. If there are any, you could ask more detailed, using the informations stored. If there are no events, make the calendar as normal. Thats also a good explanation for the column ref# (autoincrement, unique)

    Even you only have to deal with one select, and can order your result, so that it makes you no pain showing them

    >I am at present exploring the possibility of creating individual arrays for >each row in the recordset using the date as the name of the array, then >testing to see if it exists. That way I can check for the existence of a >given date at any point in my code and reference the associated values >without looping through the recordset each time. My code is as follows... > >while ($row = mysql_fetch_assoc($events)) { > $a = "date_" . $row["event_date"]; > $$a = array($row["event_id"], $row["event_title"]); >}

    Here the select could be Assuming you have the DB´s 'event_ref ' where 'event date' and 'event reference number' put in and 'event_content' where other useful informations are stored selct a.event_title, from event_ref a, event_content b where b.ref = a.ref and a.date='2002-04-15' No dealing with arrays and var_vars, just straight sql.

    HTH Oliver

    >if ($date_2002-04-15) { do_something(); } > >Any comments will be greatfully received.

    attached mail follows:


    On Fri, 5 Apr 2002, Phil Ewington wrote: > This is for an events calendar, I want all the dates form the db but when I > am generating the individual days for the calendar I need to know whether > there is an event for that day, hence pulling out all the dates from the db. > As I am looping through all the days in a month to dynamically create the > calendar, I do not want to loop through the entire recordset to look for a > date for that day in each iteration.

    That sounds like a lot of work (both for you and for the server). Assuming you want to draw a monthly calendar where each day appears whether or not it holds any events (it's even easier if you don't need that)...

    Just make sure the database returns your results in date order.

    SELECT eventtitle, eventdate FROM event WHERE eventdate>='2002-03-01' AND eventdate<'2002-04-01' ORDER BY eventdate

    Then loop through the days and draw any events that happen to occur on each day as you get to it:

    $row = mysql_fetch_assoc($sql); for ($day = 1; $day <= $num_days_in_month; $day++) { print "<h3>$day</h3>"; while ($row && (date('j', strtotime($row['eventdate'])) == $day)) { print "<p>{$row['eventtitle']}</p>"; $row = mysql_fetch_assoc($sql); } }

    miguel

    attached mail follows:


    Lately I have noticed many scripts that all consist of one file even though they create the appearance of many pages. For example, you would open setup.php and a form would appear. Then after you complete the form a new page appears with the results of your form, however the URL is still setup.php. So basically you can make complicated forms span only one file instead of having separate file to gather, display and save the data, how is this done?

    attached mail follows:


    Hi Sebastian!

    > Lately I have noticed many scripts that all consist of one > file even though > they create the appearance of many pages. For example, you would open > setup.php and a form would appear. Then after you complete > the form a new > page appears with the results of your form, however the URL is still > setup.php. So basically you can make complicated forms span > only one file > instead of having separate file to gather, display and save > the data, how is > this done?

    You can handle the HTML-output from within any functions. What I am doing normally is the following.

    I got one page, let's say main.php

    When calling this page I pass it a variable that tells main.php which function to execute ("printForm", "submitForm", "changeDB" etc.)

    This is done by a simple switch-cascade.

    Now I'm organizing my functions properly in different include-files, let's say "displayFuncs.php", "dbFuncs.php" etc..

    And IMHO anything is much more clean and relaxed like this ;) On the other hand, if you connect to a db etc. you only have to write the code for the db_connect only one time (I include this, too).

    Was this what you wanted to know?

    Cheers,

    Kiko

    ----- It's not a bug, it's a feature. christoph starkmann mailto:kikonfq.de http://www.fh-augsburg.de/~kiko ICQ: 100601600 -----

    attached mail follows:


    we still use include();

    setup.php has something like:

    if(file_exists($page) and ...more...controls..) include_once $page;

    then the $page.php is where you have a part of your site.

    You can pass $page as the GET variable: setup.php?page=page.php

    and so on....

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    Sebastian A. writes:

    > Lately I have noticed many scripts that all consist of one file even though > they create the appearance of many pages. For example, you would open > setup.php and a form would appear. Then after you complete the form a new > page appears with the results of your form, however the URL is still > setup.php. So basically you can make complicated forms span only one file > instead of having separate file to gather, display and save the data, how is > this done? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    attached mail follows:


    > Well, I think I should give a better explanation. I have been > seeing a lot > of scripts that appear to be on multiple pages. For example: > You open file.php, and you are greeted with a form asking > your name. You > give in your name and then submit the form. After you submit > the form you > would normally get a new page saying your name has been > stored or something > like that. This time, that also happens BUT you do not go to > a new separate > file. The URL in your browser is still on file.php, however > the form that > was there before is GONE and you see a totally new page. I am > asking how > something like this can be done. If it will help I can attach > a file that > does this.

    Yes, and exactly this is what I told you ;)

    I've got one page, let's say "main.php". This page is looking for a var, let's say called "$curAction"; $curAction is not present the script knows that you're new to this site and calls a function called "displayWelcome" (wherever this function is defined ;)).

    <?php

    $curAction = $HTTP_POST_VARS["curAction"];

    switch ($curAction) { case "displayForm1": { displayForm1(); break; } case "displayForm2": { displayForm2(); break; } case "logoff": { displayGoodbye(); logout(); break; }

    // And so on... }

    function displayForm1() { ?><form><!-- html goes here --></form><?php }

    // ...and so forth ?>

    So this switch casecade handles what content is to be displayed, which looks as if you where getting different pages...

    Better now?

    Cheers,

    Kiko

    ----- It's not a bug, it's a feature. christoph starkmann mailto:kikonfq.de http://www.fh-augsburg.de/~kiko ICQ: 100601600 -----

    attached mail follows:


    Assume the following file is named "this_script.php": This is all in ONE file.

    <?php if (isset($submit) ) { print "$mytext<BR>\n"; do some other stuff exit; } ?>

    <HTML> <HEAD> </HEAD> <BODY> <FORM method=post action="./this_script.php"> <INPUT type=text name=mytext><BR> <INPUT type=submit name=submit value=<Submit"> </FORM </BODY> </HTML>

    -----Original Message----- From: Sebastian A. [mailto:sebixinium.com] Sent: Friday, April 05, 2002 4:19 AM To: PHP General List (PHP.NET) Subject: [PHP] Includes

    Lately I have noticed many scripts that all consist of one file even though they create the appearance of many pages. For example, you would open setup.php and a form would appear. Then after you complete the form a new page appears with the results of your form, however the URL is still setup.php. So basically you can make complicated forms span only one file instead of having separate file to gather, display and save the data, how is this done?

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

    attached mail follows:


    Lets say I have a guestbook, and that I only want to show the last entry on my first page I cant figure out a good way to do it.. haven't managed to find a mysql command that can do it either, but maybe there are? :)

    attached mail follows:


    On Friday 05 April 2002 18:27, Hawk wrote: > Lets say I have a guestbook, and that I only want to show the last entry on > my first page > I cant figure out a good way to do it.. > haven't managed to find a mysql command that can do it either, but maybe > there are? :)

    The only reliable way to do it is to have a field in your guestbook table which records the time that the entry was made. Then you can:

    SELECT * FROM guestbook ORDER BY time_entered LIMIT 1

    I have set follow-up to php-dblists.php.net where this belongs.

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
    

    /* If there is any realistic deterrent to marriage, it's the fact that you can't afford divorce. -- Jack Nicholson */

    attached mail follows:


    add to your mySQL query:

    " order by id desc limit 1"

    This will order your data by your primary id (change 'id' to whatever you auto-increment) in the descending order and will limit the results to 1 record.

    Cheers,

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    Hawk writes:

    > Lets say I have a guestbook, and that I only want to show the last entry on > my first page > I cant figure out a good way to do it.. > haven't managed to find a mysql command that can do it either, but maybe > there are? :) > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    attached mail follows:


    this should do the trick:

    SELECT MAX(field) from table

    you have to use MAX to get the highest value in field.

    Michael

    "Jason Wong" <php-generalgremlins.com.hk> schrieb im Newsbeitrag news:php.general-91679news.php.net... > On Friday 05 April 2002 18:27, Hawk wrote: > > Lets say I have a guestbook, and that I only want to show the last entry on > > my first page > > I cant figure out a good way to do it.. > > haven't managed to find a mysql command that can do it either, but maybe > > there are? :) > > The only reliable way to do it is to have a field in your guestbook table > which records the time that the entry was made. Then you can: > > > SELECT * FROM guestbook ORDER BY time_entered LIMIT 1 > > I have set follow-up to php-dblists.php.net where this belongs. > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > If there is any realistic deterrent to marriage, it's the fact that you > can't afford divorce. > -- Jack Nicholson > */

    attached mail follows:


    try the following:

    $text = ""; $fp = fopen("http://www.yahoo.com", "r"); while (!feof($fp)) { // read a line and strip all php and html tags // there's a third optional parameter, which // allowes to specify tags not to be replaced $text .= fgetss($fp, 4096); } fclose($fp); echo $text; "Ryan Govostes" <panictwcny.rr.com> schrieb im Newsbeitrag news:BC8CE28A-480C-11D6-ACEA-003065E5E422twcny.rr.com... > The following simple code does not function: > > $html = include("http://www.yahoo.com"); > $text = strip_tags($html); > echo $text; > > I've tried several variations of the above, such as using preg_replace() > instead of strip_tags() and readfile() instead of include(), but it does > not work at all, no matter what. Does anyone know why? >

    attached mail follows:


    or instead of fopen, use: $fp = fsockopen("http://www.yahoo.com", 80, $errno, $errstr, 30) or die ("Could not connect to yahoo.com"); // wait for answer (replacement for deprecated set_socket_blocking) socket_set_blocking($fp, 1);

    i forgot to "die" in the example below, if connection could not be established. so $fp = fopen("http://www.yahoo.com", "r"); should be $fp = fopen("http://www.yahoo.com", "r") or die ("Could not connect"); or you get an endless while loop on the feof if connection fails.

    "Michael Virnstein" <michael.virnsteinbrodos.de> schrieb im Newsbeitrag news:20020405103533.10388.qmailpb1.pair.com... > try the following: > > $text = ""; > $fp = fopen("http://www.yahoo.com", "r"); > while (!feof($fp)) { > // read a line and strip all php and html tags > // there's a third optional parameter, which > // allowes to specify tags not to be replaced > $text .= fgetss($fp, 4096); > } > fclose($fp); > echo $text; > "Ryan Govostes" <panictwcny.rr.com> schrieb im Newsbeitrag > news:BC8CE28A-480C-11D6-ACEA-003065E5E422twcny.rr.com... > > The following simple code does not function: > > > > $html = include("http://www.yahoo.com"); > > $text = strip_tags($html); > > echo $text; > > > > I've tried several variations of the above, such as using preg_replace() > > instead of strip_tags() and readfile() instead of include(), but it does > > not work at all, no matter what. Does anyone know why? > > > >

    attached mail follows:


    You'de be better off using the built in nl2br() function (http://www.php.net/manual/en/function.nl2br.php) it'll have the same effect as a it'll insert a <br> tag everwhere a newline character occurs. Where 2 newline characters occur it will produce <br><br> which in your HTML will break your text in the same way that a <p> tag would.

    "James Stewart" <JStewartjubilee2000uk.org> wrote in message news:E7ACE637F3E5D211AFB50080C86DF8812826D3j2000_nt_srv1.jubilee2000uk.org. .. > Hi, > > I have a form for users of a system I am developing to add their newsletters > to a MySQL database through. I take their input and INSERT it straight into > the database after adding slashes. > > When I retrieve the information from the database I would like to replace > double occurences of new-lines with a <p> tag. Can anyone tell me what > regexp I should be searching for? > > cheers. James. >

    attached mail follows:


    FYI:

    <br><br> is not same as <p>. P is paragraph and br is just a line break of the text. So, depending on your text format the lines broken twice might (normally ARE but not too noticeably) look different.

    try to mess with CSS and you'll see the difference about how browsers see those both ways.

    In the poster's case, to have a <p> out of <br><br> he should still use nl2br() and then add this to it:

    $text = preg_replace("/\w*<br>\w*<br>\w*/i", "\n\n<p>", $text);

    Cheers,

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    Jamie Watt writes:

    > You'de be better off using the built in nl2br() function > (http://www.php.net/manual/en/function.nl2br.php) it'll have the same effect > as a it'll insert a <br> tag everwhere a newline character occurs. Where 2 > newline characters occur it will produce <br><br> which in your HTML will > break your text in the same way that a <p> tag would. > > > "James Stewart" <JStewartjubilee2000uk.org> wrote in message > news:E7ACE637F3E5D211AFB50080C86DF8812826D3j2000_nt_srv1.jubilee2000uk.org. > .. >> Hi, >> >> I have a form for users of a system I am developing to add their > newsletters >> to a MySQL database through. I take their input and INSERT it straight > into >> the database after adding slashes. >> >> When I retrieve the information from the database I would like to replace >> double occurences of new-lines with a <p> tag. Can anyone tell me what >> regexp I should be searching for? >> >> cheers. James. >> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    attached mail follows:


    Sounds like you'll have to use PHP to to first create the images. Then in your output page just include some javascript to rotate the images. If you have to you can use PHP to write the javascript.

    "Jessica Lee Tishmack" <jlt29707sci.tamucc.edu> wrote in message news:Pine.LNX.4.10.10005111313590.18992-100000penguin.tamucc.edu... > can you incorporate java script into php? (I am using php because each > image has to be generated on the fly, based on a data set...realtime data) > > > Thanks, > Jessica > > On Thu, 11 May 2000, Liz Kimber wrote: > > > You could try making the number of images and use a continusuly running java > > script to switch them, which is kinda all an animated gif is hence they stop > > often when you press the stop button! > > >

    attached mail follows:


    Sounds like you might be trying to do things the hard way. Wouldn't it be easier to simply set the table widths as a percentage rather than an exact width in pixels?

    Eg. width="50%"

    The above example will set the table width to 50% of the browser window width. Or maybe you could use a bit of DHTML and javascript to do the resizing instead?

    If you really badly want to do it the way you described below I guess you could use javascript to detect the values for screen width and height and then send them to PHP.

    "Helmut Ott" <haottfreenet.de> wrote in message news:009f01bfbda6$2e8c9850$09bf06d5pentium... Hallo everybody, huuh - has anybody seen a scriptbased, parametric pagelayout control?

    Depending on the viewers screen resoltion I would like to change table and cell widths in my page. This would mean I only need ONE version. The screen resolution detection would e.g. find a width of 640 pix. Say my sttandrad res. was 800 than a factor could calulated by setting Factor=res. viewer / res. standard. In the above sample this would be 640 / 800 = 0,8 as factor-value.

    All page, table, row, cell, images width (and heights) would have to be multilied with this factor.

    As the screen res. can only be analysed on the clientside it must be e.g. a javascript to do that.

    Did anybody hear about any way to get this done. Any tip is greatly appreciated.

    Helmut

    attached mail follows:


    Hi

    php-4.1.2 linux RH 7.2

    I have created a small php extension. The extension works as expected when I compile it using

    $ ./configure --with-foo && make # foo is the extension

    It gets compiled into the php binary. All is well, but I would like to compile my extension as a loadable modules (ie to use with the dl() function). Thus

    $ ./configure --with-foo=shared && make

    The compilation completes with no errors. The php binary works (my foo ext is not included in the binary), but I end up with *no* 'foo.so' file. Instead I get this

    $ ls -l modules/ 51776 Apr 5 13:11 foo.a 647 Apr 5 13:11 foo.la

    I expected to see a 'foo.so' file.

    Obviously I cannot use dl() on these files.

    The foo extension is as simple as possible, just to illustrate the problem. It was created using these commands:

    1. $ cd ~/php-4.1.2/ext 2. $ ./ext_skel --extname=foo 3. $ cd .. 4. $ vi ext/foo/config.m4 5. $ ./buildconf 6. $ ./configure --with-foo=shared 7. $ make

    The whole config.m4:

    PHP_ARG_WITH(foo, for foo support, [ --with-foo Include foo support])

    if test "$PHP_FOO" != "no"; then PHP_EXTENSION(foo, $ext_shared) fi

    Output from make:

    make[3]: Entering directory `/home/wic/php-4.1.2/ext/foo' /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=compile gcc -I. -I/home/wic/php-4.1.2/ext/foo -I/home/wic/php-4.1.2/main -I/home/wic/php-4.1.2 -I/home/wic/php-4.1.2/Zend -I/home/wic/php-4.1.2/ext/mysql/libmysql -I/home/wic/php-4.1.2/ext/xml/expat -I/home/wic/php-4.1.2/TSRM -g -O2 -prefer-pic -c foo.c && touch foo.slo /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=link gcc -I. -I/home/wic/php-4.1.2/ext/foo -I/home/wic/php-4.1.2/main -I/home/wic/php-4.1.2 -I/home/wic/php-4.1.2/Zend -I/home/wic/php-4.1.2/ext/mysql/libmysql -I/home/wic/php-4.1.2/ext/xml/expat -I/home/wic/php-4.1.2/TSRM -g -O2 -prefer-non-pic -static -o foo.la -avoid-version -module -rpath /home/wic/php-4.1.2/modules foo.lo /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=install cp foo.la /home/wic/php-4.1.2/modules PATH="$PATH:/sbin" ldconfig -n /home/wic/php-4.1.2/modules ---------------------------------------------------------------------- Libraries have been installed in: /home/wic/php-4.1.2/modules

    [etc...]

    Note that I can manually create a so-file from the foo.a file using ld as in:

    $ cd modules; ar x foo.a; ld -Bshareable -o foo.so foo.o

    and then call dl("foo.so"), but that is not the way to go, right???

    I think there is some arcance libtool switch missing in the Makefile, or I need something else in the config.m4 file

    Btw, my real extension is a lot more complex, but it has the same problems so I figured this foo-thing would be a bit easier to debug :-)

    I have searched high and low for any leads, but nothing has turned up so far.

    /Regards

    attached mail follows:


    hi,

    does anybody have some experience with running PHP with different permissions and modules.

    The only way that I imagine is to have 2 (or more) independent PHP installations with separate php.ini files. But this is stone age technique... I am sure that PHP has some kind of ini loading functionality (that I could not found in the documentation)

    Thank you very much for in advance for any creative suggestion. Regards, Z

    attached mail follows:


    I am running PHP and Apache and have a problem connecting to an Ms Access database

    I cannot connect to my database. I am using an Apache Server with PHP. Now as far as I can see these work fine apart from some dll files in PHP.

    I have also set up an ODBC connection to my database, but when I try and run the PHP code I get errors.

    This is the PHP code I am using. The ODBC is called link1 and the database db1.

    <?php $db = ODBC_Connect("link1", "",""); $res = ODBC_Exec($db, "SELECT Employee.Name FROM Employee;"); while (ODBC_Fetch_Row($res)) { echo "<TR><TD>".ODBC_Result($res, 'fieldname')."</TD></TR>"; } ODBC_Free_Result($res);

    ?>

    These are the errors that it returns

    X-Powered-By: PHP/4.0.6 Content-type: text/html Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data., SQL state S1000 in SQLConnect in o:\program files\apache group\apache\htdocs\name1.php on line 2

    Warning: Supplied argument is not a valid ODBC-Link resource in o:\program files\apache group\apache\htdocs\name1.php on line 3

    Warning: Supplied argument is not a valid ODBC result resource in o:\program files\apache group\apache\htdocs\name1.php on line 4

    Warning: Supplied argument is not a valid ODBC result resource in o:\program files\apache group\apache\htdocs\name1.php on line 7

    Any help on where to go would be great.

    Thanks a million

    Ronan

    _________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com

    attached mail follows:


    Ronan,

    Check these: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q306269 http://support.microsoft.com/default.aspx?scid=kb;EN-US;q174943

    It's most likely an issue with how you have your DSN setup or how apache is running.

    Best regards, Andrew Hill Director of Technology Evangelism http://www.openlinksw.com/virtuoso/whatis.htm OpenLink Virtuoso Universal Server

    > -----Original Message----- > From: ronan cleary [mailto:clear_rohotmail.com] > Sent: Friday, April 05, 2002 6:42 AM > To: php-generallists.php.net > Subject: [PHP] PHP and MS Access > > > I am running PHP and Apache and have a problem connecting to an Ms Access > database > > I cannot connect to my database. I am using an Apache Server with > PHP. Now > as far as I can see these work fine apart from some dll files in PHP. > > I have also set up an ODBC connection to my database, but when I > try and run > the PHP code I get errors. > > This is the PHP code I am using. The ODBC is called link1 and the > database > db1. > > <?php > $db = ODBC_Connect("link1", "",""); > $res = ODBC_Exec($db, "SELECT Employee.Name FROM Employee;"); > while (ODBC_Fetch_Row($res)) { > echo "<TR><TD>".ODBC_Result($res, 'fieldname')."</TD></TR>"; > } > ODBC_Free_Result($res); > > ?> > > These are the errors that it returns > > X-Powered-By: PHP/4.0.6 Content-type: text/html > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The > Microsoft > Jet database engine cannot open the file '(unknown)'. It is > already opened > exclusively by another user, or you need permission to view its > data., SQL > state S1000 in SQLConnect in o:\program files\apache > group\apache\htdocs\name1.php on line 2 > > Warning: Supplied argument is not a valid ODBC-Link resource in > o:\program > files\apache group\apache\htdocs\name1.php on line 3 > > Warning: Supplied argument is not a valid ODBC result resource in > o:\program > files\apache group\apache\htdocs\name1.php on line 4 > > Warning: Supplied argument is not a valid ODBC result resource in > o:\program > files\apache group\apache\htdocs\name1.php on line 7 > > > Any help on where to go would be great. > > Thanks a million > > Ronan > > _________________________________________________________________ > Join the world’s largest e-mail service with MSN Hotmail. > http://www.hotmail.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Running php ver 3.0.12 and mysql ver 3.22.32 on a linux box. Php installed as apache module The script im running takes a long time to execute (20-40 minutes) and includes hundreds of selects and inserts into the database, and also opening/closing lots of files. And quite often, the script just stops in the middle of runnning without any error message. It isnt a timeout, since i have set_time_limit(3600); I have absolutely no idea what it can be or where to start debugging. Any ideas what it can be (ie lack of resources?) and how would it be possible to debug it. Thanks

    attached mail follows:


    If this is a web-page you are generating, I believe browser timeout is 5 minutes.

    -----Original Message----- From: Ando [mailto:c980775ttu.ee] Sent: Friday, April 05, 2002 6:19 AM To: php-generallists.php.net Subject: [PHP] PHP stops execution without error message Importance: Low

    Running php ver 3.0.12 and mysql ver 3.22.32 on a linux box. Php installed as apache module The script im running takes a long time to execute (20-40 minutes) and includes hundreds of selects and inserts into the database, and also opening/closing lots of files. And quite often, the script just stops in the middle of runnning without any error message. It isnt a timeout, since i have set_time_limit(3600); I have absolutely no idea what it can be or where to start debugging. Any ideas what it can be (ie lack of resources?) and how would it be possible to debug it. Thanks

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

    attached mail follows:


    i don't like javascript. It's pain in the ass to get this working on more than IE and Netscape. Btw, to get it working on IE and Netscape is annoying enough already imo.So what i would do is registering some sort of variable in the session, that shows you if the page has been submitted already. On the page that processes the form, you register this variable to the session, if it isn't registered already. if it is registered already, you simply ignore the request

    That's the easiest way, but as long as the session remains, the user wouldn't be able to submit this form again. So if you want the user to be able to submit this form again but preventing him from submitting the same data again, you have to do a little more than what i mentioned above.

    Regards, Michael

    "Erik Price" <priceehhbrown.com> schrieb im Newsbeitrag news:33DA7538-464A-11D6-A42D-0050E4857868hhbrown.com... > > On Thursday, March 28, 2002, at 06:50 PM, Michael Virnstein wrote: > > > This is not possible. You cannot force the browser > > not to go back in its history, don't even trie to find a solution for > > this... > > the question you should ask yourself is not how to disable the browser > > history > > but how you can prevent your page by getting screwed by multiple posts. > > I see. Then, when I try to do something similar to this on FedEx.com or > Amazon.com, is it JavaScript that redirects me to an error page? If so > then I will have to use both tactics -- preventing a form from being > resubmit, and JavaScript to "disable" the back button (unethical as it > may be). > > > Erik > > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > priceehhbrown.com >

    attached mail follows:


    Can you help me?

    When I call the following script:

    (1) <?php (2) mail("afrodriguezatt.net", (3) "Test", (4) "Test", (5) "From:SBW Research <mailsbwresearch.com>\r\n", (6) "Return-Path:<mailsbwresearch.com>\r\n"); (7) exit; (8) ?>

    I get the following error message:

    Warning: Wrong parameter count for mail() in ... (file_name) ... on line 6.

    By the way, I tried it with and w/o the \r.

    Any suggestions?

    Thanks!

    Anthony F. Rodriguez (sbwibellatlantic.net)

    attached mail follows:


    On Friday 05 April 2002 20:49, Anthony Rodriguez wrote: > Can you help me? > > When I call the following script: > > (1) <?php > (2) mail("afrodriguezatt.net", > (3) "Test", > (4) "Test", > (5) "From:SBW Research <mailsbwresearch.com>\r\n", > (6) "Return-Path:<mailsbwresearch.com>\r\n"); > (7) exit; > (8) ?> > > I get the following error message: > > Warning: Wrong parameter count for mail() in ... (file_name) ... on line 6. > > By the way, I tried it with and w/o the \r. > > Any suggestions?

    mail() is only supposed to take 4 parameters, but you're trying to feed it with 5.

    The last parameter (the 4th) can take any number of headers separated by by '\r\n'. So try:

    > (1) <?php > (2) mail("afrodriguezatt.net", > (3) "Test", > (4) "Test", > (5) "From:SBW Research <mailsbwresearch.com>\r\n". > (6) "Return-Path:<mailsbwresearch.com>\r\n"); > (7) exit; > (8) ?>

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

    /* CF&C stole it, fair and square. -- Tim Hahn */

    attached mail follows:


    Is there any functions or command that I can print out a page or a document without using the browsers' print?

    attached mail follows:


    At 05.04.2002 14:26, you wrote: >Is there any functions or command that I can print out a page or a document >without using the browsers' print? If you have compiled php as standalone (I think it´s called the cgi) you can use the exec("lpd docname"), if you have a printer on your box, or in your network. If you want to do this on the clients(surfers) machine, you have to use the browser and JavaScript, as you are 'only' sending a html-page. HTH Oliver

    attached mail follows:


    Hi,

    I have an odd problem. I have intermittent loss of sessions happening, and I've spent lots of time trying to figure it out, but I am at a loss here.

    I found a post on phpbuilder that seem to be the same or a similar problem from 2001:

    http://www.phpbuilder.com/forum/archives/2/2001/3/1/125803

    Unfortunately no conclusion seems to have been reached in the thread.

    Anyway, to my problem. I set a cookie with the sessionid on successful login. I also store the sessionid in a mysql database with a timestamp. I check the cookie with the db, and update on each reload.

    The script resides in one page, that is used repeatedly, and uses the same sessionhandling function for each request.

    I have the timeouts set to 1 hour (3600) for both the sessioncookie, and the session file on the server.

    Php version is 4.1.2, residing on Gentoo Linux, with a mysql db.

    I have observed the directory containing the sessionfiles, while a tester browsed the site, and watched the session disappear from the directory before timeout has elapsed.

    It is an intermittent problem, and seem to happen randomly...

    Any ideas what's going on here? Any hints would be greatly appreciated!

    Regards -Hans

    attached mail follows:


    This is a general question, and I'm not trying for flames, but I've been looking at various CMS sites:

    php-nuke, post-nuke, php-website, typo-3, and ez-publish. I've probably visited others, but haven't book marked them.

    One thing which seems to characterize them all, is that they seem awfully "busy", and it is easy to lose your way when navigating. Is that because the developers are trying to cram as much as possible on to their front pages, or do they tend that way as content and headlines are added?

    Anyone know of any sites using any of the aforementioned scripts which are less busy, and on which navigation is clearer?

    Regards - Miles Thompson

    PS If you don't want to clutter the list, reply to me offlist and I'll summarize and post. /mt

    attached mail follows:


    Miguel,

    Thanks for the reply. .............................

    > MySQL has a command-line tool called 'mysqldump' which will output a text > file containing all the table creates and inserts necessary to recreate > the database.

    O.K.

    Now I have a .txt file of my sql statement. ..................................

    > As others have suggested, you can use phpmyadmin to import this file, or > you can just pipe it into the mysql command-line tool on the server once > you've created your database. Look inside the file created by mysqldump > and all will be much clearer.

    I take that to mean (the ISP's remote server where my website resides). Right?

    How can I get the compete mysql statement onto the ISP's server?

    Please advise. ................................

    What I would like to know is:

    I would like to find out the steps one takes in going from the process of having the mysql data reside on my harddrive - localhost - in development - to my ISP's server when it goes live.

    The site resides on a remote server (the ISP's) when it is published (or goes live).

    Thank you. Tony Ritter ....................................

    ---
    [This E-mail scanned for viruses by IAS, an Archiventure Company]
    

    attached mail follows:


    On Fri, 5 Apr 2002, Anthony Ritter wrote: > Now I have a .txt file of my sql statement. > >> As others have suggested, you can use phpmyadmin to import this file, or >> you can just pipe it into the mysql command-line tool on the server once >> you've created your database. Look inside the file created by mysqldump >> and all will be much clearer. > > I take that to mean (the ISP's remote server where my website resides). > Right? > > How can I get the compete mysql statement onto the ISP's server?

    If you have shell access on your ISP's server, the quickest way to get that data into the database there is to copy the file across (using FTP or scp or whatever you use) and then pipe it straight in. Assuming that the mysqldump file is called 'data.txt', your database name is 'my_database' and your database username is 'me', you could use a command like this:

    mysql -p -u me my_database < data.txt

    It'll ask for your password and then the data will be in.

    If you don't have command-line access, you could use a tool like phpmyadmin, which your ISP may provide. It has an option to import data from a mysqldump file.

    Worst comes to worst, you can write a quick PHP script that reads each line of the .txt file and sends it to mysql_query. Just skip blank lines and comments (lines starting with #).

    miguel

    attached mail follows:


    Unfortunately it doesn't. That is why I am kind of puzzled by the situation.

    --
    Joshua E Minnie
    CIO
    joshacsurf.net
    

    "Don't work for recognition, but always do work worthy of recognition."

    "Maxim Maletsky" <subscriptionsphpbeginner.com> wrote > > I think what yo wrote should be working fine for you. > > My way of your code: > > > > > foreach(file($storelist) as $line_num=>$line_data) { > foreach(explode(':', $line) as $key=>$val) { > $val = trim($val); // remove whitespaces around > > // now you are inside each element of your > multidimentional array > // combine your rest of the code and work it out the way > you need it. > > } > } > > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > maximphpbeginner.com > www.phpbeginner.com > > > > -----Original Message----- > > From: Joshua E Minnie [mailto:joshacsurf.net] > > Sent: Friday, April 05, 2002 1:07 AM > > To: php-generallists.php.net > > Subject: [PHP] Explode and Trim > > > > I am parsing through a text file and using explode to convert the > string to > > an array. The problem seems to be at the end of the string, when I > check to > > see if the last element in the array is empty it tells me that it is > not. > > The problem comes because the last element should be empty because all > that > > was after the separator was white space. > > > > ---Sample text file--- > > AL:123 2nd Ave.:SomeCity:(123) 456-7890:(123) 456-1234::: > > MI:293 3rd St.:Another City:(123) 345-2839:(123) 384-0398::: > > MI:437 4th Ave.:Yet Another City:(123) 283-4839:(123) 458-4843::: > > ---End of text file--- > > > > ---Code snippit--- > > $stores = file($storelist); > > for($i=0; $i<count($stores); $i++) { > > //$stores[$i] = trim($stores[$i],"\r"); > > //$stores[$i] = trim($stores[$i],"\n"); > > //$stores[$i] = trim($stores[$i], ":"); > > //$stores[$i] = rtrim($stores[$i]); > > echo $stores[$i]."<br><br>\n"; > > $stores[$i] = explode(":", $stores[$i]); > > } > > > > reset($states); > > while(current($states) && current($stores)) { > > for($i=0; $i<count($stores); $i++, next($stores)) { > > while($stores[$i][0] != key($states)) { > > next($states); > > $state = 0; > > } > > if($state==0) { > > echo "<b>".$states[$stores[$i][0]]."</b><br>\n"; > > $state = 1; > > } > > echo $stores[$i][1].", ".$stores[$i][2]."<br>Phone: > > ".$stores[$i][3]."<br>Fax: ".$stores[$i][4]."<br>\n"; > > if(!empty($stores[$i][5])) echo "Email: ".$stores[$i][5]."<br>\n"; > > if(!empty($stores[$i][6])) echo "Web site: > ".$stores[$i][6]."<br>\n"; > > if(!empty($stores[$i][7]) && $stores[$i][7] != "") echo > "Additional > > notes: ".$stores[$i][7]."<br>\n"; > > echo "<br>"; > > } > > } > > ---End of code snippit--- > > > > Here is the URL of where the code is being used: > > www.wildwebtech.com/acs/nuven/stores.php. The additional notes should > only > > show up if there were additional notes. > > > > -- > > Joshua E Minnie > > CIO > > joshacsurf.net > > > > "Don't work for recognition, but always do work worthy of > recognition." > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    It works great using the foreach statements, but for some reason couldn't make it work the other way. Oh well, no one ever said there was only one way to do things when programming. Thanks for your help.

    ---
    Joshua E Minnie
    CIO
    joshacsurf.net
    

    "Don't work for recognition, but always do work worthy of recognition."

    "Maxim Maletsky" <subscriptionsphpbeginner.com> wrote:> > I think what yo wrote should be working fine for you. > > My way of your code: > > > > > foreach(file($storelist) as $line_num=>$line_data) { > foreach(explode(':', $line) as $key=>$val) { > $val = trim($val); // remove whitespaces around > > // now you are inside each element of your > multidimentional array > // combine your rest of the code and work it out the way > you need it. > > } > } > > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > maximphpbeginner.com > www.phpbeginner.com > > > > -----Original Message----- > > From: Joshua E Minnie [mailto:joshacsurf.net] > > Sent: Friday, April 05, 2002 1:07 AM > > To: php-generallists.php.net > > Subject: [PHP] Explode and Trim > > > > I am parsing through a text file and using explode to convert the > string to > > an array. The problem seems to be at the end of the string, when I > check to > > see if the last element in the array is empty it tells me that it is > not. > > The problem comes because the last element should be empty because all > that > > was after the separator was white space. > > > > ---Sample text file--- > > AL:123 2nd Ave.:SomeCity:(123) 456-7890:(123) 456-1234::: > > MI:293 3rd St.:Another City:(123) 345-2839:(123) 384-0398::: > > MI:437 4th Ave.:Yet Another City:(123) 283-4839:(123) 458-4843::: > > ---End of text file--- > > > > ---Code snippit--- > > $stores = file($storelist); > > for($i=0; $i<count($stores); $i++) { > > //$stores[$i] = trim($stores[$i],"\r"); > > //$stores[$i] = trim($stores[$i],"\n"); > > //$stores[$i] = trim($stores[$i], ":"); > > //$stores[$i] = rtrim($stores[$i]); > > echo $stores[$i]."<br><br>\n"; > > $stores[$i] = explode(":", $stores[$i]); > > } > > > > reset($states); > > while(current($states) && current($stores)) { > > for($i=0; $i<count($stores); $i++, next($stores)) { > > while($stores[$i][0] != key($states)) { > > next($states); > > $state = 0; > > } > > if($state==0) { > > echo "<b>".$states[$stores[$i][0]]."</b><br>\n"; > > $state = 1; > > } > > echo $stores[$i][1].", ".$stores[$i][2]."<br>Phone: > > ".$stores[$i][3]."<br>Fax: ".$stores[$i][4]."<br>\n"; > > if(!empty($stores[$i][5])) echo "Email: ".$stores[$i][5]."<br>\n"; > > if(!empty($stores[$i][6])) echo "Web site: > ".$stores[$i][6]."<br>\n"; > > if(!empty($stores[$i][7]) && $stores[$i][7] != "") echo > "Additional > > notes: ".$stores[$i][7]."<br>\n"; > > echo "<br>"; > > } > > } > > ---End of code snippit--- > > > > Here is the URL of where the code is being used: > > www.wildwebtech.com/acs/nuven/stores.php. The additional notes should > only > > show up if there were additional notes. > > > > -- > > Joshua E Minnie > > CIO > > joshacsurf.net > > > > "Don't work for recognition, but always do work worthy of > recognition." > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    On Friday, April 5, 2002, at 02:50 AM, Miguel Cruz wrote:

    > Certain characters have special meanings in string literals (that is, > strings you explicitly type into your PHP source code) but if you get > them > in via other means (reading from file, reading from form submissions, > etc.) then they are not treated specially.

    I have heard of string 'literals' and numeric 'literals' -- and now I learn that they are different from, for instance, strings read from a file or accepted from a form. Is there a resource that discusses these different programming constructs? The PHP manual mentions string literals but assumes that the reader already knows what they are (i.e., doesn't define them opposed to other types of inputs -- http://us4.php.net/manual/ro/html/language.types.string.html).

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    Is there a way with PHP to determine screen resolution size???

    attached mail follows:


    No, this is a client side (browser) issue, like newer versions of JavaScript, or Java...

    PHP IS A SERVER SIDE LANGUAGE which generates HTML to send to the browser.

    IF you could establish the resolution on the client side, you could parse this value back to PHP as a var to build certain pages, and perhaps store the resolution in a cookie/session.

    But I have to ask if it's all worth it... I don't believe it is at all -- and that's coming from a background in graphic design, with fixed width pages, etc etc. It's the web, deal with it.

    Side note: get_browser() can establish many features of a browser (such as javascript and cookies) but not even it can determine screen resolution... this is not an issue for PHP.

    on 06/04/02 12:41 AM, Ron Allen (allenrfwd.areur.army.mil) wrote:

    > Is there a way with PHP to determine screen resolution size??? > >

    attached mail follows:


    no, there's no way. But, you could use JavaScript to do this job and appnend the values to URLs as GETs.

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    Ron Allen writes:

    > Is there a way with PHP to determine screen resolution size??? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    attached mail follows:


    Dear All,

    Sorry to trouble you with this simple question!

    if I have this php code:

    echo "<a href=http://abc.com/test.php?xyz>try</a>";

    how would I process the xyz from test.php?

    Any thoughts would be greatly appreciated!

    --Wo

    attached mail follows:


    <?php if( isset($xyz) ) { ...do something... } ?>

    -----Original Message----- From: Wo Chang [mailto:wchangnist.gov] Sent: Friday, April 05, 2002 8:55 AM To: php-generallists.php.net Subject: [PHP] how to process URL parameers

    Dear All,

    Sorry to trouble you with this simple question!

    if I have this php code:

    echo "<a href=http://abc.com/test.php?xyz>try</a>";

    how would I process the xyz from test.php?

    Any thoughts would be greatly appreciated!

    --Wo

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

    attached mail follows:


    if (isset($HTTP_GET_VARS['xyz'])){

    }

    Andrey

    ----- Original Message ----- From: "Wo Chang" <wchangnist.gov> To: <php-generallists.php.net> Sent: Friday, April 05, 2002 5:54 PM Subject: [PHP] how to process URL parameers

    Dear All,

    Sorry to trouble you with this simple question!

    if I have this php code:

    echo "<a href=http://abc.com/test.php?xyz>try</a>";

    how would I process the xyz from test.php?

    Any thoughts would be greatly appreciated!

    --Wo

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

    attached mail follows:


    On Friday, April 5, 2002, at 09:54 AM, Wo Chang wrote:

    > Sorry to trouble you with this simple question! > > if I have this php code: > > echo "<a href=http://abc.com/test.php?xyz>try</a>"; > > how would I process the xyz from test.php?

    It needs to be a name/value pair, like this:

    echo "<a href='http://abc.com/test.php?name=value'>try</a>";

    Most people do it like this, letting them put a PHP variable in there:

    echo "<a href=\"http://abc.com/test.php?variablename=$php_variable\">try</a>";

    or if you don't like to use escaped doublequotes, try

    echo '<a href="http://abc.com/test.php?variablename=' . $php_variable . '">try</a>';

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    Le Vendredi 5 Avril 2002 16:54, Wo Chang a écrit : > Dear All, > > Sorry to trouble you with this simple question! > > if I have this php code: > > echo "<a href=http://abc.com/test.php?xyz>try</a>"; > > how would I process the xyz from test.php? > > Any thoughts would be greatly appreciated! > > --Wo

    <?php //test.php

    if (isset($xyz)) { //some code } ?>

    -- 
     ( °> Nicolas Costes
     //\\  IUT de La Roche / Yon
    / \/ ) Nicolas.costesiut-laroche.univ-nantes.fr
    `-<<  http://luxregina.free.fr
    

    attached mail follows:


    Dear PHPers,

    Thanks for the extra hands! They all work!!

    --Wo

    ----- Original Message ----- From: "Erik Price" <priceehhbrown.com> To: "Wo Chang" <wchangnist.gov> Cc: <php-generallists.php.net> Sent: Friday, April 05, 2002 10:00 AM Subject: Re: [PHP] how to process URL parameers

    > > On Friday, April 5, 2002, at 09:54 AM, Wo Chang wrote: > > > Sorry to trouble you with this simple question! > > > > if I have this php code: > > > > echo "<a href=http://abc.com/test.php?xyz>try</a>"; > > > > how would I process the xyz from test.php? > > It needs to be a name/value pair, like this: > > echo "<a href='http://abc.com/test.php?name=value'>try</a>"; > > Most people do it like this, letting them put a PHP variable in there: > > echo "<a > href=\"http://abc.com/test.php?variablename=$php_variable\">try</a>"; > > or if you don't like to use escaped doublequotes, try > > echo '<a href="http://abc.com/test.php?variablename=' . $php_variable . > '">try</a>'; > > > > Erik > > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > priceehhbrown.com

    attached mail follows:


    On Friday, April 5, 2002, at 10:36 AM, Wo Chang wrote:

    > So, if I want to include multiple parameters, > I'll use something like: ?a=1?b=2 right?

    No, actually in the querystring the ? only serves to separate the URL from the querystring. So you can only use it once, immediately after the URL. To add additional values, you use the & sign.

    url.com?a=1&b=2&c=3 etc.

    > Another question: if I want to hide all these > parameters at the url, how I can do that without > using the form.

    If you want to do that, it's a little more complex -- you can't use the querystring at all. You need to pass your values via the POST method in HTTP. The easiest way to do this is to make an HTML form and specify the method of the <form> tag as POST (like this: <form method="post" action="targetpage.php">).

    There is another way, it's a bit more involved. You open a socket with the server and directly send the data as POST data. This allows you to avoid having to bother with a form. Rasmus Lerdorf wrote a function to do this (takes most of the work out of it) but it helps to understand how sockets work if you're going to take this route. Let me know if you want this function, I have a copy of it.

    I CC'd this back to the list, because there are probably others who can benefit from this conversation -- in general, try to keep discussion on the list unless there is some reason for privacy.

    Feel free to ask if you have more questions!

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    Thanks Eric, very good info!!

    For now, I jsut process the string after the "?". Things working fine.

    Many thanks!

    --Wo

    ----- Original Message ----- From: "Erik Price" <priceehhbrown.com> To: "Wo Chang" <wchangnist.gov> Cc: <php-generallists.php.net> Sent: Friday, April 05, 2002 11:14 AM Subject: Re: [PHP] how to process URL parameers

    > > On Friday, April 5, 2002, at 10:36 AM, Wo Chang wrote: > > > So, if I want to include multiple parameters, > > I'll use something like: ?a=1?b=2 right? > > No, actually in the querystring the ? only serves to separate the URL > from the querystring. So you can only use it once, immediately after > the URL. To add additional values, you use the & sign. > > url.com?a=1&b=2&c=3 > etc. > > > Another question: if I want to hide all these > > parameters at the url, how I can do that without > > using the form. > > If you want to do that, it's a little more complex -- you can't use the > querystring at all. You need to pass your values via the POST method in > HTTP. The easiest way to do this is to make an HTML form and specify > the method of the <form> tag as POST (like this: <form method="post" > action="targetpage.php">). > > There is another way, it's a bit more involved. You open a socket with > the server and directly send the data as POST data. This allows you to > avoid having to bother with a form. Rasmus Lerdorf wrote a function to > do this (takes most of the work out of it) but it helps to understand > how sockets work if you're going to take this route. Let me know if you > want this function, I have a copy of it. > > I CC'd this back to the list, because there are probably others who can > benefit from this conversation -- in general, try to keep discussion on > the list unless there is some reason for privacy. > > Feel free to ask if you have more questions! > > > Erik > > > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > priceehhbrown.com

    attached mail follows:


    >>>>> "Erik" == Erik Price <priceehhbrown.com> writes: [. . .]

    Erik> There is another way, it's a bit more involved. You open a Erik> socket with the server and directly send the data as POST Erik> data. This allows you to avoid having to bother with a Erik> form. Rasmus Lerdorf wrote a function to do this (takes Erik> most of the work out of it) but it helps to understand how Erik> sockets work if you're going to take this route. Let me Erik> know if you want this function, I have a copy of it.

    you can use curl also.

    -- 
    Share your feedback at Affero:
        http://svcs.affero.net/rm.php?r=leed_25
    

    attached mail follows:


    So I wanna learn how to code properly with register_globals off, I reead on PHP.net about the new auto globals and inmy new php4.1.2 windows installation using php.ini-rec edited according to the intall.txt file, and a few changes from books I have (upload tmp dir etc) I'm off to learn how to use the new auto globals. I've tried $_REGISTER and $_POST . Here is what I tried as a simple test.

    <form method="post" action="somefile.php"> <input type="text" name="is_name"> <input type="submit"> </form>

    --somefile.php--

    <?

    print("$_REGISTER["is_name"]"); or print("$_POST["is_name"]");

    ?>

    I also tried $HTTP_POST_VARS["name"]

    I didnt think about it till now but would it work if i assigned say : $is_name = getenv($_POST or $_REGISTER);

    this came about while I was learning sessions, which were not working right with 4.0 installed with APACHE on windows. So I decided to update my php, as an ISAPI module, instead of running as a cgi version, and I left register_globals off.

    when I tried to edit an example session script I had from a book to use $_POST, $_REGISTER, or even $_SESSION i got a blank page on the reload. I think sid is returning empty.

    Can anyone offer me advice on this, proper coding and or proper configuration in PHP.INI

    I'm trying to learn all this at once-lol, and learn it properly the first time around, especially since register globas will be deprecitated-poof.

    I WANT TO BE A GOOD PHP DUDE_LOL_HAHA

    attached mail follows:


    On Friday, April 5, 2002, at 09:55 AM, cyberskydive wrote:

    > So I wanna learn how to code properly with register_globals off, I > reead on

    Good idea, it's not really harder than doing it the old way and it helps you visualize where your data is coming from. I actually prefer it this way.

    > when I tried to edit an example session script I had from a book to use > $_POST, $_REGISTER, or even $_SESSION i got a blank page on the > reload. I > think sid is returning empty.

    Yes, I have not yet seen a book that uses the register_globals off style. Hopefully that will change as the shift towards register_globals off becomes more popular.

    > Can anyone offer me advice on this, proper coding and or proper > configuration in PHP.INI

    Just turn register_globals off, and make sure you're using PHP 4.1.x or greater. I don't know much about Windows so if there is something wrong with your server then somebody else will be a better help.

    > I'm trying to learn all this at once-lol, and learn it properly the > first > time around, especially since register globas will be deprecitated-poof.

    Yep, that's what I did -- almost from the beginning I've been doing it this way. Just make sure that any time you refer to data that comes from one of the superglobals arrays, you use $_*['variablename'] instead of just $variablename. So if you have a cookie with a value of "Fred" and a name of "first_name", do $_COOKIE['first_name'] when you want to use that variable -- its value is "Fred".

    The only one that works a bit different is $_SESSION['variablename'] -- it is the easiest way to set session variables. Just do something like

    // user has submitted POST data, and you have // checked it for errors in your script $_SESSION['variablename'] = $_POST['variablename']; // put POST variable in a session

    How easy is that! Note that doing this assignment with any other superglobal doesn't work and in most cases wouldn't make sense anyway. For instance, you can't set cookies using $_COOKIE['name'] = $name

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    the thing is, using the methods I described in my first post, the superglobals or autoglobals arent working. I cant figure out why, and , like the other guy said, most books dont include this feature in a topic for discussion.

    Can anyone offer advice?

    "Cyberskydive" <cyberskydivesunraydesigns.com> wrote in message news:20020405145742.15718.qmailpb1.pair.com... > So I wanna learn how to code properly with register_globals off, I reead on > PHP.net about the new auto globals and inmy new php4.1.2 windows > installation using php.ini-rec edited according to the intall.txt file, and > a few changes from books I have (upload tmp dir etc) I'm off to learn how to > use the new auto globals. I've tried $_REGISTER and $_POST . Here is what I > tried as a simple test. > > <form method="post" action="somefile.php"> > <input type="text" name="is_name"> > <input type="submit"> > </form> > > --somefile.php-- > > <? > > print("$_REGISTER["is_name"]"); > or > print("$_POST["is_name"]"); > > ?> > > I also tried $HTTP_POST_VARS["name"] > > I didnt think about it till now but would it work if i assigned say : > $is_name = getenv($_POST or $_REGISTER); > > this came about while I was learning sessions, which were not working right > with 4.0 installed with APACHE on windows. So I decided to update my php, as > an ISAPI module, instead of running as a cgi version, and I left > register_globals off. > > when I tried to edit an example session script I had from a book to use > $_POST, $_REGISTER, or even $_SESSION i got a blank page on the reload. I > think sid is returning empty. > > Can anyone offer me advice on this, proper coding and or proper > configuration in PHP.INI > > I'm trying to learn all this at once-lol, and learn it properly the first > time around, especially since register globas will be deprecitated-poof. > > I WANT TO BE A GOOD PHP DUDE_LOL_HAHA > >

    attached mail follows:


    On Friday, April 5, 2002, at 12:09 PM, cyberskydive wrote:

    > the thing is, using the methods I described in my first post, the > superglobals or autoglobals arent working. I cant figure out why, and , > like > the other guy said, most books dont include this feature in a topic for > discussion. > > Can anyone offer advice?

    Post your exact code, I'll look at it.

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    On Fri, 5 Apr 2002, cyberskydive wrote: > So I wanna learn how to code properly with register_globals off, I reead on > PHP.net about the new auto globals and inmy new php4.1.2 windows > installation using php.ini-rec edited according to the intall.txt file, and > a few changes from books I have (upload tmp dir etc) I'm off to learn how to > use the new auto globals. I've tried $_REGISTER and $_POST . Here is what I > tried as a simple test. > > <form method="post" action="somefile.php"> > <input type="text" name="is_name"> > <input type="submit"> > </form> > > --somefile.php-- > > <? > > print("$_REGISTER["is_name"]"); > or > print("$_POST["is_name"]"); > > ?>

    Two problems.

    1) It's $_REQUEST, not $_REGISTER

    2) Take the outermost quotes off the argument to your print, like so:

    print $_REQUEST["is_name"];

    miguel

    attached mail follows:


    As miguel suggests, these are just arrays. Use them like any other array:

    print $arr['key']; print "string {$arr['key']} string"; print 'string ' . $arr['key'] . ' string'; etc.

    Read about arrays and strings: http://us2.php.net/manual/en/language.types.array.php http://de.php.net/manual/en/language.types.string.php http://www.zend.com/zend/tut/using-strings.php

    With the only difference being that they are *super* global, so no need for: global $_SERVER; in your functions, etc.

    Now if you want to be truly cutting edge :) Then consider extract() or import_request_variables() like so:

    import_request_variables('g', 'g_');

    Which will allow: // http://www.example.com/test.php?foo=bar print $g_foo; // the GET variable foo

    Which is like: print $_GET['foo']; print $HTTP_GET_VARS['foo'];

    See manual entry for more details and features: http://uk.php.net/import_request_variables

    The above assumes you want it to be from GET and only GET, maybe this is not your desire so modify accordingly.

    Or let's say you want to use server predefined variables such as $PHP_SELF, $DOCUMENT_ROOT, etc. yet have register_globals remain off. Since register_globals = on creates these, consider:

    a) Using $_SERVER or $HTTP_SERVER_VARS in your code i.e. print $_SERVER['HTTP_USER_AGENT']; b) Or use extract()

    For example:

    // If register_globals are off (0) then extract if (!ini_get('register_globals')) { extract($HTTP_SERVER_VARS); }

    // We just created these! print $PHP_SELF; print $REQUEST_URI;

    Going through $_SERVER is good in that you're not wasting energy creating variables you'll never use, so do as you will.

    extract() has many many options, read about them: http://ca.php.net/extract

    All of the above should give ideas, have fun!

    Regards, Philip Olson

    p.s. Use a mirror http://uk.php.net/mirrors.php

    On Fri, 5 Apr 2002, Miguel Cruz wrote:

    > On Fri, 5 Apr 2002, cyberskydive wrote: > > So I wanna learn how to code properly with register_globals off, I reead on > > PHP.net about the new auto globals and inmy new php4.1.2 windows > > installation using php.ini-rec edited according to the intall.txt file, and > > a few changes from books I have (upload tmp dir etc) I'm off to learn how to > > use the new auto globals. I've tried $_REGISTER and $_POST . Here is what I > > tried as a simple test. > > > > <form method="post" action="somefile.php"> > > <input type="text" name="is_name"> > > <input type="submit"> > > </form> > > > > --somefile.php-- > > > > <? > > > > print("$_REGISTER["is_name"]"); > > or > > print("$_POST["is_name"]"); > > > > ?> > > Two problems. > > 1) It's $_REQUEST, not $_REGISTER > > 2) Take the outermost quotes off the argument to your print, like so: > > print $_REQUEST["is_name"]; > > miguel > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Ok here is my problem, for one I am new to php and would like a new pair of eyes for this piece of code, and second what I would like to accomplish is putting the contents of a directory into an array and then pulling the contents of that array into a select box for further processing... If someone could give me some more information on GetDirArray() or a different way to accomplish this problem that would be great... this is where I am thus far. <?php

    $i=0; // counter $files = array(); // array to store directory content

    // open directory $dir = opendir("/home/web/b/bignickel.net/htdocs/");

    // loop through directory and put filenames into an array while ($file = readdir($dir)) { $files[$i] = $file; $i++; } // pull $file (directory array into select box) $file_count .="<OPTION VALUE=\"$file\">$file</OPTION>"; $form = "<p><FORM METHOD=\"post\" ACTION=\"blank.php3\"> <SELECT NAME=\"files\">$file_count</SELECT> <INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"> </FORM></p>"; // close directory closedir($dir); ?> Then of course I just use an echo to display the select box but so far I have not been able to have it actually work so any help would be great.. Thanks in advance, jas

    attached mail follows:


    how about that:

    <p> <FORM METHOD="post" ACTION="blank.php3"> <SELECT NAME="files">

    <?php $dir = opendir("/home/web/b/bignickel.net/htdocs/"); while (false !== ($file = readdir($dir)) { if ($file == "." || $file == "..") { continue; } echo "<OPTION VALUE=\"$file\">$file</OPTION>\n"; } ?>

    </SELECT> <INPUT TYPE="submit" NAME="submit" VALUE="select"> </FORM> </p>

    in your example there are two mistakes: 1. "while ($file = readdir($dir))" is wrong and should be "while (false !== ($file = readdir($dir))". (see php manual readdir) 2. "$file_count .="<OPTION VALUE=\"$file\">$file</OPTION>";" is not inside the loop, so you will only get the last $file and not all (3. you probably do not need "." and ".." in your list, "." is a reference to the same directory and ".." to the directory above the current one)

    "Jas" <jlgerfenhotmail.com> schrieb im Newsbeitrag news:20020405153411.54502.qmailpb1.pair.com... > Ok here is my problem, for one I am new to php and would like a new pair of > eyes for this piece of code, and second what I would like to accomplish is > putting the contents of a directory into an array and then pulling the > contents of that array into a select box for further processing... If > someone could give me some more information on GetDirArray() or a different > way to accomplish this problem that would be great... this is where I am > thus far. > <?php > > $i=0; // counter > $files = array(); // array to store directory content > > // open directory > $dir = opendir("/home/web/b/bignickel.net/htdocs/"); > > // loop through directory and put filenames into an array > while ($file = readdir($dir)) { > $files[$i] = $file; > $i++; > } > // pull $file (directory array into select box) > $file_count .="<OPTION VALUE=\"$file\">$file</OPTION>"; > $form = "<p><FORM METHOD=\"post\" ACTION=\"blank.php3\"> > <SELECT NAME=\"files\">$file_count</SELECT> > <INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"> > </FORM></p>"; > // close directory > closedir($dir); > ?> > Then of course I just use an echo to display the select box but so far I > have not been able to have it actually work so any help would be great.. > Thanks in advance, > jas > >

    attached mail follows:


    Since I ran this on Win2000 machine, I changed name of directory: You were right on the money with your code; just a minor mod or two was required:

    <?php

    $i=0; // counter $files = array(); // array to store directory content

    // open directory $dir = opendir("c:\\wbs\\");

    // loop through directory and put filenames into an array while ($filex = readdir($dir)) { $files[$i] = $filex; $i++; // pull $file (directory array into select box) $file_count .="<OPTION VALUE=\"$filex\">$filex</OPTION>\n"; } $form = "<p><FORM METHOD=\"post\" ACTION=\"blank.php3\">\n". "<SELECT NAME=\"files\">$file_count</SELECT>\n". "<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\">\n". "</FORM></p>"; // close directory closedir($dir); print $form; ?>

    outputs the following: <p><FORM METHOD="post" ACTION="blank.php3"> <SELECT NAME="files"><OPTION VALUE=".">.</OPTION> <OPTION VALUE="..">..</OPTION> <OPTION VALUE="activities.txt">activities.txt</OPTION> <OPTION VALUE="addwbs.php3">addwbs.php3</OPTION> <OPTION VALUE="classWBS.php">classWBS.php</OPTION> <OPTION VALUE="funcs.inc">funcs.inc</OPTION> <OPTION VALUE="link.php">link.php</OPTION> <OPTION VALUE="snoopy.inc">snoopy.inc</OPTION> <OPTION VALUE="wbs.sql">wbs.sql</OPTION> <OPTION VALUE="wbsconv.php">wbsconv.php</OPTION> <OPTION VALUE="wbsform.php3">wbsform.php3</OPTION> <OPTION VALUE="wbsload.sql">wbsload.sql</OPTION> <OPTION VALUE="wbspkg.php3">wbspkg.php3</OPTION> <OPTION VALUE="wbsproject.csv">wbsproject.csv</OPTION> <OPTION VALUE="wbsproject.mpp">wbsproject.mpp</OPTION> <OPTION VALUE="xx.php">xx.php</OPTION> </SELECT> <INPUT TYPE="submit" NAME="submit" VALUE="select"> </FORM></p>

    -----Original Message----- From: Jas [mailto:jlgerfenhotmail.com] Sent: Friday, April 05, 2002 9:33 AM To: php-generallists.php.net Subject: [PHP] Directory to array to select box...

    Ok here is my problem, for one I am new to php and would like a new pair of eyes for this piece of code, and second what I would like to accomplish is putting the contents of a directory into an array and then pulling the contents of that array into a select box for further processing... If someone could give me some more information on GetDirArray() or a different way to accomplish this problem that would be great... this is where I am thus far. <?php

    $i=0; // counter $files = array(); // array to store directory content

    // open directory $dir = opendir("/home/web/b/bignickel.net/htdocs/");

    // loop through directory and put filenames into an array while ($file = readdir($dir)) { $files[$i] = $file; $i++; } // pull $file (directory array into select box) $file_count .="<OPTION VALUE=\"$file\">$file</OPTION>"; $form = "<p><FORM METHOD=\"post\" ACTION=\"blank.php3\"> <SELECT NAME=\"files\">$file_count</SELECT> <INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"> </FORM></p>"; // close directory closedir($dir); ?> Then of course I just use an echo to display the select box but so far I have not been able to have it actually work so any help would be great.. Thanks in advance, jas

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

    attached mail follows:


    Ok I tried a different way to do it and this is the resulting code... I still need to be able to make some hidden fields so the contents of the item selected may be passed to another script which will stick the path of the file into a database table if anyone wants to give me a hand with that part. Here is what I have and it is working as far as just reading the directory and putting the contents into a select box... <?php // varible to hold path to directory we wish to open $dir_name = "/path/to/directory/on/server/"; // opening directory $dir = opendir($dir_name); // varible to start form $file_list .= "<p><FORM METHOD=\"post\" ACTION=\"db.php3\"> <SELECT NAME=\"files\">$file_name"; // read the directory and place them into file names for further processing while ($file_name = readdir($dir)) { // exclude "." and ".." file names if (($file_name != ".") && ($file_name !="..")) { // variable to place results of directory into select box $file_list .= "<OPTION VALUE=\"$file_name\">$file_name</OPTION>"; } } // closing select and form and adding select button $file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"></FORM></p>"; // close the directory closedir($dir); ?> If anyone knows how to do this in a better way please let me know, but this works and all it needs is some hidden fields (i am assuming here) so that the item that the user selects from the list can be further processed, like sticking the file path (not the actual file) into a database table. (I need help with that...) Enj0y! Jas

    attached mail follows:


    Hey Rick, thanks a ton... you have helped me out alot on this list. I got the code working probably about the same time you and another gentleman posted the same fixes I made, however I now have another question about adding a hidden field to take the results of the users selection and passing it along to another form which will stick it into a database, not the file mind you, i simply need to stick the path of the file into a database table. If you have any suggestions on how to do this that would be great. Thanks again, Jas

    attached mail follows:


    I must be missing something.

    Just add a HIDDEN type in your form. It will be sent with all your form data.

    -----Original Message----- From: Jas [mailto:jlgerfenhotmail.com] Sent: Friday, April 05, 2002 10:14 AM To: php-generallists.php.net Subject: Re: [PHP] Directory to array to select box...

    Hey Rick, thanks a ton... you have helped me out alot on this list. I got the code working probably about the same time you and another gentleman posted the same fixes I made, however I now have another question about adding a hidden field to take the results of the users selection and passing it along to another form which will stick it into a database, not the file mind you, i simply need to stick the path of the file into a database table. If you have any suggestions on how to do this that would be great. Thanks again, Jas

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

    attached mail follows:


    So adding a hidden field would definately pass the contents of the select box to the other script so I am not doing anything wrong with this portion, but what if I wanted to append the path of the file name? Any tips? Thanks, jas

    attached mail follows:


    the contents of the SELECT box and the contents of the HIDDEN field are separate entities. Append the path upon transfer to the next PHP script

    Show us what you REALLY want to do here instead of keeping us guessing...

    -----Original Message----- From: Jas [mailto:jlgerfenhotmail.com] Sent: Friday, April 05, 2002 10:22 AM To: php-generallists.php.net Subject: Re: [PHP] Directory to array to select box...

    So adding a hidden field would definately pass the contents of the select box to the other script so I am not doing anything wrong with this portion, but what if I wanted to append the path of the file name? Any tips? Thanks, jas

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

    attached mail follows:


    Sorry, here is what I have thus far... everything is working except I am just not sure how to pass the result of the users selection to another script, I have added the hidden input type to try and solve it but I think I am doing something wrong, maybe I need to put the hidden input type on the second script to place the contents into the database, here is the code... <?php $dir_name = "/path/to/directory/"; $dir = opendir($dir_name); $file_list .= "<p><FORM METHOD=\"post\" ACTION=\"ad_done.php3\"> <SELECT NAME=\"files\">$file_name"; while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name !="..")) { $file_list .= "<OPTION VALUE=\"$file_name\">$file_name</OPTION>"; } } // added hidden field here... and so far it is not ge