Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    What I want is for to have a page which is password protected that lets the authenticated user carry out operations.

    I want there to be a drop down box, for each setting in the config.php file

    For example, say 1 setting is "allow posts" beside that there will be a drop down box with "Yes" and "No".

    Once the user has picked his/her preferences, they click "Update" or what have you and the file is updated.

    Would this be the best way to do it? Or would it be better to have the contents of the file in a textarea and update it this way?

    I know how to update a txt file, but am not sure how to update line 30 say, which is the $allowposts variable.

    Hope this is vaguely clear at least.

  2.  

  3. #2
    Senior Member DanielOliver's Avatar
    Join Date
    Jun 2003
    Location
    Cornwall, England.
    Posts
    1,202
    Member #
    1879
    I would follow similar technique used on forums. Check out phpBB for example. On the configuration page. No drop downs as far as configuring is concerned.

    I would say text inputs and check boxes only. Drop downs is a strange way of doing it, and not the best in terms of usability I would say.

  4. #3
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Okay. so how would I code so that a value from a database effects which checkbox is checked?

    Thanks for your input so far.

  5. #4
    Member
    Join Date
    Jan 2005
    Posts
    97
    Member #
    8727
    You would select from a db , eg a column, say, posts_allowed. You have posts allowed either 0 or 1 depending on yes or no. All you do then is just dump the row data into a variable, say, $allow and then use an if statement (if ($allow) {dothis}), since php treats anything that is 0 as false.

    Now, to update line 30, I would use file() to read the file, get its contents, dump to say $config and use $config[30]='blahblahblah';, then to write it using fwrite(). That's how I do it, I'm sure other people have much faster ways.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:02 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com