Jump to content


Photo

Form -> Config.php


  • Please log in to reply
2 replies to this topic

#1 Cell0518

Cell0518
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts
  • LocationUSA / Japan (US Navy)

Posted 10 March 2006 - 03:00 PM

Can a PHP form write information to a config.php file, or is there a special extension?

Thanks,
Chris
Chris

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 10 March 2006 - 03:05 PM

Yes php can write/create and delete files on the server. You'll want to look at the following functions if you want to write something to file:
- [a href=\"http://uk2.php.net/manual/en/function.fopen.php\" target=\"_blank\"]fopen[/a] - open a file
- [a href=\"http://uk2.php.net/manual/en/function.fread.php\" target=\"_blank\"]fread[/a] - read contents of a file
- [a href=\"http://uk2.php.net/manual/en/function.fwrite.php\" target=\"_blank\"]fwrite[/a] - write contents to file

For a quick example of how to write data to a file check out the example for fwrite function (linked above)

In order for these functions to function well make sure the file(s) have the correct CHMOD permissions (you can set these in an FTP client).

#3 Cell0518

Cell0518
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts
  • LocationUSA / Japan (US Navy)

Posted 10 March 2006 - 03:12 PM

Thanks for the quick reply. I know that's probably an "over asked" question, but I just couldn't seem to locate an answer. I guess I wasn't generalizing enough. (is that spelled right? [img src=\"http://www.phpfreaks.com/forums/style_images/1/folder_post_icons/icon1.gif\" border=\"0\" alt=\"IPB Image\" /] ) I'll take a look into it.

Thanks again,
Chris
Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users