Connecting Tech Pros Worldwide Forums | Help | Site Map

how do you use a config file in your program?

NotGiven
Guest
 
Posts: n/a
#1: Jul 17 '05
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
Guest
 
Posts: n/a
#2: Jul 17 '05

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
Jon Beckett
Guest
 
Posts: n/a
#3: Jul 17 '05

re: how do you use a config file in your program?


On Thu, 16 Sep 2004 17:31:16 -0400, "NotGiven" <noname@nonegiven.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@pluggedout.com)
working on : http://www.pluggedout.com/penpals
NotGiven
Guest
 
Posts: n/a
#4: Jul 17 '05

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@nonegiven.net> wrote in message
news:yAn2d.166836$%n4.99794@bignews6.bellsouth.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]


Nikolai Chuvakhin
Guest
 
Posts: n/a
#5: Jul 17 '05

re: how do you use a config file in your program?


"NotGiven" <noname@nonegiven.net> wrote in message
news:<yAn2d.166836$%n4.99794@bignews6.bellsouth.ne t>...[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
NotGiven
Guest
 
Posts: n/a
#6: Jul 17 '05

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.0409170628.373a030c@posting.google.c om...[color=blue]
> "NotGiven" <noname@nonegiven.net> wrote in message
> news:<yAn2d.166836$%n4.99794@bignews6.bellsouth.ne t>...[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]


Justin Koivisto
Guest
 
Posts: n/a
#7: Jul 17 '05

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_preferences{
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_preferences 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
NotGiven
Guest
 
Posts: n/a
#8: Jul 17 '05

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$AU4.2064@news7.onvoy.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_preferences{
> 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_preferences 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]


Tony Marston
Guest
 
Posts: n/a
#9: Jul 17 '05

re: how do you use a config file in your program?



"NotGiven" <noname@nonegiven.net> wrote in message
news:t%D2d.150646$0o5.138225@bignews1.bellsouth.ne t...[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

http://www.tonymarston.net


[color=blue]
> "Nikolai Chuvakhin" <nc@iname.com> wrote in message
> news:32d7a63c.0409170628.373a030c@posting.google.c om...[color=green]
>> "NotGiven" <noname@nonegiven.net> wrote in message
>> news:<yAn2d.166836$%n4.99794@bignews6.bellsouth.ne t>...[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]


Justin Koivisto
Guest
 
Posts: n/a
#10: Jul 17 '05

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$AU4.2064@news7.onvoy.net...
>[color=green]
>>NotGiven wrote:
>>[color=darkred]
>>>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_preferences{
>> 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_preferences 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
http://www.koivi.com
lawrence
Guest
 
Posts: n/a
#11: Jul 17 '05

re: how do you use a config file in your program?


"NotGiven" <noname@nonegiven.net> wrote in message news:<t%D2d.150646$0o5.138225@bignews1.bellsouth.n et>...[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:

http://philip.greenspun.com/wtr/dead-trees/index.html


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