Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Calendar Help Desk Mark Forums Read

Reply
 
Thread Tools
Old 12-22-2008, 09:38 AM   #1
Brainstorming Wizard
 
George Sepich's Avatar
 
Join Date: Mar 2004
Location: Groveland , USA.
Posts: 4,654
Thanks: 0
Thanked 10 Times in 9 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to George Sepich
Default PHP Config File Mod Help

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
George Sepich is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-22-2008, 10:35 AM   #2
PHP & Drupal Ninja
 
Darren Mothersele's Avatar
 
Join Date: May 2007
Location: London, United Kingdom.
Posts: 106
Thanks: 11
Thanked 15 Times in 12 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via AIM to Darren Mothersele Send a message via Skype™ to Darren Mothersele
Default Re: PHP Config File Mod Help

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.

Darren Mothersele is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
config, file, mod, php

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 10:39 AM.