Search the Community
Showing results for tags 'setup'.
-
Hello, I am new to PHP, so I decided the best way to learn is to build a CMS, that I can build and adapt as time progresses. I am wanting to create a setup/install wizard for when a user first uploads the website and then visits the website. I attempted to do this on my own, but it did not work, but hey I still included the code in-case I was close to getting it working. (See below). I am wanting to have a HTML form that will contain the input fields, where the user will enter their database host, username, and password. And all of the details in the form will replace the mysqli connection in the config.php file, which is seperate from the install file. That is all I really need help with at the moment, as creating users, etc is pretty easy (even though I am new to PHP). My "attempted" code: - Install.php: <?php /* Config required to replace the database strings */ require('config/config.php'); /* HTML Form to be echoed for the user */ $form = " <form name='form' action='' method='get'> <input type='text' name='host' placeholder='Database host' /> <input type='text' name='database' placeholder='Database name' /> <input type='text' name='username' placeholder='Database username' /> <input type='password' name='password' placeholder='Database password' /> <input type='submit' name='submit' value='Change values' /> </form> "; /* Echo the form so I can see it */ echo $form; /* Get the results from the HTML Form */ $gethost = $_GET['host']; $getdb = $_GET['database']; $getuser = $_GET['username']; $getpass = $_GET['password']; /* Replace the database connections in config.php */ /* However, does not work :/ */ if (isset($_GET['submit'])) { str_replace($gethost,$host); } ?> - Config.php: <?php $host = "localhost"; $username = "root"; $password = ""; $database = "website"; /* Change this line in the HTML Form in setup.php */ $dbc = mysqli_connect($host, $username, $password, $database); ?> Thanks in advanced, Unique
-
I’m moving a longstanding working site from on server to another. In the move my session handling is acting differently on the new server. My first clue was that my PHPSESSION files in the new 777 folder I built is saving a new session file each link / click. For a bit… I set session.use_trans_sid = 1 in my php5.php but… I don’t want the session id in the address bar, and B.) it didn’t actually work for forwards (REFRESH to another page.(worked fine when clicking a link) and C) my url rewrites are not working…. So step1 compare the old phpinfo file to the new one and make sure everything matches. Easy enough for most commands but…. And this is where I make this post to ask… How do I set…???? PHP Variables _REQUEST["PHPSESSID"] 1913085bab063a403cd0737472ea36a7 _COOKIE["PHPSESSID"] 1913085bab063a403cd0737472ea36a7 And do I need to? There are existing _request and cookie listing in my phpinfo view... but the new one doesn't show _REQUEST["PHPSESSID"] yet on the existing/old site it is listed. Is this something I need to turn on? do I use the php5 file to do it? Help! Please. P.S. I'm looking forward to being a php freak!!!