|
1 | 1 | <?php |
2 | | -$connection = mysqli_connect('localhost', 'root', 'funk19', 'ecomphp'); |
| 2 | +/** |
| 3 | + * Advanced PHP 7 eCommerce Website (https://22digital.agency) |
| 4 | + * |
| 5 | + * This program is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU Affero General Public License as |
| 7 | + * published by the Free Software Foundation, either version 3 of the |
| 8 | + * License, or (at your option) any later version. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU Affero General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU Affero General Public License |
| 16 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 17 | + * |
| 18 | + * @copyright Copyright (c) 22 Digital (https://22digital.agency) |
| 19 | + * @copyright Copyright (c) Justin Hartman (https://justinhartman.blog) |
| 20 | + * @author Justin Hartman <justin@hartman.me> (https://justinhartman.blog) |
| 21 | + * @link https://github.com/justinhartman/complete-php7-ecom-website GitHub Project |
| 22 | + * @since 0.1.0 |
| 23 | + * @license https://opensource.org/licenses/AGPL-3.0 AGPL-3.0 |
| 24 | + */ |
| 25 | + |
| 26 | +/** |
| 27 | + * Get and Set the environment variables. |
| 28 | + */ |
| 29 | +$dbHost = getenv("DB_HOST"); |
| 30 | +$dbUsername = getenv("DB_USERNAME"); |
| 31 | +$dbPassword = getenv("DB_PASSWORD"); |
| 32 | +$database = getenv("DB_DATABASE"); |
| 33 | + |
| 34 | +$connection = mysqli_connect($dbHost, $dbUsername, $dbPassword, $database); |
3 | 35 | if (!$connection) { |
4 | 36 | echo "Error: Unable to connect to MySQL." . PHP_EOL; |
5 | 37 | echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL; |
|
0 commit comments