Guest User

setup.php

a guest
May 3rd, 2015
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2.  
  3.     /* Config required to replace the database strings */
  4.     require('config/config.php');
  5.  
  6.     /* HTML Form to be echoed for the user */
  7.     $form = "
  8.         <form name='form' action='' method='get'>
  9.         <input type='text' name='host' placeholder='Database host' />
  10.         <input type='text' name='database' placeholder='Database name' />
  11.         <input type='text' name='username' placeholder='Database username' />
  12.         <input type='password' name='password' placeholder='Database password' />
  13.         <input type='submit' name='submit' value='Change values' />
  14.         </form>
  15.         ";
  16.     /* Echo the form so I can see it */
  17.     echo $form;
  18.     /* Get the results from the HTML Form */
  19.     $gethost = $_GET['host'];
  20.     $getdb = $_GET['database'];
  21.     $getuser = $_GET['username'];
  22.     $getpass = $_GET['password'];
  23.     /* Replace the database connections in config.php */
  24.     /* However, does not work :/ */
  25.     if (isset($_GET['submit'])) {
  26.         str_replace($gethost,$host);
  27.     }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment