how do you use a config file in your program?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NotGiven

    how do you use a config file in your program?

    I have never used a config file - my config will be a database record. I
    know how to get the record for that user.

    Is it simply using the elements of the recordset array to set page by page
    seettings?

    Any links I can read more about it?

    Thanks.


  • steve

    #2
    Re: how do you use a config file in your program?

    "NotGiven" wrote:[color=blue]
    > I have never used a config file - my config will be a database
    > record. I
    > know how to get the record for that user.
    >
    > Is it simply using the elements of the recordset array to set
    > page by page
    > seettings?
    >
    > Any links I can read more about it?
    >
    > Thanks.[/color]

    IMHO, you are asking some very basic questions. May I suggest that
    you get a good introductory book about php+msql, and that would really
    get you started.

    --
    http://www.dbForumz.com/ This article was posted by author's request
    Articles individually checked for conformance to usenet standards
    Topic URL: http://www.dbForumz.com/PHP-config-f...ict150594.html
    Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=504262

    Comment

    • Jon Beckett

      #3
      Re: how do you use a config file in your program?

      On Thu, 16 Sep 2004 17:31:16 -0400, "NotGiven" <noname@nonegiv en.net>
      wrote:
      [color=blue]
      >I have never used a config file - my config will be a database record. I
      >know how to get the record for that user.
      >
      >Is it simply using the elements of the recordset array to set page by page
      >seettings?[/color]

      I concur with the other person that has replied to you. We could spend
      half an hour discussing the methods and virtues of using config files
      versus database tables, and how you typically implement them, but you
      really need to define your question a bit more.

      Of course we could be doing you a disservice - English may not be your
      first language...



      Jonathan Beckett (jonbeckett@plu ggedout.com)
      working on : http://www.pluggedout.com/penpals

      Comment

      • NotGiven

        #4
        Re: how do you use a config file in your program?

        Thanks for your replies. English is my native language but I am relatively
        new to php, so you could say that php is not my language :-)

        What I am wanting to understand how to do is what I see many programs do -
        users set up the preferences in a record. Then whenever they return, their
        preference are set and activated. for example, how many days after a
        certain action is tanem do you want to receive an email? Then I will run a
        cron job nightly to check for these and send an email.

        Hopefully this is clearer. Thanks.


        "NotGiven" <noname@nonegiv en.net> wrote in message
        news:yAn2d.1668 36$%n4.99794@bi gnews6.bellsout h.net...[color=blue]
        >I have never used a config file - my config will be a database record. I
        >know how to get the record for that user.
        >
        > Is it simply using the elements of the recordset array to set page by page
        > seettings?
        >
        > Any links I can read more about it?
        >
        > Thanks.
        >[/color]


        Comment

        • Nikolai Chuvakhin

          #5
          Re: how do you use a config file in your program?

          "NotGiven" <noname@nonegiv en.net> wrote in message
          news:<yAn2d.166 836$%n4.99794@b ignews6.bellsou th.net>...[color=blue]
          >
          > I have never used a config file - my config will be a database record.
          > I know how to get the record for that user.[/color]

          Configuration files may or may not have anything to do with users.
          For example, they can store installation-specific information (URL
          of the application's root directory, host name/user name/password
          needed to access underlying databases, etc.)

          Cheers,
          NC

          Comment

          • NotGiven

            #6
            Re: how do you use a config file in your program?

            I probably used the wrong term then. I meant user specific details or
            preferences.

            Thanks for clarifying.


            "Nikolai Chuvakhin" <nc@iname.com > wrote in message
            news:32d7a63c.0 409170628.373a0 30c@posting.goo gle.com...[color=blue]
            > "NotGiven" <noname@nonegiv en.net> wrote in message
            > news:<yAn2d.166 836$%n4.99794@b ignews6.bellsou th.net>...[color=green]
            >>
            >> I have never used a config file - my config will be a database record.
            >> I know how to get the record for that user.[/color]
            >
            > Configuration files may or may not have anything to do with users.
            > For example, they can store installation-specific information (URL
            > of the application's root directory, host name/user name/password
            > needed to access underlying databases, etc.)
            >
            > Cheers,
            > NC[/color]


            Comment

            • Justin Koivisto

              #7
              Re: how do you use a config file in your program?

              NotGiven wrote:
              [color=blue]
              > I probably used the wrong term then. I meant user specific details or
              > preferences.[/color]

              "visitor website preferences" may be a bit easier to grasp.

              The first thing you need to do is how you will identify which user is
              which. Do they log in? Is there a cookie set? In certain applications it
              may be based on IP address...

              Once you have that figured out, then you can decide how to handle it.

              For instance, say that you have people log in with a unique username....

              There are a million and 3 ways to do this, but here is one that may be
              easy to implement:


              table user_preference s{
              username // the name of the user that logged in
              key // something to identify the preference
              value // the value of this preference
              }

              Then, for each preference that a user has changed from defualt there'd
              be a new row:

              koivi, date_format, 'Y-m-d'
              koivi, show_post_time, 0
              koivi, bg_color, '#009'
              koivi, font_color, '#ccc'
              ....

              Then when you load them (you'll likely already have some defaults
              configured somewhere), just do:

              SELECT key, value FROM user_preference s WHERE username = 'koivi'

              Then each row will have a key (or preference) and the value this user likes.

              --
              Justin Koivisto - spam@koivi.com

              Comment

              • NotGiven

                #8
                Re: how do you use a config file in your program?

                thanks.

                I have users log in using usique userID & password and sessions variable is
                assigned identifying them uniquely. In the login process, I guess I could
                do another search of the preferences table and assign them a session var as
                well.

                When I get to a page where user preference settings, I would simply
                reference the $_SESISON['var'], right?


                "Justin Koivisto" <spam@koivi.com > wrote in message
                news:dmE2d.44$A U4.2064@news7.o nvoy.net...[color=blue]
                > NotGiven wrote:
                >[color=green]
                >> I probably used the wrong term then. I meant user specific details or
                >> preferences.[/color]
                >
                > "visitor website preferences" may be a bit easier to grasp.
                >
                > The first thing you need to do is how you will identify which user is
                > which. Do they log in? Is there a cookie set? In certain applications it
                > may be based on IP address...
                >
                > Once you have that figured out, then you can decide how to handle it.
                >
                > For instance, say that you have people log in with a unique username....
                >
                > There are a million and 3 ways to do this, but here is one that may be
                > easy to implement:
                >
                >
                > table user_preference s{
                > username // the name of the user that logged in
                > key // something to identify the preference
                > value // the value of this preference
                > }
                >
                > Then, for each preference that a user has changed from defualt there'd be
                > a new row:
                >
                > koivi, date_format, 'Y-m-d'
                > koivi, show_post_time, 0
                > koivi, bg_color, '#009'
                > koivi, font_color, '#ccc'
                > ...
                >
                > Then when you load them (you'll likely already have some defaults
                > configured somewhere), just do:
                >
                > SELECT key, value FROM user_preference s WHERE username = 'koivi'
                >
                > Then each row will have a key (or preference) and the value this user
                > likes.
                >
                > --
                > Justin Koivisto - spam@koivi.com
                > http://www.koivi.com[/color]


                Comment

                • Tony Marston

                  #9
                  Re: how do you use a config file in your program?


                  "NotGiven" <noname@nonegiv en.net> wrote in message
                  news:t%D2d.1506 46$0o5.138225@b ignews1.bellsou th.net...[color=blue]
                  >I probably used the wrong term then. I meant user specific details or
                  >preferences.
                  >
                  > Thanks for clarifying.[/color]

                  If you want diferents sets of preferences per user, then a database table
                  would be the better way. After identifying the user you simply read in one
                  set of preferences.

                  --
                  Tony Marston

                  This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL



                  [color=blue]
                  > "Nikolai Chuvakhin" <nc@iname.com > wrote in message
                  > news:32d7a63c.0 409170628.373a0 30c@posting.goo gle.com...[color=green]
                  >> "NotGiven" <noname@nonegiv en.net> wrote in message
                  >> news:<yAn2d.166 836$%n4.99794@b ignews6.bellsou th.net>...[color=darkred]
                  >>>
                  >>> I have never used a config file - my config will be a database record.
                  >>> I know how to get the record for that user.[/color]
                  >>
                  >> Configuration files may or may not have anything to do with users.
                  >> For example, they can store installation-specific information (URL
                  >> of the application's root directory, host name/user name/password
                  >> needed to access underlying databases, etc.)
                  >>
                  >> Cheers,
                  >> NC[/color]
                  >
                  >[/color]


                  Comment

                  • Justin Koivisto

                    #10
                    Re: how do you use a config file in your program?

                    NotGiven wrote:

                    **fixed top-posting **
                    [color=blue]
                    > "Justin Koivisto" <spam@koivi.com > wrote in message
                    > news:dmE2d.44$A U4.2064@news7.o nvoy.net...
                    >[color=green]
                    >>NotGiven wrote:
                    >>[color=darkred]
                    >>>I probably used the wrong term then. I meant user specific details or
                    >>>preference s.[/color]
                    >>
                    >>"visitor website preferences" may be a bit easier to grasp.
                    >>
                    >>The first thing you need to do is how you will identify which user is
                    >>which. Do they log in? Is there a cookie set? In certain applications it
                    >>may be based on IP address...
                    >>
                    >>Once you have that figured out, then you can decide how to handle it.
                    >>
                    >>For instance, say that you have people log in with a unique username....
                    >>
                    >>There are a million and 3 ways to do this, but here is one that may be
                    >>easy to implement:
                    >>
                    >>table user_preference s{
                    >> username // the name of the user that logged in
                    >> key // something to identify the preference
                    >> value // the value of this preference
                    >>}
                    >>
                    >>Then, for each preference that a user has changed from defualt there'd be
                    >>a new row:
                    >>
                    >>koivi, date_format, 'Y-m-d'
                    >>koivi, show_post_time, 0
                    >>koivi, bg_color, '#009'
                    >>koivi, font_color, '#ccc'
                    >>...
                    >>
                    >>Then when you load them (you'll likely already have some defaults
                    >>configured somewhere), just do:
                    >>
                    >>SELECT key, value FROM user_preference s WHERE username = 'koivi'
                    >>
                    >>Then each row will have a key (or preference) and the value this user
                    >>likes.[/color]
                    >
                    > thanks.
                    >
                    > I have users log in using usique userID & password and sessions variable is
                    > assigned identifying them uniquely. In the login process, I guess I could
                    > do another search of the preferences table and assign them a session var as
                    > well.
                    >
                    > When I get to a page where user preference settings, I would simply
                    > reference the $_SESISON['var'], right?[/color]

                    As I said, there are many ways of doing it, that sounds like one that
                    would work.

                    --
                    Justin Koivisto - spam@koivi.com

                    Comment

                    • lawrence

                      #11
                      Re: how do you use a config file in your program?

                      "NotGiven" <noname@nonegiv en.net> wrote in message news:<t%D2d.150 646$0o5.138225@ bignews1.bellso uth.net>...[color=blue]
                      > I probably used the wrong term then. I meant user specific details or
                      > preferences.[/color]

                      For a good general level discussion aimed at beginners you should read
                      Phillip Greenspun's book How To Build Database Backed Websites.
                      Phillip was working with Tcl plus Oracle instead of PHP plus MySql,
                      but he gives examples of building a user module, and what the database
                      table definitions should look like, that you could probably borrow
                      whole, without many changes. Greenspun has been nice enough to put the
                      book online:




                      Skip down to chapter 7 which gets specific about the user module.

                      Comment

                      Working...