Changeset 4495 for trunk/wp-admin/setup-config.php
- Timestamp:
- 11/19/2006 07:56:05 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/setup-config.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/setup-config.php
r3673 r4495 3 3 4 4 if (!file_exists('../wp-config-sample.php')) 5 die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');5 die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); 6 6 7 7 $configFile = file('../wp-config-sample.php'); … … 83 83 switch($step) { 84 84 case 0: 85 ?> 85 ?> 86 86 87 <p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p> 88 <ol> 89 <li>Database name</li> 90 <li>Database username</li> 91 <li>Database password</li>92 <li>Database host</li> 93 <li>Table prefix (if you want to run more than one WordPress in a single database) </li>94 </ol> 87 <p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p> 88 <ol> 89 <li>Database name</li> 90 <li>Database username</li> 91 <li>Database password</li> 92 <li>Database host</li> 93 <li>Table prefix (if you want to run more than one WordPress in a single database) </li> 94 </ol> 95 95 <p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p> 96 96 <p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you’re all ready, <a href="setup-config.php?step=1">let’s go</a>! </p> … … 99 99 100 100 case 1: 101 ?> 102 </p> 101 ?> 102 </p> 103 103 <form method="post" action="setup-config.php?step=2"> 104 <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>105 <table> 106 <tr> 107 <th scope="row">Database Name</th> 108 <td><input name="dbname" type="text" size="25" value="wordpress" /></td>109 <td>The name of the database you want to run WP in. </td> 110 </tr> 111 <tr> 112 <th scope="row">User Name</th> 113 <td><input name="uname" type="text" size="25" value="username" /></td>114 <td>Your MySQL username</td> 115 </tr> 116 <tr> 117 <th scope="row">Password</th> 118 <td><input name="pwd" type="text" size="25" value="password" /></td>119 <td>...and MySQL password.</td> 120 </tr> 121 <tr> 122 <th scope="row">Database Host</th> 123 <td><input name="dbhost" type="text" size="25" value="localhost" /></td>124 <td>99% chance you won't need to change this value.</td> 125 </tr>126 <tr>127 <th scope="row">Table Prefix</th>128 <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>129 <td>If you want to run multiple WordPress installations in a single database, change this.</td>130 </tr> 131 </table>132 <h2 class="step">133 <input name="submit" type="submit" value="Submit" />134 </h2>135 </form> 104 <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p> 105 <table> 106 <tr> 107 <th scope="row">Database Name</th> 108 <td><input name="dbname" type="text" size="25" value="wordpress" /></td> 109 <td>The name of the database you want to run WP in. </td> 110 </tr> 111 <tr> 112 <th scope="row">User Name</th> 113 <td><input name="uname" type="text" size="25" value="username" /></td> 114 <td>Your MySQL username</td> 115 </tr> 116 <tr> 117 <th scope="row">Password</th> 118 <td><input name="pwd" type="text" size="25" value="password" /></td> 119 <td>...and MySQL password.</td> 120 </tr> 121 <tr> 122 <th scope="row">Database Host</th> 123 <td><input name="dbhost" type="text" size="25" value="localhost" /></td> 124 <td>99% chance you won't need to change this value.</td> 125 </tr> 126 <tr> 127 <th scope="row">Table Prefix</th> 128 <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td> 129 <td>If you want to run multiple WordPress installations in a single database, change this.</td> 130 </tr> 131 </table> 132 <h2 class="step"> 133 <input name="submit" type="submit" value="Submit" /> 134 </h2> 135 </form> 136 136 <?php 137 137 break; … … 139 139 case 2: 140 140 $dbname = trim($_POST['dbname']); 141 $uname = trim($_POST['uname']);142 $passwrd = trim($_POST['pwd']);143 $dbhost = trim($_POST['dbhost']);141 $uname = trim($_POST['uname']); 142 $passwrd = trim($_POST['pwd']); 143 $dbhost = trim($_POST['dbhost']); 144 144 $prefix = trim($_POST['prefix']); 145 145 if (empty($prefix)) $prefix = 'wp_'; 146 146 147 // Test the db connection.148 define('DB_NAME', $dbname);149 define('DB_USER', $uname);150 define('DB_PASSWORD', $passwrd);151 define('DB_HOST', $dbhost);147 // Test the db connection. 148 define('DB_NAME', $dbname); 149 define('DB_USER', $uname); 150 define('DB_PASSWORD', $passwrd); 151 define('DB_HOST', $dbhost); 152 152 153 // We'll fail here if the values are no good.154 require_once('../wp-includes/wp-db.php');153 // We'll fail here if the values are no good. 154 require_once('../wp-includes/wp-db.php'); 155 155 $handle = fopen('../wp-config.php', 'w'); 156 156 157 foreach ($configFile as $line_num => $line) {158 switch (substr($line,0,16)) {159 case "define('DB_NAME'":160 fwrite($handle, str_replace("wordpress", $dbname, $line));161 break;162 case "define('DB_USER'":163 fwrite($handle, str_replace("'username'", "'$uname'", $line));164 break;165 case "define('DB_PASSW":166 fwrite($handle, str_replace("'password'", "'$passwrd'", $line));167 break;168 case "define('DB_HOST'":169 fwrite($handle, str_replace("localhost", $dbhost, $line));170 break;157 foreach ($configFile as $line_num => $line) { 158 switch (substr($line,0,16)) { 159 case "define('DB_NAME'": 160 fwrite($handle, str_replace("wordpress", $dbname, $line)); 161 break; 162 case "define('DB_USER'": 163 fwrite($handle, str_replace("'username'", "'$uname'", $line)); 164 break; 165 case "define('DB_PASSW": 166 fwrite($handle, str_replace("'password'", "'$passwrd'", $line)); 167 break; 168 case "define('DB_HOST'": 169 fwrite($handle, str_replace("localhost", $dbhost, $line)); 170 break; 171 171 case '$table_prefix =': 172 172 fwrite($handle, str_replace('wp_', $prefix, $line)); 173 173 break; 174 default:175 fwrite($handle, $line);176 }177 }178 fclose($handle);174 default: 175 fwrite($handle, $line); 176 } 177 } 178 fclose($handle); 179 179 chmod('../wp-config.php', 0666); 180 ?> 181 <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p> 180 ?> 181 <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p> 182 182 <?php 183 183 break;
Note: See TracChangeset
for help on using the changeset viewer.