0

I am new to PHP, and I am trying to make a setup page, that will check if the website has been setup via the setup.php file. When the user is redirected to the setup file, they have to input the database details into a HTML form, which will then change the database connection in the config.php file.

How can I write in PHP, to check if the website has been setup? (I thought maybe a boolean could solve this problem)

And,

How can I make a HTML form that will change the mysqli database connection to the details given in the form? (I think maybe the str_replace() function could do this, but I simply do not understand it)

Thanks in advance,

Unique

EDIT: Added Links, setup.php - http://pastebin.com/gHn6ASRg

config.php - http://pastebin.com/B5uApy1F

Unique
  • 55
  • 1
  • 1
  • 9
  • 1
    Do you have code sample of what you have so far? ... The question doesn't quite make sense – Just Lucky Really May 03 '15 at 22:43
  • Simplest check is just testing for `file_exists("whatever/config.php")`. And an ini file (outside the docroot) is often just as suitable. See also [Writing a configuration file in PHP](http://stackoverflow.com/q/10840308). And share previous attempts to narrow your question down. – mario May 03 '15 at 22:50
  • @mario I will try, I dont fully understand what you mean, but I will give it a try. thanks! – Unique May 03 '15 at 22:53
  • `str_replace()` by itself won't do. Without assigning the result anyway. (And please use the `{}` code posting feature, not external file hosters.) – mario May 03 '15 at 22:53

0 Answers0