![]() |
| ||||||||
|
|||||||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
|
Brainstorming Wizard
War Room Member
Join Date: Mar 2004
Posts: 4,732
Thanks: 0
Thanked 34 Times in 23 Posts
|
I have a simple one line config file...
<?php $clickbanknickname = "namegoeshere"; ?> I need some kind of form or admin panel that will allow my customers to easily change the above file (it will be hosted on my server) Is there a way to maybe have them fill out a one field form with their CB nickname, send that to a text file on my server and then "include" that text file in the above config? Thanks, George |
|
|
|
|
|
#2 |
|
PHP & Drupal Ninja
Join Date: May 2007
Location: London, United Kingdom.
Posts: 105
Thanks: 11
Thanked 15 Times in 12 Posts
|
assuming you want them to supply a password in order to change the value. in one file you have code like this:
<?php if ($_REQUEST['password'] == 'secret-password-here') { $myFile = "configfilename.inc"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $_REQUEST['cbusername']); fclose($fh); } else { // print a form here with password and cbusername field } ?> In your config file use file_get_contents('configfilename.inc') to read in the value from the config file as a string. This is only a very basic script - you should probably do more validation of user input. |
|
|
|
|
|
|
![]() |
|
| Tags |
| config, file, mod, php |
| Thread Tools | |
|
|
![]() |